aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/java/typedef_funcptr_runme.java
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/java/typedef_funcptr_runme.java')
-rw-r--r--Examples/test-suite/java/typedef_funcptr_runme.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/Examples/test-suite/java/typedef_funcptr_runme.java b/Examples/test-suite/java/typedef_funcptr_runme.java
new file mode 100644
index 000000000..0dd44cecd
--- /dev/null
+++ b/Examples/test-suite/java/typedef_funcptr_runme.java
@@ -0,0 +1,34 @@
+
+import typedef_funcptr.*;
+
+public class typedef_funcptr_runme {
+
+ static {
+ try {
+ System.loadLibrary("typedef_funcptr");
+ } 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[]) {
+ int a = 100;
+ int b = 10;
+
+ if (typedef_funcptr.do_op(a,b,typedef_funcptr.addf) != 110)
+ throw new RuntimeException("addf failed");
+ if (typedef_funcptr.do_op(a,b,typedef_funcptr.subf) != 90)
+ throw new RuntimeException("subf failed");
+
+ if (typedef_funcptr.do_op_typedef_int(a,b,typedef_funcptr.addf) != 110)
+ throw new RuntimeException("addf failed");
+ if (typedef_funcptr.do_op_typedef_int(a,b,typedef_funcptr.subf) != 90)
+ throw new RuntimeException("subf failed");
+
+ if (typedef_funcptr.do_op_typedef_Integer(a,b,typedef_funcptr.addf) != 110)
+ throw new RuntimeException("addf failed");
+ if (typedef_funcptr.do_op_typedef_Integer(a,b,typedef_funcptr.subf) != 90)
+ throw new RuntimeException("subf failed");
+ }
+}