Unit tests

Okey, another pull request of some missing unit tests.