Пример #1
0
 def test_new_pos(self):
     self.assertEqual(new_pos((1, 1), north), (1, 0))
     self.assertEqual(new_pos((1, 1), south), (1, 2))
     self.assertEqual(new_pos((1, 1), east), (2, 1))
     self.assertEqual(new_pos((1, 1), west), (0, 1))
     self.assertEqual(new_pos((1, 1), stop), (1, 1))
     self.assertEqual(new_pos((0, 0), (1, 1)), (1, 1))
Пример #2
0
 def test_new_pos(self):
     self.assertEqual(new_pos((1, 1), north), (1, 0))
     self.assertEqual(new_pos((1, 1), south), (1, 2))
     self.assertEqual(new_pos((1, 1), east), (2, 1))
     self.assertEqual(new_pos((1, 1), west), (0, 1))
     self.assertEqual(new_pos((1, 1), stop), (1, 1))
     self.assertEqual(new_pos((0, 0), (1, 1)), (1, 1))
Пример #3
0
 def test_diff_pos_arbitrary(self):
     vectors = [(0, 0), (0, 1), (-1, 1), (-2, 3)]
     orig = (1, 1)
     for vec in vectors:
         new = new_pos(orig, vec)
         self.assertEqual(vec, diff_pos(orig, new))
Пример #4
0
 def test_diff_pos_arbitrary(self):
     vectors = [(0, 0), (0, 1), (-1, 1), (-2, 3)]
     orig = (1, 1)
     for vec in vectors:
         new = new_pos(orig, vec)
         self.assertEqual(vec, diff_pos(orig, new))