Added missing unit tests from branch unit_tests.
Fixes #167.