29package com.jogamp.gluegen.test.junit.generation;
31import java.nio.IntBuffer;
33import com.jogamp.common.nio.Buffers;
34import com.jogamp.common.nio.ElementBuffer;
36import org.junit.Assert;
46 public void chapter01(
final Bindingtest2 bt2)
throws Exception {
47 Assert.assertEquals(
false, T2_PointerStorage.usesNativeCode());
49 final T2_PointerStorage store = bt2.createT2PointerStorage();
51 final long[] int32PtrArray = store.getInt32PtrArray(0,
new long[10], 0, 10);
53 Assert.assertEquals(10, int32PtrArray.length);
54 System.err.print(
"int32PtrArray[10] = { ");
55 for(
int i=0; i<int32PtrArray.length; ++i) {
56 Assert.assertNotEquals(0, int32PtrArray[i]);
59 Assert.assertEquals(1, ib.limit());
60 final int value = ib.get(0);
61 Assert.assertEquals(i, value);
62 System.err.print(value+
", ");
64 System.err.println(
"}");
66 Assert.assertEquals(0, store.getInt32PtrPtrElemCount());
67 store.setInt32PtrPtr(
false, int32PtrArray, 3, 0, 7);
68 store.setInt32PtrPtr(
true, int32PtrArray, 8, 3, 2);
69 store.setInt32PtrPtr(
true, int32PtrArray, 0, 5, 2);
70 final long[] int32PtrPtr = store.getInt32PtrPtr(0,
new long[7], 0, 7);
72 System.err.print(
"int32PtrPtr[7] = { ");
73 for(
int i=0; i<int32PtrPtr.length; ++i) {
74 Assert.assertNotEquals(0, int32PtrPtr[i]);
77 Assert.assertEquals(1, ib.limit());
78 final int value = ib.get(0);
81 case 0: exp = 3;
break;
82 case 1: exp = 4;
break;
83 case 2: exp = 5;
break;
84 case 3: exp = 8;
break;
85 case 4: exp = 9;
break;
86 case 5: exp = 0;
break;
87 case 6: exp = 1;
break;
90 Assert.assertEquals(exp, value);
91 System.err.print(value+
", ");
93 System.err.println(
"}");
95 bt2.destroyT2PointerStorage(store);
Utility methods allowing easy java.nio.Buffer manipulations.
static final int SIZEOF_INT
Hardware independent container holding an array of linearly aligned elements, while its getDirectBuff...
final ByteBuffer getByteBuffer()
Returns the ByteBuffer, i.e.
static ElementBuffer derefPointer(final int elementSize, final long aptr, final int elemCount)
Test Bindingtest2 with T2_PointerStorage instance and pointer pointer.
void chapter01(final Bindingtest2 bt2)
Test Bindingtest2 with T2_PointerStorage instance and pointer pointer.