As safety in your car is extremely important checking the brakes on a used car work properly before buying the car is just as important. There are a few things you can do to check the brakes when you take the car for a test drive:
If you listen for the brakes when testing the car and you hear a squealing sound this means the brakes are wearing thin and should be changed soon, if you hear a metal on metal sound then this is very bad it means the brake pads have worn down that far that the metal from the pad is grinding against the rotor this can warp the rotor meaning not only would you have to replace the brakes pads but also the rotor as well.
Push the pedal
When driving push the pedal with your foot if it seems soft at one time then hard at another then it could simply be that the brakes need bleeding to remove air pockets. If when stepping on the brake pedal the pad sinks to the floor then the vehicle may require a new brake master cylinder, as with any technical work always be sure before checking anything on a vehicle you are thinking of purchasing. It could also mean it has a leak in the brake fluid system or there's not enough brake fluid in the system which means the brakes will not work efficiently.
Driving at higher speeds
Use the brakes at a higher speed and if it swerves to one side slightly then this could mean there's not enough hydraulic pressure from the fluid on that side. However, if you feel a shuddering when using the brake at higher speeds this probably means your brakes are warped and there are a couple of things you can do either have the rotors refinished so they have been smoothed over or replace them altogether if they are too damaged to be fixed. The only problem with having to have them refinished is that it makes the rotor thinner meaning they will wear quicker but not as quick as they would if you leave your brake pads to wear down too much before changing them.
The brake fluid
You can check the brake fluid under the hood of the car in the brake fluid reservoir you need to check there's enough in there and that it's clean. If the level simply needs a top up that's not a problem, however, if it needs topping up regularly this could mean there is a leak so just ask when it was last filled if it seems a little down. If the fluid is dirty it may need replacing as the fluid does eventually get dirty through the dust from braking, general dirt etc.
Make sure you check the brakes thoroughly before purchasing any car as the safety factor is very important.