[OCaml] Runtime tests for constructor_rename, cpp_nodefault and some others
Add runtime tests for constructor_rename, cpp_nodefault, extend, extend_special_variables, extend_template, extern_c, and global_ns_arg.
This commit is contained in:
parent
b82d3007f3
commit
5b6c57e6ae
7 changed files with 80 additions and 0 deletions
26
Examples/test-suite/ocaml/extend_runme.ml
Normal file
26
Examples/test-suite/ocaml/extend_runme.ml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
open Swig
|
||||
open Extend
|
||||
|
||||
let _ =
|
||||
let base1 = new_Base '() and base2 = new_Base '(10) in
|
||||
assert ((base1 -> "[value]" () as int) = 0);
|
||||
assert ((base2 -> "[value]" () as int) = 10);
|
||||
let cint = C_int 5 in
|
||||
assert ((base1 -> "method" (cint) as int) = 5);
|
||||
assert ((_Base_zeroVal '() as int) = 0);
|
||||
assert ((base2 -> "currentValue" () as int) = 10);
|
||||
let cint = C_int 7 in
|
||||
assert ((base2 -> "extendmethod" (cint) as int) = 14);
|
||||
;;
|
||||
|
||||
let _ =
|
||||
let der1 = new_Derived '(0) and der2 = new_Derived '(17) in
|
||||
assert ((der1 -> "[value]" () as int) = 0);
|
||||
let cint = C_int 5 in
|
||||
assert ((der1 -> "method" (cint) as int) = 10);
|
||||
assert ((der2 -> "[value]" () as int) = 34);
|
||||
let cfloat = C_float 200. in
|
||||
ignore (der2 -> "[extendval]" (cfloat));
|
||||
assert (abs_float ((der2 -> "[actualval]" () as float) -. 2.) < 0.001);
|
||||
assert (abs_float ((der2 -> "[extendval]" () as float) -. 200.) < 0.001);
|
||||
;;
|
||||
Loading…
Add table
Add a link
Reference in a new issue