Add unittests.
Completed all functions. All tests pass.