Example #1
0
File: cfa.py Project: yasong/bincat
 def parse(cls, region, s, t, length):
     value, vtop, vbot = parsers.parse_val(s)
     if type(value) is int and length != 0:
         value &= 2**length - 1
         vtop &= 2**length - 1
         vbot &= 2**length - 1
     if t is None or t == "NONE":
         taint, ttop, tbot = (0, 0, 0)
     elif t == "ALL":
         taint, ttop, tbot = (2**length - 1, 0, 0)
     else:
         taint, ttop, tbot = parsers.parse_val(t)
     return cls(region, value, length, vtop, vbot, taint, ttop, tbot)
Example #2
0
def test_parse_val_exc(test):
    with pytest.raises(Exception):
        parse_val(test)
Example #3
0
def test_parse_val(test, expval, exptop, expbot):
    val, top, bot = parse_val(test)
    assert val == expval
    assert top == exptop
    assert bot == expbot