Beispiel #1
0
def test_llop_fold():
    assert llop.int_add(lltype.Signed, 10, 2) == 12
    assert llop.int_add(lltype.Signed, -6, -7) == -13
    S1 = lltype.GcStruct('S1', ('x', lltype.Signed), hints={'immutable': True})
    s1 = lltype.malloc(S1)
    s1.x = 123
    assert llop.getfield(lltype.Signed, s1, 'x') == 123
    S2 = lltype.GcStruct('S2', ('x', lltype.Signed))
    s2 = lltype.malloc(S2)
    s2.x = 123
    py.test.raises(TypeError, "llop.getfield(lltype.Signed, s2, 'x')")
Beispiel #2
0
def test_llop_fold():
    assert llop.int_add(lltype.Signed, 10, 2) == 12
    assert llop.int_add(lltype.Signed, -6, -7) == -13
    S1 = lltype.GcStruct('S1', ('x', lltype.Signed), hints={'immutable': True})
    s1 = lltype.malloc(S1)
    s1.x = 123
    assert llop.getfield(lltype.Signed, s1, 'x') == 123
    S2 = lltype.GcStruct('S2', ('x', lltype.Signed))
    s2 = lltype.malloc(S2)
    s2.x = 123
    py.test.raises(TypeError, "llop.getfield(lltype.Signed, s2, 'x')")
Beispiel #3
0
 def llf(x, y):
     return llop.int_add(lltype.Signed, x, y)
Beispiel #4
0
 def f(x):
     i = llop.int_invert(lltype.Signed, x)
     i = llop.int_add(lltype.Signed, x, 1)
     return llop.int_neg(lltype.Signed, i)
Beispiel #5
0
def int_add(space, n, m):
    return space.newint(llop.int_add(lltype.Signed, n, m))
Beispiel #6
0
 def f(x):
     i = llop.int_invert(lltype.Signed, x)
     i = llop.int_add(lltype.Signed, x, 1)
     return llop.int_neg(lltype.Signed, i)
Beispiel #7
0
def int_add(space, n, m):
    return space.wrap(llop.int_add(lltype.Signed, n, m))
Beispiel #8
0
def int_add(space, n, m):
    return space.wrap(llop.int_add(lltype.Signed, n, m))
Beispiel #9
0
 def llf(x, y):
     return llop.int_add(lltype.Signed, x, y)