Extract test functionality

Fix #101.
This was unused.