changeset 16965:c0376739e835

NFI: adopt unittests to new NFI behaviour; add new unittest
author Matthias Grimmer <grimmer@ssw.jku.at>
date Wed, 27 Aug 2014 09:13:37 +0200
parents 41f66e61b39a
children e92bc7d8e2dd
files graal/com.oracle.nfi.test/test/com/oracle/nfi/test/NativeFunctionInterfaceTest.java
diffstat 1 files changed, 17 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.nfi.test/test/com/oracle/nfi/test/NativeFunctionInterfaceTest.java	Wed Aug 27 09:13:00 2014 +0200
+++ b/graal/com.oracle.nfi.test/test/com/oracle/nfi/test/NativeFunctionInterfaceTest.java	Wed Aug 27 09:13:37 2014 +0200
@@ -347,46 +347,50 @@
     @Test
     public void test15() {
         assumeTrue(nfi.isDefaultLibrarySearchSupported());
-        try {
-            nfi.getFunctionHandle("an invalid function name", int.class);
+        NativeFunctionHandle functionHandle = nfi.getFunctionHandle("an invalid function name", int.class);
+        if (functionHandle != null) {
             fail();
-        } catch (UnsatisfiedLinkError e) {
         }
     }
 
     @Test
     public void test16() {
         NativeLibraryHandle javaLib = nfi.getLibraryHandle(getJavaLibPath());
-        try {
-
-            nfi.getFunctionHandle(javaLib, "an invalid function name", int.class);
+        NativeFunctionHandle functionHandle = nfi.getFunctionHandle(javaLib, "an invalid function name", int.class);
+        if (functionHandle != null) {
             fail();
-        } catch (UnsatisfiedLinkError e) {
         }
     }
 
     @Test
     public void test17() {
         NativeLibraryHandle[] libs = {nfi.getLibraryHandle(getVMLibPath()), nfi.getLibraryHandle(getJavaLibPath())};
-        try {
-            nfi.getFunctionPointer(libs, "an invalid function name");
+        NativeFunctionHandle functionHandle = nfi.getFunctionHandle(libs, "an invalid function name", int.class);
+        if (functionHandle != null) {
             fail();
-        } catch (UnsatisfiedLinkError e) {
         }
     }
 
     @Test
     public void test18() {
         NativeLibraryHandle[] libs = {nfi.getLibraryHandle(getVMLibPath()), nfi.getLibraryHandle(getJavaLibPath())};
-        try {
-            nfi.getFunctionHandle(libs, "an invalid function name", int.class);
+        NativeFunctionHandle functionHandle = nfi.getFunctionHandle(libs, "an invalid function name", int.class);
+        if (functionHandle != null) {
             fail();
-        } catch (UnsatisfiedLinkError e) {
         }
     }
 
     @Test
     public void test19() {
+        NativeLibraryHandle[] libs = {nfi.getLibraryHandle(getVMLibPath()), nfi.getLibraryHandle(getJavaLibPath())};
+        NativeFunctionPointer functionPointer = nfi.getFunctionPointer(libs, "an invalid function name");
+        if (functionPointer != null) {
+            fail();
+        }
+    }
+
+    @Test
+    public void test20() {
         try {
             nfi.getLibraryHandle("an invalid library name");
             fail();