Commit graph

290 commits

Author SHA1 Message Date
Thomas Reitmayr
7963445048 Add and improve Ruby test cases in the context of nesting and namespaces
This is done in preparation for adding namespace support to the Ruby
part of SWIG. Some existing test cases were reorganized or duplicated
for flat/nonflat nesting. For some a Ruby test script was added.
Finally the ruby/Makefile.in was improved so that for test cases
without an explicit test script, the generated wrapper library will
be loaded by the Ruby interpreter to ensure loading works fine.
2020-12-16 22:30:46 +01:00
Gareth Francis
33765e5025 Extend C# wchar_t member test to pass unicode strings 2020-09-12 17:19:15 +01:00
Gareth Francis
6db3ab0d05 Add test for wchar_t members to li_std_string.i 2020-09-12 17:04:28 +01:00
William S Fulton
bfddc50a6a Add C# support for void *VOID_INT_PTR member variables
Issue reported by Carlos Frederico Biscaya on swig-user mailing list.
2020-08-13 16:06:48 +01:00
William S Fulton
6910e5f09c Merge branch 'shared-ptr-template-upcast'
* shared-ptr-template-upcast:
  comments
  Applying shared_ptr template upcast fix to CSharp, adding CSharp test, and cleanup
  Adding test case demonstrating issue where SWIG does not generate a correctly typed, upcasted shared_ptr for a template instantiation deriving from a base class
  WIP - Use the non-encoded type string for upcasting a shared_ptr of a derived type to a shared_ptr of the base type
  comments
  Applying shared_ptr template upcast fix to CSharp, adding CSharp test, and cleanup
  Adding test case demonstrating issue where SWIG does not generate a correctly typed, upcasted shared_ptr for a template instantiation deriving from a base class
  WIP - Use the non-encoded type string for upcasting a shared_ptr of a derived type to a shared_ptr of the base type
2020-01-17 18:45:30 +00:00
William S Fulton
6fb345feb2 'out' or 'ref' usage in a cstype typemap in directors
'out' / 'ref' was not always stripped out in parts of the
director code generation.

Issue #1628
2019-11-26 19:32:34 +00:00
William S Fulton
15a0681b11 Add note about wchar_t marshalling fix required for Windows 2019-07-25 18:57:10 +01:00
William S Fulton
c7aae28a99 Remove failing wchar c# test 2019-07-24 08:35:13 +01:00
William S Fulton
55b5552a6a More C# wstring testing 2019-07-23 19:57:06 +01:00
William S Fulton
2d36b3468a More C# wstring testing 2019-07-23 19:41:25 +01:00
William S Fulton
eb6efdb60b C# wstring testing
Test code from issue #1530
2019-07-23 19:10:35 +01:00
William S Fulton
a9a7b03ba6 Split testcases li_std_wstring.i and li_std_wstring_inherit.i
Not many languages have support for std_wstring.i, so disable testing
for these languages until added.
2019-07-22 19:05:21 +01:00
William S Fulton
53b425b638 Merge branch 'bugfix/616-csharp-bool-array'
* bugfix/616-csharp-bool-array:
  Add changes entry to fix C# bool[]
  Quieten failing bool[] testcase message
  Skip failing bool[] test cases when running under mono
  Change C# bool[] typemaps to marshall as 1-byte
2019-07-16 19:51:32 +01:00
William S Fulton
fc9c37192b Quieten failing bool[] testcase message 2019-07-16 19:46:32 +01:00
Gareth Francis
15ad67c37f Skip failing bool[] test cases when running under mono 2019-07-15 16:08:31 +01:00
Vadim Zeitlin
28c6140c56 Allow std::set<> C# typemaps to work for non-nullable types too
Notably make them work for primitive types, such as "int".

Doing this requires using "object" instead of the actual C# type of the
variable to store the current value in the iterator, as we don't
currently have a "csnullabletype" typemap that would expand to "T" for
nullable types and "T?" for the other ones. This is a bit ugly, but it
shouldn't matter much for the generated code and is already done in
std::vector<> typemaps.

Also add a simple unit test verifying the basic functionality for such
vectors.

Closes #1568.
2019-07-11 13:09:46 +02:00
Vadim Zeitlin
53d75dc133 Replace leftover string with the proper type in C# set typemap
This is just a mistake remaining from generalizing the old
string-specific typemap to any type.

Fix it now and update a unit test to test for sets of objects other than
strings.
2019-07-11 12:49:17 +02:00
William S Fulton
20d96531e3 nested_inheritance_interface testcase enhancement
Fixes unused variable reported by C# compiler and enhance test slightly
2019-07-09 19:36:46 +01:00
Isaac Pascual Monells
f1f98348b4 Add nested_inheritance_interface test for csharp 2019-07-08 12:49:28 +02:00
Gareth Francis
58863bba59 Change C# bool[] typemaps to marshall as 1-byte
Default marshalling for bool[] now uses 1-byte entries in the array, to
ensure array contents is as expected in C++.

When running under mono csharp_lib_arrays_bool testcase will fail
due to an apparent bug in mono. Works correctly under Microsoft's
runtime. See https://github.com/mono/mono/issues/15592
2019-07-06 12:56:27 +01:00
etse
3359b4ccab Applying shared_ptr template upcast fix to CSharp, adding CSharp test, and cleanup 2019-05-06 15:30:54 -04:00
William S Fulton
a8055b45d7 Check Dispose is called in C# auto_ptr test 2019-04-08 19:37:00 +01:00
William S Fulton
06462acdf9 Fix C# CA1063 warning by implementing the recommended Dispose methods.
Previously just the Dispose() method was generated.
Now the Dispose() and Dispose(bool disposing) methods are generated.
Changes are required if custom "csfinalize", "csdestruct" or "csdestruct_derived"
typemaps are being used. Details in #421 on Github. SWIG will error out if one of
the "csfinalize, "csdestruct" or "csdestruct_derived" typemaps are found. Example
error message:

  foo.h:60: Error: A deprecated csfinalize typemap was found for Foo, please remove
  it and replace all csdestruct, csdestruct_derived and csfinalize typemaps by the
  csdispose, csdispose_derived, csdisposing and csdisposing_derived typemaps.

Closes #421
2019-04-08 19:20:45 +01:00
William S Fulton
78051fdd33 C# std::list changes to support types that are not assignable
Assignable fixes are based on those used by C# std::vector where the
default wrappers work if there is no operator== available in the
template type. Enhanced wrappers are obtained via a macro:
 SWIG_STD_LIST_ENHANCED(SomeNamespace::Klass)
 %template(ListKlass) std::list<SomeNamespace::Klass>;

Remove bool specialization (left over from the original std::vector
wrappers).
Add in missing typedefs.
2019-03-25 07:19:49 +00:00
Adrien JUND
e7f9316e60 C# - add std::list 2019-03-25 07:19:49 +00:00
Vadim Zeitlin
aaa12450c0 Implement set-theoretic methods in std::set C# typemaps
These implementations are not optimized, i.e. are done in a naive way in
C#, rather than using C++ functions more efficiently, but are better
than nothing.
2019-03-11 23:05:38 +01:00
Vadim Zeitlin
f0067b6bbf Add std::set<> typemaps for C#
Create new Lib/csharp/std_set.i based on the existing std_map.i and run
li_std_set unit test for C# as well.

Notice that the set operations defined by the base ISet<> interface are
not implemented yet.
2019-03-11 22:49:03 +01:00
William S Fulton
1f44997343 rename std::array testcase 2019-02-13 22:46:20 +00:00
Vadim Zeitlin
5e7426dcc6 Avoid comparing doubles in nested_in_template.i unit test
This should also have been part of
30bb977a64

See #1358.
2018-12-04 20:46:35 +01:00
Vadim Zeitlin
30bb977a64 Fix handling of abstract base classes nested inside templates
Code handling %template in the parser created a totally new top-level
module child of namespace type when handling templates inside a
namespace and copied the nodes from the previously parsed C++ template
declaration to it. However copies of this node kept their original
values of "abstracts" attribute, which contained pointers to the classes
in the original template declaration, i.e. outside of the subtree
created for the instantiated template. This, in turn, meant that during
the types resolution pass, the code in TypePass did not update the types
used in the methods of the classes appearing in the "abstracts" List,
even though it did update the types for the children of the instantiated
template subtree.

And this finally resulted in wrongly detecting overridden virtual
methods as abstract in Allocate::is_abstract_inherit() during the next
pass, as the signatures of the overridden method -- using resolved types
-- and of the method from the class pointed to by "abstract" -- using
the original types from C++ code -- didn't match.

Resolve this simply by not copying "abstracts" attributes when creating
the template subtree and doing another pass over this tree to recreate
them using the new nodes, just as it's already done for "defaultargs"
attribute, presumably for similar reasons. Note that doing another pass
over the tree is not as efficient as doing everything in a single pass,
but merging the new update_abstracts() with update_defaultargs() is not
completely obvious, so for now keep it simple and optimize it later if
necessary.

Also, add a test checking for the situation described above.

Closes #1353.
2018-11-24 19:21:47 +01:00
William S Fulton
dcbccc6f6f Test non-default compare template argument in std::map 2018-10-09 22:43:19 +01:00
William S Fulton
b90e3ae35d C# directors override/virtual - additional testing
Add runtime test for scenario described in #1323.
Expand testing to cover a mix of override/virtual method overloading.
Remove testSwigDerivedClassHasMethod() test - not fixed yet.
2018-09-25 19:40:35 +01:00
Rokas Kupstys
e4a251f321 Add new keywords for non-verriding methods in director_basic test. 2018-09-25 19:39:53 +01:00
Rokas Kupstys
ea3140a981 Improve correctness of SwigDerivedClassHasMethod() tests
Tests first added in issue #1323
2018-09-25 19:39:02 +01:00
William S Fulton
220247c130 Test c++17 nested namespaces and %nspace 2018-05-14 21:03:31 +01:00
William S Fulton
5c39dcfb28 Add c++17 nested namespaces runtime test for C# 2018-05-14 21:03:31 +01:00
William S Fulton
368cd3b52c Add ToArray test for C# std::vector wrapper 2018-01-12 18:26:47 +00:00
William S Fulton
dafe2d6949 Add director typemaps for pointer const ref types 2017-10-24 23:47:40 +01:00
William S Fulton
46ea2ab0a6 Add director shared_ptr typemaps for C# 2017-10-17 21:55:31 +01:00
William S Fulton
a55981b883 Fix C# std::complex pass by value typemaps 2017-10-02 19:07:24 +01:00
William S Fulton
e01cfd70c7 Add missing declaration for std::complex
Fixes missing type information for std::complex in scripting languages.
Closes #732.

Update Javascript and Octave complextest, although they don't actually
get run as they don't work
2017-10-02 19:07:24 +01:00
William S Fulton
ed4b84f4d3 Fix overloading of shared_ptr method overloading
Add 'equivalent' attribute to typecheck typemap.
Closes #1098.
2017-09-23 15:19:34 +01:00
William S Fulton
f5e1856650 Expand std::shared_ptr testing to C# D Java Python 2017-09-22 20:03:47 +01:00
William S Fulton
19fa79830d Run some preprocessor constants tests that were previously disabled.
These probably should have been enabled with 256e283fc3
2017-09-18 07:10:49 +01:00
William S Fulton
9e2a12416c Fix type promotion wrapping some non-trivial constant expressions
This was previously an integral type instead of a floating point type:
2017-09-18 07:06:27 +01:00
William S Fulton
90ba174fce Fix generated code for constant expressions containing wchar_t L literals.
Such as:
  # define __WCHAR_MAX    (0x7fffffff + L'\0')

Reported on swig-user mailing list.
2017-09-17 19:02:55 +01:00
Olly Betts
90f9117e10 Fix various comment and documentation typos 2017-08-13 18:04:33 +12:00
William S Fulton
241460eddc director_smartptr runtime tests enhancement
Add same changes from previous commit to additional languages
2017-05-23 21:36:24 +01:00
Vadim Zeitlin
ec565f74cf Extend C# complex support to member variables of this type
Define csvar{in,out} typemaps needed to support properties of complex type and
apply the existing cstype and csin ones to them as well.

Add unit test verifying that this works as expected in C# and, also, in
Python, even though no changes were needed there.
2017-04-01 23:51:45 +02:00
Vadim Zeitlin
aa047c43f7 Add support for std::complex<> to C#
Create Lib/csharp/complex.i with simplest possible typemaps mapping
std::complex<> to System.Numerics.Complex.
2017-04-01 23:51:45 +02:00