ffi: Add some tests to ensure that 64bit integers are handled properly.

db4
Doug Coleman 2014-07-07 17:02:36 -07:00
parent 608c23ad8f
commit beb2d1df3a
3 changed files with 26 additions and 1 deletions

View File

@ -6,7 +6,8 @@ math memory namespaces namespaces.private parser
quotations sequences specialized-arrays stack-checker quotations sequences specialized-arrays stack-checker
stack-checker.errors system threads tools.test words stack-checker.errors system threads tools.test words
alien.complex concurrency.promises alien.data alien.complex concurrency.promises alien.data
byte-arrays classes compiler.test libc ; byte-arrays classes compiler.test libc layouts
math.bitwise ;
FROM: alien.c-types => float short ; FROM: alien.c-types => float short ;
SPECIALIZED-ARRAY: float SPECIALIZED-ARRAY: float
SPECIALIZED-ARRAY: char SPECIALIZED-ARRAY: char
@ -662,6 +663,18 @@ FUNCTION: short ffi_test_48 ( bool-field-test x ) ;
test-struct-11 "f-fastcall" "ffi_test_58" { int int int } test-struct-11 "f-fastcall" "ffi_test_58" { int int int }
alien-invoke gc ; alien-invoke gc ;
! Make sure that large longlong/ulonglong are correctly dealt with
FUNCTION: longlong ffi_test_59 ( longlong x ) ;
FUNCTION: ulonglong ffi_test_60 ( ulonglong x ) ;
[ t ] [ most-positive-fixnum 1 + [ ffi_test_59 ] keep = ] unit-test
[ t ] [ most-positive-fixnum 1 + [ ffi_test_60 ] keep = ] unit-test
[ -1 ] [ -1 ffi_test_59 ] unit-test
[ -1 ] [ 0xffffffffffffffff ffi_test_59 ] unit-test
[ 0xffffffffffffffff ] [ -1 ffi_test_60 ] unit-test
[ 0xffffffffffffffff ] [ 0xffffffffffffffff ffi_test_60 ] unit-test
! GCC bugs ! GCC bugs
mingw? [ mingw? [
[ 13 ] [ 3 4.0 5 ffi_test_52 ] unit-test [ 13 ] [ 3 4.0 5 ffi_test_52 ] unit-test

View File

@ -298,3 +298,11 @@ FACTOR_FASTCALL(struct test_struct_11) ffi_test_58(int x, int y, int z) {
struct test_struct_11 r = { x + y, y - z }; struct test_struct_11 r = { x + y, y - z };
return r; return r;
} }
signed long long ffi_test_59(signed long long x) {
return x;
}
unsigned long long ffi_test_60(unsigned long long x) {
return x;
}

View File

@ -199,3 +199,7 @@ FACTOR_EXPORT FACTOR_FASTCALL(int)
FACTOR_EXPORT FACTOR_FASTCALL(struct test_struct_11) ffi_test_57(int x, int y); FACTOR_EXPORT FACTOR_FASTCALL(struct test_struct_11) ffi_test_57(int x, int y);
FACTOR_EXPORT FACTOR_FASTCALL(struct test_struct_11) FACTOR_EXPORT FACTOR_FASTCALL(struct test_struct_11)
ffi_test_58(int x, int y, int z); ffi_test_58(int x, int y, int z);
signed long long ffi_test_59(signed long long x);
unsigned long long ffi_test_60(unsigned long long x);