Factor out basic test cases to functions