add in check for array inputs
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8496 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0a81874538
commit
250d3f8244
3 changed files with 10 additions and 4 deletions
|
|
@ -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[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 (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
|
// Now set the array members and check that they have been set correctly
|
||||||
as.setArray_c(array_c);
|
as.setArray_c(array_c);
|
||||||
check_string(array_c, as.getArray_c());
|
check_string(array_c, as.getArray_c());
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,8 @@ JAVA_ARRAYSOFCLASSES(struct AnotherStruct)
|
||||||
struct AnotherStruct {
|
struct AnotherStruct {
|
||||||
SimpleStruct simple;
|
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