示例#1
0
def check_generators(coll):
    ReportGuard(False)
    S = FroidurePin(coll[0])
    S.add_generators(coll[1:])
    for i, x in enumerate(coll):
        assert S.generator(i) == x

    with pytest.raises(RuntimeError):
        S.generator(len(coll))

    U = FroidurePin(coll[0])
    for x in coll[1:]:
        U.add_generator(x)
    assert S.number_of_generators() == U.number_of_generators()
    assert S.size() == U.size()

    S.closure(coll)
    assert S.number_of_generators() == len(coll)

    U = S.copy_closure(coll)
    assert U.number_of_generators() == S.number_of_generators()
    assert U.size() == S.size()
    assert U is not S

    U = S.copy_add_generators(coll)
    assert U.number_of_generators() == 2 * S.number_of_generators()
    assert U.size() == S.size()
    assert U is not S
示例#2
0
def check_constructors(coll):
    ReportGuard(False)
    # default constructor
    S = FroidurePin(coll[0])
    S.add_generators(coll[1:])

    # copy constructor
    U = FroidurePin(S)
    assert S is not U
    assert S.number_of_generators() == U.number_of_generators()
    assert S.current_size() == U.current_size()