diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/junit/com/jogamp/common/util/IntIntHashMapTest.java | 167 | ||||
-rw-r--r-- | src/junit/com/jogamp/common/util/LongIntHashMapTest.java | 167 | ||||
-rw-r--r-- | src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java (renamed from src/junit/com/jogamp/gluegen/test/junit/generation/BaseTest1.java) | 110 | ||||
-rw-r--r-- | src/junit/com/jogamp/gluegen/test/junit/generation/BindingJNILibLoader.java | 8 | ||||
-rw-r--r-- | src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java | 14 | ||||
-rw-r--r-- | src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java | 16 | ||||
-rw-r--r-- | src/junit/com/jogamp/gluegen/test/junit/generation/test1-gluegen.cfg | 2 | ||||
-rw-r--r-- | src/junit/com/jogamp/gluegen/test/junit/generation/test1p1-gluegen.cfg | 8 | ||||
-rw-r--r-- | src/junit/com/jogamp/gluegen/test/junit/generation/test1p2-gluegen.cfg | 18 |
9 files changed, 422 insertions, 88 deletions
diff --git a/src/junit/com/jogamp/common/util/IntIntHashMapTest.java b/src/junit/com/jogamp/common/util/IntIntHashMapTest.java new file mode 100644 index 0000000..bc02947 --- /dev/null +++ b/src/junit/com/jogamp/common/util/IntIntHashMapTest.java @@ -0,0 +1,167 @@ +/** + * Created on Sunday, March 28 2010 21:01 + */ +package com.jogamp.common.util; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; +import java.util.Random; +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.*; +import static java.lang.System.*; + +/** + * + * @author Michael Bien + */ +public class IntIntHashMapTest { + + private static int iterations; + private static int[] rndKeys; + private static int[] rndValues; + + @BeforeClass + public static void init() { + + iterations = 20000; + final int keySeed = 42; + final int valueSeed = 23; + + Random keyRnd = new Random(/*keySeed*/); + Random valueRnd = new Random(/*valueSeed*/); + + rndKeys = new int[iterations]; + rndValues = new int[iterations]; + for (int i = 0; i < iterations; i++) { + rndValues[i] = valueRnd.nextInt(); + rndKeys[i] = keyRnd.nextInt(); + } + + } + + /** + * Test of put method, of class IntIntHashMap. + */ + @Test + public void testPutRemove() { + + final IntIntHashMap intmap = new IntIntHashMap(); + final HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(); + + // put + for (int i = 0; i < iterations; i++) { + intmap.put(rndKeys[i], rndValues[i]); + + assertTrue(intmap.containsValue(rndValues[i])); + assertTrue(intmap.containsKey(rndKeys[i])); + } + + for (int i = 0; i < iterations; i++) { + map.put(rndKeys[i], rndValues[i]); + } + + assertEquals(map.size(), intmap.size()); + + for (Entry<Integer, Integer> entry : map.entrySet()) { + assertTrue(intmap.containsKey(entry.getKey())); + assertTrue(intmap.containsValue(entry.getValue())); + } + + int i = 0; + for (Entry<Integer, Integer> entry : map.entrySet()) { + assertEquals((int)entry.getValue(), intmap.remove(entry.getKey())); + assertEquals(map.size() - i - 1, intmap.size()); + i++; + } + + } + + @Test + public void iteratorTest() { + + final IntIntHashMap intmap = new IntIntHashMap(iterations); + + for (int i = 0; i < iterations; i++) { + intmap.put(rndKeys[i], rndValues[i]); + } + + Iterator iterator = intmap.iterator(); + assertNotNull(iterator); + assertTrue(iterator.hasNext()); + + int n = 0; + while (iterator.hasNext()) { + IntIntHashMap.Entry entry = (IntIntHashMap.Entry)iterator.next(); + assertNotNull(entry); + n++; + } + assertEquals(intmap.size(), n); + +// out.println(intmap); + + } + + @Test + public void benchmark() { + + // simple benchmark + final IntIntHashMap intmap = new IntIntHashMap(1024); + final HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(1024); + + out.println(intmap.getClass().getName()+" vs "+map.getClass().getName()); + + out.println("put"); + long time = nanoTime(); + for (int i = 0; i < iterations; i++) { + intmap.put(rndKeys[i], rndValues[i]); + } + long intmapPutTime = (nanoTime() - time); + out.println(" iimap: " + intmapPutTime/1000000.0f+"ms"); + + + time = nanoTime(); + for (int i = 0; i < iterations; i++) { + map.put(rndKeys[i], rndValues[i]); + } + long mapPutTime = (nanoTime() - time); + out.println(" map: " + mapPutTime/1000000.0f+"ms"); + + + System.out.println(); + System.out.println("get"); + long intmapGetTime = (nanoTime() - time); + out.println(" iimap: " + intmapGetTime/1000000.0f+"ms"); + for (int i = 0; i < iterations; i++) { + intmap.get(rndValues[i]); + } + + long mapGetTime = (nanoTime() - time); + out.println(" map: " + mapGetTime/1000000.0f+"ms"); + for (int i = 0; i < iterations; i++) { + map.get(rndValues[i]); + } + + + out.println(); + out.println("remove"); + long intmapRemoveTime = (nanoTime() - time); + out.println(" iimap: " + intmapRemoveTime/1000000.0f+"ms"); + for (int i = 0; i < iterations; i++) { + intmap.remove(rndValues[i]); + } + + long mapRemoveTime = (nanoTime() - time); + out.println(" map: " + mapRemoveTime/1000000.0f+"ms"); + for (int i = 0; i < iterations; i++) { + map.remove(rndValues[i]); + } + + assertTrue("'put' to slow", intmapPutTime <= mapPutTime); + assertTrue("'get' to slow", intmapGetTime <= mapGetTime); + assertTrue("'remove' to slow", intmapRemoveTime <= mapRemoveTime); + } + + +} diff --git a/src/junit/com/jogamp/common/util/LongIntHashMapTest.java b/src/junit/com/jogamp/common/util/LongIntHashMapTest.java new file mode 100644 index 0000000..b51211c --- /dev/null +++ b/src/junit/com/jogamp/common/util/LongIntHashMapTest.java @@ -0,0 +1,167 @@ +/** + * Created on Sunday, March 28 2010 21:01 + */ +package com.jogamp.common.util; + +import java.util.Iterator; +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.Random; +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.*; +import static java.lang.System.*; + +/** + * + * @author Michael Bien + * @author Simon Goller + */ +public class LongIntHashMapTest { + + private static int iterations; + private static long[] rndKeys; + private static int[] rndValues; + + @BeforeClass + public static void init() { + + iterations = 20000; + final int keySeed = 42; + final int valueSeed = 23; + + Random keyRnd = new Random(/*keySeed*/); + Random valueRnd = new Random(/*valueSeed*/); + + rndKeys = new long[iterations]; + rndValues = new int[iterations]; + for (int i = 0; i < iterations; i++) { + rndValues[i] = valueRnd.nextInt(); + rndKeys[i] = keyRnd.nextLong(); + } + + } + /** + * Test of put method, of class LongIntHashMap. + */ + @Test + public void testPutRemove() { + + final LongIntHashMap intmap = new LongIntHashMap(); + final HashMap<Long, Integer> map = new HashMap<Long, Integer>(); + + // put + for (int i = 0; i < iterations; i++) { + intmap.put(rndKeys[i], rndValues[i]); + + assertTrue(intmap.containsValue(rndValues[i])); + assertTrue(intmap.containsKey(rndKeys[i])); + } + + for (int i = 0; i < iterations; i++) { + map.put(rndKeys[i], rndValues[i]); + } + + assertEquals(map.size(), intmap.size()); + + for (Entry<Long, Integer> entry : map.entrySet()) { + assertTrue(intmap.containsKey(entry.getKey())); + assertTrue(intmap.containsValue(entry.getValue())); + } + + int i = 0; + for (Entry<Long, Integer> entry : map.entrySet()) { + assertEquals((int)entry.getValue(), intmap.remove(entry.getKey())); + assertEquals(map.size() - i - 1, intmap.size()); + i++; + } + + } + + @Test + public void iteratorTest() { + + final LongIntHashMap map = new LongIntHashMap(iterations); + + for (int i = 0; i < iterations; i++) { + map.put(rndKeys[i], rndValues[i]); + } + + Iterator iterator = map.iterator(); + assertNotNull(iterator); + assertTrue(iterator.hasNext()); + + int n = 0; + while (iterator.hasNext()) { + LongIntHashMap.Entry entry = (LongIntHashMap.Entry)iterator.next(); + assertNotNull(entry); + n++; + } + assertEquals(map.size(), n); + +// out.println(intmap); + + } + + @Test + public void benchmark() { + + // simple benchmark + final LongIntHashMap intmap = new LongIntHashMap(1024); + final HashMap<Long, Integer> map = new HashMap<Long, Integer>(1024); + + out.println(intmap.getClass().getName()+" vs "+map.getClass().getName()); + + out.println("put"); + long time = nanoTime(); + for (int i = 0; i < iterations; i++) { + intmap.put(rndKeys[i], rndValues[i]); + } + long intmapPutTime = (nanoTime() - time); + out.println(" iimap: " + intmapPutTime/1000000.0f+"ms"); + + + time = nanoTime(); + for (int i = 0; i < iterations; i++) { + map.put(rndKeys[i], rndValues[i]); + } + long mapPutTime = (nanoTime() - time); + out.println(" map: " + mapPutTime/1000000.0f+"ms"); + + + System.out.println(); + System.out.println("get"); + long intmapGetTime = (nanoTime() - time); + out.println(" iimap: " + intmapGetTime/1000000.0f+"ms"); + for (int i = 0; i < iterations; i++) { + intmap.get(rndValues[i]); + } + + long mapGetTime = (nanoTime() - time); + out.println(" map: " + mapGetTime/1000000.0f+"ms"); + for (int i = 0; i < iterations; i++) { + map.get(rndValues[i]); + } + + + out.println(); + out.println("remove"); + long intmapRemoveTime = (nanoTime() - time); + out.println(" iimap: " + intmapRemoveTime/1000000.0f+"ms"); + for (int i = 0; i < iterations; i++) { + intmap.remove(rndValues[i]); + } + + long mapRemoveTime = (nanoTime() - time); + out.println(" map: " + mapRemoveTime/1000000.0f+"ms"); + for (int i = 0; i < iterations; i++) { + map.remove(rndValues[i]); + } + + assertTrue("'put' to slow", intmapPutTime <= mapPutTime); + assertTrue("'get' to slow", intmapGetTime <= mapGetTime); + assertTrue("'remove' to slow", intmapRemoveTime <= mapRemoveTime); + } + + +} diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseTest1.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java index 5a5d17c..fec8e6d 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseTest1.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java @@ -58,7 +58,7 @@ import static com.jogamp.gluegen.test.junit.generation.BuildEnvironment.*; * @author Michael Bien * @author Sven Gothel */ -public class BaseTest1 { +public class BaseClass { /** * Verifies the existence and creation of the generated class. @@ -77,14 +77,14 @@ public class BaseTest1 { Object obj = clazzImpl.newInstance(); Assert.assertTrue("Not of type "+ifName, clazzIf.isAssignableFrom(obj.getClass())); - Assert.assertTrue("Not of type com.jogamp.gluegen.test.junit.generation.BindingTest1", (obj instanceof com.jogamp.gluegen.test.junit.generation.BindingTest1)); + Assert.assertTrue("Not of type com.jogamp.gluegen.test.junit.generation.Bindingtest1", (obj instanceof com.jogamp.gluegen.test.junit.generation.Bindingtest1)); } /** * Verifies if all generated method signatures are completed, * ie a compilation only coverage test without functional tests. */ - public void chapter__TestCoverageSignature(BindingTest1 binding) throws Exception { + public void chapter__TestCoverageSignature(Bindingtest1 binding) throws Exception { int i; long result; long context = 0; @@ -147,7 +147,7 @@ public class BaseTest1 { * This is a compilation (coverage) and runtime time (semantic) test. * This covers indirect primitive arrays and direct NIO buffers. */ - public void chapter03TestCoverageFunctionalityDirectNIOAndPrimitiveArray(BindingTest1 binding) throws Exception { + public void chapter03TestCoverageFunctionalityDirectNIOAndPrimitiveArray(Bindingtest1 binding) throws Exception { int i; long result; @@ -159,35 +159,35 @@ public class BaseTest1 { Int64Buffer bb2L = Int64Buffer.wrap(bb2); bb2L.put(0, 100); - IntBuffer ib1 = Buffers.newDirectByteBuffer(Buffers.SIZEOF_INT * BindingTest1.ARRAY_SIZE).asIntBuffer(); - for(i=0; i<BindingTest1.ARRAY_SIZE; i++) { + IntBuffer ib1 = Buffers.newDirectByteBuffer(Buffers.SIZEOF_INT * Bindingtest1.ARRAY_SIZE).asIntBuffer(); + for(i=0; i<Bindingtest1.ARRAY_SIZE; i++) { ib1.put(i, 1000); } - Int64Buffer lb1 = Int64Buffer.allocateDirect(BindingTest1.ARRAY_SIZE); - for(i=0; i<BindingTest1.ARRAY_SIZE; i++) { + Int64Buffer lb1 = Int64Buffer.allocateDirect(Bindingtest1.ARRAY_SIZE); + for(i=0; i<Bindingtest1.ARRAY_SIZE; i++) { lb1.put(i, 1000); } - Int64Buffer lb2 = Int64Buffer.allocateDirect(BindingTest1.ARRAY_SIZE); - for(i=0; i<BindingTest1.ARRAY_SIZE; i++) { + Int64Buffer lb2 = Int64Buffer.allocateDirect(Bindingtest1.ARRAY_SIZE); + for(i=0; i<Bindingtest1.ARRAY_SIZE; i++) { lb2.put(i, 10000); } - int[] iarray1 = new int[BindingTest1.ARRAY_SIZE]; + int[] iarray1 = new int[Bindingtest1.ARRAY_SIZE]; int iarray1_offset = 0; - for(i=0; i<BindingTest1.ARRAY_SIZE; i++) { + for(i=0; i<Bindingtest1.ARRAY_SIZE; i++) { iarray1[i]= 1000; } - long[] larray1 = new long[BindingTest1.ARRAY_SIZE]; + long[] larray1 = new long[Bindingtest1.ARRAY_SIZE]; int larray1_offset = 0; - for(i=0; i<BindingTest1.ARRAY_SIZE; i++) { + for(i=0; i<Bindingtest1.ARRAY_SIZE; i++) { larray1[i]= 1000; } - long[] larray2 = new long[BindingTest1.ARRAY_SIZE]; + long[] larray2 = new long[Bindingtest1.ARRAY_SIZE]; int larray2_offset = 0; - for(i=0; i<BindingTest1.ARRAY_SIZE; i++) { + for(i=0; i<Bindingtest1.ARRAY_SIZE; i++) { larray2[i]= 10000; } @@ -215,43 +215,43 @@ public class BaseTest1 { // Int64Buffer arrayTestFoo2 ( Int64Buffer ) { lb2.rewind(); - Int64Buffer lb3 = Int64Buffer.allocateDirect(BindingTest1.ARRAY_SIZE); + Int64Buffer lb3 = Int64Buffer.allocateDirect(Bindingtest1.ARRAY_SIZE); lb3.put(lb2); lb3.rewind(); lb2.rewind(); // System.out.println("lb3: "+lb3); - Assert.assertTrue("Wrong result: "+lb3.capacity(), BindingTest1.ARRAY_SIZE == lb3.capacity()); - Assert.assertTrue("Wrong result: "+lb3.remaining(), BindingTest1.ARRAY_SIZE == lb3.remaining()); + Assert.assertTrue("Wrong result: "+lb3.capacity(), Bindingtest1.ARRAY_SIZE == lb3.capacity()); + Assert.assertTrue("Wrong result: "+lb3.remaining(), Bindingtest1.ARRAY_SIZE == lb3.remaining()); Int64Buffer lbR = binding.arrayTestFoo2(lb3); // System.out.println("lbR: "+lbR); Assert.assertNotNull(lbR); - Assert.assertTrue("Wrong result: "+lb3.capacity(), BindingTest1.ARRAY_SIZE == lb3.capacity()); - Assert.assertTrue("Wrong result: "+lb3.remaining(), BindingTest1.ARRAY_SIZE == lb3.remaining()); - Assert.assertTrue("Wrong result: "+lbR.capacity(), BindingTest1.ARRAY_SIZE == lbR.capacity()); - Assert.assertTrue("Wrong result: "+lbR.remaining(), BindingTest1.ARRAY_SIZE == lbR.remaining()); + Assert.assertTrue("Wrong result: "+lb3.capacity(), Bindingtest1.ARRAY_SIZE == lb3.capacity()); + Assert.assertTrue("Wrong result: "+lb3.remaining(), Bindingtest1.ARRAY_SIZE == lb3.remaining()); + Assert.assertTrue("Wrong result: "+lbR.capacity(), Bindingtest1.ARRAY_SIZE == lbR.capacity()); + Assert.assertTrue("Wrong result: "+lbR.remaining(), Bindingtest1.ARRAY_SIZE == lbR.remaining()); int j=0; - for(j=0; j<BindingTest1.ARRAY_SIZE; j++) { + for(j=0; j<Bindingtest1.ARRAY_SIZE; j++) { Assert.assertTrue("Wrong result: s:"+lb3.get(j)+" d: "+lbR.get(j), 1+lb3.get(j)==lbR.get(j)); } } // Int64Buffer arrayTestFoo2 ( long[], int ) { - long[] larray3 = new long[BindingTest1.ARRAY_SIZE]; - for(i=0; i<BindingTest1.ARRAY_SIZE; i++) { + long[] larray3 = new long[Bindingtest1.ARRAY_SIZE]; + for(i=0; i<Bindingtest1.ARRAY_SIZE; i++) { larray3[i]= larray2[i]; } Int64Buffer lbR = binding.arrayTestFoo2(larray3, 0); Assert.assertNotNull(lbR); - Assert.assertTrue("Wrong result: "+lbR.capacity(), BindingTest1.ARRAY_SIZE == lbR.capacity()); - Assert.assertTrue("Wrong result: "+lbR.remaining(), BindingTest1.ARRAY_SIZE == lbR.remaining()); + Assert.assertTrue("Wrong result: "+lbR.capacity(), Bindingtest1.ARRAY_SIZE == lbR.capacity()); + Assert.assertTrue("Wrong result: "+lbR.remaining(), Bindingtest1.ARRAY_SIZE == lbR.remaining()); int j=0; - for(j=0; j<BindingTest1.ARRAY_SIZE; j++) { + for(j=0; j<Bindingtest1.ARRAY_SIZE; j++) { Assert.assertTrue("Wrong result: s:"+larray3[j]+" d: "+lbR.get(j), 1+larray3[j]==lbR.get(j)); } } @@ -260,31 +260,31 @@ public class BaseTest1 { // PointerBuffer arrayTestFoo3PtrPtr(PointerBuffer) { lb2.rewind(); - Int64Buffer lb3 = Int64Buffer.allocateDirect(BindingTest1.ARRAY_SIZE*BindingTest1.ARRAY_SIZE); + Int64Buffer lb3 = Int64Buffer.allocateDirect(Bindingtest1.ARRAY_SIZE*Bindingtest1.ARRAY_SIZE); int j; - for(j=0; j<BindingTest1.ARRAY_SIZE; j++) { + for(j=0; j<Bindingtest1.ARRAY_SIZE; j++) { lb3.put(lb2); lb2.rewind(); } lb3.rewind(); // System.out.println("lb3: "+lb3); - Assert.assertTrue("Wrong result: "+lb3.capacity(), BindingTest1.ARRAY_SIZE*BindingTest1.ARRAY_SIZE == lb3.capacity()); - Assert.assertTrue("Wrong result: "+lb3.remaining(), BindingTest1.ARRAY_SIZE*BindingTest1.ARRAY_SIZE == lb3.remaining()); + Assert.assertTrue("Wrong result: "+lb3.capacity(), Bindingtest1.ARRAY_SIZE*Bindingtest1.ARRAY_SIZE == lb3.capacity()); + Assert.assertTrue("Wrong result: "+lb3.remaining(), Bindingtest1.ARRAY_SIZE*Bindingtest1.ARRAY_SIZE == lb3.remaining()); PointerBuffer pb = binding.arrayTestFoo3ArrayToPtrPtr(lb3); // System.out.println("pb: "+pb); - Assert.assertTrue("Wrong result: "+pb.capacity(), BindingTest1.ARRAY_SIZE == pb.capacity()); - Assert.assertTrue("Wrong result: "+pb.remaining(), BindingTest1.ARRAY_SIZE == pb.remaining()); + Assert.assertTrue("Wrong result: "+pb.capacity(), Bindingtest1.ARRAY_SIZE == pb.capacity()); + Assert.assertTrue("Wrong result: "+pb.remaining(), Bindingtest1.ARRAY_SIZE == pb.remaining()); PointerBuffer pb2 = binding.arrayTestFoo3PtrPtr(pb); Assert.assertNotNull(pb2); - Assert.assertTrue("Wrong result: "+pb2.capacity(), BindingTest1.ARRAY_SIZE == pb2.capacity()); - Assert.assertTrue("Wrong result: "+pb2.remaining(), BindingTest1.ARRAY_SIZE == pb2.remaining()); - for(j=0; j<BindingTest1.ARRAY_SIZE*BindingTest1.ARRAY_SIZE; j++) { - Assert.assertTrue("Wrong result: s:"+lb2.get(j%BindingTest1.ARRAY_SIZE)+" d: "+lb3.get(j), - 1+lb2.get(j%BindingTest1.ARRAY_SIZE)==lb3.get(j)); + Assert.assertTrue("Wrong result: "+pb2.capacity(), Bindingtest1.ARRAY_SIZE == pb2.capacity()); + Assert.assertTrue("Wrong result: "+pb2.remaining(), Bindingtest1.ARRAY_SIZE == pb2.remaining()); + for(j=0; j<Bindingtest1.ARRAY_SIZE*Bindingtest1.ARRAY_SIZE; j++) { + Assert.assertTrue("Wrong result: s:"+lb2.get(j%Bindingtest1.ARRAY_SIZE)+" d: "+lb3.get(j), + 1+lb2.get(j%Bindingtest1.ARRAY_SIZE)==lb3.get(j)); } } @@ -292,10 +292,10 @@ public class BaseTest1 { // " " // PointerBuffer arrayTestFoo3PtrPtr(PointerBuffer) { - PointerBuffer pb = PointerBuffer.allocateDirect(BindingTest1.ARRAY_SIZE); + PointerBuffer pb = PointerBuffer.allocateDirect(Bindingtest1.ARRAY_SIZE); int j; - for(j=0; j<BindingTest1.ARRAY_SIZE; j++) { - Int64Buffer lb3 = Int64Buffer.allocateDirect(BindingTest1.ARRAY_SIZE); + for(j=0; j<Bindingtest1.ARRAY_SIZE; j++) { + Int64Buffer lb3 = Int64Buffer.allocateDirect(Bindingtest1.ARRAY_SIZE); lb3.put(lb2); lb2.rewind(); lb3.rewind(); @@ -305,20 +305,20 @@ public class BaseTest1 { pb.rewind(); // System.out.println("lb3: "+lb3); - Assert.assertTrue("Wrong result: "+pb.capacity(), BindingTest1.ARRAY_SIZE == pb.capacity()); - Assert.assertTrue("Wrong result: "+pb.remaining(), BindingTest1.ARRAY_SIZE == pb.remaining()); + Assert.assertTrue("Wrong result: "+pb.capacity(), Bindingtest1.ARRAY_SIZE == pb.capacity()); + Assert.assertTrue("Wrong result: "+pb.remaining(), Bindingtest1.ARRAY_SIZE == pb.remaining()); Assert.assertNotNull(pb.getReferencedBuffer(0)); Assert.assertTrue("Wrong result: "+pb.getReferencedBuffer(0)+" != "+lb2.getBuffer(), pb.getReferencedBuffer(0).equals(lb2.getBuffer())); PointerBuffer pb2 = binding.arrayTestFoo3PtrPtr(pb); Assert.assertNotNull(pb2); - Assert.assertTrue("Wrong result: "+pb2.capacity(), BindingTest1.ARRAY_SIZE == pb2.capacity()); - Assert.assertTrue("Wrong result: "+pb2.remaining(), BindingTest1.ARRAY_SIZE == pb2.remaining()); - for(j=0; j<BindingTest1.ARRAY_SIZE; j++) { + Assert.assertTrue("Wrong result: "+pb2.capacity(), Bindingtest1.ARRAY_SIZE == pb2.capacity()); + Assert.assertTrue("Wrong result: "+pb2.remaining(), Bindingtest1.ARRAY_SIZE == pb2.remaining()); + for(j=0; j<Bindingtest1.ARRAY_SIZE; j++) { ByteBuffer bb = (ByteBuffer) pb.getReferencedBuffer(j); Int64Buffer i64b = Int64Buffer.wrap(bb); - for(i=0; i<BindingTest1.ARRAY_SIZE; i++) { + for(i=0; i<Bindingtest1.ARRAY_SIZE; i++) { Assert.assertTrue("Wrong result: ["+j+"]["+i+"] s:"+lb2.get(i)+" d: "+i64b.get(i), 1+lb2.get(i)==i64b.get(i)); } } @@ -378,8 +378,8 @@ public class BaseTest1 { { long cfg_base = 0xAABBCCDD11223344L; - PointerBuffer pb = PointerBuffer.allocateDirect(BindingTest1.ARRAY_SIZE); - for(i=0; i<BindingTest1.ARRAY_SIZE; i++) { + PointerBuffer pb = PointerBuffer.allocateDirect(Bindingtest1.ARRAY_SIZE); + for(i=0; i<Bindingtest1.ARRAY_SIZE; i++) { long cfg_native; if(Platform.is32Bit()) { cfg_native = (cfg_base+i) & 0x00000000FFFFFFFFL; // umask 1st 32bit @@ -395,9 +395,9 @@ public class BaseTest1 { } pb.rewind(); PointerBuffer pb2 = binding.typeTestAnonPointer(pb); - Assert.assertTrue("Wrong result: "+pb2.capacity(), BindingTest1.ARRAY_SIZE == pb2.capacity()); - Assert.assertTrue("Wrong result: "+pb2.remaining(), BindingTest1.ARRAY_SIZE == pb2.remaining()); - for(i=0; i<BindingTest1.ARRAY_SIZE; i++) { + Assert.assertTrue("Wrong result: "+pb2.capacity(), Bindingtest1.ARRAY_SIZE == pb2.capacity()); + Assert.assertTrue("Wrong result: "+pb2.remaining(), Bindingtest1.ARRAY_SIZE == pb2.remaining()); + for(i=0; i<Bindingtest1.ARRAY_SIZE; i++) { Assert.assertTrue("Wrong result: 0x"+Long.toHexString(pb.get(i))+"+1 != 0x"+Long.toHexString(pb2.get(i)), (pb.get(i)+1)==pb2.get(i)); } } @@ -406,7 +406,7 @@ public class BaseTest1 { /** * This covers indirect primitive arrays and indirect NIO buffers. */ - public void chapter04TestSomeFunctionsAllIndirect(BindingTest1 binding) throws Exception { + public void chapter04TestSomeFunctionsAllIndirect(Bindingtest1 binding) throws Exception { int i; long result; diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/BindingJNILibLoader.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BindingJNILibLoader.java index 8d0093c..9cfbef0 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/BindingJNILibLoader.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BindingJNILibLoader.java @@ -37,19 +37,19 @@ import java.security.*; public class BindingJNILibLoader extends JNILibLoaderBase { - public static void loadBindingTest1p1() { + public static void loadBindingtest1p1() { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - loadLibrary("BindingTest1p1", null, true); + loadLibrary("Bindingtest1p1", null, true); return null; } }); } - public static void loadBindingTest1p2() { + public static void loadBindingtest1p2() { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - loadLibrary("BindingTest1p2", null, true); + loadLibrary("Bindingtest1p2", null, true); return null; } }); diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java index 814fc75..d4f8600 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java @@ -32,7 +32,7 @@ package com.jogamp.gluegen.test.junit.generation; -import com.jogamp.gluegen.test.junit.generation.impl.BindingTest1p1Impl; +import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest1p1Impl; import com.jogamp.common.nio.Buffers; import com.jogamp.common.nio.PointerBuffer; @@ -58,14 +58,14 @@ import static com.jogamp.gluegen.test.junit.generation.BuildEnvironment.*; * @author Michael Bien * @author Sven Gothel */ -public class Test1p1JavaEmitter extends BaseTest1 { +public class Test1p1JavaEmitter extends BaseClass { /** * Verifies loading of the new library. */ @Test public void chapter01TestLoadLibrary() throws Exception { - BindingJNILibLoader.loadBindingTest1p1(); + BindingJNILibLoader.loadBindingtest1p1(); } /** @@ -73,7 +73,7 @@ public class Test1p1JavaEmitter extends BaseTest1 { */ @Test public void chapter02TestClassExist() throws Exception { - testClassExist("Test1p1"); + testClassExist("test1p1"); } /** @@ -81,7 +81,7 @@ public class Test1p1JavaEmitter extends BaseTest1 { * ie a compilation only coverage test without functional tests. */ public void chapter__TestCoverageSignature() throws Exception { - chapter__TestCoverageSignature(new BindingTest1p1Impl()); + chapter__TestCoverageSignature(new Bindingtest1p1Impl()); } /** @@ -92,7 +92,7 @@ public class Test1p1JavaEmitter extends BaseTest1 { */ @Test public void chapter03TestCoverageFunctionalityDirectNIOAndPrimitiveArray() throws Exception { - chapter03TestCoverageFunctionalityDirectNIOAndPrimitiveArray(new BindingTest1p1Impl()); + chapter03TestCoverageFunctionalityDirectNIOAndPrimitiveArray(new Bindingtest1p1Impl()); } /** @@ -100,7 +100,7 @@ public class Test1p1JavaEmitter extends BaseTest1 { */ @Test public void chapter04TestSomeFunctionsAllIndirect() throws Exception { - chapter04TestSomeFunctionsAllIndirect(new BindingTest1p1Impl()); + chapter04TestSomeFunctionsAllIndirect(new Bindingtest1p1Impl()); } } diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java index a299799..1bfc6d0 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java @@ -32,7 +32,7 @@ package com.jogamp.gluegen.test.junit.generation; -import com.jogamp.gluegen.test.junit.generation.impl.BindingTest1p2Impl; +import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest1p2Impl; import com.jogamp.common.os.NativeLibrary; import com.jogamp.common.os.DynamicLookupHelper; @@ -46,7 +46,7 @@ import static com.jogamp.gluegen.test.junit.generation.BuildEnvironment.*; * @author Michael Bien * @author Sven Gothel */ -public class Test1p2ProcAddressEmitter extends BaseTest1 { +public class Test1p2ProcAddressEmitter extends BaseClass { DynamicLookupHelper dynamicLookupHelper; @@ -55,11 +55,11 @@ public class Test1p2ProcAddressEmitter extends BaseTest1 { */ @Test public void chapter01TestLoadLibrary() throws Exception { - BindingJNILibLoader.loadBindingTest1p2(); + BindingJNILibLoader.loadBindingtest1p2(); dynamicLookupHelper = NativeLibrary.open("test1", getClass().getClassLoader(), true); Assert.assertNotNull("NativeLibrary.open(test1) failed", dynamicLookupHelper); - BindingTest1p2Impl.resetProcAddressTable(dynamicLookupHelper); + Bindingtest1p2Impl.resetProcAddressTable(dynamicLookupHelper); } /** @@ -67,7 +67,7 @@ public class Test1p2ProcAddressEmitter extends BaseTest1 { */ @Test public void chapter02TestClassExist() throws Exception { - testClassExist("Test1p2"); + testClassExist("test1p2"); } /** @@ -75,7 +75,7 @@ public class Test1p2ProcAddressEmitter extends BaseTest1 { * ie a compilation only coverage test without functional tests. */ public void chapter__TestCoverageSignature() throws Exception { - chapter__TestCoverageSignature(new BindingTest1p2Impl()); + chapter__TestCoverageSignature(new Bindingtest1p2Impl()); } /** @@ -86,7 +86,7 @@ public class Test1p2ProcAddressEmitter extends BaseTest1 { */ @Test public void chapter03TestCoverageFunctionalityDirectNIOAndPrimitiveArray() throws Exception { - chapter03TestCoverageFunctionalityDirectNIOAndPrimitiveArray(new BindingTest1p2Impl()); + chapter03TestCoverageFunctionalityDirectNIOAndPrimitiveArray(new Bindingtest1p2Impl()); } /** @@ -94,7 +94,7 @@ public class Test1p2ProcAddressEmitter extends BaseTest1 { */ @Test public void chapter04TestSomeFunctionsAllIndirect() throws Exception { - chapter04TestSomeFunctionsAllIndirect(new BindingTest1p2Impl()); + chapter04TestSomeFunctionsAllIndirect(new Bindingtest1p2Impl()); } public static void main(String[] args) { diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1-gluegen.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-gluegen.cfg index 971419e..bc8840a 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1-gluegen.cfg +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-gluegen.cfg @@ -1,5 +1,5 @@ Package com.jogamp.gluegen.test.junit.generation -JavaClass BindingTest1 +JavaClass Bindingtest1 Style InterfaceOnly JavaOutputDir classes diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1p1-gluegen.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test1p1-gluegen.cfg index 2062512..6ef171b 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1p1-gluegen.cfg +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1p1-gluegen.cfg @@ -1,14 +1,14 @@ Package com.jogamp.gluegen.test.junit.generation -JavaClass BindingTest1p1 +JavaClass Bindingtest1p1 Style InterfaceAndImpl JavaOutputDir classes NativeOutputDir native -Extends BindingTest1p1 BindingTest1 +Extends Bindingtest1p1 Bindingtest1 Include test1-common.cfg -Import com.jogamp.gluegen.test.junit.generation.BindingTest1 -Import com.jogamp.gluegen.test.junit.generation.BindingTest1p1 +Import com.jogamp.gluegen.test.junit.generation.Bindingtest1 +Import com.jogamp.gluegen.test.junit.generation.Bindingtest1p1 diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1p2-gluegen.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test1p2-gluegen.cfg index d8ef816..649499d 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1p2-gluegen.cfg +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1p2-gluegen.cfg @@ -1,14 +1,14 @@ Package com.jogamp.gluegen.test.junit.generation -JavaClass BindingTest1p2 +JavaClass Bindingtest1p2 Style InterfaceAndImpl JavaOutputDir classes NativeOutputDir native -Extends BindingTest1p2 BindingTest1 +Extends Bindingtest1p2 Bindingtest1 # Use a ProcAddressTable so we dynamically look up the routines EmitProcAddressTable true -ProcAddressTableClassName BindingTest1p2ProcAddressTable +ProcAddressTableClassName Bindingtest1p2ProcAddressTable GetProcAddressTableExpr _table ProcAddressNameExpr PFN $UPPERCASE({0}) PROC @@ -24,12 +24,12 @@ LocalProcAddressCallingConvention __ALL__ MYAPIENTRY Include test1-common.cfg Include ../../../../../../../../make/config/intptr.cfg -Import com.jogamp.gluegen.test.junit.generation.BindingTest1 -Import com.jogamp.gluegen.test.junit.generation.BindingTest1p2 +Import com.jogamp.gluegen.test.junit.generation.Bindingtest1 +Import com.jogamp.gluegen.test.junit.generation.Bindingtest1p2 -CustomJavaCode BindingTest1p2Impl private static BindingTest1p2ProcAddressTable _table = new BindingTest1p2ProcAddressTable(); -CustomJavaCode BindingTest1p2Impl public static void resetProcAddressTable(DynamicLookupHelper lookup) { -CustomJavaCode BindingTest1p2Impl _table.reset(lookup); -CustomJavaCode BindingTest1p2Impl } +CustomJavaCode Bindingtest1p2Impl private static Bindingtest1p2ProcAddressTable _table = new Bindingtest1p2ProcAddressTable(); +CustomJavaCode Bindingtest1p2Impl public static void resetProcAddressTable(DynamicLookupHelper lookup) { +CustomJavaCode Bindingtest1p2Impl _table.reset(lookup); +CustomJavaCode Bindingtest1p2Impl } |