Beispiel #1
0
def test_garbage_collected_dsl_raises_runtime_error():
    mnemonic = Mnemonic('FOO')
    asm = AsmDsl()
    labeller = asm.label
    del asm
    gc.collect()
    with raises(RuntimeError):
        labeller(mnemonic)
Beispiel #2
0
def test_mnemonic_repr(m):
    r = repr(Mnemonic(m))
    assert r.startswith('Mnemonic')
    assert m in r
    assert check_balanced(r)
Beispiel #3
0
def test_mnemonic_value(m):
    assert str(Mnemonic(m)) == m
Beispiel #4
0
def test_mnemonic_illegal_initial_character_raises_value_error(m):
    with raises(ValueError):
        Mnemonic(m)
Beispiel #5
0
def test_empty_mnemonic_raises_value_error():
    with raises(ValueError):
        Mnemonic('')
Beispiel #6
0
def test_mnemonic_interning(m):
    assert Mnemonic(m) is Mnemonic(m)
Beispiel #7
0
def test_mnemonic_illegal_unicode_categories_raise_value_error(p, q):
    m = p + q
    with raises(ValueError):
        Mnemonic(m)
Beispiel #8
0
def test_negative_indirect_address_raises_value_error(address):
    FOO = Mnemonic('FOO')
    asm = AsmDsl()
    with raises(ValueError):
        asm(FOO, {address})
Beispiel #9
0
def test_parse_operand_unsupported_indirect_type_raises_not_implemented_error(
):
    FOO = Mnemonic('FOO')
    asm = AsmDsl()
    with raises(TypeError):
        asm(FOO, [object()])
Beispiel #10
0
def test_unknown_mnemonic_raises_value_error():
    mnemonic = Mnemonic("XXX")
    asm = AsmDsl()
    with raises(ValueError):
        asm(mnemonic)
Beispiel #11
0
def test_unknown_mnemonic_raises_value_error(m):
    mnemonic = Mnemonic(m)
    assume(mnemonic not in MNEMONIC_TO_STATEMENT)
    asm = AsmDsl()
    with raises(ValueError):
        asm(mnemonic)