Exemplo n.º 1
0
 def test_get_neighbor_from_non_origin(self):
     coord = Coord(2, -3, 1)
     neighbors = [coord.get_neighbor(i) for i in range(6)]
     self.assertEqual(len(neighbors), 6)
     self.assertEqual(neighbors[0], Coord(3, -4, 1))
     self.assertEqual(neighbors[1], Coord(3, -3, 0))
     self.assertEqual(neighbors[2], Coord(2, -2, 0))
     self.assertEqual(neighbors[3], Coord(1, -2, 1))
     self.assertEqual(neighbors[4], Coord(1, -3, 2))
     self.assertEqual(neighbors[5], Coord(2, -4, 2))
Exemplo n.º 2
0
 def test_get_neighbor_from_origin(self):
     coord = Coord()
     neighbors = [coord.get_neighbor(i) for i in range(6)]
     self.assertEqual(len(neighbors), 6)
     self.assertEqual(neighbors[0], Coord(1, -1, 0))
     self.assertEqual(neighbors[1], Coord(1, 0, -1))
     self.assertEqual(neighbors[2], Coord(0, 1, -1))
     self.assertEqual(neighbors[3], Coord(-1, 1, 0))
     self.assertEqual(neighbors[4], Coord(-1, 0, 1))
     self.assertEqual(neighbors[5], Coord(0, -1, 1))