[OCaml] Add a typecheck typemap for SWIGTYPE
This fixes many of the remaining warnings in the OCaml test suite. Add multiple runtime tests.
This commit is contained in:
parent
6522afe90a
commit
b7a400f991
8 changed files with 211 additions and 10 deletions
52
Examples/test-suite/ocaml/template_default_arg_runme.ml
Normal file
52
Examples/test-suite/ocaml/template_default_arg_runme.ml
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
open Swig
|
||||
open Template_default_arg
|
||||
|
||||
let _ =
|
||||
let helloInt = new_Hello_int '() and enumArg = _hi '() in
|
||||
assert (helloInt -> foo (enumArg) = C_void);
|
||||
assert (helloInt -> foo () = C_void);
|
||||
|
||||
let x = new_X_int '() in
|
||||
assert (x -> meth (20.0, 200) as int = 200);
|
||||
assert (x -> meth (20) as int = 20);
|
||||
assert (x -> meth () as int = 0);
|
||||
|
||||
let x = new_Y_unsigned '() in
|
||||
let args = C_list [ C_double 20.0 ; C_uint 200l ] in
|
||||
assert (x -> meth (args) as int = 200);
|
||||
let args = C_uint 20l in
|
||||
assert (x -> meth (args) as int = 20);
|
||||
assert (x -> meth () as int = 0);
|
||||
|
||||
let x = new_X_longlong '() in
|
||||
assert (x -> meth (20.0) as int = 0);
|
||||
let x = new_X_longlong '(20.0) in
|
||||
assert (x -> meth (20.0) as int = 0);
|
||||
let args = C_list [ C_double 20.0 ; C_int64 200L ] in
|
||||
let x = new_X_longlong '(args) in
|
||||
assert (x -> meth (20.0) as int = 0);
|
||||
|
||||
let x = new_X_int '() in
|
||||
assert (x -> meth (20.0) as int = 0);
|
||||
let x = new_X_int '(20.0) in
|
||||
assert (x -> meth (20.0) as int = 0);
|
||||
let x = new_X_int '(20.0, 200) in
|
||||
assert (x -> meth (20.0) as int = 0);
|
||||
|
||||
let arg = new_Foo_int '() in
|
||||
assert (_ott '(arg) as int = 30);
|
||||
assert (_ott '() as int = 10);
|
||||
assert (_ott '(1) as int = 10);
|
||||
assert (_ott '(1, 1) as int = 10);
|
||||
assert (_ott '("hi") as int = 20);
|
||||
assert (_ott '("hi", 1) as int = 20);
|
||||
assert (_ott '("hi", 1, 1) as int = 20);
|
||||
|
||||
let arg = new_Hello_int '() in
|
||||
assert (_ottstring '(arg, "hi") as int = 40);
|
||||
assert (_ottstring '(arg) as int = 40);
|
||||
assert (_ottint '(arg, 1) as int = 50);
|
||||
assert (_ottint '(arg) as int = 50);
|
||||
assert (_ott '(arg, 1.0) as int = 60);
|
||||
assert (_ott '(arg) as int = 60);
|
||||
;;
|
||||
Loading…
Add table
Add a link
Reference in a new issue