Tests

The actual test coverage is minimal, but I wanted to get the autotools stuff in, and other PRs also add tests
This part isn't finished, but it does pass the tests as written so far