def test_accuracy(self): # test calc_accuracy return correct accuracy HEIGHT = 1000 UPDATE = 800 track = Track(0, HEIGHT, (0, 0)) add_update_circle(track, UPDATE) accuracy = calculate_accuracy(track, FRAME_RATE, VELOCITY) self.assertEqual(accuracy, (HEIGHT - UPDATE) / FRAME_RATE / VELOCITY)
def test_track_circles(self): # test track handles correct amount of circles FIRST_UPDATE = 20 SECOND_UPDATE = 50 track = create_track() add_update_circle(track, FIRST_UPDATE) add_update_circle(track, SECOND_UPDATE) self.assertEqual(len(track.get_circles()), 2)
def test_track_remove_circle(self): # test track remove circles correctly FIRST_UPDATE = 20 SECOND_UPDATE = 50 track = create_track() add_update_circle(track, FIRST_UPDATE) add_update_circle(track, SECOND_UPDATE) track.remove_circle() self.assertEqual(track.get_circles(), [(0, SECOND_UPDATE)])
def test_track_circles_position(self): # test track has circles at correct position FIRST_UPDATE = 20 SECOND_UPDATE = 50 track = create_track() add_update_circle(track, FIRST_UPDATE) add_update_circle(track, SECOND_UPDATE) self.assertEqual([(0, FIRST_UPDATE + SECOND_UPDATE), (0, SECOND_UPDATE)], track.get_circles())
def create_and_update_tracks(update_velocity): tracks = get_track_dict(TRACK_NUM) update = tracks[1].height + int(update_velocity * FRAME_RATE) add_update_circle(tracks[1], update) return tracks