Add unit tests using boost test

Added UnitTests for a few classes, as well as fixing some minor bugs and cleaning up a little bit in the process.
This really helped me while debugging because the leaf files are deterministic (-> always have the same checksum). I can benchmark the performance overhead, but I don't think it matters.