ffi/unsafe: add _double' and _float' tests

This commit is contained in:
Matthew Flatt 2013-04-19 06:16:49 -06:00
parent 38fffd3582
commit 5ec31c8f65
2 changed files with 10 additions and 0 deletions

View File

@ -12,6 +12,8 @@ X int add1_int_int (int x) { return x + 1; }
X int add1_byte_int (byte x) { return x + 1; }
X byte add1_int_byte (int x) { return x + 1; }
X byte add1_byte_byte (byte x) { return x + 1; }
X float add1_float_float (float x) { return x + 1; }
X double add1_double_double (double x) { return x + 1; }
X int decimal_int_int_int (int x, int y) { return 10*x + y; }
X int decimal_byte_int_int (byte x, int y) { return 10*x + y; }
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); }
X short callback3_int_short_short (short(*f)(int)) { return f(3); }
X byte callback3_byte_byte_byte (byte(*f)(byte)) { return f(3); }
X short callback3_short_short_short(short(*f)(short)) { return f(3); }
X float callback3_float_float_float(float(*f)(float)) { return f(3.0); }
X double callback3_double_double_double(double(*f)(double)) { return f(3.0); }
X int g1;
X int curry_ret_int_int (int x) { return g1 + x; }

View File

@ -146,6 +146,10 @@
(t 2 'add1_byte_byte (_fun _byte -> _byte) 1)
(t -1 'add1_int_int (_fun _int -> _int ) -2)
(t -1 'add1_int_int (_fun _int -> _fixint ) -2)
(t 2.0 'add1_float_float (_fun _float -> _float) 1.0)
(t -1.0 'add1_float_float (_fun _float -> _float) -2.0)
(t 2.0 'add1_double_double (_fun _double -> _double) 1.0)
(t -1.0 'add1_double_double (_fun _double -> _double) -2.0)
;; ---
(t 12 'decimal_int_int_int (_fun _int _int -> _int ) 1 2)
(t 12 'decimal_byte_int_int (_fun _byte _int -> _int ) 1 2)
@ -173,6 +177,8 @@
(t 9 'callback3_int_short_short (_fun (_fun _int -> _short) -> _short) sqr)
(t 9 'callback3_byte_byte_byte (_fun (_fun _byte -> _byte) -> _byte) sqr)
(t 9 'callback3_short_short_short (_fun (_fun _short -> _short) -> _short) sqr)
(t 9.0 'callback3_float_float_float (_fun (_fun _float -> _float) -> _float) sqr)
(t 9.0 'callback3_double_double_double (_fun (_fun _double -> _double) -> _double) sqr)
;; ---
(tc 3 'curry_int_int_int (_fun _int -> (_fun _int -> _int )) 1 2)
(tc 3 'curry_byte_int_int (_fun _byte -> (_fun _int -> _int )) 1 2)