コード例 #1
0
ファイル: test_state.py プロジェクト: ziebam/game_of_life
def test_live_cell_with_one_live_neighbor():
    """Tests the board with a live cell with one live neighbor on it."""

    # fmt: off
    init_state = data["test_live_cell_with_one_live_neighbor"]["init_state"]
    expected_next_state = data["test_live_cell_with_one_live_neighbor"][
        "expected_next_state"]
    # fmt: on

    actual_next_state = get_next_state(init_state)

    assert expected_next_state == actual_next_state
コード例 #2
0
ファイル: test_state.py プロジェクト: ziebam/game_of_life
def test_dead_cell_with_no_live_neighbors():
    """Tests the board with only dead cells on it."""

    # fmt: off
    init_state = data["test_dead_cell_with_no_live_neighbors"]["init_state"]
    expected_next_state = data["test_dead_cell_with_no_live_neighbors"][
        "expected_next_state"]
    # fmt: on

    actual_next_state = get_next_state(init_state)

    assert expected_next_state == actual_next_state
コード例 #3
0
ファイル: test_state.py プロジェクト: ziebam/game_of_life
def test_live_cell_with_zero_live_neighbors():
    """Tests the board with a live cell without any neighbors on it."""

    # fmt: off
    init_state = data["test_live_cell_with_zero_live_neighbors"]["init_state"]
    expected_next_state = data["test_live_cell_with_zero_live_neighbors"][
        "expected_next_state"]
    # fmt: on

    actual_next_state = get_next_state(init_state)

    assert expected_next_state == actual_next_state
コード例 #4
0
ファイル: test_state.py プロジェクト: ziebam/game_of_life
def test_live_cell_with_more_than_three_live_neighbors():
    """Tests the board with a live cell with more than three live neighbor on it.
    """

    # fmt: off
    init_state = data["test_live_cell_with_more_than_three_live_neighbors"][
        "init_state"]
    expected_next_state = data[
        "test_live_cell_with_more_than_three_live_neighbors"][
            "expected_next_state"]
    # fmt: on

    actual_next_state = get_next_state(init_state)

    assert expected_next_state == actual_next_state
コード例 #5
0
ファイル: test_state.py プロジェクト: ziebam/game_of_life
def test_dead_cell_with_exactly_three_live_neighbors():
    """Tests the board with a dead cell with exactly three live neighbor on it.
    """

    # fmt: off
    init_state = data["test_dead_cell_with_exactly_three_live_neighbors"][
        "init_state"]
    expected_next_state = data[
        "test_dead_cell_with_exactly_three_live_neighbors"][
            "expected_next_state"]
    # fmt: on

    actual_next_state = get_next_state(init_state)

    assert expected_next_state == actual_next_state