diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-16 00:30:23 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-16 00:30:23 +0000 |
commit | c8875fb97fc03779a5bba09872227b1d08e5d52a (patch) | |
tree | a0b991cf5866ae1d616639b906ac001811d74508 /libjava/classpath/test/native/lib/JNILinkTest.java | |
parent | c40c1730800ed292b6db39a83d592476fa59623c (diff) | |
download | ppe42-gcc-c8875fb97fc03779a5bba09872227b1d08e5d52a.tar.gz ppe42-gcc-c8875fb97fc03779a5bba09872227b1d08e5d52a.zip |
Initial revision
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102074 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/test/native/lib/JNILinkTest.java')
-rw-r--r-- | libjava/classpath/test/native/lib/JNILinkTest.java | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/libjava/classpath/test/native/lib/JNILinkTest.java b/libjava/classpath/test/native/lib/JNILinkTest.java new file mode 100644 index 00000000000..326c8ea0445 --- /dev/null +++ b/libjava/classpath/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; } +} |