def testForwardTwoMetres(self): d = DriveSystem(2) d.forward(2) self.assertEqual(d.get_position(), (0, 2)) self.assertEqual(d.get_bearing(), 0)
def testForwardHalfMetre(self): d = DriveSystem(2) d.forward(0.5) self.assertEqual(d.get_position(), (0,0.5)) self.assertEqual(d.get_bearing(), 0)
def test360DegreeTravel(self): d = DriveSystem(2) d.spin(360) d.forward(5) self.assertAlmostEqual(d.get_position()[0], 0) self.assertAlmostEqual(d.get_position()[1], 5)
def testForwardOneMetre(self): d = DriveSystem(2) d.forward(1) self.assertEqual(d.get_position(), (0, 1)) self.assertEqual(d.get_bearing(), 0)
def test330DegreeTravel(self): d = DriveSystem(2) d.spin(330) d.forward(5) self.assertAlmostEqual(d.get_position()[0], -2.5) self.assertAlmostEqual(d.get_position()[1], 4.330127)