[pypy-svn] r24994 - pypy/dist/pypy/translator/squeak/test
nik at codespeak.net
nik at codespeak.net
Sat Mar 25 13:48:57 CET 2006
Author: nik
Date: Sat Mar 25 13:48:56 2006
New Revision: 24994
Added:
pypy/dist/pypy/translator/squeak/test/test_datastructure.py
Log:
add some tuple tests to gensqueak. tuple iteration doesn't really work
right now, because handling of loops is generally very primitive in
gensqueak.
Added: pypy/dist/pypy/translator/squeak/test/test_datastructure.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/squeak/test/test_datastructure.py Sat Mar 25 13:48:56 2006
@@ -0,0 +1,32 @@
+from pypy.translator.squeak.test.runtest import compile_function
+
+class TestTuple:
+
+ def test_twotuple(self):
+ def f(i):
+ # Use two different two-tuples to make sure gensqueak can cope
+ # with the two different classes.
+ b = (True, i)
+ if b[0]:
+ i = b[1] + 1
+ if i > 0:
+ return (i, 1)
+ else:
+ return (i, -1)
+ def g(i):
+ return f(i)[1]
+ fn = compile_function(g, [int])
+ res = fn(2)
+ assert res == "1"
+ res = fn(-2)
+ assert res == "-1"
+
+ def DONT_test_tupleiter(self):
+ def f(i):
+ t = (i,)
+ for x in t:
+ i += x
+ return t
+ fn = compile_function(f, [int])
+ res = fn(2)
+ assert res == "4"
More information about the Pypy-commit
mailing list