add in check for array inputs
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8496 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
25c581e0b6
commit
8629d7f513
3 changed files with 10 additions and 4 deletions
|
|
@ -25,10 +25,10 @@ typedef struct {
|
|||
unsigned long array_ul[ARRAY_LEN];
|
||||
long long array_ll[ARRAY_LEN];
|
||||
float array_f [ARRAY_LEN];
|
||||
double array_d [ARRAY_LEN];
|
||||
SimpleStruct array_struct[ARRAY_LEN];
|
||||
SimpleStruct* array_structpointers[ARRAY_LEN];
|
||||
int* array_ipointers [ARRAY_LEN];
|
||||
double array_d [ARRAY_LEN];
|
||||
SimpleStruct array_struct[ARRAY_LEN];
|
||||
SimpleStruct* array_structpointers[ARRAY_LEN];
|
||||
int* array_ipointers [ARRAY_LEN];
|
||||
finger array_enum[ARRAY_LEN];
|
||||
finger* array_enumpointers[ARRAY_LEN];
|
||||
const int array_const_i[ARRAY_LEN];
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@ public class java_lib_arrays_runme {
|
|||
if (another_struct[0].getSimple().getDouble_field() != 222.333) throw new RuntimeException("AnotherStruct[0] failed");
|
||||
if (another_struct[1].getSimple().getDouble_field() != 444.555) throw new RuntimeException("AnotherStruct[1] failed");
|
||||
|
||||
if (java_lib_arrays.extract(another_struct, 0) != 222.333) throw new RuntimeException("extract 0 failed");
|
||||
if (java_lib_arrays.extract(another_struct, 1) != 444.555) throw new RuntimeException("extract 1 failed");
|
||||
|
||||
// Now set the array members and check that they have been set correctly
|
||||
as.setArray_c(array_c);
|
||||
check_string(array_c, as.getArray_c());
|
||||
|
|
|
|||
|
|
@ -17,5 +17,8 @@ JAVA_ARRAYSOFCLASSES(struct AnotherStruct)
|
|||
struct AnotherStruct {
|
||||
SimpleStruct simple;
|
||||
};
|
||||
double extract(struct AnotherStruct as[], int index) {
|
||||
return as[index].simple.double_field;
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue