Commits

Armin Rigo committed 733a234

fix test_symbolic

Comments (0)

Files changed (1)

pypy/translator/c/test/test_symbolic.py

 from pypy.translator.interactive import Translation
+from pypy.translator.c.test.test_genc import compile
 from pypy import conftest
 from pypy.rpython.lltypesystem import llmemory, lltype
 from pypy.rlib.objectmodel import ComputedIntSymbolic
 
-def getcompiled(f, args):
-    t = Translation(f, args)
-    fn = t.compile_c()
-    if conftest.option.view:
-        t.view()
-    return fn, t
-
 def test_offsetof():
     STRUCT = lltype.GcStruct("s", ("x", lltype.Signed), ("y", lltype.Signed))
     offsetx = llmemory.offsetof(STRUCT, 'x')
         result = (adr + offsetx).signed[0]
         (adr + offsety).signed[0] = 2
         return result * 10 + s.y
-    fn, t = getcompiled(f, [])
+    fn = compile(f, [])
     res = fn()
     assert res == 12
 
     signedsize = llmemory.sizeof(lltype.Signed)
     def f():
         return arraysize-signedsize*10
-    fn, t = getcompiled(f, [])
+    fn = compile(f, [])
     res = fn()
     assert res == 0
 
         for i in range(5):
             result = 10 * result + a[i]
         return result
-    fn, t = getcompiled(f, [])
+    fn = compile(f, [])
     res = fn()
     assert res == 1234501234
 
         for i in range(5):
             result = 10 * result + a[i]
         return result
-    fn, t = getcompiled(f, [])
+    fn = compile(f, [])
     res = fn()
     assert res == 1234501234
 
         result = (adr + offsety).signed[0] * 10 + int(offsety < sizeofs)
         llmemory.raw_free(adr)
         return result
-    fn, t = getcompiled(f, [])
+    fn = compile(f, [])
     res = fn()
     assert res == 51
 
         assert not too_early
         return 7
     k = ComputedIntSymbolic(compute_fn)
-    def f():
+    def f(ignored):
         return k*6
 
     t = Translation(f)
     if conftest.option.view:
         t.view()
     too_early = False
-    fn = t.compile_c()
-    res = fn()
+    fn = compile(f, [int])
+    res = fn(0)
     assert res == 42