Example #1
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))
Example #2
0
 def test_get_offset(self):
     c = Coords(10,1)
     self.assertEqual(Coords(2,1), c.get_offset(Direction('w'), 8))
     self.assertEqual(Coords(13,1), c.get_offset(Direction('e'), 3))
     self.assertEqual(Coords(10,-1), c.get_offset(Direction('n'), 2))
     self.assertEqual(Coords(10,2), c.get_offset(Direction('s')))