I dropped a hammer on my foot and its swollen and bruised. How to tell it's broken?

X-ray. The best way to tell if a bone is broken is to get an x-ray. All of those other things you learned, eg if you can move it then it is not broken, are not reliable.
Radiographs. Anytime you have an injury and you suspect that you may have broken a bone, the best way is to have a specialist perform a thorough examination and a series of x-rays. They are inexpensive and an extremely valuable tool.