Brian Kearns avatar Brian Kearns committed e589c0e

try to fix test_rarithmetic again, this time on 64bit

Comments (0)

Files changed (1)

rpython/rlib/test/test_rarithmetic.py

 #print machbits
 
 
-
 class Test_r_int:
     def test__add__(self):
         self.binary_test(lambda x, y: x + y)
             res = f(arg)
             cmp = f(r_int(arg))
             assert res == cmp
-        
+
     def binary_test(self, f, rargs = None):
         if not rargs:
             rargs = (-10, -1, 3, 55)
             res = f(arg) & maxint_mask 
             cmp = f(r_uint(arg))
             assert res == cmp
-        
+
     def binary_test(self, f, rargs = None, translated=False):
         mask = maxint_mask 
         if not rargs:
     except OverflowError:
         pass
     else:
-        assert False        
+        assert False
     try:
         ovfcheck(x+x)
     except OverflowError:
     except OverflowError:
         pass
     else:
-        assert False    
+        assert False
 
 def test_ovfcheck_float_to_int():
     assert ovfcheck_float_to_int(1.0) == 1
     assert not int_between(1, 2, 2)
     assert not int_between(1, 1, 1)
 
-U1 = r_ulonglong(0x0102030405060708L)
-U2 = r_ulonglong(0x0807060504030201L)
-S1 = r_longlong(0x0102030405060708L)
-S2 = r_longlong(0x0807060504030201L)
+# these can't be prebuilt on 32bit
+L1 = 0x0102030405060708L
+L2 = 0x0807060504030201L
 
 def test_byteswap():
     from rpython.rtyper.lltypesystem import rffi, lltype
-    
+
     assert rffi.cast(lltype.Signed, byteswap(rffi.cast(rffi.USHORT, 0x0102))) == 0x0201
     assert rffi.cast(lltype.Signed, byteswap(rffi.cast(rffi.INT, 0x01020304))) == 0x04030201
-    assert byteswap(U1) == U2
-    assert byteswap(S1) == S2
+    assert byteswap(rffi.cast(rffi.LONGLONG, L1)) == L2
+    assert byteswap(rffi.cast(rffi.ULONGLONG, L1)) == L2
     assert ((byteswap(2.3) - 1.903598566252326e+185) / 1e185) < 0.000001
     assert (rffi.cast(lltype.Float, byteswap(rffi.cast(lltype.SingleFloat, 2.3))) - 4.173496037651603e-08) < 1e-16
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.