def test_move_particle(self): """ Make sure the particle always stays within the bound of the height and width of the simulation. Assumes a 1000 by 1000 simulation size. """ test_height = 1000 test_width = 1000 a = Particle(1, -100, 0) a.x_velocity = 900 a.y_velocity = 480 for _ in range(10000000): a.move_particle() self.assertGreater(test_width, a.x_position) self.assertLessEqual(0, a.x_position) self.assertGreaterEqual(test_height, a.y_position) self.assertLessEqual(0, a.y_position)
def test_move_particle(self): """ Make sure the particle always stays within the bound of the height and width of the simulation. Assumes a 1000 by 1000 simulation size. """ test_height = 1000 test_width = 1000 a = Particle(1, -100, 0) a.x_velocity = 900 a.y_velocity = 480 # Include a fudge factor of 0.001 for _ in range(10000000): a.move_particle() self.assertGreater(test_width, a.x_position) self.assertLessEqual(0, a.x_position) self.assertGreaterEqual(test_height, a.y_position) self.assertLessEqual(0, a.y_position)