From 3a6d631b080458d4b3fe620f13ba7741c62effef Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 8 Nov 2003 21:02:37 +0000 Subject: [PATCH] Java specific test to test the various.i typemap library. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5279 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/Makefile.in | 4 +- .../java/java_lib_various_runme.java | 53 +++++++++++++++++++ Examples/test-suite/java_lib_various.i | 45 ++++++++++++++++ 3 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 Examples/test-suite/java/java_lib_various_runme.java create mode 100644 Examples/test-suite/java_lib_various.i 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