[pypy-svn] pypy default: port test_silly_max and test_iter_max to test_pypy_c_new; we still need to understand what we want to check, though

antocuni commits-noreply at bitbucket.org
Fri Apr 15 10:35:24 CEST 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: 
Changeset: r43378:2e5bd737be0c
Date: 2011-04-15 10:10 +0200
http://bitbucket.org/pypy/pypy/changeset/2e5bd737be0c/

Log:	port test_silly_max and test_iter_max to test_pypy_c_new; we still
	need to understand what we want to check, though

diff --git a/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py b/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
--- a/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
@@ -1454,3 +1454,29 @@
             --TICK--
             jump(p0, p1, p2, p3, i11, i9, descr=<Loop0>)
         """)
+
+    def test_silly_max(self):
+        def main():
+            i=2
+            sa=0
+            while i < 300: 
+                sa+=max(*range(i))
+                i+=1
+            return sa
+        log = self.run(main, [], threshold=200)
+        assert log.result == main()
+        loop, = log.loops_by_filename(self.filepath)
+        # XXX: what do we want to check here?
+
+    def test_iter_max(self):
+        def main():
+            i=2
+            sa=0
+            while i < 300:
+                sa+=max(range(i))
+                i+=1
+            return sa
+        log = self.run(main, [], threshold=200)
+        assert log.result == main()
+        loop, = log.loops_by_filename(self.filepath)
+        # XXX: what do we want to check here?

diff --git a/pypy/module/pypyjit/test/test_pypy_c.py b/pypy/module/pypyjit/test/test_pypy_c.py
--- a/pypy/module/pypyjit/test/test_pypy_c.py
+++ b/pypy/module/pypyjit/test/test_pypy_c.py
@@ -223,29 +223,6 @@
             return total
         ''' % startvalue, 170, ([], startvalue + 4999450000L))
 
-
-    def test_silly_max(self):
-        self.run_source('''
-        def main():
-            i=2
-            sa=0
-            while i < 2000: 
-                sa+=max(*range(i))
-                i+=1
-            return sa
-        ''', 125, ([], 1997001))
-
-    def test_iter_max(self):
-        self.run_source('''
-        def main():
-            i=2
-            sa=0
-            while i < 2000: 
-                sa+=max(range(i))
-                i+=1
-            return sa
-        ''', 88, ([], 1997001))
-
     def test__ffi_call(self):
         from pypy.rlib.test.test_libffi import get_libm_name
         libm_name = get_libm_name(sys.platform)


More information about the Pypy-commit mailing list