예제 #1
0
    def test_should_turn_dead_when_a_live_cell_have_2_alive_neighbour(self):
        # given
        cell = Cell(True)
        number_of_alive_neighbour = 1

        # when
        cell.next(number_of_alive_neighbour)

        # then
        self.assertFalse(cell.state)
예제 #2
0
    def test_should_turn_alive_when_a_cell_have_3_alive_neighbour(self):
        # given
        cell = Cell(False)
        number_of_alive_neighbour = 3

        # when
        cell.next(number_of_alive_neighbour)

        # then
        self.assertTrue(cell.state)
예제 #3
0
    def test_should_keep_alive_when_a_alive_cell_have_2_alive_neighbour(self):
        # given
        cell = Cell(True)

        number_of_alive_neighbour = 2

        # when
        cell.next(number_of_alive_neighbour)

        # then
        self.assertTrue(cell.state)
예제 #4
0
    def test_should_keep_dead_when_a_dead_cell_have_2_alive_neighbour(self):
        # given
        cell = Cell(False)

        number_of_alive_neighbour = 2

        # when
        cell.next(number_of_alive_neighbour)

        # then
        self.assertFalse(cell.state)