Extend "ignore" parameter test

- Ensure that `argout` is called even when a parameter is ignored
- Ensure that ignored parameters with default arguments are handled
  correctly
This commit is contained in:
Seth R Johnson 2022-02-12 19:25:34 -05:00
commit 47eb9c8078

View file

@ -3,14 +3,19 @@
%module ignore_parameter
%typemap(in,numinputs=0) char* a "static const char* hi = \"hello\"; $1 = const_cast<char *>(hi);";
%typemap(in,numinputs=0) int bb "$1 = 101;";
%typemap(in,numinputs=0) int bb "$1 = 101; called_argout = 0;";
%typemap(in,numinputs=0) double ccc "$1 = 8.8;";
%typemap(freearg) char* a ""; // ensure freearg is not generated (needed for Java at least)
%typemap(argout) int bb "called_argout = 1;"
%ignore unignorable;
%inline %{
// constant for detecting correct "argout" call
int called_argout = 0;
// global function tests
char* jaguar(char* a, int b, double c) { return a; }
int lotus(char* aa, int bb, double cc) { return bb; }
@ -25,6 +30,7 @@ struct SportsCars {
double bugatti(char* aaa, int bbb, double ccc) { return ccc; }
int lamborghini(int bb) { return bb; }
int maseratti(int unignorable) { return unignorable; }
double audi(double ccc=9.5) { return ccc; }
};
// constructor tests