Relocate tests and write unit tests.