git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4835 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2003-05-29 18:30:10 +00:00
commit e36fa7ef6b
4 changed files with 47 additions and 2 deletions

View 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];
}
%}

View file

@ -43,7 +43,6 @@ DYNAMIC_LIB_PATH = $(RUNTIMEDIR):.
# Broken C++ test cases. (Can be run individually using make testcase.cpptest.)
CPP_TEST_BROKEN += \
typedef_class \
array_typedef_memberin \
exception_order \
template_default_arg \
@ -70,6 +69,7 @@ CPP_TEST_CASES += \
arrayref \
arrays_global \
arrays_global_twodim \
array_member \
arrays_scope \
bloody_hell \
bool_default \
@ -222,6 +222,7 @@ CPP_TEST_CASES += \
template_whitespace \
throw_exception \
typedef_array_member \
typedef_class \
typedef_funcptr \
typedef_inherit \
typedef_mptr \

View 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"

View file

@ -13,5 +13,4 @@ class B
typedef RealA A2;
int testA (const A2& a) {return a.a;}
};
%}