summaryrefslogtreecommitdiff
path: root/Examples/test-suite/java
diff options
context:
space:
mode:
authorAndrey Starodubtsev <andrey.starodubtsev@gmail.com>2016-06-08 15:04:47 +0300
committerAndrey Starodubtsev <andrey.starodubtsev@gmail.com>2016-06-08 15:04:47 +0300
commitb2bcf040c09a28c38c5a4516dcf6966982f8123b (patch)
treee5293ff35db38e4a1767468b3a797fb4f1516efd /Examples/test-suite/java
parentde56ef9e4d53bd65c0b6d14197ef8de3df5c0f65 (diff)
downloadswig-b2bcf040c09a28c38c5a4516dcf6966982f8123b.tar.gz
java directorargout + java/typemaps.i fixes
- directorargout didn't work - it used string "jresult" instead of argument name - java/typemaps.i didn't work with directors - test for using java/typemaps.i in directors added
Diffstat (limited to 'Examples/test-suite/java')
-rw-r--r--Examples/test-suite/java/Makefile.in1
-rw-r--r--Examples/test-suite/java/java_director_typemaps_runme.java115
2 files changed, 116 insertions, 0 deletions
diff --git a/Examples/test-suite/java/Makefile.in b/Examples/test-suite/java/Makefile.in
index e69964352..d63a25879 100644
--- a/Examples/test-suite/java/Makefile.in
+++ b/Examples/test-suite/java/Makefile.in
@@ -28,6 +28,7 @@ CPP_TEST_CASES = \
java_director_exception_feature \
java_director_exception_feature_nspace \
java_director_ptrclass \
+ java_director_typemaps \
java_enums \
java_jnitypes \
java_lib_arrays_dimensionless \
diff --git a/Examples/test-suite/java/java_director_typemaps_runme.java b/Examples/test-suite/java/java_director_typemaps_runme.java
new file mode 100644
index 000000000..612ccb31a
--- /dev/null
+++ b/Examples/test-suite/java/java_director_typemaps_runme.java
@@ -0,0 +1,115 @@
+// tests for java/typemaps.i used for directors
+
+import java_director_typemaps.*;
+import java.math.BigInteger;
+
+public class java_director_typemaps_runme {
+
+ static {
+ try {
+ System.loadLibrary("java_director_typemaps");
+ } 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[]) {
+ Quux quux = new java_director_MyQuux();
+ quux.etest();
+ }
+}
+
+class java_director_MyQuux extends Quux {
+ public java_director_MyQuux() {
+ super();
+ }
+
+ public void director_method_bool_output(
+ boolean[] bool_arg,
+
+ byte[] signed_char_arg,
+ short[] unsigned_char_arg,
+
+ short[] short_arg,
+ int[] unsigned_short_arg,
+
+ int[] int_arg,
+ long[] unsigned_int_arg,
+
+ int[] long_arg,
+ long[] unsigned_long_arg,
+
+ long[] long_long_arg,
+ // BigInteger[] unsigned_long_long_arg,
+
+ float[] float_arg,
+ double[] double_arg)
+ {
+ bool_arg[0] = true;
+ signed_char_arg[0] = 1;
+ unsigned_char_arg[0] = 2;
+ short_arg[0] = 3;
+ unsigned_short_arg[0] = 4;
+ int_arg[0] = 5;
+ unsigned_int_arg[0] = 6;
+ long_arg[0] = 7;
+ unsigned_long_arg[0] = 8;
+ long_long_arg[0] = 9;
+ // unsigned_long_long_arg[0] = 10;
+ float_arg[0] = 11;
+ double_arg[0] = 12;
+ }
+
+ public void director_method_bool_inout(
+ boolean[] bool_arg,
+
+ byte[] signed_char_arg,
+ short[] unsigned_char_arg,
+
+ short[] short_arg,
+ int[] unsigned_short_arg,
+
+ int[] int_arg,
+ long[] unsigned_int_arg,
+
+ int[] long_arg,
+ long[] unsigned_long_arg,
+
+ long[] long_long_arg,
+ // BigInteger[] unsigned_long_long_arg,
+
+ float[] float_arg,
+ double[] double_arg)
+ {
+ if (bool_arg[0]) throw new RuntimeException("unexpected value for bool_arg");
+
+ if (signed_char_arg[0] != 101) throw new RuntimeException("unexpected value for signed_char_arg");
+ if (unsigned_char_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_char_arg");
+ if (short_arg[0] != 101) throw new RuntimeException("unexpected value for short_arg");
+ if (unsigned_short_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_short_arg");
+ if (int_arg[0] != 101) throw new RuntimeException("unexpected value for int_arg");
+ if (unsigned_int_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_int_arg");
+ if (long_arg[0] != 101) throw new RuntimeException("unexpected value for long_arg");
+ if (unsigned_long_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_long_arg");
+ if (long_long_arg[0] != 101) throw new RuntimeException("unexpected value for long_long_arg");
+ // if (unsigned_long_long_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_long_long_arg");
+ if (float_arg[0] != 101) throw new RuntimeException("unexpected value for float_arg");
+ if (double_arg[0] != 101) throw new RuntimeException("unexpected value for double_arg");
+
+ bool_arg[0] = false;
+ signed_char_arg[0] = 11;
+ unsigned_char_arg[0] = 12;
+ short_arg[0] = 13;
+ unsigned_short_arg[0] = 14;
+ int_arg[0] = 15;
+ unsigned_int_arg[0] = 16;
+ long_arg[0] = 17;
+ unsigned_long_arg[0] = 18;
+ long_long_arg[0] = 19;
+ // unsigned_long_long_arg[0] = 110;
+ float_arg[0] = 111;
+ double_arg[0] = 112;
+ }
+}