Esempio n. 1
0
def test_check_in_range_with_another_out_of_range_integer():
    err = check_in_range(INT(128), {}, lo=0, hi=128)
    assert err == "integer must be in range [0, 128)"
Esempio n. 2
0
def test_check_in_range_with_non_integer():
    assert check_in_range(R(1), {}, lo=0, hi=128) == "expected integer"
Esempio n. 3
0
def test_check_in_range_with_data_label():
    err = check_in_range(SYM("n"), {"n": DataLabel(1)}, lo=0, hi=128)
    assert err == "cannot use label as constant"
Esempio n. 4
0
def test_check_in_range_with_undefined_symbol():
    assert check_in_range(SYM("n"), {}, lo=0, hi=128) == "undefined constant"
Esempio n. 5
0
def test_check_in_range_with_valid_integers():
    assert check_in_range(INT(50), {}, lo=0, hi=128) is None
    assert check_in_range(INT(0), {}, lo=0, hi=128) is None
    assert check_in_range(INT(127), {}, lo=0, hi=128) is None
    assert check_in_range(SYM("n"), {"n": Constant(127)}, lo=0, hi=128) is None
Esempio n. 6
0
def test_check_in_range_with_out_of_range_symbol():
    err = check_in_range(SYM("n"), {"n": Constant(128)}, lo=0, hi=128)
    assert err == "integer must be in range [0, 128)"