Exemplo n.º 1
0
def test_continued_conjunctive(G, H, J):
    """
    Test that the continued conjunctive sum matches known results.
    """
    assert canonical_form(continued_conjunctive(G, H)) == J
Exemplo n.º 2
0
def test_shortened_selective(G, H, J):
    """
    Test that the shortened selective sum matches known results.
    """
    assert canonical_form(shortened_selective(G, H)) == J
Exemplo n.º 3
0
def test_disjunctive_2(G, H, J):
    """
    Test that the disjunctive sum matches known results, without canonizing.
    """
    assert canonical_form(disjunctive(G, H, canon=False)) == J
Exemplo n.º 4
0
def test_diminished_disjunctive(G, H, J):
    """
    Test that the diminished disjunctive sum matches known results.
    """
    assert canonical_form(diminished_disjunctive(G, H)) == J
Exemplo n.º 5
0
def test_sequential(G, H, J):
    """
    Test that the sequential sum matches known results.
    """
    assert canonical_form(sequential(G, H)) == J
Exemplo n.º 6
0
def test_side(G, H, J):
    """
    Test that the side sum matches known results.
    """
    assert canonical_form(side(G, H)) == J
Exemplo n.º 7
0
def test_ordinal(G, H, J):
    """
    Test that the ordinal sum matches known results.
    """
    assert canonical_form(ordinal(G, H)) == J
Exemplo n.º 8
0
def test_canonical_form(G):
    """
    Test that canonicalizing doesn't effect the value of the game.
    """
    with recursion_limit(10_000):
        assert canonical_form(G) == G
Exemplo n.º 9
0
         {Game({-1}, {-2}), Game({0}, {-4})}),
])
def test_not_numberish(g):
    """
    Test that these games are not numberish.
    """
    assert not g.is_numberish


@pytest.mark.parametrize(('g', 'bday'), [
    (zero, 0),
    (one, 1),
    (-one, 1),
    (star, 1),
    (up, 2),
    (canonical_form(up + star), 2),
    (half, 2),
])
def test_birthday(g, bday):
    """
    Test some birthdays.
    """
    assert g.birthday == bday


@pytest.mark.parametrize(('g', 'sp'), [
    (up, {up, zero, star, zero}),
])
def test_subpositions(g, sp):
    """
    Test that subpositions are yielded correctly.