[pypy-svn] r25312 - pypy/dist/pypy/rpython/test
nik at codespeak.net
nik at codespeak.net
Tue Apr 4 19:10:49 CEST 2006
Author: nik
Date: Tue Apr 4 19:10:48 2006
New Revision: 25312
Modified:
pypy/dist/pypy/rpython/test/test_rlist.py
Log:
start migrating rlist tests to ootypesystem.
Modified: pypy/dist/pypy/rpython/test/test_rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rlist.py (original)
+++ pypy/dist/pypy/rpython/test/test_rlist.py Tue Apr 4 19:10:48 2006
@@ -160,40 +160,42 @@
# ____________________________________________________________
-def test_simple():
- def dummyfn():
- l = [10, 20, 30]
- return l[2]
- res = interpret(dummyfn, [])
- assert res == 30
-
-def test_append():
- def dummyfn():
- l = []
- l.append(50)
- l.append(60)
- l.append(70)
- l.append(80)
- l.append(90)
- return len(l), l[0], l[-1]
- res = interpret(dummyfn, [])
- assert res.item0 == 5
- assert res.item1 == 50
- assert res.item2 == 90
+class BaseTestListRtyping:
-def test_len():
- def dummyfn():
- l = [5, 10]
- return len(l)
- res = interpret(dummyfn, [])
- assert res == 2
-
- def dummyfn():
- l = [5]
- l.append(6)
- return len(l)
- res = interpret(dummyfn, [])
- assert res == 2
+ def test_simple(self):
+ def dummyfn():
+ l = [10, 20, 30]
+ return l[2]
+ res = interpret(dummyfn, [], type_system=self.ts)
+ assert res == 30
+
+ def test_append(self):
+ def dummyfn():
+ l = []
+ l.append(50)
+ l.append(60)
+ l.append(70)
+ l.append(80)
+ l.append(90)
+ return len(l), l[0], l[-1]
+ res = interpret(dummyfn, [], type_system=self.ts)
+ assert res.item0 == 5
+ assert res.item1 == 50
+ assert res.item2 == 90
+
+ def test_len(self):
+ def dummyfn():
+ l = [5, 10]
+ return len(l)
+ res = interpret(dummyfn, [], type_system=self.ts)
+ assert res == 2
+
+ def dummyfn():
+ l = [5]
+ l.append(6)
+ return len(l)
+ res = interpret(dummyfn, [])
+ assert res == 2
def test_iterate():
def dummyfn():
@@ -1045,3 +1047,13 @@
assert isinstance(r_B_list, ListRepr)
assert r_A_list.lowleveltype == r_B_list.lowleveltype
+
+
+class TestLltypeRtyping(BaseTestListRtyping):
+
+ ts = "lltype"
+
+class TestOotypeRtyping(BaseTestListRtyping):
+
+ ts = "ootype"
+
More information about the Pypy-commit
mailing list