diff options
Diffstat (limited to 'src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java')
-rw-r--r-- | src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java b/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java index 62eccf0..967122e 100644 --- a/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java +++ b/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java @@ -5,6 +5,8 @@ import static java.lang.System.out; import java.io.IOException; import java.nio.ByteBuffer; +import jogamp.common.os.PlatformPropsImpl; + import org.junit.Assert; import org.junit.Test; @@ -20,16 +22,16 @@ public class TestStructAccessorEndian extends JunitTracer { @Test public void testStructAccessorEndian1 () { - final MachineDescription machine = Platform.getMachineDescription(); - int bitsPtr = machine.pointerSizeInBytes() * 8; - String bitsProp = System.getProperty("sun.arch.data.model"); - out.println("OS: <"+Platform.OS+"> CPU: <"+Platform.ARCH+"> Bits: <"+bitsPtr+"/"+bitsProp+">"); + final MachineDescription machine = Platform.getMachineDescription(); + final int bitsPtr = machine.pointerSizeInBytes() * 8; + final String bitsProp = System.getProperty("sun.arch.data.model"); + out.println("OS: <"+PlatformPropsImpl.OS+"> CPU: <"+PlatformPropsImpl.ARCH+"> Bits: <"+bitsPtr+"/"+bitsProp+">"); out.println("CPU is: "+ (Platform.is32Bit()?"32":"64") + " bit"); out.println(machine.toString()); - long[] valuesSource = { 0x0123456789ABCDEFL, 0x8877665544332211L, 0xAFFEDEADBEEFAFFEL }; - ByteBuffer tst = Buffers.newDirectByteBuffer(Buffers.SIZEOF_LONG * valuesSource.length); - StructAccessor acc = new StructAccessor(tst); + final long[] valuesSource = { 0x0123456789ABCDEFL, 0x8877665544332211L, 0xAFFEDEADBEEFAFFEL }; + final ByteBuffer tst = Buffers.newDirectByteBuffer(Buffers.SIZEOF_LONG * valuesSource.length); + final StructAccessor acc = new StructAccessor(tst); int i; @@ -38,15 +40,15 @@ public class TestStructAccessorEndian extends JunitTracer { } for(i=0; i<valuesSource.length; i++) { - long v = acc.getLongAt(i*8); - long t = valuesSource[i]; + final long v = acc.getLongAt(i*8); + final long t = valuesSource[i]; Assert.assertTrue("Value["+i+"] shall be 0x"+Long.toHexString(t)+", is: 0x"+Long.toHexString(v), t == v); } } - - public static void main(String args[]) throws IOException { - String tstname = TestStructAccessorEndian.class.getName(); + + public static void main(final String args[]) throws IOException { + final String tstname = TestStructAccessorEndian.class.getName(); org.junit.runner.JUnitCore.main(tstname); } - + } |