From feae681f4e6fc7e1925924e41a28123b9b56eb35 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sun, 14 Dec 2003 00:02:33 +0000 Subject: [PATCH] arrays of structures runtime test git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5563 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../java/java_lib_arrays_runme.java | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/Examples/test-suite/java/java_lib_arrays_runme.java b/Examples/test-suite/java/java_lib_arrays_runme.java index 9490e5e2f..9c245e0e9 100644 --- a/Examples/test-suite/java/java_lib_arrays_runme.java +++ b/Examples/test-suite/java/java_lib_arrays_runme.java @@ -40,6 +40,13 @@ public class java_lib_arrays_runme { array_struct[0].setDouble_field(222.333); array_struct[1].setDouble_field(444.555); + AnotherStruct[] another_struct={new AnotherStruct(), new AnotherStruct()}; + another_struct[0].setSimple(array_struct[0]); + another_struct[1].setSimple(array_struct[1]); + + 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"); + // 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()); @@ -87,63 +94,55 @@ public class java_lib_arrays_runme { // Functions to check that the array values were set correctly public static void check_string(String original, String checking) { if (!checking.equals(original)) { - System.err.println("Runtime test failed. checking = [" + checking + "]"); - System.exit(1); + throw new RuntimeException("Runtime test failed. checking = [" + checking + "]"); } } public static void check_byte_array(byte[] original, byte[] checking) { for (int i=0; i