[pypy-svn] r66755 - pypy/branch/pyjitpl5-floats/pypy/jit/backend/test
fijal at codespeak.net
fijal at codespeak.net
Sat Aug 8 10:40:03 CEST 2009
Author: fijal
Date: Sat Aug 8 10:40:01 2009
New Revision: 66755
Modified:
pypy/branch/pyjitpl5-floats/pypy/jit/backend/test/runner_test.py
Log:
float fields tests
Modified: pypy/branch/pyjitpl5-floats/pypy/jit/backend/test/runner_test.py
==============================================================================
--- pypy/branch/pyjitpl5-floats/pypy/jit/backend/test/runner_test.py (original)
+++ pypy/branch/pyjitpl5-floats/pypy/jit/backend/test/runner_test.py Sat Aug 8 10:40:01 2009
@@ -341,6 +341,23 @@
'ptr', descr=fielddescr2)
assert res.value == null_const.value
+ def test_field_float(self):
+ f_box, _ = self.alloc_instance(self.F)
+ intfielddescr = self.cpu.fielddescrof(self.F, 'intfield')
+ floatfielddescr = self.cpu.fielddescrof(self.F, 'floatfield')
+ i = BoxInt(3)
+ f = BoxFloat(3.5)
+ self.execute_operation(rop.SETFIELD_GC, [f_box, i], 'void',
+ descr=intfielddescr)
+ self.execute_operation(rop.SETFIELD_GC, [f_box, f], 'void',
+ descr=floatfielddescr)
+ res = self.execute_operation(rop.GETFIELD_GC, [f_box], 'int',
+ descr=intfielddescr)
+ assert res.value == 3
+ res = self.execute_operation(rop.GETFIELD_GC, [f_box], 'float',
+ descr=floatfielddescr)
+ assert res.value == 3.5
+
def test_passing_guards(self):
for (opname, args) in [(rop.GUARD_TRUE, [BoxInt(1)]),
(rop.GUARD_FALSE, [BoxInt(0)]),
@@ -585,6 +602,8 @@
('next', lltype.Ptr(S)))
U = lltype.GcStruct('U', ('parent', T),
('next', lltype.Ptr(S)))
+ F = lltype.GcStruct('F', ('intfield', lltype.Signed),
+ ('floatfield', lltype.Float))
def alloc_instance(self, T):
More information about the Pypy-commit
mailing list