Beispiel #1
0
 def test_angle_to_cycles_shortest_distance(self):
     qty = 24
     # quarter turn forwards
     self.assertEqual(angle_to_cycles(180, 6, qty), 0.25)
     # quarter turn backwards
     self.assertEqual(angle_to_cycles(180, 18, qty), -0.25)
     # quarter turn over rollover backwards
     self.assertEqual(angle_to_cycles(300, 2, qty), -0.25)
 def test_angle_to_cycles_shortest_distance(self):
     qty = 24
     # quarter turn forwards
     self.assertEqual(angle_to_cycles(180, 6, qty), 0.25)
     # quarter turn backwards
     self.assertEqual(angle_to_cycles(180, 18, qty), -0.25)
     # quarter turn over rollover backwards
     self.assertEqual(angle_to_cycles(300, 2, qty), -0.25)
Beispiel #3
0
    def test_angle_to_cycles(self):
        qty = 24  # states
        self.assertEqual(angle_to_cycles(0, 0, qty), 0)
        self.assertEqual(angle_to_cycles(360, 0, qty), 0)
        self.assertEqual(angle_to_cycles(720, 0, qty), 0)

        self.assertEqual(angle_to_cycles(180, 12, qty), 0)
        self.assertEqual(angle_to_cycles(180, 0, qty), 0.5)

        # forwards quarter a turn
        self.assertEqual(angle_to_cycles(270, 12, qty), 0.25)
        # backwards quarter a turn
        self.assertEqual(angle_to_cycles(180, 18, qty), -0.25)
    def test_angle_to_cycles(self):
        qty = 24  # states
        self.assertEqual(angle_to_cycles(0, 0, qty), 0)
        self.assertEqual(angle_to_cycles(360, 0, qty), 0)
        self.assertEqual(angle_to_cycles(720, 0, qty), 0)

        self.assertEqual(angle_to_cycles(180, 12, qty), 0)
        self.assertEqual(angle_to_cycles(180, 0, qty), 0.5)

        # forwards quarter a turn
        self.assertEqual(angle_to_cycles(270, 12, qty), 0.25)
        # backwards quarter a turn
        self.assertEqual(angle_to_cycles(180, 18, qty), -0.25)