What conditions can be detected by a thyroid function test?