Add CMake and start testing

Hello Jonah!

The PR moves to build system from a Makefile to CMake and adds the very basics for testing. Not sure what's your preferred unit testing framework, currently it uses `google-mock` (for matchers) + `google-test`. Everything should be set up automatically. While writing the first unit tests I already discovered a few issues so it seems this is something the project really needs. The testing conventions will probably change, this is just to get things started.

With the changes applied, the current work-flow is as follows:

```
mkdir build && cd build
CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Debug ..
make -j8 && make test
```

Let me know if it works for you (tested on Ubuntu with Clang) and if this is actually something you're interested in. I could probably do the same with `autotools` but it would be a lot more work.