summaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp/common/nio
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-03 16:06:47 +0200
committerSven Gothel <[email protected]>2014-07-03 16:06:47 +0200
commitdf9ff7f340a5ab4e07efc613f5f264eeae63d4c7 (patch)
tree239ae276b82024b140428e6c0fe5d739fdd686a4 /src/junit/com/jogamp/common/nio
parenteb47aaba63e3b1bf55f274a0f338f1010a017ae4 (diff)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) - Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines
Diffstat (limited to 'src/junit/com/jogamp/common/nio')
-rw-r--r--src/junit/com/jogamp/common/nio/BuffersTest.java34
-rw-r--r--src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java136
-rw-r--r--src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java40
-rw-r--r--src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java28
-rw-r--r--src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java28
5 files changed, 135 insertions, 131 deletions
diff --git a/src/junit/com/jogamp/common/nio/BuffersTest.java b/src/junit/com/jogamp/common/nio/BuffersTest.java
index 9ad7823..68bd71f 100644
--- a/src/junit/com/jogamp/common/nio/BuffersTest.java
+++ b/src/junit/com/jogamp/common/nio/BuffersTest.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.
*/
-
+
/*
* Created on Sunday, July 04 2010 20:00
*/
@@ -49,45 +49,45 @@ public class BuffersTest extends JunitTracer {
@Test
public void slice() {
-
- IntBuffer buffer = Buffers.newDirectIntBuffer(6);
+
+ final IntBuffer buffer = Buffers.newDirectIntBuffer(6);
buffer.put(new int[]{1,2,3,4,5,6}).rewind();
- IntBuffer threefour = Buffers.slice(buffer, 2, 2);
+ final IntBuffer threefour = Buffers.slice(buffer, 2, 2);
assertEquals(3, threefour.get(0));
assertEquals(4, threefour.get(1));
assertEquals(2, threefour.capacity());
-
+
assertEquals(0, buffer.position());
assertEquals(6, buffer.limit());
- IntBuffer fourfivesix = Buffers.slice(buffer, 3, 3);
+ final IntBuffer fourfivesix = Buffers.slice(buffer, 3, 3);
assertEquals(4, fourfivesix.get(0));
assertEquals(5, fourfivesix.get(1));
assertEquals(6, fourfivesix.get(2));
assertEquals(3, fourfivesix.capacity());
-
+
assertEquals(0, buffer.position());
assertEquals(6, buffer.limit());
-
- IntBuffer onetwothree = Buffers.slice(buffer, 0, 3);
+
+ final IntBuffer onetwothree = Buffers.slice(buffer, 0, 3);
assertEquals(1, onetwothree.get(0));
assertEquals(2, onetwothree.get(1));
assertEquals(3, onetwothree.get(2));
assertEquals(3, onetwothree.capacity());
-
+
assertEquals(0, buffer.position());
assertEquals(6, buffer.limit());
-
+
// is it really sliced?
buffer.put(2, 42);
-
+
assertEquals(42, buffer.get(2));
assertEquals(42, onetwothree.get(2));
-
+
}
diff --git a/src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java b/src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java
index b0cd49e..b0f3cfb 100644
--- a/src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java
+++ b/src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -56,30 +56,30 @@ import org.junit.runners.MethodSorters;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class CachedBufferFactoryTest extends JunitTracer {
-
+
private final int BUFFERCOUNT = 120;
-
+
private static int[] sizes;
private static int[] values;
private static IntBuffer[] buffers;
-
+
@Before
public void setup() {
-
+
sizes = new int[BUFFERCOUNT];
values = new int[sizes.length];
buffers = new IntBuffer[sizes.length];
-
- Random rnd = new Random(7);
-
+
+ final Random rnd = new Random(7);
+
// setup
for (int i = 0; i < sizes.length; i++) {
sizes[i] = rnd.nextInt(80)+1;
values[i] = rnd.nextInt();
}
-
+
}
-
+
@After
public void teardown() {
sizes = null;
@@ -89,34 +89,34 @@ public class CachedBufferFactoryTest extends JunitTracer {
@Test
public void dynamicTest() {
-
- CachedBufferFactory factory = CachedBufferFactory.create(64);
-
+
+ final CachedBufferFactory factory = CachedBufferFactory.create(64);
+
// create
for (int i = 0; i < sizes.length; i++) {
buffers[i] = factory.newDirectIntBuffer(sizes[i]);
assertEquals(ByteOrder.nativeOrder(), buffers[i].order());
fill(buffers[i], values[i]);
}
-
+
// check
checkBuffers(buffers, sizes, values);
-
+
}
-
+
@Test
public void dynamicConcurrentTest() throws InterruptedException, ExecutionException {
-
+
final CachedBufferFactory factory = CachedBufferFactory.createSynchronized(24);
-
- List<Callable<Object>> callables = new ArrayList<Callable<Object>>();
-
+
+ final List<Callable<Object>> callables = new ArrayList<Callable<Object>>();
+
final CountDownLatch latch = new CountDownLatch(10);
-
+
// create
for (int i = 0; i < sizes.length; i++) {
final int n = i;
- Callable<Object> c = new Callable<Object>() {
+ final Callable<Object> c = new Callable<Object>() {
public Object call() throws Exception {
latch.countDown();
latch.await();
@@ -127,52 +127,52 @@ public class CachedBufferFactoryTest extends JunitTracer {
};
callables.add(c);
}
-
- ExecutorService dathVader = Executors.newFixedThreadPool(10);
+
+ final ExecutorService dathVader = Executors.newFixedThreadPool(10);
dathVader.invokeAll(callables);
-
+
dathVader.shutdown();
-
+
// check
checkBuffers(buffers, sizes, values);
-
+
}
- private void checkBuffers(IntBuffer[] buffers, int[] sizes, int[] values) {
+ private void checkBuffers(final IntBuffer[] buffers, final int[] sizes, final int[] values) {
for (int i = 0; i < buffers.length; i++) {
- IntBuffer buffer = buffers[i];
+ final IntBuffer buffer = buffers[i];
assertEquals(sizes[i], buffer.capacity());
assertEquals(0, buffer.position());
assertTrue(equals(buffer, values[i]));
}
}
-
+
@Test
public void staticTest() {
-
- CachedBufferFactory factory = CachedBufferFactory.create(10, true);
-
+
+ final CachedBufferFactory factory = CachedBufferFactory.create(10, true);
+
for (int i = 0; i < 5; i++) {
factory.newDirectByteBuffer(2);
}
-
+
try{
factory.newDirectByteBuffer(1);
fail();
- }catch (RuntimeException ex) {
+ }catch (final RuntimeException ex) {
// expected
}
-
+
}
-
- private void fill(IntBuffer buffer, int value) {
+
+ private void fill(final IntBuffer buffer, final int value) {
while(buffer.remaining() != 0)
buffer.put(value);
buffer.rewind();
}
-
- private boolean equals(IntBuffer buffer, int value) {
+
+ private boolean equals(final IntBuffer buffer, final int value) {
while(buffer.remaining() != 0) {
if(value != buffer.get())
return false;
@@ -181,37 +181,37 @@ public class CachedBufferFactoryTest extends JunitTracer {
buffer.rewind();
return true;
}
-
-
+
+
/* load testing */
-
+
private int size = 4;
- private int iterations = 10000;
-
+ private final int iterations = 10000;
+
// @Test
public Object loadTest() {
- CachedBufferFactory factory = CachedBufferFactory.create();
- ByteBuffer[] buffer = new ByteBuffer[iterations];
+ final CachedBufferFactory factory = CachedBufferFactory.create();
+ final ByteBuffer[] buffer = new ByteBuffer[iterations];
for (int i = 0; i < buffer.length; i++) {
buffer[i] = factory.newDirectByteBuffer(size);
}
return buffer;
}
-
+
// @Test
public Object referenceTest() {
- ByteBuffer[] buffer = new ByteBuffer[iterations];
+ final ByteBuffer[] buffer = new ByteBuffer[iterations];
for (int i = 0; i < buffer.length; i++) {
buffer[i] = Buffers.newDirectByteBuffer(size);
}
return buffer;
}
-
-
- public static void main(String[] args) {
-
+
+
+ public static void main(final String[] args) {
+
CachedBufferFactoryTest test = new CachedBufferFactoryTest();
-
+
out.print("warmup...");
Object obj = null;
for (int i = 0; i < 100; i++) {
@@ -220,33 +220,33 @@ public class CachedBufferFactoryTest extends JunitTracer {
gc();
}
out.println("done");
-
+
test = new CachedBufferFactoryTest();
gc();
-
+
for (int i = 0; i < 10; i++) {
-
+
out.println("allocation size: "+test.size);
-
+
long time = System.currentTimeMillis();
obj = test.referenceTest();
if(obj == null) return; // ref lock
-
+
out.println("reference: "+ (System.currentTimeMillis()-time));
gc();
-
+
time = currentTimeMillis();
obj = test.loadTest();
if(obj == null) return; // ref lock
-
+
out.println("factory: "+ (System.currentTimeMillis()-time));
-
+
gc();
-
+
test.size*=2;
}
-
+
}
-
+
}
diff --git a/src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java b/src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java
index 192a49e..61bbafa 100644
--- a/src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java
+++ b/src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.common.nio;
import java.io.IOException;
@@ -41,7 +41,7 @@ import org.junit.runners.MethodSorters;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBuffersFloatDoubleConversion extends JunitTracer {
- public static boolean cmpFloatArray(float[] d1, int d1_offset, float[] d2, int d2_offset, int len) {
+ public static boolean cmpFloatArray(final float[] d1, final int d1_offset, final float[] d2, final int d2_offset, final int len) {
if( d1.length - d1_offset < len) {
throw new RuntimeException("d1 too small len "+len+" > "+d1.length+" - "+d1_offset);
}
@@ -55,7 +55,7 @@ public class TestBuffersFloatDoubleConversion extends JunitTracer {
return ok;
}
- public static boolean cmpDoubleArray(double[] d1, int d1_offset, double[] d2, int d2_offset, int len) {
+ public static boolean cmpDoubleArray(final double[] d1, final int d1_offset, final double[] d2, final int d2_offset, final int len) {
if( d1.length - d1_offset < len) {
throw new RuntimeException("d1 too small len "+len+" > "+d1.length+" - "+d1_offset);
}
@@ -69,7 +69,7 @@ public class TestBuffersFloatDoubleConversion extends JunitTracer {
return ok;
}
- public static void incrFloatArray(float[] data, int offset, int len) {
+ public static void incrFloatArray(final float[] data, final int offset, final int len) {
if( data.length - offset < len) {
throw new RuntimeException("data too small len "+len+" > "+data.length+" - "+offset);
}
@@ -78,7 +78,7 @@ public class TestBuffersFloatDoubleConversion extends JunitTracer {
}
}
- public static void incrDoubleArray(double[] data, int offset, int len) {
+ public static void incrDoubleArray(final double[] data, final int offset, final int len) {
if( data.length - offset < len) {
throw new RuntimeException("data too small len "+len+" > "+data.length+" - "+offset);
}
@@ -87,7 +87,7 @@ public class TestBuffersFloatDoubleConversion extends JunitTracer {
}
}
- public static void setFloatArray(float[] data, int offset, int len) {
+ public static void setFloatArray(final float[] data, final int offset, final int len) {
if( data.length - offset < len) {
throw new RuntimeException("data too small len "+len+" > "+data.length+" - "+offset);
}
@@ -96,7 +96,7 @@ public class TestBuffersFloatDoubleConversion extends JunitTracer {
}
}
- public static void setDoubleArray(double[] data, int offset, int len) {
+ public static void setDoubleArray(final double[] data, final int offset, final int len) {
if( data.length - offset < len) {
throw new RuntimeException("data too small len "+len+" > "+data.length+" - "+offset);
}
@@ -105,8 +105,8 @@ public class TestBuffersFloatDoubleConversion extends JunitTracer {
}
}
- public static void doItDoubleArray01(double[] data, int offset, int len) {
- float[] f_data = Buffers.getFloatArray(data, offset, null, 0, len);
+ public static void doItDoubleArray01(final double[] data, final int offset, final int len) {
+ final float[] f_data = Buffers.getFloatArray(data, offset, null, 0, len);
incrFloatArray(f_data, 0, len);
Buffers.getDoubleArray(f_data, 0, data, offset, len);
}
@@ -117,23 +117,23 @@ public class TestBuffersFloatDoubleConversion extends JunitTracer {
final int len = 20;
// reference 1
- float[] fa_ref = new float[100];
+ final float[] fa_ref = new float[100];
setFloatArray(fa_ref, offset, len);
incrFloatArray(fa_ref, offset, len);
// reference 2
- double[] da_ref = new double[100];
+ final double[] da_ref = new double[100];
setDoubleArray(da_ref, offset, len);
incrDoubleArray(da_ref, offset, len);
// test 1: forth and back .. double -> float -> double
{
- double[] da1 = new double[100];
+ final double[] da1 = new double[100];
setDoubleArray(da1, offset, len);
incrDoubleArray(da1, offset, len);
// conv_forth: double[offset..len] -> float[0..len]
- float[] f_da1 = Buffers.getFloatArray(da1, offset, null, 0, len);
+ final float[] f_da1 = Buffers.getFloatArray(da1, offset, null, 0, len);
Assert.assertTrue(cmpFloatArray(fa_ref, offset, f_da1, 0, len));
// conv_back: float[0..len] -> double[offset..len]
@@ -143,7 +143,7 @@ public class TestBuffersFloatDoubleConversion extends JunitTracer {
// test 2: forth, incr, back .. double -> float -> incr -> double
{
- double[] da1 = new double[100];
+ final double[] da1 = new double[100];
setDoubleArray(da1, offset, len);
doItDoubleArray01(da1, offset, len);
@@ -151,8 +151,8 @@ public class TestBuffersFloatDoubleConversion extends JunitTracer {
}
}
- public static void main(String args[]) throws IOException {
- String tstname = TestBuffersFloatDoubleConversion.class.getName();
+ public static void main(final String args[]) throws IOException {
+ final String tstname = TestBuffersFloatDoubleConversion.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
diff --git a/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java b/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java
index 3a1c584..49a470f 100644
--- a/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java
+++ b/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java
@@ -3,6 +3,8 @@ package com.jogamp.common.nio;
import java.io.IOException;
+import jogamp.common.os.PlatformPropsImpl;
+
import com.jogamp.common.os.*;
import com.jogamp.junit.util.JunitTracer;
@@ -17,24 +19,24 @@ import org.junit.runners.MethodSorters;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestPointerBufferEndian extends JunitTracer {
- protected void testImpl (boolean direct) {
+ protected void testImpl (final boolean direct) {
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 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(machine.toString());
- long[] valuesSource = { 0x0123456789ABCDEFL, 0x8877665544332211L, 0xAFFEDEADBEEFAFFEL };
- long[] values32Bit = { 0x0000000089ABCDEFL, 0x0000000044332211L, 0x00000000BEEFAFFEL };
+ final long[] valuesSource = { 0x0123456789ABCDEFL, 0x8877665544332211L, 0xAFFEDEADBEEFAFFEL };
+ final long[] values32Bit = { 0x0000000089ABCDEFL, 0x0000000044332211L, 0x00000000BEEFAFFEL };
- PointerBuffer ptr = direct ? PointerBuffer.allocateDirect(3) : PointerBuffer.allocate(valuesSource.length);
+ final 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];
+ final long v = ptr.get() ;
+ final 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++;
}
@@ -50,9 +52,9 @@ public class TestPointerBufferEndian extends JunitTracer {
public void testIndirect () {
testImpl (false);
}
-
- public static void main(String args[]) throws IOException {
- String tstname = TestPointerBufferEndian.class.getName();
+
+ public static void main(final String args[]) throws IOException {
+ final String tstname = TestPointerBufferEndian.class.getName();
org.junit.runner.JUnitCore.main(tstname);
- }
+ }
}
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);
}
-
+
}