Skip to content

Commit 5ec31c8

Browse files
committed
ffi/unsafe: add _double' and _float' tests
1 parent 38fffd3 commit 5ec31c8

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

collects/tests/racket/foreign-test.c

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ X int add1_int_int (int x) { return x + 1; }
1212
X int add1_byte_int (byte x) { return x + 1; }
1313
X byte add1_int_byte (int x) { return x + 1; }
1414
X byte add1_byte_byte (byte x) { return x + 1; }
15+
X float add1_float_float (float x) { return x + 1; }
16+
X double add1_double_double (double x) { return x + 1; }
1517
X int decimal_int_int_int (int x, int y) { return 10*x + y; }
1618
X int decimal_byte_int_int (byte x, int y) { return 10*x + y; }
1719
X int decimal_int_byte_int (int x, byte y) { return 10*x + y; }
@@ -36,6 +38,8 @@ X byte callback3_int_byte_byte (byte(*f)(int)) { return f(3); }
3638
X short callback3_int_short_short (short(*f)(int)) { return f(3); }
3739
X byte callback3_byte_byte_byte (byte(*f)(byte)) { return f(3); }
3840
X short callback3_short_short_short(short(*f)(short)) { return f(3); }
41+
X float callback3_float_float_float(float(*f)(float)) { return f(3.0); }
42+
X double callback3_double_double_double(double(*f)(double)) { return f(3.0); }
3943

4044
X int g1;
4145
X int curry_ret_int_int (int x) { return g1 + x; }

collects/tests/racket/foreign-test.rktl

+6
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@
146146
(t 2 'add1_byte_byte (_fun _byte -> _byte) 1)
147147
(t -1 'add1_int_int (_fun _int -> _int ) -2)
148148
(t -1 'add1_int_int (_fun _int -> _fixint ) -2)
149+
(t 2.0 'add1_float_float (_fun _float -> _float) 1.0)
150+
(t -1.0 'add1_float_float (_fun _float -> _float) -2.0)
151+
(t 2.0 'add1_double_double (_fun _double -> _double) 1.0)
152+
(t -1.0 'add1_double_double (_fun _double -> _double) -2.0)
149153
;; ---
150154
(t 12 'decimal_int_int_int (_fun _int _int -> _int ) 1 2)
151155
(t 12 'decimal_byte_int_int (_fun _byte _int -> _int ) 1 2)
@@ -173,6 +177,8 @@
173177
(t 9 'callback3_int_short_short (_fun (_fun _int -> _short) -> _short) sqr)
174178
(t 9 'callback3_byte_byte_byte (_fun (_fun _byte -> _byte) -> _byte) sqr)
175179
(t 9 'callback3_short_short_short (_fun (_fun _short -> _short) -> _short) sqr)
180+
(t 9.0 'callback3_float_float_float (_fun (_fun _float -> _float) -> _float) sqr)
181+
(t 9.0 'callback3_double_double_double (_fun (_fun _double -> _double) -> _double) sqr)
176182
;; ---
177183
(tc 3 'curry_int_int_int (_fun _int -> (_fun _int -> _int )) 1 2)
178184
(tc 3 'curry_byte_int_int (_fun _byte -> (_fun _int -> _int )) 1 2)

0 commit comments

Comments
 (0)