factor out test functions