Author: Maciej Fijalkowski <fij...@gmail.com> Branch: virtual-arguments Changeset: r56240:36df4c1f4262 Date: 2012-07-19 22:49 +0200 http://bitbucket.org/pypy/pypy/changeset/36df4c1f4262/
Log: fix tests diff --git a/pypy/jit/metainterp/resume.py b/pypy/jit/metainterp/resume.py --- a/pypy/jit/metainterp/resume.py +++ b/pypy/jit/metainterp/resume.py @@ -799,7 +799,9 @@ def __init__(self, storage, metainterp): self._init(metainterp.cpu, storage) self.metainterp = metainterp - self.liveboxes = [None] * metainterp.cpu.get_latest_value_count() + count = metainterp.cpu.get_latest_value_count() + assert count >= 0 + self.liveboxes = [None] * count self._prepare(storage) def consume_boxes(self, info, boxes_i, boxes_r, boxes_f): diff --git a/pypy/jit/metainterp/test/test_tracingopts.py b/pypy/jit/metainterp/test/test_tracingopts.py --- a/pypy/jit/metainterp/test/test_tracingopts.py +++ b/pypy/jit/metainterp/test/test_tracingopts.py @@ -329,6 +329,7 @@ def test_list_caching_negative(self): def fn(n): + assert n >= 0 a = [0] * n if n > 1000: a.append(0) @@ -350,6 +351,7 @@ def __init__(self, a, s): self = jit.hint(self, access_directly=True, fresh_virtualizable=True) + assert a >= 0 self.l = [0] * (4 + a) self.s = s @@ -556,6 +558,7 @@ def fn(n): a = g.a res = len(a) + len(a) + assert n >= 0 a1 = [0] * n g.a = a1 return len(a1) + res diff --git a/pypy/jit/tl/tlc.py b/pypy/jit/tl/tlc.py --- a/pypy/jit/tl/tlc.py +++ b/pypy/jit/tl/tlc.py @@ -216,6 +216,7 @@ t = ord(c) if t & 128: t = -(-ord(c) & 0xff) + assert t >= 0 return t class Frame(object): diff --git a/pypy/rlib/test/test_runicode.py b/pypy/rlib/test/test_runicode.py --- a/pypy/rlib/test/test_runicode.py +++ b/pypy/rlib/test/test_runicode.py @@ -709,7 +709,7 @@ def test_utf8(self): from pypy.rpython.test.test_llinterp import interpret def f(x): - + assert x >= 0 s1 = "".join(["\xd7\x90\xd6\x96\xeb\x96\x95\xf0\x90\x91\x93"] * x) u, consumed = runicode.str_decode_utf_8(s1, len(s1), True) s2 = runicode.unicode_encode_utf_8(u, len(u), True) diff --git a/pypy/rpython/test/test_llinterp.py b/pypy/rpython/test/test_llinterp.py --- a/pypy/rpython/test/test_llinterp.py +++ b/pypy/rpython/test/test_llinterp.py @@ -263,6 +263,7 @@ def test_list_multiply(): def f(i): + assert i >= 0 l = [i] l = l * i # uses alloc_and_set for len(l) == 1 return len(l) diff --git a/pypy/rpython/test/test_rlist.py b/pypy/rpython/test/test_rlist.py --- a/pypy/rpython/test/test_rlist.py +++ b/pypy/rpython/test/test_rlist.py @@ -863,21 +863,23 @@ def test_list_multiply(self): def fn(i): + assert i >= 0 lst = [i] * i ret = len(lst) if ret: ret *= lst[-1] return ret - for arg in (1, 9, 0, -1, -27): + for arg in (1, 9, 0): res = self.interpret(fn, [arg]) assert res == fn(arg) def fn(i): + assert i >= 0 lst = [i, i + 1] * i ret = len(lst) if ret: ret *= lst[-1] return ret - for arg in (1, 9, 0, -1, -27): + for arg in (1, 9, 0): res = self.interpret(fn, [arg]) assert res == fn(arg) @@ -1035,6 +1037,7 @@ return 42 return -1 def g(n): + assert n >= 0 l = [1] * n return f(l) res = self.interpret(g, [3]) @@ -1048,6 +1051,7 @@ return 42 return -1 def g(n): + assert n >= 0 l = [1] * n f(l) return l[2] @@ -1056,6 +1060,7 @@ def test_list_equality(self): def dummyfn(n): + assert n >= 0 lst = [12] * n assert lst == [12, 12, 12] lst2 = [[12, 34], [5], [], [12, 12, 12], [5]] @@ -1380,6 +1385,7 @@ def test_memoryerror(self): def fn(i): + assert i >= 0 lst = [0] * i lst[i-1] = 5 return lst[0] diff --git a/pypy/rpython/test/test_rstr.py b/pypy/rpython/test/test_rstr.py --- a/pypy/rpython/test/test_rstr.py +++ b/pypy/rpython/test/test_rstr.py @@ -828,6 +828,7 @@ def test_count_char(self): const = self.const def fn(i): + assert i >= 0 s = const("").join([const("abcasd")] * i) return s.count(const("a")) + s.count(const("a"), 2) + \ s.count(const("b"), 1, 6) + s.count(const("a"), 5, 99) @@ -837,6 +838,7 @@ def test_count(self): const = self.const def fn(i): + assert i >= 0 s = const("").join([const("abcabsd")] * i) one = i / i # confuse the annotator return (s.count(const("abc")) + const("abcde").count(const("")) + diff --git a/pypy/translator/backendopt/test/test_writeanalyze.py b/pypy/translator/backendopt/test/test_writeanalyze.py --- a/pypy/translator/backendopt/test/test_writeanalyze.py +++ b/pypy/translator/backendopt/test/test_writeanalyze.py @@ -232,6 +232,7 @@ def g(x, y, z): return f(x, y, z) def f(x, y, z): + assert x >= 0 l = [0] * x l.append(y) return len(l) + z @@ -291,6 +292,7 @@ def g(x, y, z): return f(x, y, z) def f(x, y, z): + assert x >= 0 l = [0] * x l[1] = 42 return len(l) + z @@ -309,6 +311,7 @@ def g(x, y, z): return f(x, y, z) def f(x, y, z): + assert x >= 0 l = [0] * x l.append(z) return len(l) + z _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit