diff options
author | Sven Gothel <[email protected]> | 2011-02-13 14:10:11 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-02-13 14:10:11 +0100 |
commit | ed080420e9584a881ea3c50dc63b68c65bf0e67d (patch) | |
tree | 0f705724944ecd4ea16151017484304728a92b68 /src/junit/com/jogamp/gluegen/test | |
parent | f92907da4946b29ca3b0132743f1cf0b7d59e080 (diff) | |
parent | 092467f806af49846e3f7beb1f44bbbf4ff02891 (diff) |
Merge remote branch 'mbien/master'
Diffstat (limited to 'src/junit/com/jogamp/gluegen/test')
-rw-r--r-- | src/junit/com/jogamp/gluegen/test/junit/runtime/TestPointerBufferEndian.java | 53 | ||||
-rw-r--r-- | src/junit/com/jogamp/gluegen/test/junit/runtime/TestStructAccessorEndian.java | 43 |
2 files changed, 0 insertions, 96 deletions
diff --git a/src/junit/com/jogamp/gluegen/test/junit/runtime/TestPointerBufferEndian.java b/src/junit/com/jogamp/gluegen/test/junit/runtime/TestPointerBufferEndian.java deleted file mode 100644 index afe3405..0000000 --- a/src/junit/com/jogamp/gluegen/test/junit/runtime/TestPointerBufferEndian.java +++ /dev/null @@ -1,53 +0,0 @@ - -package com.jogamp.gluegen.test.junit.runtime; - -import com.jogamp.common.nio.*; -import com.jogamp.common.os.*; - -import java.nio.*; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import static java.lang.System.*; - -public class TestPointerBufferEndian { - - protected void testImpl (boolean direct) { - int bitsPtr = Platform.getPointerSizeInBits(); - String bitsProp = System.getProperty("sun.arch.data.model"); - String os = System.getProperty("os.name"); - String cpu = System.getProperty("os.arch"); - System.out.println("OS: <"+os+"> CPU: <"+cpu+"> Bits: <"+bitsPtr+"/"+bitsProp+">"); - System.out.println("CPU is: "+ (Platform.is32Bit()?"32":"64") + " bit"); - System.out.println("Buffer is in: "+ (Platform.isLittleEndian()?"little":"big") + " endian"); - - long[] valuesSource = { 0x0123456789ABCDEFL, 0x8877665544332211L, 0xAFFEDEADBEEFAFFEL }; - long[] values32Bit = { 0x0000000089ABCDEFL, 0x0000000044332211L, 0x00000000BEEFAFFEL }; - - PointerBuffer ptr = direct ? PointerBuffer.allocateDirect(3) : PointerBuffer.allocate(valuesSource.length); - ptr.put(valuesSource, 0, valuesSource.length); - ptr.rewind(); - - int i=0; - while(ptr.hasRemaining()) { - long v = ptr.get() ; - long t = Platform.is32Bit() ? values32Bit[i] : valuesSource[i]; - Assert.assertTrue("Value["+i+"] shall be 0x"+Long.toHexString(t)+", is: 0x"+Long.toHexString(v), t == v); - i++; - } - Assert.assertTrue("iterator "+i+" != "+valuesSource.length, i==valuesSource.length); - } - - @Test - public void testDirect () { - testImpl (true); - } - - @Test - public void testIndirect () { - testImpl (false); - } -} diff --git a/src/junit/com/jogamp/gluegen/test/junit/runtime/TestStructAccessorEndian.java b/src/junit/com/jogamp/gluegen/test/junit/runtime/TestStructAccessorEndian.java deleted file mode 100644 index 264c86b..0000000 --- a/src/junit/com/jogamp/gluegen/test/junit/runtime/TestStructAccessorEndian.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.jogamp.gluegen.test.junit.runtime; - -import com.jogamp.common.nio.*; -import com.jogamp.common.os.*; - -import java.nio.*; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import static java.lang.System.*; - -public class TestStructAccessorEndian { - - @Test - public void testStructAccessorEndian1 () { - int bitsPtr = Platform.getPointerSizeInBits(); - String bitsProp = System.getProperty("sun.arch.data.model"); - String os = System.getProperty("os.name"); - String cpu = System.getProperty("os.arch"); - System.out.println("OS: <"+os+"> CPU: <"+cpu+"> Bits: <"+bitsPtr+"/"+bitsProp+">"); - System.out.println("CPU is: "+ (Platform.is32Bit()?"32":"64") + " bit"); - System.out.println("Buffer is in: "+ (Platform.isLittleEndian()?"little":"big") + " endian"); - - long[] valuesSource = { 0x0123456789ABCDEFL, 0x8877665544332211L, 0xAFFEDEADBEEFAFFEL }; - ByteBuffer tst = Buffers.newDirectByteBuffer(Buffers.SIZEOF_LONG * valuesSource.length); - StructAccessor acc = new StructAccessor(tst); - - int i; - - for(i=0; i<valuesSource.length; i++) { - acc.setLongAt(i, valuesSource[i]); - } - - for(i=0; i<valuesSource.length; i++) { - long v = acc.getLongAt(i); - long t = valuesSource[i]; - Assert.assertTrue("Value["+i+"] shall be 0x"+Long.toHexString(t)+", is: 0x"+Long.toHexString(v), t == v); - } - } -} |