[pypy-dev] [pypy-svn] pypy default: port test_intbound_addsub_ge to test_pypy_c_new

Hakan Ardo hakan at debian.org
Thu Apr 14 14:53:19 CEST 2011


On Thu, Apr 14, 2011 at 2:44 PM, antocuni <commits-noreply at bitbucket.org> wrote:
> Author: Antonio Cuni <anto.cuni at gmail.com>
> Branch:
> Changeset: r43345:fd3f23ae8324
> Date: 2011-04-14 14:42 +0200
> http://bitbucket.org/pypy/pypy/changeset/fd3f23ae8324/
>
> Log:    port test_intbound_addsub_ge 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
> @@ -1194,3 +1194,33 @@
>             --TICK--
>             jump(p0, p1, p2, p3, i11, i13, descr=<Loop0>)
>         """)
> +
> +    def test_intbound_addsub_ge(self):
> +        def main(n):
> +            i, a, b = 0, 0, 0
> +            while i < n:
> +                if i + 5 >= 5:
> +                    a += 1
> +                if i - 1 >= -1:
> +                    b += 1
> +                i += 1
> +            return (a, b)
> +        #
> +        log = self.run(main, [300], threshold=200)
> +        assert log.result == (300, 300)
> +        loop, = log.loops_by_filename(self.filepath)
> +        assert loop.match("""
> +            i10 = int_lt(i8, i9)
> +            guard_true(i10, descr=...)
> +        # XXX: why do we need ovf check here? If we put a literal "300"
> +        # instead of "n", it disappears

With n==sys.maxint, the operation i+5 would be the one overflowing.

-- 
Håkan Ardö



More information about the Pypy-dev mailing list