summaryrefslogtreecommitdiffstats
path: root/test/junit
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-03-22 17:19:17 +0100
committerMichael Bien <[email protected]>2010-03-22 17:19:17 +0100
commitebb79dfb8ab9752c6ce92ca1af6c430d22bc069c (patch)
treebe16ba927e92c3ef3e0326d397b38629dcd3413f /test/junit
parent58d9dd488cbd7eee530031ef9ea523037be175cd (diff)
fixed regression in constant emission where a type suffix (e.g. 'f') was illegally added after a closing bracket.
added testcase.
Diffstat (limited to 'test/junit')
-rw-r--r--test/junit/com/sun/gluegen/BasicTest.java22
-rw-r--r--test/junit/com/sun/gluegen/test.h3
2 files changed, 16 insertions, 9 deletions
diff --git a/test/junit/com/sun/gluegen/BasicTest.java b/test/junit/com/sun/gluegen/BasicTest.java
index dc6efb9..a43d3e5 100644
--- a/test/junit/com/sun/gluegen/BasicTest.java
+++ b/test/junit/com/sun/gluegen/BasicTest.java
@@ -2,12 +2,13 @@ package com.sun.gluegen;
import com.sun.gluegen.runtime.BufferFactory;
import com.sun.gluegen.runtime.PointerBuffer;
-import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import org.junit.AfterClass;
import org.junit.Test;
+import static org.junit.Assert.*;
import static java.lang.System.*;
import static com.sun.gluegen.BuildUtil.*;
@@ -40,14 +41,19 @@ public class BasicTest {
compileNatives();
}
-// @Test
- public void bindingTest() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException, InstantiationException {
+ @Test
+ public void bindingTest() throws Exception {
String nativesPath = gluegenRoot + "/build/test/build/natives";
System.load(nativesPath + "/librofl.so");
- Object bindingTest = Class.forName("test.BindingTest").newInstance();
+ Class<?> clazz = Class.forName("test.BindingTest");
+
+ assertEquals((long)0xFFFFFFFF, clazz.getDeclaredField("GL_INVALID_INDEX").get(null));
+ assertEquals(-0.5f, clazz.getDeclaredField("AL_FLANGER_DEFAULT_FEEDBACK").get(null));
+ // TODO fix Exception: ...Caused by: java.lang.UnsatisfiedLinkError: test.BindingTest.arrayTest0(JLjava/lang/Object;I)I
+ /*
// test values
ByteBuffer dbb = BufferFactory.newDirectByteBuffer(32);
ByteBuffer bb = ByteBuffer.allocate(32).order(ByteOrder.nativeOrder());
@@ -59,8 +65,10 @@ public class BasicTest {
int offset = 0;
long id = 42;
+
// invoke everything public
- Method[] methods = bindingTest.getClass().getDeclaredMethods();
+ Object bindingTest = clazz.newInstance();
+ Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
@@ -91,13 +99,11 @@ public class BasicTest {
out.print(param+", ");
out.println();
- // TODO fix Exception: ...Caused by: java.lang.UnsatisfiedLinkError: test.BindingTest.arrayTest0(JLjava/lang/Object;I)I
-
Object result = method.invoke(bindingTest, paramInstances);
out.println("result: "+result);
out.println("success");
}
-
+ */
}
@AfterClass
diff --git a/test/junit/com/sun/gluegen/test.h b/test/junit/com/sun/gluegen/test.h
index acac88e..10399a6 100644
--- a/test/junit/com/sun/gluegen/test.h
+++ b/test/junit/com/sun/gluegen/test.h
@@ -1,4 +1,5 @@
-#define GL_INVALID_INDEX 0xFFFFFFFFu
+#define GL_INVALID_INDEX 0xFFFFFFFFu
+#define AL_FLANGER_DEFAULT_FEEDBACK (-0.5f)
typedef unsigned long foo;