Place tests in function