Added unit tests

We could probably use a real unit testing framework,
but this is simple and works well for the time being.