Commit graph

116 commits

Author SHA1 Message Date
Zackery Spytz
90dce1af3e [OCaml] Runtime tests for rename_rstrip_encoder and using2
Add runtime tests for rename_rstrip_encoder and using2.

They are based on the runtime tests that already exist for other
languages.
2022-12-04 19:37:22 -08:00
William S Fulton
1d73341aa4 Polymorphism in R wrappers fixed for C++ structs 2022-10-24 08:56:55 +01:00
Olly Betts
867e49d7c5 [Ocaml] Add mod_runme.ml
See #2126
2022-10-19 07:42:11 +13:00
William S Fulton
76f5670fa4 Fix OCaml %rename for enum items 2022-10-05 22:42:17 +01:00
William S Fulton
ed333b6b97 std::string throws typemaps
Go, Guile, Racket, Scilab: Add throws typemaps for std::string so that
thrown string exception messages can be seen.

Test all language for std::string throws typemaps
2022-09-19 09:09:29 +01:00
William S Fulton
4a29229bab Add catches_strings test to test throws char * typemap 2022-09-19 09:09:29 +01:00
Olly Betts
07f0b732ba Add machinery for C++14, C++17 and C++20 testing
Support running testcases conditional on the compiler supporting
a each language version, like we already handle C++11.

Currently no testcases are actually run in this way for these
newer language versions.
2022-07-26 15:28:51 +12:00
William S Fulton
71cd6a38fe Performance optimisation for directors for classes passed by value
The directorin typemaps in the director methods now use std::move on the
input parameter when copying the object from the stack to the heap prior
to the callback into the target language, thereby taking advantage of
move semantics if available.
2022-07-04 11:19:29 +01:00
William S Fulton
6ccef6dae1 Ocaml clean fixes 2022-06-30 09:36:29 +01:00
William S Fulton
5cc4591ae7 Consistent cpp11 testing in test-suite
Move HAVE_CXX11 into makefiles so that running test-suite
from top level directory or in the language's test-suite directory
is consistent. For example, running 'make check-java-test-suite'
behaves the same as 'cd Examples/test-suite/java && make check'.
2022-03-27 19:34:20 +01:00
William S Fulton
cbd9bd6d71 Fix running make-cpp11 for ocaml 2022-03-27 16:43:30 +01:00
William S Fulton
f44153069b Ocaml test-suite 'passes' with c++11 testing now
Test c++17 on Github Actions to try keep it passing when
configure detects g++ can test c++17.
2022-03-27 13:50:30 +01:00
William S Fulton
a71c318b06 Stop testing two recently failing ocaml tests
Problem here seems to be one also affecting other ocaml broken tests:
1. Enum value names should be using sym:name not name (ie %rename is broken for ocaml enum items)
2. directorin typemaps are not correct
2022-03-27 13:33:02 +01:00
Seth R Johnson
fc2b90acd1 Add a "diamond" pattern to multi-impmort test
This tests whether multiple modules can correctly import
the same common module.

```
a -> d
  -> b -> c -> d*
```
2022-02-12 19:40:03 -05:00
William S Fulton
f318bb8286 Add missing clean targets
template_typedef_cplx2 files are generated by the template_typedef_import.multicpptest
but can also be cleaned by the template_typedef_cplx2.cpptest target.
2020-10-10 15:02:26 +01:00
Zackery Spytz
b1b13d7d0a Use %rename 2020-06-07 13:56:07 -06:00
Zackery Spytz
2f48bec666 Merge remote-tracking branch 'upstream/master' into OCaml-INPUT-OUTPUT-INOUT-primitives 2019-05-08 14:05:02 -06:00
William S Fulton
83ea2280e2 Fix Python compile errors with overloading and varargs
Fixes wrapping overloaded functions/constructors where a vararg
function is declared after a non-vararg function.
This is a long standing bug in the Python layer exposed since fastunpack
was turned on by default.
2019-02-25 19:27:23 +00:00
Zackery Spytz
5a58f9a87b Merge remote-tracking branch 'upstream/master' into OCaml-INPUT-OUTPUT-INOUT-primitives 2019-02-18 20:41:13 -07:00
William S Fulton
f19882ed51
Merge pull request #1473 from ZackerySpytz/OCaml-wrapmacro-test
[OCaml] Fix the wrapmacro test
2019-02-18 19:33:22 +00:00
Zackery Spytz
470ce2dd31 [OCaml] Add missing INPUT, OUTPUT, and INOUT typemaps for primitives
The typemaps are based on PHP's.
2019-02-18 04:23:40 -07:00
Zackery Spytz
10d62aecd5 [OCaml] Fix the wrapmacro test
Add a typecheck typemap for size_t and const size_t &.

Add the const qualifier to the typemaps for primitive reference
types.

Add multiple runtime tests.
2019-02-17 01:41:59 -07:00
Zackery Spytz
b7a400f991 [OCaml] Add a typecheck typemap for SWIGTYPE
This fixes many of the remaining warnings in the OCaml test suite.

Add multiple runtime tests.
2019-02-16 01:07:31 -07:00
William S Fulton
6522afe90a
Merge pull request #1471 from ZackerySpytz/OCaml-segfaults-list-args
[OCaml] Fix segfaults when too few arguments are passed to a function
2019-02-15 19:14:45 +00:00
William S Fulton
1f4b3a4553
Merge pull request #1470 from ZackerySpytz/OCaml-dynamic_cast-test
[OCaml] Fix the dynamic_cast test
2019-02-15 19:10:15 +00:00
William S Fulton
dd8c3e1466
Merge pull request #1461 from ZackerySpytz/OCaml-argout-typemaps-ref-types
[OCaml] Don't use argout typemaps by default for some reference types
2019-02-15 19:06:05 +00:00
Zackery Spytz
071803f000 [OCaml] Fix segfaults when too few arguments are passed to a function
Prevent segfaults when too few arguments are passed to a function.

Length checks are not needed for the wrappers of overloaded
functions -- the generated dispatch function already checks.

Add default_args_runme.ml.

Fix minor errors in some runtime tests.  Extra args were being passed
in some cases.
2019-02-15 01:17:15 -07:00
Zackery Spytz
a159a252dd [OCaml] Fix the dynamic_cast test
Add out typemaps for SWIGTYPE *DYNAMIC and SWIGTYPE &DYNAMIC.

Add dynamic_cast_runme.ml.
2019-02-14 02:21:36 -07:00
William S Fulton
ad7f9cd8d7 Mark and setup OCaml as an experimental target language.
Issue #1437
2019-02-11 18:30:35 +00:00
Zackery Spytz
b2d93665fe [OCaml] Don't use argout typemaps by default for some reference types
The OCaml module's typemaps.i supplied argout typemaps for some
reference types (e.g. int &) by default, which was unintuitive and
inconsistent when compared with other modules. The argout_ref example
depended on this, so add a typemap to argout_ref/example.i.

Add multiple runtime tests that deal with references.
2019-02-09 22:04:46 -07:00
William S Fulton
9ab873f432 Merge branch 'ZackerySpytz-OCaml-classDirectorMethod-CAMLreturn'
* ZackerySpytz-OCaml-classDirectorMethod-CAMLreturn:
  [OCaml] Fix possible GC issues in generated director code

 Conflicts:
	Examples/test-suite/ocaml/director_unroll_runme.ml
2019-02-09 22:54:43 +00:00
William S Fulton
6ec798f7ff Merge branch 'ZackerySpytz-OCaml-exception-improvements'
* ZackerySpytz-OCaml-exception-improvements:
  [OCaml] Some exception improvements
2019-02-09 22:35:48 +00:00
William S Fulton
5c66ed3d0b Merge branch 'ZackerySpytz-OCaml-fix-typedef_mptr'
* ZackerySpytz-OCaml-fix-typedef_mptr:
  [OCaml] Fix and re-enable typedef_mptr_runme.ml
2019-02-09 22:29:18 +00:00
William S Fulton
d7bb500315 Merge branch 'ZackerySpytz-OCaml-director-ctors'
* ZackerySpytz-OCaml-director-ctors:
  [OCaml] Fix a bug in the ctors of director classes
2019-02-09 22:28:10 +00:00
William S Fulton
b80b4d5638 Merge branch 'ZackerySpytz-OCaml-director_pass_by_value'
* ZackerySpytz-OCaml-director_pass_by_value:
  [OCaml] Fix director_pass_by_value
  [OCaml] Reduce the duplication in typemaps.i
2019-02-09 22:25:29 +00:00
Zackery Spytz
28a846705f [OCaml] Fix possible GC issues in generated director code
Make `classDirectorMethod()` generate `CAMLreturn_type()` or
`CAMLreturn0` when there are local variables of type `value`.
2019-02-07 22:08:10 -07:00
Zackery Spytz
e5b8b5a164 [OCaml] Some exception improvements
The OCaml module's exception handling code was poorly designed,
gave confusing exception messages, and was vulnerable to buffer
overflows.

The OCaml module's SWIG_exception_() was adding a useless newline to
the end of the exception message.

In some cases, the integer value of f.e. SWIG_TypeError was being added
to the exception message.

The unneeded else in the OCaml module's SWIG_contract_assert() macro
was causing -Wmisleading-indentation warnings.

The OCaml module's exception handling code now mirrors that of the
Java module.

Add Lib/ocaml/std_except.i.
Add multiple runtime tests.
2019-02-07 16:25:10 -07:00
Zackery Spytz
d3b1211a92 [OCaml] Fix and re-enable typedef_mptr_runme.ml
typedef_mptr_runme.ml was attempting to pass OCaml functions to
do_op().

Remove unneeded prints.
2019-02-05 20:10:06 -07:00
Zackery Spytz
828ce477c8 [OCaml] Fix a bug in the ctors of director classes
If a class was given the director feature, it was not possible
to use ctors with multiple parameters.

Add director_default_runme.ml (it is based on
director_default_runme.java).
2019-02-05 13:35:43 -07:00
Zackery Spytz
9942e6a582 [OCaml] Fix director_pass_by_value
Add a directorin typemap for SWIGTYPE.

Add director_frob_runme.ml, director_pass_by_value_runme.ml, and
director_unroll_runme.ml.

This commit fixes most of the director-related warnings in the OCaml
test suite. Of the director tests that are currently included in the
OCaml test suite, director_basic and director_property are the only
ones which give warnings (due to issues with typecheck typemaps).
2019-02-04 11:29:54 -07:00
Zackery Spytz
35e417a4db [OCaml] Runtime tests for default_arg_values, inherit_missing and some others
Add runtime tests for default_arg_values, inherit_missing,
memberin_extend, rename_predicates, template_inherit,
template_tbase_template, and typedef_classforward_same_name.
2019-02-01 12:59:29 -07:00
William S Fulton
054a85c546 Merge branch 'ZackerySpytz-OCaml-char_binary-test'
* ZackerySpytz-OCaml-char_binary-test:
  [OCaml] Fix the char_binary test for OCaml
2019-01-31 07:35:11 +00:00
William S Fulton
280ce63100 Merge branch 'ZackerySpytz-OCaml-template_opaque-using_extend-runtime-tests'
* ZackerySpytz-OCaml-template_opaque-using_extend-runtime-tests:
  [OCaml] Runtime tests for template_opaque, using_extend and some others
2019-01-31 07:25:11 +00:00
William S Fulton
526b2cf0ae Merge branch 'ZackerySpytz-OCaml-director-classes-throw'
* ZackerySpytz-OCaml-director-classes-throw:
  [OCaml] Fix handling of exception specifications for director classes
2019-01-31 07:21:50 +00:00
William S Fulton
2b788c47fa Merge branch 'ZackerySpytz-OCaml-inctest-li_cpointer_cpp-runtime-tests'
* ZackerySpytz-OCaml-inctest-li_cpointer_cpp-runtime-tests:
  [OCaml] Runtime tests for inctest, li_cpointer_cpp and some others
2019-01-31 07:15:03 +00:00
Zackery Spytz
85860c0a61 [OCaml] Fix the char_binary test for OCaml
Add %typemap(in) (char *STRING, size_t LENGTH).

Fix warnings in char_binary.i.

./../char_binary.i:7: Warning 453: Can't apply (char *STRING,size_t LENGTH). No typemaps are defined.
./../char_binary.i:8: Warning 453: Can't apply (char *STRING,size_t LENGTH). No typemaps are defined.

Add a runtime test (it is based on the Python and Go char_binary
runtime tests).
2019-01-29 09:18:30 -07:00
Zackery Spytz
f78358d9aa [OCaml] Runtime tests for template_opaque, using_extend and some others
Add runtime tests for namespace_virtual_method, template_opaque,
using_extend, using_inherit, using_pointers, using_private, and
varargs_overload.
2019-01-27 06:50:51 -07:00
Zackery Spytz
35663b1622 [OCaml] Fix handling of exception specifications for director classes
The OCaml module was generating invalid code for director classes
which contain methods with exception specifications. The fix is based
on some of the code in python.cxx's classDirectorMethod().

This commit fixes compilation failures for a number of director unit
tests.

Add director_exception_catches_runme.ml,
director_exception_nothrow_runme.ml, and director_ignore_runme.ml.
2019-01-26 05:58:38 -07:00
Zackery Spytz
4d54d305fc [OCaml] Runtime tests for inctest, li_cpointer_cpp and some others
Add runtime tests for inctest, li_cpointer_cpp, newobject2,
special_variables, special_variable_macros, template_extend1, and
template_extend2.
2019-01-22 22:50:40 -07:00
Zackery Spytz
4074f788b3 [OCaml] Fix %allowexception
OCaml's variableWrapper() wasn't calling emit_action_code() for
in/out typemaps, which meant that %allowexception was being ignored.

In addition, remove all comments in the typemaps in Lib/ocaml. In the
case of the allowexcept test, one of the typemap comments caused
compilation to fail because it became nested within another comment
in an %exception block.

Re-enable the allowexcept test.
Add allowexcept_runme.ml.
2019-01-22 07:51:45 -07:00