new test
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4835 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
1d590457ba
commit
53ef3e4ac7
4 changed files with 47 additions and 2 deletions
24
Examples/test-suite/array_member.i
Normal file
24
Examples/test-suite/array_member.i
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
%module array_member
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
|
||||||
|
typedef struct Foo {
|
||||||
|
char text[8];
|
||||||
|
int data[8];
|
||||||
|
} Foo;
|
||||||
|
|
||||||
|
int global_data[8] = { 0,1,2,3,4,5,6,7 };
|
||||||
|
|
||||||
|
void set_value(int *x, int i, int v) {
|
||||||
|
x[i] = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_value(int *x, int i) {
|
||||||
|
return x[i];
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -43,7 +43,6 @@ DYNAMIC_LIB_PATH = $(RUNTIMEDIR):.
|
||||||
|
|
||||||
# Broken C++ test cases. (Can be run individually using make testcase.cpptest.)
|
# Broken C++ test cases. (Can be run individually using make testcase.cpptest.)
|
||||||
CPP_TEST_BROKEN += \
|
CPP_TEST_BROKEN += \
|
||||||
typedef_class \
|
|
||||||
array_typedef_memberin \
|
array_typedef_memberin \
|
||||||
exception_order \
|
exception_order \
|
||||||
template_default_arg \
|
template_default_arg \
|
||||||
|
|
@ -70,6 +69,7 @@ CPP_TEST_CASES += \
|
||||||
arrayref \
|
arrayref \
|
||||||
arrays_global \
|
arrays_global \
|
||||||
arrays_global_twodim \
|
arrays_global_twodim \
|
||||||
|
array_member \
|
||||||
arrays_scope \
|
arrays_scope \
|
||||||
bloody_hell \
|
bloody_hell \
|
||||||
bool_default \
|
bool_default \
|
||||||
|
|
@ -222,6 +222,7 @@ CPP_TEST_CASES += \
|
||||||
template_whitespace \
|
template_whitespace \
|
||||||
throw_exception \
|
throw_exception \
|
||||||
typedef_array_member \
|
typedef_array_member \
|
||||||
|
typedef_class \
|
||||||
typedef_funcptr \
|
typedef_funcptr \
|
||||||
typedef_inherit \
|
typedef_inherit \
|
||||||
typedef_mptr \
|
typedef_mptr \
|
||||||
|
|
|
||||||
21
Examples/test-suite/python/array_member_runme.py
Normal file
21
Examples/test-suite/python/array_member_runme.py
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
from array_member import *
|
||||||
|
|
||||||
|
f = Foo()
|
||||||
|
f.data = cvar.global_data
|
||||||
|
|
||||||
|
for i in range(0,8):
|
||||||
|
if get_value(f.data,i) != get_value(cvar.global_data,i):
|
||||||
|
raise RuntimeError, "Bad array assignment"
|
||||||
|
|
||||||
|
|
||||||
|
for i in range(0,8):
|
||||||
|
set_value(f.data,i,-i)
|
||||||
|
|
||||||
|
cvar.global_data = f.data
|
||||||
|
|
||||||
|
for i in range(0,8):
|
||||||
|
if get_value(f.data,i) != get_value(cvar.global_data,i):
|
||||||
|
raise RuntimeError, "Bad array assignment"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -13,5 +13,4 @@ class B
|
||||||
typedef RealA A2;
|
typedef RealA A2;
|
||||||
int testA (const A2& a) {return a.a;}
|
int testA (const A2& a) {return a.a;}
|
||||||
};
|
};
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue