Add unit tests (fixes #1)