This PR fixes the build and adds some tests.