[pypy-svn] r77319 - pypy/branch/fast-forward/pypy/rlib/test
afa at codespeak.net
afa at codespeak.net
Thu Sep 23 23:02:04 CEST 2010
Author: afa
Date: Thu Sep 23 23:02:02 2010
New Revision: 77319
Modified:
pypy/branch/fast-forward/pypy/rlib/test/test_rstruct.py
Log:
A failing test that shows why pypy-c crashes the second time.
Modified: pypy/branch/fast-forward/pypy/rlib/test/test_rstruct.py
==============================================================================
--- pypy/branch/fast-forward/pypy/rlib/test/test_rstruct.py (original)
+++ pypy/branch/fast-forward/pypy/rlib/test/test_rstruct.py Thu Sep 23 23:02:02 2010
@@ -1,7 +1,9 @@
from pypy.rpython.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
from pypy.rlib.rstruct.runpack import runpack
+from pypy.rlib.rstruct import ieee
from pypy.rlib.rarithmetic import LONG_BIT
+from pypy.translator.c.test.test_genc import compile
import struct
class BaseTestRStruct(BaseRtypingTest):
@@ -34,3 +36,18 @@
class TestOOType(BaseTestRStruct, OORtypeMixin):
pass
+
+class TestCompiled:
+ def test_pack_float(self):
+ def pack(x):
+ result = []
+ ieee.pack_float(result, x, 8, False)
+ return ''.join(result)
+ c_pack = compile(pack, [float])
+ def unpack(s):
+ return ieee.unpack_float(s, False)
+ c_unpack = compile(unpack, [str])
+
+ s = c_pack(123.456)
+ assert s == pack(123.456)
+ assert c_unpack(s) == 123.456
More information about the Pypy-commit
mailing list