summaryrefslogtreecommitdiffstats
path: root/test/com
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-08-25 12:59:35 +0200
committerMichael Bien <[email protected]>2010-08-25 12:59:35 +0200
commit4836f3ab7916c681450d06f118b90c31f0bcdc8c (patch)
tree1c6fcf378168f0611123c9da5c8f05f6da2fec99 /test/com
parent7bd341b72fc69a9a5fedb25ef1f15ebe08141212 (diff)
added new CL_INVALID_PROPERTY exception + CLException junit test.
Diffstat (limited to 'test/com')
-rw-r--r--test/com/jogamp/opencl/CLExceptionTest.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/com/jogamp/opencl/CLExceptionTest.java b/test/com/jogamp/opencl/CLExceptionTest.java
new file mode 100644
index 00000000..f6d7ca7b
--- /dev/null
+++ b/test/com/jogamp/opencl/CLExceptionTest.java
@@ -0,0 +1,37 @@
+
+package com.jogamp.opencl;
+
+import java.lang.reflect.InvocationTargetException;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author Michael Bien
+ */
+public class CLExceptionTest {
+
+ @Test
+ public void testCLExceptions() throws InstantiationException, IllegalAccessException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException {
+ Class<?>[] subTypes = CLException.class.getDeclaredClasses();
+
+ for (Class<?> type : subTypes) {
+
+ if(type.getName().startsWith(CLException.class.getName()+"$CL")) {
+
+ CLException exception = (CLException) type.getConstructor(String.class).newInstance("foo");
+
+ assertNotNull("can not resolve "+exception, CLException.resolveErrorCode(exception.errorcode));
+
+ try{
+ CLException.checkForError(exception.errorcode, "foo");
+ fail("expected exception for: "+exception.getClass().getName()+" code: "+exception.errorcode);
+ }catch(CLException ex) {
+ assertTrue("wrong instance; expected "+exception.getClass()+" but got "+ex.getClass(),
+ exception.getClass().equals(ex.getClass()));
+ }
+ }
+ }
+ }
+
+}