[pypy-svn] rev 2082 - in pypy/trunk/src/pypy/translator: . test tool

sanxiyn at codespeak.net sanxiyn at codespeak.net
Sun Oct 26 16:21:15 CET 2003


Author: sanxiyn
Date: Sun Oct 26 16:21:14 2003
New Revision: 2082

Modified:
   pypy/trunk/src/pypy/translator/gencl.py
   pypy/trunk/src/pypy/translator/test/test_cltrans.py
   pypy/trunk/src/pypy/translator/tool/buildcl.py
Log:
buildcl: What is test1018628.lisp? I need name!
test_cltrans: simple_func, while_func from snippet
gencl: binary_op sub, gt. two line fix.


Modified: pypy/trunk/src/pypy/translator/gencl.py
==============================================================================
--- pypy/trunk/src/pypy/translator/gencl.py	(original)
+++ pypy/trunk/src/pypy/translator/gencl.py	Sun Oct 26 16:21:14 2003
@@ -31,11 +31,13 @@
         print "; Op", self.opname, "is missing"
     binary_ops = {
         "add": "+",
+        "sub": "-",
         "inplace_add": "+", # weird, but it works
         "mod": "mod",
         "lt": "<",
         "le": "<=",
         "eq": "=",
+        "gt": ">",
         "getitem": "elt",
     }
     def op_binary(self, op):

Modified: pypy/trunk/src/pypy/translator/test/test_cltrans.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/test_cltrans.py	(original)
+++ pypy/trunk/src/pypy/translator/test/test_cltrans.py	Sun Oct 26 16:21:14 2003
@@ -75,5 +75,11 @@
         cl_sieve = make_cl_func(t.sieve_of_eratosthenes)
         self.assertEquals(cl_sieve(), 1028)
 
+    def test_easy(self):
+        f1 = make_cl_func(t.simple_func)
+        self.assertEquals(f1(1), 2)
+        f2 = make_cl_func(t.while_func)
+        self.assertEquals(f2(10), 55)
+
 if __name__ == '__main__':
     test.main()

Modified: pypy/trunk/src/pypy/translator/tool/buildcl.py
==============================================================================
--- pypy/trunk/src/pypy/translator/tool/buildcl.py	(original)
+++ pypy/trunk/src/pypy/translator/tool/buildcl.py	Sun Oct 26 16:21:14 2003
@@ -21,10 +21,7 @@
     gen = GenCL(fun)
     out = gen.emitcode()
     i = 1
-    fpath = path.join("test%d.lisp" % i)
-    while fpath.exists():
-        fpath = path.join("test%d.lisp" % i)
-        i += 1
+    fpath = path.join("%s.lisp" % fun.name)
     def _(*args):
         fpath.write(out)
         fp = file(str(fpath), "a")


More information about the Pypy-commit mailing list