Exemple #1
0
 def test_sanity(self):
     for dirname in self.directions:
         d = Direction(dirname)
         for x in range(4):
             d.turn_left()
         self.assertEqual(d, Direction(dirname))
     
         for x in range(4):
             d.turn_right()
         self.assertEqual(d, Direction(dirname))
Exemple #2
0
    def test_sanity(self):
        c = Coords(1,1)
        d = Direction('n')
        for x in range(4):
            c = c.get_offset(d, 5)
            d.turn_left()
        self.assertEqual(c, Coords(1,1))

        for x in range(4):
            c = c.get_offset(d, -1)
            d.turn_right()
        self.assertEqual(c, Coords(1,1))
Exemple #3
0
 def test_turns(self):
     d = Direction('n')
     d.turn_left()
     self.assertEqual(d, Direction('w'))
     d.turn_right()
     self.assertEqual(d, Direction('n'))