Commit 729dfcc4 authored by Armin Rigo's avatar Armin Rigo
Browse files

Fix tests, now that 'lltype.typeOf(very_large_long)' gives an error

parent d67646a1ac41
......@@ -66,17 +66,18 @@ class TestW_StdObjSpace:
def test_wrap_various_unsigned_types(self):
import sys
from rpython.rlib.rarithmetic import r_uint
from rpython.rtyper.lltypesystem import lltype, rffi
space = self.space
value = sys.maxint * 2
x = rffi.cast(lltype.Unsigned, value)
x = r_uint(value)
assert space.eq_w(space.wrap(value), space.wrap(x))
x = rffi.cast(rffi.UINTPTR_T, value)
x = rffi.cast(rffi.UINTPTR_T, r_uint(value))
assert x > 0
assert space.eq_w(space.wrap(value), space.wrap(x))
value = 60000
x = rffi.cast(rffi.USHORT, value)
x = rffi.cast(rffi.USHORT, r_uint(value))
assert space.eq_w(space.wrap(value), space.wrap(x))
value = 200
x = rffi.cast(rffi.UCHAR, value)
x = rffi.cast(rffi.UCHAR, r_uint(value))
assert space.eq_w(space.wrap(value), space.wrap(x))
......@@ -147,7 +147,7 @@ class Test64Bits:
py.test.skip()
def test_reuse_scratch_register(self):
base_addr = 0xFEDCBA9876543210
base_addr = intmask(0xFEDCBA9876543210)
cb = LocationCodeBuilder64()
cb.begin_reuse_scratch_register()
cb.MOV(ecx, heap(base_addr))
......@@ -167,7 +167,7 @@ class Test64Bits:
# ------------------------------------------------------------
def test_64bit_address_1(self):
base_addr = 0xFEDCBA9876543210
base_addr = intmask(0xFEDCBA9876543210)
cb = LocationCodeBuilder64()
cb.CMP(ecx, AddressLoc(ImmedLoc(0), ImmedLoc(0), 0, base_addr))
# this case is a CMP_rj
......@@ -181,7 +181,7 @@ class Test64Bits:
assert cb.getvalue() == expected_instructions
def test_64bit_address_2(self):
base_addr = 0xFEDCBA9876543210
base_addr = intmask(0xFEDCBA9876543210)
cb = LocationCodeBuilder64()
cb.MOV(ecx, AddressLoc(ImmedLoc(0), edx, 3, base_addr))
# this case is a CMP_ra
......@@ -195,7 +195,7 @@ class Test64Bits:
assert cb.getvalue() == expected_instructions
def test_64bit_address_3(self):
base_addr = 0xFEDCBA9876543210
base_addr = intmask(0xFEDCBA9876543210)
cb = LocationCodeBuilder64()
cb.MOV(ecx, AddressLoc(edx, ImmedLoc(0), 0, base_addr))
# this case is a CMP_rm
......@@ -211,7 +211,7 @@ class Test64Bits:
assert cb.getvalue() == expected_instructions
def test_64bit_address_4(self):
base_addr = 0xFEDCBA9876543210
base_addr = intmask(0xFEDCBA9876543210)
cb = LocationCodeBuilder64()
cb.begin_reuse_scratch_register()
assert cb._reuse_scratch_register is True
......@@ -234,7 +234,7 @@ class Test64Bits:
# ------------------------------------------------------------
def test_MOV_64bit_constant_into_r11(self):
base_constant = 0xFEDCBA9876543210
base_constant = intmask(0xFEDCBA9876543210)
cb = LocationCodeBuilder64()
cb.MOV(r11, imm(base_constant))
......@@ -245,7 +245,7 @@ class Test64Bits:
assert cb.getvalue() == expected_instructions
def test_MOV_64bit_constant_into_rax(self):
base_constant = 0xFEDCBA9876543210
base_constant = intmask(0xFEDCBA9876543210)
cb = LocationCodeBuilder64()
cb.MOV(eax, imm(base_constant))
......@@ -256,7 +256,7 @@ class Test64Bits:
assert cb.getvalue() == expected_instructions
def test_MOV_64bit_address_into_r11(self):
base_addr = 0xFEDCBA9876543210
base_addr = intmask(0xFEDCBA9876543210)
cb = LocationCodeBuilder64()
cb.MOV(r11, heap(base_addr))
......@@ -270,7 +270,7 @@ class Test64Bits:
def test_MOV_immed32_into_64bit_address_1(self):
immed = -0x01234567
base_addr = 0xFEDCBA9876543210
base_addr = intmask(0xFEDCBA9876543210)
cb = LocationCodeBuilder64()
cb.MOV(AddressLoc(ImmedLoc(0), ImmedLoc(0), 0, base_addr),
ImmedLoc(immed))
......@@ -286,7 +286,7 @@ class Test64Bits:
def test_MOV_immed32_into_64bit_address_2(self):
immed = -0x01234567
base_addr = 0xFEDCBA9876543210
base_addr = intmask(0xFEDCBA9876543210)
cb = LocationCodeBuilder64()
cb.MOV(AddressLoc(ImmedLoc(0), edx, 3, base_addr),
ImmedLoc(immed))
......@@ -302,7 +302,7 @@ class Test64Bits:
def test_MOV_immed32_into_64bit_address_3(self):
immed = -0x01234567
base_addr = 0xFEDCBA9876543210
base_addr = intmask(0xFEDCBA9876543210)
cb = LocationCodeBuilder64()
cb.MOV(AddressLoc(edx, ImmedLoc(0), 0, base_addr),
ImmedLoc(immed))
......@@ -320,7 +320,7 @@ class Test64Bits:
def test_MOV_immed32_into_64bit_address_4(self):
immed = -0x01234567
base_addr = 0xFEDCBA9876543210
base_addr = intmask(0xFEDCBA9876543210)
cb = LocationCodeBuilder64()
cb.MOV(AddressLoc(edx, esi, 2, base_addr), ImmedLoc(immed))
# this case is a MOV_ai
......@@ -339,7 +339,7 @@ class Test64Bits:
def test_MOV_immed64_into_64bit_address_1(self):
immed = 0x0123456789ABCDEF
base_addr = 0xFEDCBA9876543210
base_addr = intmask(0xFEDCBA9876543210)
cb = LocationCodeBuilder64()
cb.MOV(AddressLoc(ImmedLoc(0), ImmedLoc(0), 0, base_addr),
ImmedLoc(immed))
......@@ -361,7 +361,7 @@ class Test64Bits:
def test_MOV_immed64_into_64bit_address_2(self):
immed = 0x0123456789ABCDEF
base_addr = 0xFEDCBA9876543210
base_addr = intmask(0xFEDCBA9876543210)
cb = LocationCodeBuilder64()
cb.MOV(AddressLoc(ImmedLoc(0), edx, 3, base_addr),
ImmedLoc(immed))
......@@ -383,7 +383,7 @@ class Test64Bits:
def test_MOV_immed64_into_64bit_address_3(self):
immed = 0x0123456789ABCDEF
base_addr = 0xFEDCBA9876543210
base_addr = intmask(0xFEDCBA9876543210)
cb = LocationCodeBuilder64()
cb.MOV(AddressLoc(eax, ImmedLoc(0), 0, base_addr),
ImmedLoc(immed))
......@@ -407,7 +407,7 @@ class Test64Bits:
def test_MOV_immed64_into_64bit_address_4(self):
immed = 0x0123456789ABCDEF
base_addr = 0xFEDCBA9876543210
base_addr = intmask(0xFEDCBA9876543210)
cb = LocationCodeBuilder64()
cb.MOV(AddressLoc(edx, eax, 2, base_addr), ImmedLoc(immed))
# this case is a MOV_ai
......
......@@ -11,7 +11,7 @@ from rpython.rlib import jit_libffi
from rpython.rlib.jit_libffi import (types, CIF_DESCRIPTION, FFI_TYPE_PP,
jit_ffi_call)
from rpython.rlib.unroll import unrolling_iterable
from rpython.rlib.rarithmetic import intmask, r_longlong, r_singlefloat
from rpython.rlib.rarithmetic import intmask, r_longlong, r_singlefloat, r_uint
from rpython.rlib.longlong2float import float2longlong
def get_description(atypes, rtype):
......@@ -230,8 +230,8 @@ class FfiCallTests(object):
def test_handle_unsigned(self):
self._run([types.ulong], types.ulong,
[rffi.cast(rffi.ULONG, sys.maxint + 91348)],
rffi.cast(rffi.ULONG, sys.maxint + 4242))
[rffi.cast(rffi.ULONG, r_uint(sys.maxint + 91348))],
rffi.cast(rffi.ULONG, r_uint(sys.maxint + 4242)))
def test_handle_unsignedchar(self):
self._run([types.uint8], types.uint8,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment