Port more tests and reformat some code.
Finish porting type tests.