diff --git a/Examples/test-suite/java/Makefile.in b/Examples/test-suite/java/Makefile.in index df5f06217..2324b463b 100644 --- a/Examples/test-suite/java/Makefile.in +++ b/Examples/test-suite/java/Makefile.in @@ -10,11 +10,13 @@ top_srcdir = @top_srcdir@/.. top_builddir = @top_builddir@../ C_TEST_CASES = \ - java_lib_arrays + java_lib_arrays \ + java_lib_various CPP_TEST_CASES = \ java_constants \ java_enums \ + java_lib_various \ java_jnitypes \ java_pragmas \ java_throws \ diff --git a/Examples/test-suite/java/java_lib_various_runme.java b/Examples/test-suite/java/java_lib_various_runme.java new file mode 100644 index 000000000..bf0d41211 --- /dev/null +++ b/Examples/test-suite/java/java_lib_various_runme.java @@ -0,0 +1,53 @@ + +// Test case to check typemaps in various.i + +import java_lib_various.*; + +public class java_lib_various_runme { + + static { + try { + System.loadLibrary("java_lib_various"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + + // STRING_ARRAY typemap parameter + String animals[] = {"Cat","Dog","Cow","Goat"}; + if (java_lib_various.check_animals(animals) != 1) + throw new RuntimeException("check_animals failed"); + + // STRING_ARRAY typemap return value + String expected[] = { "Dave", "Mike", "Susan", "John", "Michelle" }; + String got[] = java_lib_various.get_names(); + for (int i=0; i