[pypy-commit] pypy default: A passing test for widening casts from a short unsigned value.

arigo noreply at buildbot.pypy.org
Wed Dec 7 17:52:11 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r50273:bb4fc57d2649
Date: 2011-12-07 17:51 +0100
http://bitbucket.org/pypy/pypy/changeset/bb4fc57d2649/

Log:	A passing test for widening casts from a short unsigned value.

diff --git a/pypy/translator/c/test/test_typed.py b/pypy/translator/c/test/test_typed.py
--- a/pypy/translator/c/test/test_typed.py
+++ b/pypy/translator/c/test/test_typed.py
@@ -275,6 +275,14 @@
         fn = self.getcompiled(f, [r_longlong])
         assert fn(0) == 0
 
+    def test_upcast_int(self):
+        from pypy.rpython.lltypesystem import rffi
+        def f(v):
+            v = rffi.cast(rffi.USHORT, v)
+            return intmask(v)
+        fn = self.getcompiled(f, [int])
+        assert fn(0x1234CDEF) == 0xCDEF
+
     def test_function_ptr(self):
         def f1():
             return 1


More information about the pypy-commit mailing list