示例#1
0
    def test_gives_correct_result_1(self):
        game = GameOfLife()
        game.grid = [
                [True, True, True],
                [True, True, True],
                [True, True, True]
               ]

        self.assertEqual(
            game.number_of_neighbours(1, 1, game.grid),
            8
        )
示例#2
0
    def test_doesnt_crash_on_edges2(self):
        game = GameOfLife()
        game.grid = [
                [False, False, False],
                [False, True, True],
                [False, False, False]
               ]

        self.assertEqual(
            game.number_of_neighbours(0, 2, game.grid),
            2
        )
示例#3
0
    def test_gives_correct_result_2(self):
        game = GameOfLife()
        game.grid = [
                [False, False, False],
                [False, False, False],
                [False, False, False]
               ]

        self.assertEqual(
            game.number_of_neighbours(1, 1, game.grid),
            0
        )