Exemplo n.º 1
0
def test_any():
    bitvectors.bitvectors = {}
    bitvectors.create_bitvector("something_else", "one", "two")

    b = bitvectors.Bitvector("something_else")

    assert b.any() is False
    b.one = True
    assert b.any() is True
Exemplo n.º 2
0
def test_instance():
    # Instance a Bitvector
    bitvectors.bitvectors = {}
    bitvectors.create_bitvector("something_else", "one", "two")

    b = bitvectors.Bitvector("something_else")

    assert b.one is False
    assert b.two is False
Exemplo n.º 3
0
def test_str():
    bitvectors.bitvectors = {}
    bitvectors.create_bitvector("something_else", "one", "two")

    b = bitvectors.Bitvector("something_else")

    assert str(b) == ""
    b.one = True
    assert str(b) == "one"
    b.two = True
    assert str(b) == "one, two"
Exemplo n.º 4
0
def test_fromstr():
    bitvectors.bitvectors = {}
    bitvectors.create_bitvector("something_else", "one", "two")

    b = bitvectors.Bitvector("something_else", "one")

    assert b.one is True
    assert b.two is False

    b = bitvectors.Bitvector("something_else", "one, two")

    assert b.one is True
    assert b.two is True
Exemplo n.º 5
0
def test_setall():
    bitvectors.bitvectors = {}
    bitvectors.create_bitvector("something_else", "one", "two")

    b = bitvectors.Bitvector("something_else")

    assert b.one is False
    assert b.two is False

    b.setall(True)

    assert b.one is True
    assert b.two is True
Exemplo n.º 6
0
def test_create():
    # Just create a bitvector
    bitvectors.bitvectors = {}
    bitvectors.create_bitvector("something_else", "one", "two")

    assert "something_else" in bitvectors.bitvectors