Add API tests

Fixes gh-5.