Commit Graph

123 Commits

Author SHA1 Message Date
Olly Betts 8a73e25fe2 argcargv.i: NULL terminate argv with empty input
Fixes needed for: C# R
2023-05-23 10:12:49 +12:00
Olly Betts eaefa489c5 [js] argcargv.i: Allow empty array or empty string 2023-05-22 14:08:13 +12:00
Olly Betts 915dc93b0d [octave] Fix argcargv.i bug
The strings from the Octave array are returned in a temporary
std::string object so we need to make a copy of them or else the
final string ends up replicated as all elements.

Unfortunately argcargvtest.i was only checking the final element's
value, so fix it to test both the elements as a regression test for
this, and to catch any similar issues with other target languages.
2023-05-22 13:38:59 +12:00
Olly Betts 5eedba422f [js] Add _runme.js files for ynit tests that pass
Fixes #2600
2023-05-22 08:18:31 +12:00
Erez Geva bdc2190cde Add argc and argv multi-argument typemap to Java, Guile, JavaScript, Scilab and C#
Fixes #2552

Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
2023-05-20 16:17:00 +12:00
Erez Geva b6eaee8d12 Add li_constraints test, testing 'constraints.i'.
For: JavaScript, C#, go, Java, Lua, Perl, PHP, python, Ruby, TCL and Octave.

Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
2023-05-12 01:23:31 +02:00
William S Fulton 281af00437 Tweak to struct name in testcase for R 2023-05-06 15:09:07 +01:00
William S Fulton e0c7f81ba5 Merge branch 'typedef-namespace'
* typedef-namespace:
  Partial revert of previous commit for typedefs
  add an unit test
  tentative fix for typedef/using declaration to struct typedef

Conflicts:
	CHANGES.current
2023-05-06 11:36:30 +01:00
William S Fulton 65be881295 Partial revert of previous commit for typedefs
Setting current symbol table for a typedef seems wrong.
No difference to test-suite though.

Testcase rename for C++11 testing and minor adjustments.

Issue #2550
Closes #2551
2023-05-06 11:13:23 +01:00
Momtchil Momtchev 33b4834920 add an unit test 2023-05-06 10:54:14 +01:00
Momtchil Momtchev edd55210bb take into account numinputs when counting arguments 2023-04-26 18:23:53 +02:00
Olly Betts 7bb7295a33 [js] Improve default for JSENGINE
Previously the default was always "node", even if nodejs wasn't
detected by configure.  This leads to a confusing failure from
"make check" if you have another support JS engine installed
but not node.

Now the default it picked based on which engines configure
found.  If only one was detected, that should be used.  If
multiple are, you can override the default choice by specifying
e.g. ENGINE=jsc on the make command line.

Fixes #2453
2023-04-22 13:33:46 +12:00
Olly Betts b508598a42 [js] Turn on C++ output for node too
Nodejs is like V8 and needs C++ output enabled when wrapping C code.

The testsuite was masking this bug by using SWIG options
`-v8 -DBUILDING_NODE_EXTENSION=1` rather than `-node` when testing
with nodejs, while the javascript examples currently all seem to all get
processed with -c++.
2023-04-22 13:33:46 +12:00
William S Fulton 1d73341aa4 Polymorphism in R wrappers fixed for C++ structs 2022-10-24 08:56:55 +01:00
Olly Betts cfd2557cda Revert "[js] Add mod_runme.js"
This reverts commit ea514c3961.

The new runme.js isn't used for node because it fails to run
multicpptest testcases, but was failing for jsc in CI.

The first problem is the new file is missing `new` where the two
objects are created, but fixing that reveals that this testcase
is currently broken for Javascript so just revert for now.
2022-10-20 11:42:27 +13:00
Olly Betts ea514c3961 [js] Add mod_runme.js
See #2126
2022-10-19 07:35:53 +13:00
William S Fulton e622a708d2 Fix Javascript node test-suite to use desired c++ standard
Passes the -std determined in configure.ac to node-gyp
2022-10-15 14:58:25 +01:00
William S Fulton bba072d95d Merge branch 'fix-cast'
* fix-cast:
  add tests for new casting behavior
  skip tests when value is out of range
  refactor integers JS testcase to avoid repeating code
  Return uint64_t as double if is bigger than uint32_t
  Use SWIG_TypeCast in SWIG_V8_ConvertInstancePtr if types don't match (#3)
2022-10-14 19:19:13 +01:00
Alba Mendez 55d7a51343 add tests for new casting behavior
more integers are preserved now
2022-10-10 13:28:44 +02:00
Alba Mendez 5b02dc93d6 skip tests when value is out of range 2022-10-10 13:28:44 +02:00
Alba Mendez cf7733e4b8 refactor integers JS testcase to avoid repeating code 2022-10-10 12:49:57 +02:00
William S Fulton 4a397869a2 Merge branch 'director-unwrap-result'
* director-unwrap-result:
  Unwrap director classes only when returning a pointer or reference to an object
2022-10-07 18:41:14 +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
William S Fulton e97181ebc0 Add missing typecheck typemaps for std::auto_ptr and std::unique_ptr
To fix overloading when using these types.
2022-09-17 10:23:51 +01:00
William S Fulton dad7c93ca0 Provide SWIGTYPE MOVE typemaps in swigmove.i
For implementing full move semantics when passing parameters by value.
Based on SWIGTYPE && and std::unique_ptr typemaps which implement move
semantics.

Added for all languages, but untested for: Go, Ocaml, R, Scilab (and
unlikely to be fully functional for same reasons as for std::unique_ptr
support).

Issue #999
2022-09-16 08:36:25 +01:00
William S Fulton 2212af3f4f rvalue reference outputs
Document rvalue reference outputs behaviour
Test rvalue reference outputs
2022-09-08 08:46:32 +01:00
William S Fulton 7934561874 Test/fixes to handle NULL pointer for unique_ptr/auto_ptr
Also add missing unique_ptr tests for Lua and Racket.
2022-08-31 19:42:55 +01:00
William S Fulton e139a36511 SWIGTYPE && input typemaps now assume object has been moved
Replicated Java implementation.

Fully implemented for:
- C#
- D
- Guile
- Javascript (UTL)
- Lua
- MzScheme
- Octave (UTL)
- Perl (UTL)
- PHP
- Python (UTL)
- Ruby (UTL)
- Tcl (UTL)

PHP std::auto_ptr std::unique_ptr minor tweaks and testcase corrections
2022-08-31 19:40:14 +01:00
William S Fulton d4b1152d4b Add raw pointer handling test for virtual inheritance
This is a test added for D in previous commit, now expanded to all target languages.

Tidy up counting object instances.
2022-08-05 22:30:23 +01:00
William S Fulton fe17296eb4 Add Javascript support for std::unique_ptr and std::auto_ptr
Equivalent to Ruby/Python implementations.
2022-08-04 07:14:30 +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 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
Olly Betts 8dbcd710ff [Javascript] Fix handling of functions which take void*
Fixes #682
2022-03-07 14:17:52 +13:00
Olly Betts deb7cbf741
Merge branch 'master' into director-unwrap-result 2022-03-01 11:34:59 +13: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
Olly Betts 31af3ce9bf Avoid -Wempty-body warnings from SWIG_contract_assert 2022-02-11 18:39:08 +13:00
William S Fulton 99954d6d4e Shorten testcase variable names for Scilab 6 to work 2021-11-15 22:45:56 +00:00
Vadim Zeitlin 4b05d8d947 Don't run ccomplextest as part of JavaScript test suite
This test currently fails due to "I" being undefined, so disable it to
let the rest of the tests to pass and add it later when this can be
fixed.
2021-10-01 02:11:11 +02:00
Vadim Zeitlin 58a49bac66 Suppress more -Wignored-qualifiers in JavaScript tests
This is probably not the greatest idea, and it would be better to change
the generated code to avoid these tests instead, but it was already done
like this for several tests, so just add two more of them that generate
warnings such as

../../member_funcptr_galore_wrap.cxx: In function ‘SwigV8ReturnValue _wrap_MemberFuncPtrs_aaa6(const SwigV8Arguments&)’:
../../member_funcptr_galore_wrap.cxx:3495:90: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers]
 3495 |   result = (int)((MemberFuncPtrs const *)arg1)->aaa6((short (Funcs::*const )(bool) const)arg2);
      |                                                                                          ^~~~

when using gcc 9.
2021-10-01 01:39:12 +02:00
William S Fulton 9739be60d0 Add two Javascript testcases converted from Python 2021-03-11 20:10:18 +00:00
William S Fulton 04b46cc8a3 Javascript type conversion support
Add testcase for previous commit.
Add missing assert for future type conversions support that will use
the heap instead of pointer casts (for smart pointer type conversions).

Closes #1963
2021-03-11 20:10:13 +00:00
William S Fulton 227614056b Convert javascript_arrays.i example into testcase 2021-03-06 10:55:47 +00:00
William S Fulton 4b64becbbb OUTPUT typemaps on methods that don't return void
SWIGJSC_ValueIsArray could be implemented by JSValueIsArray in later
versions of Javascript webkit, similar fix to previous commits for v8.

Enhance testing of OUTPUT typemaps to test more than one output.
2021-03-01 14:20:18 +00:00
William S Fulton 1de4a3a8f6 Add Javascript test for missing new in constructor call
Testcase for issue #969 and issue #626
2021-02-28 22:01:32 +00:00
William S Fulton 769dc27bcd Javascript: Add runtime tests for typemaps.i
Tests fix in previous couple of commits.
2021-02-28 21:01:56 +00:00
William S Fulton 1d4ef62466 Node: Fix handling of large unsigned values
Closes #1269
2021-02-26 23:31:12 +00: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
William S Fulton fd592fdc3b Split C complex.h from C++ complex testing 2020-10-10 15:01:29 +01:00
William S Fulton 339377410b Put test in alphabetical order 2020-10-07 22:21:37 +01:00