Adds functional tests

Added functional/integration tests. This library is so small that I'm not sure it's worth having unit tests, so just testing the public interface. We can add unit tests if specific bugs are found to check regressions.