Beispiel #1
0
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
Beispiel #2
0
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
Beispiel #3
0
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
Beispiel #4
0
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
Beispiel #5
0
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