OCaml's classHandler() requires name, not sym:name.
In classHandler(), assign sym:name to the classname global so that it can be used in membervariableHandler(). Add a small runme test for li_std_vector. Use swigp4 when compiling the runme tests.
This commit is contained in:
parent
4a912668fc
commit
4ca6fdc551
3 changed files with 33 additions and 9 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
LANGUAGE = ocaml
|
||||
OCAMLC = @OCAMLC@
|
||||
OCAMLPP = -pp "camlp4o ./swigp4.cmo"
|
||||
VARIANT = _static
|
||||
SCRIPTSUFFIX = _runme.ml
|
||||
|
||||
|
|
@ -51,7 +52,7 @@ run_testcase = \
|
|||
if [ $(srcdir) != . ]; then \
|
||||
cp $(srcdir)/$(ml_runme) $(ml_runme); \
|
||||
fi ; \
|
||||
$(COMPILETOOL) $(OCAMLC) -c $(ml_runme) && \
|
||||
$(COMPILETOOL) $(OCAMLC) $(OCAMLPP) -c $(ml_runme) && \
|
||||
if [ -f $(top_srcdir)/Examples/test-suite/$*.list ]; then \
|
||||
$(COMPILETOOL) $(OCAMLC) swig.cmo -custom -g -cc '$(CXX)' -o runme `cat $(top_srcdir)/Examples/test-suite/$(*).list | sed -e 's/\(.*\)/\1_wrap.o \1.cmo/g'`&& $(RUNTOOL) ./runme; \
|
||||
else \
|
||||
|
|
|
|||
23
Examples/test-suite/ocaml/li_std_vector_runme.ml
Normal file
23
Examples/test-suite/ocaml/li_std_vector_runme.ml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
open Swig
|
||||
open Li_std_vector
|
||||
|
||||
let _ =
|
||||
let iv = new_IntVector '() in
|
||||
assert (iv -> "empty" () as bool);
|
||||
assert ((iv -> "size" () as int) = 0);
|
||||
ignore (iv -> "push_back" (123));
|
||||
assert ((iv -> "empty" () as bool) = false);
|
||||
assert ((iv -> "size" () as int) = 1);
|
||||
assert ((iv -> "[]" (0) as int) = 123);
|
||||
ignore (iv -> "clear" ());
|
||||
assert (iv -> "empty" () as bool);
|
||||
assert ((iv -> "size" () as int) = 0);
|
||||
;;
|
||||
|
||||
let _ =
|
||||
let rv = new_RealVector '() in
|
||||
ignore (rv -> "push_back" (100.));
|
||||
ignore (rv -> "push_back" (200.));
|
||||
assert ((rv -> "[]" (0) as float) = 100.);
|
||||
assert ((rv -> "[]" (1) as float) = 200.);
|
||||
;;
|
||||
Loading…
Add table
Add a link
Reference in a new issue