changed tests function to be more generic and easy to add new tests