示例#1
0
def test_example_part_1():
    register = Namespace()
    for instruction, condition in example():
        run(register, instruction, condition)
        print(register)

    assert register.high[1] == 1
示例#2
0
def test_all_time_high_register():
    r = Namespace()

    assert r.all_time_high is None

    r['a'] = 10
    assert r['a'] == 10
    assert r['b'] == 0

    assert r.high == ('a', 10)
    assert r.all_time_high == ('a', 10)

    r['a'] = -5
    assert r.high == ('b', 0)
    assert r.all_time_high == ('a', 10)
示例#3
0
def test_register_high_default():
    reg = Namespace()
    reg['a'] = reg['c'] - 10
    reg['b'] = -5
    assert reg.high == ('c', 0)
示例#4
0
def test_register_high():
    reg = Namespace()
    reg['a'] = reg['b'] + 10
    assert reg.high == ('a', 10)
示例#5
0
def test_register_missing():
    reg = Namespace()

    assert 'a' not in reg
    assert reg['a'] == 0
    assert 'a' in reg
示例#6
0
def test_empty_register_high():
    reg = Namespace()
    assert reg.high is None
示例#7
0
def test_register_high_reset():
    reg = Namespace()
    reg['a'] = reg['b'] + 10
    assert reg.high == ('a', 10)
    reg['a'] = -5
    assert reg.high == ('b', 0)