Add unit tests

This PR adds several unit tests. Many of them are failing at the moment. One even causes looping behavior requiring the tests to be manually stopped.

However, the goal is to provide a starting point for more rigorous testing. Tests are a separate target, so developing them will not interfere with other development.