def test_simple_compile_c(): import ctypes def f(x,y): return x+y t = Translation(f, [int, int]) t.source(backend='c') t.compile() dll = ctypes.CDLL(str(t.driver.c_entryp)) f = dll.pypy_g_f assert f(2, 3) == 5
def test_simple_source(): def f(x, y): return x,y t = Translation(f, [int, int], backend='c') t.annotate() t.source() assert 'source_c' in t.driver.done t = Translation(f, [int, int]) t.source_c() assert 'source_c' in t.driver.done t = Translation(f, [int, int]) py.test.raises(Exception, "t.source()")