more cases, and C/C++ compatibility
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6349 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
2feaa15679
commit
200111d52d
3 changed files with 10 additions and 4 deletions
|
|
@ -308,6 +308,7 @@ C_TEST_CASES += \
|
||||||
name \
|
name \
|
||||||
nested \
|
nested \
|
||||||
newobject2 \
|
newobject2 \
|
||||||
|
overload_extend \
|
||||||
overload_extendc \
|
overload_extendc \
|
||||||
preproc \
|
preproc \
|
||||||
ret_by_value \
|
ret_by_value \
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,18 @@
|
||||||
%module overload_extend
|
%module overload_extend
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
%typemap(default) double y "$1=1000;";
|
||||||
|
#endif
|
||||||
|
|
||||||
#pragma SWIG nowarn=-302
|
#pragma SWIG nowarn=-302
|
||||||
%extend Foo {
|
%extend Foo {
|
||||||
int test() { return 0; }
|
int test() { return 0; }
|
||||||
int test(int x) { x = 0; return 1; }
|
int test(int x) { x = 0; return 1; }
|
||||||
int test(char *s) { s = 0; return 2; }
|
int test(char *s) { s = 0; return 2; }
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
int test(double x, double y = 0) { x = 0; y = 0; return 3; }
|
double test(double x, double y = 1000) { return x + y; }
|
||||||
#else
|
#else
|
||||||
int test(double x, double y) { x = 0; y = 0; return 3; }
|
double test(double x, double y) { return x + y; }
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@ if f.test(3) != 1:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
if f.test("hello") != 2:
|
if f.test("hello") != 2:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
if f.test(3.5,2.5) != 3:
|
if f.test(3,2) != 5:
|
||||||
|
raise RuntimeError
|
||||||
|
if f.test(3.0) != 1003:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue