summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Keiser <shalom@gnu.org>1998-07-01 03:41:24 +0000
committerJohn Keiser <shalom@gnu.org>1998-07-01 03:41:24 +0000
commit342fa4da19707091bea21313bf4145595b62bc1a (patch)
tree227f2339521c547faa979ea6732584ad7651285e /test
parentba17eaa903d5308f58b897ab6df9e41bf2d08fe4 (diff)
downloadclasspath-342fa4da19707091bea21313bf4145595b62bc1a.tar.gz
Created tests for primlib and jnilink. primlib test needs one more addition. Later.
Diffstat (limited to 'test')
-rw-r--r--test/native/lib/JNILinkTest.java103
-rw-r--r--test/native/lib/MethodTester.c110
-rw-r--r--test/native/lib/MethodTester.h61
-rw-r--r--test/native/lib/PrimlibInterface.c162
-rw-r--r--test/native/lib/PrimlibInterface.h141
-rw-r--r--test/native/lib/PrimlibTest.java88
6 files changed, 665 insertions, 0 deletions
diff --git a/test/native/lib/JNILinkTest.java b/test/native/lib/JNILinkTest.java
new file mode 100644
index 000000000..326c8ea04
--- /dev/null
+++ b/test/native/lib/JNILinkTest.java
@@ -0,0 +1,103 @@
+public class JNILinkTest {
+ static {
+ System.loadLibrary("jnilinktest");
+ }
+
+ public static void main(String args[]) {
+ MethodTester m = new MethodTester();
+ Data1 d1 = new Data1();
+ Data2 d2 = new Data2();
+ int NUM_TESTS=4;
+ for(int i=0;i<NUM_TESTS;i++) {
+ try {
+ if(m.test1(d1,d2))
+ System.out.println("SUCCEED: test1");
+ else
+ System.out.println("FAIL: test1");
+ } catch(Exception E) {
+ System.out.println("FAIL: test1 (exception)");
+ }
+ }
+ for(int i=0;i<NUM_TESTS;i++) {
+ try {
+ if(m.test2(d1,d2))
+ System.out.println("SUCCEED: test2");
+ else
+ System.out.println("FAIL: test2");
+ } catch(Exception E) {
+ System.out.println("FAIL: test2");
+ }
+ }
+ for(int i=0;i<NUM_TESTS;i++) {
+ try {
+ if(m.test3(d1,d2))
+ System.out.println("SUCCEED: test3");
+ else
+ System.out.println("FAIL: test3");
+ } catch(Exception E) {
+ System.out.println("FAIL: test3");
+ }
+ }
+ for(int i=0;i<NUM_TESTS;i++) {
+ try {
+ if(m.test4(d1,d2))
+ System.out.println("SUCCEED: test4");
+ else
+ System.out.println("FAIL: test4");
+ } catch(Exception E) {
+ System.out.println("FAIL: test4");
+ }
+ }
+ for(int i=0;i<NUM_TESTS;i++) {
+ try {
+ if(m.test5(d1,d2))
+ System.out.println("SUCCEED: test5");
+ else
+ System.out.println("FAIL: test5");
+ } catch(Exception E) {
+ System.out.println("FAIL: test5");
+ }
+ }
+ for(int i=0;i<NUM_TESTS;i++) {
+ try {
+ if(m.test6(d1,d2))
+ System.out.println("SUCCEED: test6");
+ else
+ System.out.println("FAIL: test6");
+ } catch(Exception E) {
+ System.out.println("FAIL: test5");
+ }
+ }
+ }
+}
+
+class MethodTester {
+ // class test
+ native boolean test1(Data1 d1, Data2 d2);
+ // field test
+ native boolean test2(Data1 d1, Data2 d2);
+ // static field test
+ native boolean test3(Data1 d1, Data2 d2);
+ // method test
+ native boolean test4(Data1 d1, Data2 d2);
+ // static method test
+ native boolean test5(Data1 d1, Data2 d2);
+ // final method test
+ native boolean test6(Data1 d1, Data2 d2);
+}
+
+class Data1 {
+ static boolean staticVar = true;
+ private boolean instanceVar = true;
+ static boolean staticMethod() { return true; }
+ boolean instanceMethod() { return true; }
+ boolean finalMethod() { return true; }
+}
+
+class Data2 extends Data1 {
+ static boolean staticVar = false;
+ private boolean instanceVar = false;
+ static boolean staticMethod() { return false; }
+ boolean instanceMethod() { return false; }
+ boolean finalMethod() { return false; }
+}
diff --git a/test/native/lib/MethodTester.c b/test/native/lib/MethodTester.c
new file mode 100644
index 000000000..24f59bd11
--- /dev/null
+++ b/test/native/lib/MethodTester.c
@@ -0,0 +1,110 @@
+#include "MethodTester.h"
+#include <jnilink.h>
+#include <jcl.h>
+
+static linkPtr t1_1=NULL;
+static linkPtr t1_2=NULL;
+static linkPtr t2=NULL;
+static linkPtr t3=NULL;
+static linkPtr t4=NULL;
+static linkPtr t5=NULL;
+static linkPtr t6=NULL;
+
+/*
+ * Class: MethodTester
+ * Method: test1
+ * Signature: (LData1;LData2;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_MethodTester_test1
+(JNIEnv * env, jobject thisObj, jobject d1, jobject d2) {
+ if(LINK_LinkClass(env,&t1_1,"Data1") == NULL || LINK_LinkClass(env,&t1_2,"Data2") == NULL)
+ return JNI_FALSE;
+ if(!(*env)->IsAssignableFrom(env, LINK_ResolveClass(env,t1_1), LINK_ResolveClass(env,t1_2))
+ && (*env)->IsAssignableFrom(env, LINK_ResolveClass(env,t1_2), LINK_ResolveClass(env,t1_1))) {
+ return JNI_TRUE;
+ } else {
+ return JNI_FALSE;
+ }
+}
+
+/*
+ * Class: MethodTester
+ * Method: test2
+ * Signature: (LData1;LData2;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_MethodTester_test2
+(JNIEnv * env, jobject thisObj, jobject d1, jobject d2) {
+ jclass c1 = (*env)->GetObjectClass(env,d1);
+ jclass c2 = (*env)->GetObjectClass(env,d2);
+ if(LINK_LinkField(env,&t2,c1,"instanceVar","Z") == NULL)
+ return JNI_FALSE;
+ return (*env)->GetBooleanField(env,d1,LINK_ResolveField(env,t2))
+ && (*env)->GetBooleanField(env,d2,LINK_ResolveField(env,t2));
+}
+
+/*
+ * Class: MethodTester
+ * Method: test3
+ * Signature: (LData1;LData2;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_MethodTester_test3
+ (JNIEnv * env, jobject thisObj, jobject d1, jobject d2) {
+ jclass c1 = (*env)->GetObjectClass(env,d1);
+ jclass c2 = (*env)->GetObjectClass(env,d2);
+ if(LINK_LinkStaticField(env,&t3,c1,"staticVar","Z") == NULL)
+ return JNI_FALSE;
+ return (*env)->GetStaticBooleanField(env,d1,LINK_ResolveStaticField(env,t3))
+ && (*env)->GetStaticBooleanField(env,d2,LINK_ResolveStaticField(env,t3));
+}
+
+/*
+ * Class: MethodTester
+ * Method: test4
+ * Signature: (LData1;LData2;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_MethodTester_test4
+ (JNIEnv * env, jobject thisObj, jobject d1, jobject d2) {
+ jclass c1 = (*env)->GetObjectClass(env,d1);
+ jclass c2 = (*env)->GetObjectClass(env,d2);
+ jmethodID m1;
+ jmethodID m2;
+ if(LINK_LinkMethod(env,&t4,c1,"instanceMethod","()Z") == NULL)
+ return JNI_FALSE;
+ m1 = LINK_ResolveMethod(env,t4);
+ m2 = LINK_ResolveMethod(env,t4);
+ return (*env)->CallBooleanMethod(env,d1,m1)
+ && !(*env)->CallBooleanMethod(env,d2,m2);
+}
+
+
+/*
+ * Class: MethodTester
+ * Method: test5
+ * Signature: (LData1;LData2;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_MethodTester_test5
+ (JNIEnv * env, jobject thisObj, jobject d1, jobject d2) {
+ jclass c1 = (*env)->GetObjectClass(env,d1);
+ jclass c2 = (*env)->GetObjectClass(env,d2);
+ if(LINK_LinkStaticMethod(env,&t5,c1,"staticMethod","()Z") == NULL)
+ return JNI_FALSE;
+ return (*env)->CallStaticBooleanMethod(env,c1,LINK_ResolveStaticMethod(env,t5))
+ && (*env)->CallStaticBooleanMethod(env,c2,LINK_ResolveStaticMethod(env,t5));
+}
+
+
+/*
+ * Class: MethodTester
+ * Method: test6
+ * Signature: (LData1;LData2;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_MethodTester_test6
+ (JNIEnv * env, jobject thisObj, jobject d1, jobject d2) {
+ jclass c1 = (*env)->GetObjectClass(env,d1);
+ jclass c2 = (*env)->GetObjectClass(env,d2);
+ if(LINK_LinkMethod(env,&t6,c1,"finalMethod","()Z") == NULL)
+ return JNI_FALSE;
+ return (*env)->CallBooleanMethod(env,d1,LINK_ResolveMethod(env,t6))
+ && !(*env)->CallBooleanMethod(env,d2,LINK_ResolveMethod(env,t6));
+}
+
diff --git a/test/native/lib/MethodTester.h b/test/native/lib/MethodTester.h
new file mode 100644
index 000000000..896fc05c7
--- /dev/null
+++ b/test/native/lib/MethodTester.h
@@ -0,0 +1,61 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class MethodTester */
+
+#ifndef _Included_MethodTester
+#define _Included_MethodTester
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: MethodTester
+ * Method: test1
+ * Signature: (LData1;LData2;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_MethodTester_test1
+ (JNIEnv *, jobject, jobject, jobject);
+
+/*
+ * Class: MethodTester
+ * Method: test2
+ * Signature: (LData1;LData2;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_MethodTester_test2
+ (JNIEnv *, jobject, jobject, jobject);
+
+/*
+ * Class: MethodTester
+ * Method: test3
+ * Signature: (LData1;LData2;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_MethodTester_test3
+ (JNIEnv *, jobject, jobject, jobject);
+
+/*
+ * Class: MethodTester
+ * Method: test4
+ * Signature: (LData1;LData2;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_MethodTester_test4
+ (JNIEnv *, jobject, jobject, jobject);
+
+/*
+ * Class: MethodTester
+ * Method: test5
+ * Signature: (LData1;LData2;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_MethodTester_test5
+ (JNIEnv *, jobject, jobject, jobject);
+
+/*
+ * Class: MethodTester
+ * Method: test6
+ * Signature: (LData1;LData2;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_MethodTester_test6
+ (JNIEnv *, jobject, jobject, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/test/native/lib/PrimlibInterface.c b/test/native/lib/PrimlibInterface.c
new file mode 100644
index 000000000..47918470a
--- /dev/null
+++ b/test/native/lib/PrimlibInterface.c
@@ -0,0 +1,162 @@
+#include "PrimlibInterface.h"
+#include <primlib.h>
+
+/*
+ * Class: PrimlibInterface
+ * Method: unwrapBoolean
+ * Signature: (Ljava/lang/Object;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_PrimlibInterface_unwrapBoolean
+(JNIEnv * env, jclass thisClass, jobject o) {
+ return PRIMLIB_UnwrapBoolean(env, o);
+}
+
+/*
+ * Class: PrimlibInterface
+ * Method: unwrapByte
+ * Signature: (Ljava/lang/Object;)B
+ */
+JNIEXPORT jbyte JNICALL Java_PrimlibInterface_unwrapByte
+ (JNIEnv * env, jclass thisClass, jobject o) {
+ return PRIMLIB_UnwrapByte(env, o);
+}
+
+/*
+ * Class: PrimlibInterface
+ * Method: unwrapShort
+ * Signature: (Ljava/lang/Object;)S
+ */
+JNIEXPORT jshort JNICALL Java_PrimlibInterface_unwrapShort
+ (JNIEnv * env, jclass thisClass, jobject o) {
+ return PRIMLIB_UnwrapShort(env, o);
+}
+
+/*
+ * Class: PrimlibInterface
+ * Method: unwrapChar
+ * Signature: (Ljava/lang/Object;)C
+ */
+JNIEXPORT jchar JNICALL Java_PrimlibInterface_unwrapChar
+ (JNIEnv * env, jclass thisClass, jobject o) {
+ return PRIMLIB_UnwrapChar(env, o);
+}
+
+/*
+ * Class: PrimlibInterface
+ * Method: unwrapInt
+ * Signature: (Ljava/lang/Object;)I
+ */
+JNIEXPORT jint JNICALL Java_PrimlibInterface_unwrapInt
+ (JNIEnv * env, jclass thisClass, jobject o) {
+ return PRIMLIB_UnwrapInt(env, o);
+}
+
+/*
+ * Class: PrimlibInterface
+ * Method: unwrapLong
+ * Signature: (Ljava/lang/Object;)J
+ */
+JNIEXPORT jlong JNICALL Java_PrimlibInterface_unwrapLong
+ (JNIEnv * env, jclass thisClass, jobject o) {
+ return PRIMLIB_UnwrapLong(env, o);
+}
+
+/*
+ * Class: PrimlibInterface
+ * Method: unwrapFloat
+ * Signature: (Ljava/lang/Object;)F
+ */
+JNIEXPORT jfloat JNICALL Java_PrimlibInterface_unwrapFloat
+ (JNIEnv * env, jclass thisClass, jobject o) {
+ return PRIMLIB_UnwrapFloat(env, o);
+}
+
+/*
+ * Class: PrimlibInterface
+ * Method: unwrapDouble
+ * Signature: (Ljava/lang/Object;)D
+ */
+JNIEXPORT jdouble JNICALL Java_PrimlibInterface_unwrapDouble
+ (JNIEnv * env, jclass thisClass, jobject o) {
+ return PRIMLIB_UnwrapDouble(env, o);
+}
+
+/*
+ * Class: PrimlibInterface
+ * Method: wrapBoolean
+ * Signature: (Z)Ljava/lang/Boolean;
+ */
+JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapBoolean
+(JNIEnv * env, jclass thisClass, jboolean val) {
+ return PRIMLIB_WrapBoolean(env, val);
+}
+
+/*
+ * Class: PrimlibInterface
+ * Method: wrapByte
+ * Signature: (B)Ljava/lang/Byte;
+ */
+JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapByte
+(JNIEnv * env, jclass thisClass, jbyte val) {
+ return PRIMLIB_WrapByte(env, val);
+}
+
+/*
+ * Class: PrimlibInterface
+ * Method: wrapShort
+ * Signature: (S)Ljava/lang/Short;
+ */
+JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapShort
+(JNIEnv * env, jclass thisClass, jshort val) {
+ return PRIMLIB_WrapShort(env, val);
+}
+
+/*
+ * Class: PrimlibInterface
+ * Method: wrapChar
+ * Signature: (C)Ljava/lang/Character;
+ */
+JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapChar
+(JNIEnv * env, jclass thisClass, jchar val) {
+ return PRIMLIB_WrapChar(env, val);
+}
+
+/*
+ * Class: PrimlibInterface
+ * Method: wrapInt
+ * Signature: (I)Ljava/lang/Integer;
+ */
+JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapInt
+(JNIEnv * env, jclass thisClass, jint val) {
+ return PRIMLIB_WrapInt(env, val);
+}
+
+/*
+ * Class: PrimlibInterface
+ * Method: wrapLong
+ * Signature: (J)Ljava/lang/Long;
+ */
+JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapLong
+(JNIEnv * env, jclass thisClass, jlong val) {
+ return PRIMLIB_WrapLong(env, val);
+}
+
+/*
+ * Class: PrimlibInterface
+ * Method: wrapFloat
+ * Signature: (F)Ljava/lang/Float;
+ */
+JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapFloat
+(JNIEnv * env, jclass thisClass, jfloat val) {
+ return PRIMLIB_WrapFloat(env, val);
+}
+
+/*
+ * Class: PrimlibInterface
+ * Method: wrapDouble
+ * Signature: (D)Ljava/lang/Double;
+ */
+JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapDouble
+(JNIEnv * env, jclass thisClass, jdouble val) {
+ return PRIMLIB_WrapDouble(env, val);
+}
diff --git a/test/native/lib/PrimlibInterface.h b/test/native/lib/PrimlibInterface.h
new file mode 100644
index 000000000..2e0463cc2
--- /dev/null
+++ b/test/native/lib/PrimlibInterface.h
@@ -0,0 +1,141 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class PrimlibInterface */
+
+#ifndef _Included_PrimlibInterface
+#define _Included_PrimlibInterface
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: PrimlibInterface
+ * Method: unwrapBoolean
+ * Signature: (Ljava/lang/Object;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_PrimlibInterface_unwrapBoolean
+ (JNIEnv *, jclass, jobject);
+
+/*
+ * Class: PrimlibInterface
+ * Method: unwrapByte
+ * Signature: (Ljava/lang/Object;)B
+ */
+JNIEXPORT jbyte JNICALL Java_PrimlibInterface_unwrapByte
+ (JNIEnv *, jclass, jobject);
+
+/*
+ * Class: PrimlibInterface
+ * Method: unwrapShort
+ * Signature: (Ljava/lang/Object;)S
+ */
+JNIEXPORT jshort JNICALL Java_PrimlibInterface_unwrapShort
+ (JNIEnv *, jclass, jobject);
+
+/*
+ * Class: PrimlibInterface
+ * Method: unwrapChar
+ * Signature: (Ljava/lang/Object;)C
+ */
+JNIEXPORT jchar JNICALL Java_PrimlibInterface_unwrapChar
+ (JNIEnv *, jclass, jobject);
+
+/*
+ * Class: PrimlibInterface
+ * Method: unwrapInt
+ * Signature: (Ljava/lang/Object;)I
+ */
+JNIEXPORT jint JNICALL Java_PrimlibInterface_unwrapInt
+ (JNIEnv *, jclass, jobject);
+
+/*
+ * Class: PrimlibInterface
+ * Method: unwrapLong
+ * Signature: (Ljava/lang/Object;)J
+ */
+JNIEXPORT jlong JNICALL Java_PrimlibInterface_unwrapLong
+ (JNIEnv *, jclass, jobject);
+
+/*
+ * Class: PrimlibInterface
+ * Method: unwrapFloat
+ * Signature: (Ljava/lang/Object;)F
+ */
+JNIEXPORT jfloat JNICALL Java_PrimlibInterface_unwrapFloat
+ (JNIEnv *, jclass, jobject);
+
+/*
+ * Class: PrimlibInterface
+ * Method: unwrapDouble
+ * Signature: (Ljava/lang/Object;)D
+ */
+JNIEXPORT jdouble JNICALL Java_PrimlibInterface_unwrapDouble
+ (JNIEnv *, jclass, jobject);
+
+/*
+ * Class: PrimlibInterface
+ * Method: wrapBoolean
+ * Signature: (Z)Ljava/lang/Boolean;
+ */
+JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapBoolean
+ (JNIEnv *, jclass, jboolean);
+
+/*
+ * Class: PrimlibInterface
+ * Method: wrapByte
+ * Signature: (B)Ljava/lang/Byte;
+ */
+JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapByte
+ (JNIEnv *, jclass, jbyte);
+
+/*
+ * Class: PrimlibInterface
+ * Method: wrapShort
+ * Signature: (S)Ljava/lang/Short;
+ */
+JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapShort
+ (JNIEnv *, jclass, jshort);
+
+/*
+ * Class: PrimlibInterface
+ * Method: wrapChar
+ * Signature: (C)Ljava/lang/Character;
+ */
+JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapChar
+ (JNIEnv *, jclass, jchar);
+
+/*
+ * Class: PrimlibInterface
+ * Method: wrapInt
+ * Signature: (I)Ljava/lang/Integer;
+ */
+JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapInt
+ (JNIEnv *, jclass, jint);
+
+/*
+ * Class: PrimlibInterface
+ * Method: wrapLong
+ * Signature: (J)Ljava/lang/Long;
+ */
+JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapLong
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: PrimlibInterface
+ * Method: wrapFloat
+ * Signature: (F)Ljava/lang/Float;
+ */
+JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapFloat
+ (JNIEnv *, jclass, jfloat);
+
+/*
+ * Class: PrimlibInterface
+ * Method: wrapDouble
+ * Signature: (D)Ljava/lang/Double;
+ */
+JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapDouble
+ (JNIEnv *, jclass, jdouble);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/test/native/lib/PrimlibTest.java b/test/native/lib/PrimlibTest.java
new file mode 100644
index 000000000..94b2fb41c
--- /dev/null
+++ b/test/native/lib/PrimlibTest.java
@@ -0,0 +1,88 @@
+public class PrimlibTest {
+ static {
+ System.loadLibrary("jnilinktest");
+ }
+
+ public static void main(String args[]) {
+ Object[] o = new Object[8];
+ o[0] = new Boolean(true);
+ o[1] = new Byte((byte)1);
+ o[2] = new Short((short)2);
+ o[3] = new Character((char)3);
+ o[4] = new Integer(4);
+ o[5] = new Long(5L);
+ o[6] = new Float(6F);
+ o[7] = new Double(7D);
+
+ String[] s = {"boolean", "byte", "short", "char", "int", "long", "float", "double"};
+ for(int i=0;i<8;i++) {
+ try {
+ System.out.println(PrimlibInterface.unwrapBoolean(o[i]) ? "CONVERTED: UnwrapBoolean(" + s[i] + ")" : "INCORRECT: UnwrapBoolean(" + s[i] + ")");
+ } catch(Exception E) {
+ System.out.println("EXCEPTION: UnwrapBoolean(" + s[i] + ")");
+ }
+
+ try {
+ System.out.println(PrimlibInterface.unwrapByte(o[i]) == i ? "CONVERTED: UnwrapByte(" + s[i] + ")" : "INCORRECT: UnwrapByte(" + s[i] + ")");
+ } catch(Exception E) {
+ System.out.println("EXCEPTION: UnwrapByte(" + s[i] + ")");
+ }
+
+ try {
+ System.out.println(PrimlibInterface.unwrapShort(o[i]) == i ? "CONVERTED: UnwrapShort(" + s[i] + ")" : "INCORRECT: UnwrapShort(" + s[i] + ")");
+ } catch(Exception E) {
+ System.out.println("EXCEPTION: UnwrapShort(" + s[i] + ")");
+ }
+
+ try {
+ System.out.println(PrimlibInterface.unwrapChar(o[i]) == i ? "CONVERTED: UnwrapChar(" + s[i] + ")" : "INCORRECT: UnwrapChar(" + s[i] + ")");
+ } catch(Exception E) {
+ System.out.println("EXCEPTION: UnwrapChar(" + s[i] + ")");
+ }
+
+ try {
+ System.out.println(PrimlibInterface.unwrapInt(o[i]) == i ? "CONVERTED: UnwrapInt(" + s[i] + ")" : "INCORRECT: UnwrapInt(" + s[i] + ")");
+ } catch(Exception E) {
+ System.out.println("EXCEPTION: UnwrapInt(" + s[i] + ")");
+ }
+
+ try {
+ System.out.println(PrimlibInterface.unwrapLong(o[i]) == i ? "CONVERTED: UnwrapLong(" + s[i] + ")" : "INCORRECT: UnwrapLong(" + s[i] + ")");
+ } catch(Exception E) {
+ System.out.println("EXCEPTION: UnwrapLong(" + s[i] + ")");
+ }
+
+ try {
+ System.out.println(PrimlibInterface.unwrapFloat(o[i]) == i ? "CONVERTED: UnwrapFloat(" + s[i] + ")" : "INCORRECT: UnwrapFloat(" + s[i] + ")");
+ } catch(Exception E) {
+ System.out.println("EXCEPTION: UnwrapFloat(" + s[i] + ")");
+ }
+
+ try {
+ System.out.println(PrimlibInterface.unwrapDouble(o[i]) == i ? "CONVERTED: UnwrapDouble(" + s[i] + ")" : "INCORRECT: UnwrapDouble(" + s[i] + ")");
+ } catch(Exception E) {
+ System.out.println("EXCEPTION: UnwrapDouble(" + s[i] + ")");
+ }
+ }
+ }
+}
+
+class PrimlibInterface {
+ static native boolean unwrapBoolean(Object o);
+ static native byte unwrapByte(Object o);
+ static native short unwrapShort(Object o);
+ static native char unwrapChar(Object o);
+ static native int unwrapInt(Object o);
+ static native long unwrapLong(Object o);
+ static native float unwrapFloat(Object o);
+ static native double unwrapDouble(Object o);
+
+ static native Boolean wrapBoolean(boolean val);
+ static native Byte wrapByte(byte val);
+ static native Short wrapShort(short val);
+ static native Character wrapChar(char val);
+ static native Integer wrapInt(int val);
+ static native Long wrapLong(long val);
+ static native Float wrapFloat(float val);
+ static native Double wrapDouble(double val);
+}