port to vigra's unittest framework; some refactoring