[pypy-svn] pypy default: port test_assert to test_pypy_c_new
antocuni
commits-noreply at bitbucket.org
Thu Apr 14 16:54:06 CEST 2011
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch:
Changeset: r43351:daa9def466ca
Date: 2011-04-14 16:27 +0200
http://bitbucket.org/pypy/pypy/changeset/daa9def466ca/
Log: port test_assert to test_pypy_c_new
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
@@ -1308,4 +1308,24 @@
--TICK--
jump(p0, p1, p2, p3, p4, i12, i14, descr=<Loop0>)
""")
-
+
+ def test_assert(self):
+ def main(a):
+ i, s = 0, 0
+ while i < 300:
+ assert a == 7
+ s += a + 1
+ i += 1
+ return s
+ log = self.run(main, [7], threshold=200)
+ assert log.result == 300*8
+ loop, = log.loops_by_filename(self.filepath)
+ assert loop.match("""
+ i8 = int_lt(i6, 300)
+ guard_true(i8, descr=...)
+ i10 = int_add_ovf(i5, 8)
+ guard_no_overflow(descr=...)
+ i12 = int_add(i6, 1)
+ --TICK--
+ jump(p0, p1, p2, p3, p4, i10, i12, descr=<Loop0>)
+ """)
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,18 +223,6 @@
return total
''' % startvalue, 170, ([], startvalue + 4999450000L))
-
- def test_assert(self):
- self.run_source('''
- def main(a):
- i, s = 0, 0
- while i < 1500:
- assert a == 7
- s += a + 1
- i += 1
- return s
- ''', 38, ([7], 8*1500))
-
def test_zeropadded(self):
self.run_source('''
from array import array
More information about the Pypy-commit
mailing list