19 PKG =
'uuv_trajectory_control' 20 roslib.load_manifest(PKG)
24 from uuv_waypoints
import Waypoint
29 wp0 = Waypoint(x=1, y=2, z=3)
30 wp1 = Waypoint(x=1, y=2, z=3)
31 self.assertEquals(wp0, wp1,
'Waypoints equal operator failed')
34 wp0 = Waypoint(x=1, y=2, z=3)
35 wp1 = Waypoint(x=6, y=5, z=4)
36 self.assertNotEquals(wp0, wp1,
'Waypoints unequal operator failed')
40 wp.violates_constraint =
True 41 self.assertTrue(wp.violates_constraint,
'Constraint violation flag not correctly set')
44 wp = Waypoint(x=0, y=2, z=0)
45 self.assertEquals(wp.dist([0, 4, 0]), 2,
'Distance calculation is wrong')
46 self.assertEquals(wp.dist([2, 2, 0]), 2,
'Distance calculation is wrong')
47 self.assertEquals(wp.dist([0, 2, 2]), 2,
'Distance calculation is wrong')
50 wp0 = Waypoint(x=1, y=2, z=3)
52 wp1.from_message(wp0.to_message())
53 self.assertEquals(wp0, wp1,
"Waypoint to message conversion failed")
56 if __name__ ==
'__main__':
58 rosunit.unitrun(PKG,
'test_waypoint', TestWaypoint)
def test_violate_constraint_flag(self)
def test_to_message(self)
def test_equal_waypoints(self)
def test_distance_calculation(self)
def test_unequal_waypoints(self)