Exemplo n.º 1
0
    def test_get_neighbors_of_cell_should_return_all_neighbors(self):
        cell = (1, 1)
        result = get_neighbors_of(cell)

        expected = {
            (0, 0), (0, 1), (0, 2),
            (1, 0),         (1, 2),
            (2, 0), (2, 1), (2, 2),
        }
        self.assertEqual(result, expected)
Exemplo n.º 2
0
 def test_get_neighbors_of_cell_one_one_should_return_neighbors(self):
     cell = (1, 1)
     result = get_neighbors_of(cell)
     self.assertEqual(result, {(0, 0), (0, 1), (0, 2), (1, 0), (1, 2),
                               (2, 0), (2, 1), (2, 2)})
Exemplo n.º 3
0
 def test_zero_neighbors(self):
     result = get_neighbors_of((1, 1), {(1, 1)})
     self.assertEqual(result, 0)
Exemplo n.º 4
0
 def test__neighbors(self):
     result = get_neighbors_of((1, 1), {(0, 1), (1, 1)})
     self.assertEqual(result, 1)
Exemplo n.º 5
0
 def test_get_neighbors_of_cell_should_return_one(self):
     cell = (0, 3)
     result = get_neighbors_of(cell)
     self.assertEqual(result, 1)