From 173b0ee78d7c659f9205dfee80fca8d8d91ea0b4 Mon Sep 17 00:00:00 2001 From: sheeple Date: Fri, 6 Feb 2009 12:21:53 -0600 Subject: [PATCH] Add some more tests for complex numbers in FFI --- basis/compiler/tests/alien.factor | 14 +++++++++++--- vm/ffi_test.c | 12 +++++++++++- vm/ffi_test.h | 6 +++++- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/basis/compiler/tests/alien.factor b/basis/compiler/tests/alien.factor index b9c62f1429..8830c59b31 100644 --- a/basis/compiler/tests/alien.factor +++ b/basis/compiler/tests/alien.factor @@ -559,9 +559,17 @@ FUNCTION: test_struct_14 ffi_test_44 ( ) ; inline [ ] [ stack-frame-bustage 2drop ] unit-test -FUNCTION: complex-float ffi_test_45 ( complex-float x, complex-double y ) ; +FUNCTION: complex-float ffi_test_45 ( int x ) ; + +[ C{ 0.0 3.0 } ] [ 3 ffi_test_45 ] unit-test + +FUNCTION: complex-double ffi_test_46 ( int x ) ; + +[ C{ 0.0 3.0 } ] [ 3 ffi_test_46 ] unit-test + +FUNCTION: complex-float ffi_test_47 ( complex-float x, complex-double y ) ; [ C{ 4.0 4.0 } ] [ C{ 1.0 2.0 } - C{ 1.5 1.0 } ffi_test_45 -] unit-test \ No newline at end of file + C{ 1.5 1.0 } ffi_test_47 +] unit-test diff --git a/vm/ffi_test.c b/vm/ffi_test.c index c7a9f7d890..a5a43cf2ae 100755 --- a/vm/ffi_test.c +++ b/vm/ffi_test.c @@ -303,7 +303,17 @@ struct test_struct_14 ffi_test_44(void) return retval; } -_Complex float ffi_test_45(_Complex float x, _Complex double y) +_Complex float ffi_test_45(int x) +{ + return x; +} + +_Complex double ffi_test_46(int x) +{ + return x; +} + +_Complex float ffi_test_47(_Complex float x, _Complex double y) { return x + 2 * y; } diff --git a/vm/ffi_test.h b/vm/ffi_test.h index 42ab8d71d1..f8634b304e 100755 --- a/vm/ffi_test.h +++ b/vm/ffi_test.h @@ -89,4 +89,8 @@ DLLEXPORT struct test_struct_16 ffi_test_43(float x, int a); DLLEXPORT struct test_struct_14 ffi_test_44(); -DLLEXPORT _Complex float ffi_test_45(_Complex float x, _Complex double y); +DLLEXPORT _Complex float ffi_test_45(int x); + +DLLEXPORT _Complex double ffi_test_46(int x); + +DLLEXPORT _Complex float ffi_test_47(_Complex float x, _Complex double y);