def test_distance_calculation(self): wp = Waypoint(x=0, y=2, z=0) self.assertEquals(wp.dist([0, 4, 0]), 2, 'Distance calculation is wrong') self.assertEquals(wp.dist([2, 2, 0]), 2, 'Distance calculation is wrong') self.assertEquals(wp.dist([0, 2, 2]), 2, 'Distance calculation is wrong')
def test_add_repeated_waypoint(self): wp = Waypoint(x=1, y=2, z=3, max_forward_speed=1) wp_set = WaypointSet() self.assertTrue(wp_set.add_waypoint(wp), 'Error occured while adding waypoint to empty set') self.assertFalse(wp_set.add_waypoint(wp), 'Repeated waypoint wrongfully added')
def test_to_message(self): wp0 = Waypoint(x=1, y=2, z=3) wp1 = Waypoint() wp1.from_message(wp0.to_message()) self.assertEquals(wp0, wp1, "Waypoint to message conversion failed")
def test_violate_constraint_flag(self): wp = Waypoint() wp.violates_constraint = True self.assertTrue(wp.violates_constraint, 'Constraint violation flag not correctly set')
def test_unequal_waypoints(self): wp0 = Waypoint(x=1, y=2, z=3) wp1 = Waypoint(x=6, y=5, z=4) self.assertNotEquals(wp0, wp1, 'Waypoints unequal operator failed')
def test_equal_waypoints(self): wp0 = Waypoint(x=1, y=2, z=3) wp1 = Waypoint(x=1, y=2, z=3) self.assertEquals(wp0, wp1, 'Waypoints equal operator failed')