Confirming a miscarriage

If you have very early miscarriage, how do the doctors confirm the miscarriage? What kind of tests do they do?