[pypy-svn] r67019 - in pypy/branch/pyjitpl5/pypy/jit/backend/test: . loopdata

fijal at codespeak.net fijal at codespeak.net
Thu Aug 20 12:56:36 CEST 2009


Author: fijal
Date: Thu Aug 20 12:56:35 2009
New Revision: 67019

Added:
   pypy/branch/pyjitpl5/pypy/jit/backend/test/loopdata/
   pypy/branch/pyjitpl5/pypy/jit/backend/test/loopdata/simple.ops
   pypy/branch/pyjitpl5/pypy/jit/backend/test/test_loopparser.py   (contents, props changed)
Log:
Tests for the previous checkin


Added: pypy/branch/pyjitpl5/pypy/jit/backend/test/loopdata/simple.ops
==============================================================================
--- (empty file)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/test/loopdata/simple.ops	Thu Aug 20 12:56:35 2009
@@ -0,0 +1,15 @@
+LOOP bi(0,6),bi(1,4),bi(2,18)
+#(no jitdriver.get_printable_location!)
+1:int_add bi(2,18),bi(0,6)
+  => bi(3,24)
+2:int_sub bi(1,4),ci(4,1)
+  => bi(5,3)
+3:int_gt bi(5,3),ci(6,0)
+  => bi(7,1)
+4:guard_true bi(7,1)
+  BEGIN(0)
+  0:fail bi(0,6),bi(5,3),bi(3,24)[]
+  END
+#(no jitdriver.get_printable_location!)
+6:jump bi(0,6),bi(5,3),bi(3,24)
+LOOP END

Added: pypy/branch/pyjitpl5/pypy/jit/backend/test/test_loopparser.py
==============================================================================
--- (empty file)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/test/test_loopparser.py	Thu Aug 20 12:56:35 2009
@@ -0,0 +1,21 @@
+
+import py
+from pypy.jit.backend.loopparser import *
+
+class TestParser(object):
+    def parse(self, name):
+        parser = Parser()
+        return parser.parse(py.magic.autopath().join('..', 'loopdata', name))
+
+    def test_simple_loop(self):
+        topblock = self.parse('simple.ops')
+        assert len(topblock.operations) == 7
+        assert isinstance(topblock.operations[0], Comment)
+        assert isinstance(topblock.operations[-2], Comment)
+        assert isinstance(topblock.operations[4], GuardOperation)
+        assert ([op.opname for op in topblock.operations
+                 if not isinstance(op, Comment)] ==
+                ['int_add', 'int_sub', 'int_gt', 'guard_true', 'jump'])
+        subops = topblock.operations[4].suboperations.operations
+        assert len(subops) == 1
+        assert subops[0].opname == 'fail'



More information about the Pypy-commit mailing list