[pypy-svn] r15356 - in pypy/dist/pypy/rpython: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Fri Jul 29 17:10:52 CEST 2005
Author: cfbolz
Date: Fri Jul 29 17:10:50 2005
New Revision: 15356
Modified:
pypy/dist/pypy/rpython/llinterp.py
pypy/dist/pypy/rpython/test/test_llinterp.py
Log:
added missing invert operations plus test
Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py (original)
+++ pypy/dist/pypy/rpython/llinterp.py Fri Jul 29 17:10:50 2005
@@ -321,6 +321,16 @@
assert type(c) is float
return math.fmod(b,c)
+ def op_int_invert(self, a):
+ assert type(a) is int
+ return ~a
+
+ def op_uint_invert(self, a):
+ assert type(a) is r_uint
+ return ~a
+
+
+
# operations on pyobjects!
for opname in opimpls.keys():
exec py.code.Source("""
Modified: pypy/dist/pypy/rpython/test/test_llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_llinterp.py (original)
+++ pypy/dist/pypy/rpython/test/test_llinterp.py Fri Jul 29 17:10:50 2005
@@ -8,6 +8,7 @@
from pypy.rpython.rint import signed_repr
from pypy.rpython import rstr
from pypy.annotation.model import lltype_to_annotation
+from pypy.rpython.rarithmetic import r_uint
# switch on logging of interp to show more info on failing tests
@@ -86,6 +87,13 @@
res = interpret(number_ops, [3])
assert res == 4
+def test_invert():
+ def f(x):
+ return ~x
+ res = interpret(f, [3])
+ assert res == ~3
+ assert interpret(f, [r_uint(3)]) == ~r_uint(3)
+
def test_float_ops():
res = interpret(number_ops, [3.5])
assert res == 4.5
More information about the Pypy-commit
mailing list