예제 #1
0
 def test_wobble_circle_10(self):
     wobble = Wobble(
         algorithm=circle,
         radius=10,
         speed=5,
         interval=10,
     )
     self.assertEqual(10, len(list(wobble(0, 0, 100, 0))))
     self.assertEqual(5, len(list(wobble(0, 0, 55, 0))))
     self.assertEqual(6, len(list(wobble(0, 0, 55, 0))))
     self.assertEqual(210, wobble._total_distance)
예제 #2
0
 def test_wobble_jigsaw_10_2(self):
     wobble = Wobble(
         algorithm=jigsaw,
         radius=10,
         speed=5,
         interval=10,
     )
     self.assertEqual(10, len(list(wobble(0, 0, 100, 0))))
     self.assertEqual(5, len(list(wobble(0, 0, 55.1, 0))))
     self.assertEqual(6, len(list(wobble(0, 0, 55, 0))))
     self.assertAlmostEqual(0.1 / 10, wobble._remainder)
     self.assertEqual(210, wobble._total_distance)
예제 #3
0
 def test_wobble_circle_fract(self):
     wobble = Wobble(
         algorithm=circle,
         radius=10,
         speed=5,
         interval=1,
     )
     for i in range(1000):
         if (i + 1) % 10 == 0:
             self.assertEqual(1,
                              len(list(wobble(i / 10, 0, (i + 1) / 10, 0))))
         else:
             self.assertEqual(0,
                              len(list(wobble(i / 10, 0, (i + 1) / 10, 0))))
     self.assertEqual(50, len(list(wobble(0, 0, 50.5, 0))))
     self.assertEqual(51, len(list(wobble(0, 0, 50.5, 0))))
     self.assertEqual(201, wobble._total_distance)