aboutsummaryrefslogtreecommitdiffstats
path: root/test/junit/com/sun
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-11-07 04:35:47 +0100
committerSven Gothel <[email protected]>2010-11-07 04:35:47 +0100
commited83567444bd803918b8904eb71b155d4eff2de4 (patch)
tree715069bef306f409e5030b1a90871b55c1c41a7f /test/junit/com/sun
parent5aadf241bb46a66a57c6c5b6776aa6a0da1633f6 (diff)
com.sun -> com.jogamp
Diffstat (limited to 'test/junit/com/sun')
-rw-r--r--test/junit/com/sun/gluegen/BasicProcAddressEmitterTest.java96
-rw-r--r--test/junit/com/sun/gluegen/BasicTest.java143
-rw-r--r--test/junit/com/sun/gluegen/BuildUtil.java179
-rw-r--r--test/junit/com/sun/gluegen/PCPPTest.java76
-rw-r--r--test/junit/com/sun/gluegen/StructAccessorTest.java126
-rw-r--r--test/junit/com/sun/gluegen/StructValidator.java105
-rw-r--r--test/junit/com/sun/gluegen/build.xml95
-rw-r--r--test/junit/com/sun/gluegen/dyntest.cfg25
-rw-r--r--test/junit/com/sun/gluegen/pcpptest.h6
-rw-r--r--test/junit/com/sun/gluegen/struct.cfg7
-rw-r--r--test/junit/com/sun/gluegen/struct.h21
-rw-r--r--test/junit/com/sun/gluegen/test.c24
-rw-r--r--test/junit/com/sun/gluegen/test.cfg9
-rw-r--r--test/junit/com/sun/gluegen/test.h17
14 files changed, 0 insertions, 929 deletions
diff --git a/test/junit/com/sun/gluegen/BasicProcAddressEmitterTest.java b/test/junit/com/sun/gluegen/BasicProcAddressEmitterTest.java
deleted file mode 100644
index 10156f9..0000000
--- a/test/junit/com/sun/gluegen/BasicProcAddressEmitterTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * Copyright 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-
-package com.jogamp.gluegen;
-
-import com.jogamp.gluegen.procaddress.ProcAddressEmitter;
-import java.lang.reflect.Field;
-import java.util.HashSet;
-import java.util.Set;
-import org.junit.AfterClass;
-import org.junit.Test;
-import static java.util.Arrays.*;
-import static com.jogamp.gluegen.BuildUtil.*;
-import static org.junit.Assert.*;
-
-/**
- * Basic test using ProcAddressEmitter.
- * @author Michael Bien
- */
-public class BasicProcAddressEmitterTest {
-
- @Test
- public void generateBindingTest() {
- generate("dyntest", "test", ProcAddressEmitter.class.getName());
- }
-
- /**
- * fails if ant script fails (which is a good thing).
- * executeTarget throws RuntimeException on failure
- */
- @Test
- public void compileJavaTest() {
- compileJava();
- }
-
- /*
- * fails if ant script fails (which is a good thing)
- * executeTarget throws RuntimeException on failure
- */
- @Test
- public void compileNativesTest() {
- compileNatives();
- }
-
- @Test
- public void renameTest() throws Exception {
-
- Class<?> binding = Class.forName("test.DynBindingTest");
- Class<?> table = Class.forName("test.Table");
-
- Field[] fields = table.getDeclaredFields();
-
-
- Set<String> expected = new HashSet<String>(
- asList("arrayTest", "bufferTest", "pbTest", "manyBuffersTest", "mixedTest", "doubleTest"));
-
- for (Field field : fields) {
- System.out.println("address field: "+field);
-
- String function = field.getName().substring("_addressoff_".length()-1);
- assertTrue("unexpected field: '"+function+"'",expected.contains(function));
- }
-
- }
-
- @AfterClass
- public static void tearDown() {
-// cleanGeneratedFiles();
- }
-
-}
diff --git a/test/junit/com/sun/gluegen/BasicTest.java b/test/junit/com/sun/gluegen/BasicTest.java
deleted file mode 100644
index 38bb7f9..0000000
--- a/test/junit/com/sun/gluegen/BasicTest.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/**
- * Copyright 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-
-package com.jogamp.gluegen;
-
-import com.jogamp.common.nio.Buffers;
-import com.jogamp.common.nio.PointerBuffer;
-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.jogamp.gluegen.BuildUtil.*;
-
-/**
- *
- * @author Michael Bien
- */
-public class BasicTest {
-
- @Test
- public void generateBindingTest() {
- generate("test");
- }
-
- /**
- * fails if ant script fails (which is a good thing).
- * executeTarget throws RuntimeException on failure
- */
- @Test
- public void compileJavaTest() {
- compileJava();
- }
-
- /*
- * fails if ant script fails (which is a good thing)
- * executeTarget throws RuntimeException on failure
- */
- @Test
- public void compileNativesTest() {
- compileNatives();
- }
-
- @Test
- public void bindingTest() throws Exception {
-
- // String nativesPath = testOutput + "/build/natives";
- // System.load(nativesPath + "/librofl.so");
- System.loadLibrary("rofl");
-
- 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 = Buffers.newDirectByteBuffer(32);
- ByteBuffer bb = ByteBuffer.allocate(32).order(ByteOrder.nativeOrder());
-
- PointerBuffer dpb = PointerBuffer.allocateDirect(32);
- PointerBuffer pb = PointerBuffer.allocate(32);
-
- long[] array = new long[] {1,2,3,4,5,6,7,8,9};
- int offset = 0;
- long id = 42;
-
-
- // invoke everything public
- Object bindingTest = clazz.newInstance();
- Method[] methods = clazz.getDeclaredMethods();
-
- for (Method method : methods) {
-
- // prepare method parameters
- Class<?>[] paramTypes = method.getParameterTypes();
- Object[] paramInstances = new Object[paramTypes.length];
-
- for (int i = 0; i < paramTypes.length; i++) {
- Class<?> paramType = paramTypes[i];
- if(paramType.isInstance(dbb)) {
- paramInstances[i] = dbb;
- }else if(paramType.isInstance(bb)) {
- paramInstances[i] = bb;
- }else if(paramType.isInstance(dpb)) {
- paramInstances[i] = dpb;
- }else if(paramType.isInstance(pb)) {
- paramInstances[i] = pb;
- }else if(paramType.isPrimitive()) { // TODO primitive types
- paramInstances[i] = offset;
- }else if(paramType.isArray()) { // TODO array types
- paramInstances[i] = array;
- }
- }
-
- out.println("invoking: "+method);
- out.println("with params: ");
- for (Object param : paramInstances)
- out.print(param+", ");
- out.println();
-
- Object result = method.invoke(bindingTest, paramInstances);
- out.println("result: "+result);
- out.println("success");
- }
- */
- }
-
- @AfterClass
- public static void tearDown() {
-// cleanGeneratedFiles();
- }
-
-}
diff --git a/test/junit/com/sun/gluegen/BuildUtil.java b/test/junit/com/sun/gluegen/BuildUtil.java
deleted file mode 100644
index ce88ba2..0000000
--- a/test/junit/com/sun/gluegen/BuildUtil.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- * Copyright 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-
-package com.jogamp.gluegen;
-
-import com.jogamp.gluegen.JavaEmitter;
-import com.jogamp.gluegen.GlueGen;
-import java.io.File;
-import java.net.URISyntaxException;
-import org.apache.tools.ant.DefaultLogger;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.ProjectHelper;
-
-import static java.lang.System.*;
-
-/**
- * @author Michael Bien
- */
-public final class BuildUtil {
-
- private static final Project project;
-
- public static final String gluegenRoot;
- public static final String path;
- public static final String testOutput;
- public static final String rootrel_build;
-
- static {
-
- out.println(" - - - System info - - - ");
- out.println("OS: " + System.getProperty("os.name"));
- out.println("VM: " + System.getProperty("java.vm.name"));
-
- String rootrel_build_tmp = System.getProperty("rootrel.build");
- if(null==rootrel_build_tmp || rootrel_build_tmp.length()==0) {
- rootrel_build_tmp = "build" ;
- }
- rootrel_build = rootrel_build_tmp;
- out.println("rootrel.build: " + rootrel_build);
-
- // setup paths
- try {
- File executionRoot = new File(BuildUtil.class.getProtectionDomain().getCodeSource().getLocation().toURI());
- out.println("execution root: " + executionRoot);
- gluegenRoot = executionRoot.getParentFile().getParentFile().getParentFile().getParentFile().toString();
- out.println("gluegen project root: " + gluegenRoot);
- } catch (URISyntaxException ex) {
- throw new RuntimeException("can not determine gluegen root", ex);
- }
-
- path = gluegenRoot + "/test/junit/com/jogamp/gluegen";
- testOutput = gluegenRoot + "/" + rootrel_build + "/test";
-
- out.println("path: "+path);
- out.println("testOutput: "+testOutput);
- out.println(" - - - - - - - - - - - - ");
-
- cleanGeneratedFiles();
-
- //setup ant build file
- project = new Project();
- project.setProperty("rootrel.build", rootrel_build);
- passSystemProperty(project, "gluegen-cpptasks.file");
- passSystemProperty(project, "os.arch");
-
- DefaultLogger logger = new DefaultLogger();
- logger.setErrorPrintStream(out);
- logger.setOutputPrintStream(out);
- logger.setMessageOutputLevel(Project.MSG_WARN);
- project.addBuildListener(logger);
-
- project.init();
-
- File buildFile = new File(path, "build.xml");
- if(!buildFile.exists()) {
- throw new RuntimeException("buildfile "+buildFile+" does not exist");
- }
-
- ProjectHelper.configureProject(project, buildFile);
- }
-
- public static Project passSystemProperty(Project p, String name) {
- String tmp = System.getProperty(name);
- if(null!=tmp && tmp.length()>0) {
- p.setProperty(name, tmp);
- }
- return p;
- }
-
- public static void cleanGeneratedFiles() {
- out.println("cleaning generated files");
- deleteDirectory(new File(testOutput+"/gensrc"));
- out.println("done");
- }
-
- /**
- * fails if ant script fails (which is a good thing).
- * executeTarget throws RuntimeException on failure
- */
- public static void compileJava() {
- out.println("compiling java files");
- project.executeTarget("compile.java");
- out.println("done");
- }
-
- /**
- * fails if ant script fails (which is a good thing)
- * executeTarget throws RuntimeException on failure
- */
- public static void compileNatives() {
- out.println("compiling native files");
- project.executeTarget("compile.native");
- out.println("done");
- }
-
- public static void generate(String bindingName) {
- generate(bindingName, JavaEmitter.class.getName());
-// generate(bindingName, DebugEmitter.class.getName());
- }
-
- public static void generate(String bindingName, String emitter) {
- generate(bindingName, bindingName, emitter);
- }
- public static void generate(String bindingName, String header, String emitter) {
-
- out.println("generate binding to '" + bindingName+"' using '"+emitter+"'");
-
- GlueGen.main( "-I"+path,
- "-O"+testOutput+"/gensrc",
- "-E"+emitter,
- "-C"+path+"/"+bindingName+".cfg",
- path+"/"+header+".h" );
-
- out.println("done");
- }
-
- public static void deleteDirectory(File path) {
- if(path.exists()) {
-
- File[] files = path.listFiles();
- for (int i = 0; i < files.length; i++) {
- if (files[i].isDirectory()) {
- deleteDirectory(files[i]);
- } else {
- files[i].delete();
- }
- }
-
- path.delete();
- }
- }
-
-
-}
diff --git a/test/junit/com/sun/gluegen/PCPPTest.java b/test/junit/com/sun/gluegen/PCPPTest.java
deleted file mode 100644
index c1f12ab..0000000
--- a/test/junit/com/sun/gluegen/PCPPTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Copyright 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-
-package com.jogamp.gluegen;
-
-import com.jogamp.gluegen.pcpp.PCPP;
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.Collections;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-/**
- * serves mainly as entry point for debugging purposes.
- * @author Michael Bien
- */
-public class PCPPTest {
-
- @Test
- public void pcppMacroDefinitionTest() throws FileNotFoundException, IOException {
-
- PCPP pp = new PCPP(Collections.<String>emptyList());
- ByteArrayOutputStream output = new ByteArrayOutputStream();
- pp.setOut(output);
-
- String filename = "pcpptest.h";
- String filepath = BuildUtil.path + "/" + filename;
-
- pp.run(new BufferedReader(new FileReader(filepath)), filename);
-
- String expected = "# 1 \"pcpptest.h\""+
- "# define CL_SCHAR_MIN (-127-1)"+
- " cl_char __attribute__(( aligned(2))) s[ 2];"+
- "# 7 \"pcpptest.h\"";
- output.flush();
- String result = output.toString();
- output.close();
-
- assertEquals(killWhitespace(expected), killWhitespace(result));
-
- }
-
- private String killWhitespace(String a) {
- return a.replaceAll("\\p{javaWhitespace}+", "");
- }
-
-
-}
diff --git a/test/junit/com/sun/gluegen/StructAccessorTest.java b/test/junit/com/sun/gluegen/StructAccessorTest.java
deleted file mode 100644
index 4d1bffd..0000000
--- a/test/junit/com/sun/gluegen/StructAccessorTest.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Copyright 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-
-package com.jogamp.gluegen;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Locale;
-import javax.tools.Diagnostic;
-import javax.tools.DiagnosticCollector;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-import junit.framework.Assert;
-import org.junit.AfterClass;
-import org.junit.Test;
-import static java.lang.System.*;
-import static com.jogamp.gluegen.BuildUtil.*;
-
-/**
- *
- * @author Michael Bien
- */
-public class StructAccessorTest {
-
- @Test
- public void generateStruct() {
- generate("struct");
- }
-
- @Test
- public void compileStructJava() {
- compileJava();
- }
-
- @Test
- public void compileStructNatives() {
- // this will only copy gluegen-rt to the right place
- compileNatives();
- }
-
- @Test
- public void validateGeneratedStructs() throws IOException, NoSuchMethodException, ClassNotFoundException, IllegalAccessException, InvocationTargetException {
-
- // compile testcase
- String source = gluegenRoot + "/test/junit/com/jogamp/gluegen/StructValidator.java";
- compile(new File(source), testOutput + "/build/classes");
-
- // invoke test
- Class<?> test = Class.forName("com.jogamp.gluegen.StructValidator");
- test.getDeclaredMethod("validate").invoke(null);
- }
-
- private void compile(File file, String dest) throws IOException {
- compile(new File[] {file}, dest);
- }
-
- // yeah, java 6 has even a compiler api...
- private void compile(File[] files, String destination) throws IOException {
-
- out.println("compiling files:\n " + Arrays.asList(files));
-
- JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- DiagnosticCollector<JavaFileObject> collector = new DiagnosticCollector<JavaFileObject>();
- StandardJavaFileManager fileManager = compiler.getStandardFileManager(collector, null, null);
-
- Iterable<? extends JavaFileObject> fileObj = fileManager.getJavaFileObjects(files);
-
- boolean success = compiler.getTask( new OutputStreamWriter(out),
- fileManager,
- collector,
- Arrays.asList("-d", destination/*, "-verbose"*/),
- null,
- fileObj ).call();
-
- fileManager.close();
-
- List<Diagnostic<? extends JavaFileObject>> list = collector.getDiagnostics();
- if(!list.isEmpty() || !success) {
- for (Diagnostic<? extends JavaFileObject> d : list) {
- out.println("Error on line "+ d.getLineNumber());
- out.println("Compiler Message:\n"+d.getMessage(Locale.ENGLISH));
- }
- Assert.fail("compilation failed");
- }
-
- out.println("done");
-
- }
-
- @AfterClass
- public static void tearDown() {
-// cleanGeneratedFiles();
- }
-
-}
diff --git a/test/junit/com/sun/gluegen/StructValidator.java b/test/junit/com/sun/gluegen/StructValidator.java
deleted file mode 100644
index b6eb426..0000000
--- a/test/junit/com/sun/gluegen/StructValidator.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * Copyright 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-
-package com.jogamp.gluegen;
-
-import java.lang.reflect.InvocationTargetException;
-import org.junit.Ignore;
-
-import static org.junit.Assert.*;
-
-/**
- * this file will not compile unless {@link com.jogamp.gluegen.StructAccessorTest} has been run.
- * @author Michael Bien
- */
-@Ignore
-public class StructValidator {
-
- // invoked via reflection from StructAccessorTest1
- public static void validate() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, ClassNotFoundException {
-
- System.out.println("validating struct accessors...");
-
- float[] mu = new float[] {1, 2, 3, 4};
- float[] light = new float[] {5, 6, 7};
- int fastRendering = 1;
- int shadow = 42;
- int iterations = 512;
- int sss = 12;
- float epsilon = (float) Math.PI;
- int height = 640;
- int width = 480;
-
- structtest.RenderingConfig config = structtest.RenderingConfig.create();
-
- //set
- config.setLight(light);
- config.setMu(mu);
- config.setActvateFastRendering(fastRendering);
- config.setEnableShadow(shadow);
- config.setMaxIterations(iterations);
- config.setEpsilon(epsilon);
- config.setSuperSamplingSize(sss);
- config.setWidth(width);
- config.setHeight(height);
-
- structtest.Camera camera = config.getCamera();
- camera.getOrig().setX(1001).setY(1002).setZ(1003);
- camera.getDir().setX(2001).setY(2002).setZ(2003);
-
- //get and validate
- assertArrayEquals(mu, config.getMu());
- assertArrayEquals(light, config.getLight());
-
- assertEquals(fastRendering, config.getActvateFastRendering());
- assertEquals(shadow, config.getEnableShadow());
- assertEquals(iterations, config.getMaxIterations());
- assertEquals(epsilon, config.getEpsilon(), 0.01f);
- assertEquals(sss, config.getSuperSamplingSize());
- assertEquals(width, config.getWidth());
- assertEquals(height, config.getHeight());
-
- assertEquals(camera.getOrig().getX(), 1001, 0.001);
- assertEquals(camera.getOrig().getY(), 1002, 0.001);
- assertEquals(camera.getOrig().getZ(), 1003, 0.001);
-
- assertEquals(camera.getDir().getX(), 2001, 0.001);
- assertEquals(camera.getDir().getY(), 2002, 0.001);
- assertEquals(camera.getDir().getZ(), 2003, 0.001);
-
- System.out.println("done");
-
- }
-
- private static final void assertArrayEquals(float[] a, float[] b) {
- for (int i = 0; i < b.length; i++) {
- assertEquals(a[i], b[i], 0.0001f);
- }
- }
-
-}
diff --git a/test/junit/com/sun/gluegen/build.xml b/test/junit/com/sun/gluegen/build.xml
deleted file mode 100644
index 95617be..0000000
--- a/test/junit/com/sun/gluegen/build.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="GlueGenTest" default="default" basedir=".">
-
- <description>Tests GlueGen</description>
-
- <condition property="rootrel.build" value="build">
- <not>
- <isset property="rootrel.build"/>
- </not>
- </condition>
-
- <property name="gluegen.root" value="../../../../.." />
- <property name="src.dir" value="${gluegen.root}/${rootrel.build}/test/gensrc/java" />
- <property name="build.dir" value="${gluegen.root}/${rootrel.build}/test/build" />
-
- <!-- Pull in GlueGen cpptasks build file -->
- <import file="${gluegen.root}/make/gluegen-cpptasks.xml" />
-
- <target name="compile.java">
-
- <echo message=" - - - compiling java files - - - "/>
-
- <property name="build.dir.java" value="${build.dir}/classes"/>
- <property name="tools.jar" value="${java.home}/../lib/tools.jar"/>
-
- <echo message="src: ${src.dir} "/>
- <echo message="build: ${build.dir.java} "/>
-
- <mkdir dir="${build.dir.java}"/>
-
- <javac destdir="${build.dir.java}" source="1.5" failonerror="true" debug="true" debuglevel="lines,vars,source">
- <src path="${src.dir}"/>
- <classpath path="${gluegen.root}/${rootrel.build}/classes:${src.dir}:${gluegen.root}/${rootrel.build}/antlr-3.2.jar:${gluegen.root}/make/lib/junit.jar:${tools.jar}:${ant.core.lib}"/>
- </javac>
-
- <echo message=" - - - java files compiled - - - "/>
-
- </target>
-
- <target name="compile.native" depends="c.configure">
-
- <echo message=" - - - compiling natives - - - "/>
-
- <property name="obj.dir" value="${build.dir}/obj"/>
- <property name="natives.dir" value="${build.dir}/natives"/>
-
- <property name="output.lib.name" value="rofl"/>
- <property name="obj.dir" value="${obj.dir}/${output.lib.name}"/>
-
- <property name="c.compiler.optimise" value="none"/>
- <property name="c.compiler.debug" value="false"/>
-
- <mkdir dir="${obj.dir}" />
- <mkdir dir="${natives.dir}" />
-
- <cc outtype="shared"
- objdir="${obj.dir}"
- outfile="${natives.dir}/${output.lib.name}"
- optimize="${c.compiler.optimise}"
- debug="${c.compiler.debug}"
- multithreaded="true"
- exceptions="false"
- rtti="false"
- failonerror="true">
-
- <fileset dir="${gluegen.root}/test/junit/com/jogamp/gluegen" includes="*.c"/>
-
- <compiler extends="${compiler.cfg.id}" >
- <includepath path="${java.includes.dir}"/>
- <includepath path="${java.includes.dir.platform}"/>
- <includepath path="${gluegen.root}/test/junit/com/jogamp/gluegen"/>
- </compiler>
-
- <linker extends="${linker.cfg.id}">
-
- </linker>
- </cc>
-
- <echo message=" - - - natives compiled - - - "/>
-
- <copy todir="${natives.dir}">
- <fileset dir="${gluegen.root}/${rootrel.build}/obj">
- <include name="*.so"/>
- </fileset>
- </copy>
-
- </target>
-
- <target name="c.configure" depends="gluegen.cpptasks.detect.os,gluegen.cpptasks.setup.compiler">
- <property name="compiler.cfg.id" value="${compiler.cfg.id.base}" />
- <property name="linker.cfg.id" value="${linker.cfg.id.base}" />
- </target>
-
-</project>
diff --git a/test/junit/com/sun/gluegen/dyntest.cfg b/test/junit/com/sun/gluegen/dyntest.cfg
deleted file mode 100644
index 60b8764..0000000
--- a/test/junit/com/sun/gluegen/dyntest.cfg
+++ /dev/null
@@ -1,25 +0,0 @@
-Package test
-Style AllStatic
-JavaClass DynBindingTest
-JavaOutputDir java
-NativeOutputDir native
-
-CustomCCode #include "test.h"
-
-Import com.jogamp.common.nio.*
-
-
-EmitProcAddressTable true
-ProcAddressTableClassName Table
-GetProcAddressTableExpr table
-ProcAddressNameExpr $UpperCase(arg)
-
-ForceProcAddressGen __ALL__
-
-CustomJavaCode DynBindingTest private final static Table table;
-CustomJavaCode DynBindingTest static {
-CustomJavaCode DynBindingTest table = new Table();
-CustomJavaCode DynBindingTest //table.reset();
-CustomJavaCode DynBindingTest }
-
-RenameJavaMethod arrayTest fancyArrayTest \ No newline at end of file
diff --git a/test/junit/com/sun/gluegen/pcpptest.h b/test/junit/com/sun/gluegen/pcpptest.h
deleted file mode 100644
index 58b8935..0000000
--- a/test/junit/com/sun/gluegen/pcpptest.h
+++ /dev/null
@@ -1,6 +0,0 @@
-
-#define CL_SCHAR_MIN (-127-1)
-#define CL_ALIGNED(_x) __attribute__ ((aligned(_x)))
-
-cl_char CL_ALIGNED(2) s[2];
-
diff --git a/test/junit/com/sun/gluegen/struct.cfg b/test/junit/com/sun/gluegen/struct.cfg
deleted file mode 100644
index a1e1138..0000000
--- a/test/junit/com/sun/gluegen/struct.cfg
+++ /dev/null
@@ -1,7 +0,0 @@
-Package structtest
-
-JavaOutputDir java
-
-EmitStruct Vec
-EmitStruct Camera
-EmitStruct RenderingConfig
diff --git a/test/junit/com/sun/gluegen/struct.h b/test/junit/com/sun/gluegen/struct.h
deleted file mode 100644
index 2819d5c..0000000
--- a/test/junit/com/sun/gluegen/struct.h
+++ /dev/null
@@ -1,21 +0,0 @@
-
-typedef struct {
- float x, y, z;
-} Vec;
-
-typedef struct {
- Vec orig, dir;
-} Camera;
-
-typedef struct {
- unsigned int width, height;
- int superSamplingSize;
- int actvateFastRendering;
- int enableShadow;
-
- unsigned int maxIterations;
- float epsilon;
- float mu[4];
- float light[3];
- Camera camera;
-} RenderingConfig;
diff --git a/test/junit/com/sun/gluegen/test.c b/test/junit/com/sun/gluegen/test.c
deleted file mode 100644
index c511a53..0000000
--- a/test/junit/com/sun/gluegen/test.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "test.h"
-
-int arrayTest(long context, foo * array) {
- return 42;
-}
-
-int bufferTest(void * object) {
- return 42;
-}
-
-void pbTest(size_t * object) {
-}
-
-int manyBuffersTest(void * object1, void * object2, void * object3, void * object4, void * object5) {
- return 42;
-}
-
-int mixedTest(long context, void * object, foo * array){
- return 42;
-}
-
-int doubleTest(long context, void * object1, foo * array1, void * object2, foo * array2) {
- return 42;
-}
diff --git a/test/junit/com/sun/gluegen/test.cfg b/test/junit/com/sun/gluegen/test.cfg
deleted file mode 100644
index a2ac567..0000000
--- a/test/junit/com/sun/gluegen/test.cfg
+++ /dev/null
@@ -1,9 +0,0 @@
-Package test
-Style AllStatic
-JavaClass BindingTest
-JavaOutputDir java
-NativeOutputDir native
-
-CustomCCode #include "test.h"
-
-Import com.jogamp.common.nio.* \ No newline at end of file
diff --git a/test/junit/com/sun/gluegen/test.h b/test/junit/com/sun/gluegen/test.h
deleted file mode 100644
index cef2b7e..0000000
--- a/test/junit/com/sun/gluegen/test.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#define GL_INVALID_INDEX 0xFFFFFFFFu
-#define AL_FLANGER_DEFAULT_FEEDBACK (-0.5f)
-
-typedef unsigned long foo;
-typedef unsigned long size_t;
-
-int arrayTest(long context, foo * array );
-
-int bufferTest(void * object);
-
-void pbTest(size_t * object);
-
-int manyBuffersTest(void * object1, void * object2, void * object3, void * object4, void * object5);
-
-int mixedTest(long context, void * object, foo * array );
-
-int doubleTest(long context, void * object1, foo * array1, void * object2, foo * array2 );