Unit tests

Here is a start to a unit test suite built with QUnit. There may be better ways to do it, this is my first attempt.