summaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp/common/util/TestFloatStack01.java
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/util/TestFloatStack01.java
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/util/TestFloatStack01.java')
-rw-r--r--src/junit/com/jogamp/common/util/TestFloatStack01.java142
1 files changed, 71 insertions, 71 deletions
diff --git a/src/junit/com/jogamp/common/util/TestFloatStack01.java b/src/junit/com/jogamp/common/util/TestFloatStack01.java
index eab83aa..c0c1a2f 100644
--- a/src/junit/com/jogamp/common/util/TestFloatStack01.java
+++ b/src/junit/com/jogamp/common/util/TestFloatStack01.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.util;
import java.io.IOException;
@@ -43,8 +43,8 @@ import org.junit.runners.MethodSorters;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class /*testname*/TestFloatStack01/*testname*/ extends JunitTracer {
- static final boolean equals(/*value*/float/*value*/[] b, int bOffset,
- /*value*/float/*value*/[] stack, int stackOffset, int length) {
+ static final boolean equals(final /*value*/float/*value*/[] b, final int bOffset,
+ final /*value*/float/*value*/[] stack, final int stackOffset, final int length) {
for(int i=0; i<length; i++) {
if( b[bOffset+i] != stack[stackOffset+i]) {
return false;
@@ -52,40 +52,40 @@ public class /*testname*/TestFloatStack01/*testname*/ extends JunitTracer {
}
return true;
}
-
-
+
+
@Test
public void test01PrimitiveArray_I32_G02() {
final int initialSizeElem = 32;
final int growSizeElem = 2;
testPrimitiveArrayImpl(initialSizeElem, growSizeElem);
}
-
+
@Test
public void test02PrimitiveArray_I00_G32() {
final int initialSizeElem = 0;
final int growSizeElem = 32;
testPrimitiveArrayImpl(initialSizeElem, growSizeElem);
}
-
+
static private final boolean VERBOSE = false;
-
- private void testPrimitiveArrayImpl(int initialSizeElem, int growSizeElem) {
- final int compNum = 3;
- /*value*/float/*value*/[] e0 =
+
+ private void testPrimitiveArrayImpl(final int initialSizeElem, final int growSizeElem) {
+ final int compNum = 3;
+ final /*value*/float/*value*/[] e0 =
new /*value*/float/*value*/[] { 0, 1, 2 };
- /*value*/float/*value*/[] e1 =
+ final /*value*/float/*value*/[] e1 =
new /*value*/float/*value*/[] { 3, 4, 5 };
-
+
final int totalSizeElem = initialSizeElem+2*growSizeElem;
-
+
final int initialSizeComp = initialSizeElem*compNum;
final int growSizeComp = growSizeElem*compNum;
final int totalSizeComp = totalSizeElem*compNum;
-
- final /*name*/FloatStack/*name*/ fs0 =
+
+ final /*name*/FloatStack/*name*/ fs0 =
new /*name*/FloatStack/*name*/(initialSizeComp, growSizeComp);
-
+
//
// PUT
//
@@ -99,9 +99,9 @@ public class /*testname*/TestFloatStack01/*testname*/ extends JunitTracer {
final int j = ( i - initialSizeElem ) % growSizeElem ;
final int k = ( 0 < j && j < growSizeElem ) ? growSizeElem - j : 0;
Assert.assertTrue("Error #"+i+"("+j+", "+k+"), "+fs0, fs0.remaining() == k*compNum);
- }
+ }
Assert.assertTrue("Error "+fs0, fs0.position() == i*compNum);
-
+
String s;
if( 0 == i % 2) {
if(VERBOSE) {
@@ -123,47 +123,47 @@ public class /*testname*/TestFloatStack01/*testname*/ extends JunitTracer {
}
Assert.assertTrue("Error "+fs0, fs0.remaining() == 0);
Assert.assertTrue("Error "+fs0, fs0.position() == totalSizeComp);
-
+
fs0.setGrowSize(0);
{
Exception expectedException = null;
try {
fs0.putOnTop(e1, 0, compNum);
- } catch (Exception e) {
+ } catch (final Exception e) {
expectedException = e;
}
if(null == expectedException || !(expectedException instanceof IndexOutOfBoundsException) ) {
Assert.assertTrue("Error "+fs0+", exception "+expectedException, false);
}
}
-
+
//
// GET
//
-
+
for(int i=0; i<totalSizeElem; i++) {
Assert.assertTrue("Error "+fs0, fs0.remaining() == i*compNum);
Assert.assertTrue("Error "+fs0, fs0.position() == (totalSizeElem-i)*compNum);
-
- final /*value*/float/*value*/[] buf =
+
+ final /*value*/float/*value*/[] buf =
new /*value*/float/*value*/[compNum];
fs0.getFromTop(buf, 0, compNum);
if( 0 == i % 2) {
- Assert.assertTrue("Error "+fs0+", #"+i+": "+Arrays.toString(e1)+" != "+Arrays.toString(buf), Arrays.equals(e1, buf));
+ Assert.assertTrue("Error "+fs0+", #"+i+": "+Arrays.toString(e1)+" != "+Arrays.toString(buf), Arrays.equals(e1, buf));
} else {
Assert.assertTrue("Error "+fs0+", #"+i+": "+Arrays.toString(e0)+" != "+Arrays.toString(buf), Arrays.equals(e0, buf));
}
}
Assert.assertTrue("Error "+fs0, fs0.remaining() == totalSizeComp);
- Assert.assertTrue("Error "+fs0, fs0.position() == 0);
-
+ Assert.assertTrue("Error "+fs0, fs0.position() == 0);
+
{
- final /*value*/float/*value*/[] buf =
+ final /*value*/float/*value*/[] buf =
new /*value*/float/*value*/[compNum];
Exception expectedException = null;
try {
fs0.getFromTop(buf, 0, compNum);
- } catch (Exception e) {
+ } catch (final Exception e) {
expectedException = e;
}
if(null == expectedException || !(expectedException instanceof IndexOutOfBoundsException) ) {
@@ -178,43 +178,43 @@ public class /*testname*/TestFloatStack01/*testname*/ extends JunitTracer {
final int growSizeElem = 2;
testFloatBufferImpl(initialSizeElem, growSizeElem);
}
-
+
@Test
public void test12FloatBuffer_I00_G32() {
final int initialSizeElem = 0;
final int growSizeElem = 32;
testFloatBufferImpl(initialSizeElem, growSizeElem);
}
-
- private void testFloatBufferImpl(int initialSizeElem, int growSizeElem) {
- final int compNum = 3;
- /*value2*/FloatBuffer/*value2*/ fb0 =
+
+ private void testFloatBufferImpl(final int initialSizeElem, final int growSizeElem) {
+ final int compNum = 3;
+ final /*value2*/FloatBuffer/*value2*/ fb0 =
/*value2*/FloatBuffer/*value2*/.allocate(3*compNum);
-
- /*value*/float/*value*/[] e0 =
+
+ final /*value*/float/*value*/[] e0 =
new /*value*/float/*value*/[] { 0, 1, 2 };
- /*value*/float/*value*/[] e1 =
- new /*value*/float/*value*/[] { 3, 4, 5 };
- /*value*/float/*value*/[] e2 =
- new /*value*/float/*value*/[] { 6, 7, 8 }; // not put on stack!
+ final /*value*/float/*value*/[] e1 =
+ new /*value*/float/*value*/[] { 3, 4, 5 };
+ final /*value*/float/*value*/[] e2 =
+ new /*value*/float/*value*/[] { 6, 7, 8 }; // not put on stack!
fb0.put(e0);
fb0.put(e1);
fb0.put(e2);
fb0.position(0);
-
+
final int totalSizeElem = initialSizeElem+2*growSizeElem;
-
+
final int initialSizeComp = initialSizeElem*compNum;
final int growSizeComp = growSizeElem*compNum;
final int totalSizeComp = totalSizeElem*compNum;
-
- final /*name*/FloatStack/*name*/ fs0 =
+
+ final /*name*/FloatStack/*name*/ fs0 =
new /*name*/FloatStack/*name*/(initialSizeComp, growSizeComp);
//
// PUT
//
-
+
for(int i=0; i<totalSizeElem; i++) {
if( 0 == i ) {
Assert.assertTrue("Error #"+i+", "+fs0+", "+fb0, fb0.position() == 0);
@@ -230,13 +230,13 @@ public class /*testname*/TestFloatStack01/*testname*/ extends JunitTracer {
final int j = ( i - initialSizeElem ) % growSizeElem ;
final int k = ( 0 < j && j < growSizeElem ) ? growSizeElem - j : 0;
Assert.assertTrue("Error #"+i+"("+j+", "+k+"), "+fs0, fs0.remaining() == k*compNum);
- }
+ }
Assert.assertTrue("Error "+fs0, fs0.position() == i*compNum);
-
+
final int fb0Pos0 = fb0.position();
fs0.putOnTop(fb0, compNum);
Assert.assertTrue("Error "+fs0+", "+fb0, fb0.position() == fb0Pos0 + compNum);
- }
+ }
Assert.assertTrue("Error "+fs0, fs0.remaining() == 0);
Assert.assertTrue("Error "+fs0, fs0.position() == totalSizeComp);
@@ -246,31 +246,31 @@ public class /*testname*/TestFloatStack01/*testname*/ extends JunitTracer {
Exception expectedException = null;
try {
fs0.putOnTop(fb0, compNum);
- } catch (Exception e) {
+ } catch (final Exception e) {
expectedException = e;
}
if(null == expectedException || !(expectedException instanceof IndexOutOfBoundsException) ) {
Assert.assertTrue("Error "+fs0+", exception "+expectedException, false);
- }
+ }
fb0.position(0);
}
-
+
//
// GET
//
-
+
for(int i=0; i<totalSizeElem; i++) {
Assert.assertTrue("Error "+fs0, fs0.remaining() == i*compNum);
Assert.assertTrue("Error "+fs0, fs0.position() == (totalSizeElem-i)*compNum);
-
- final /*value*/float/*value*/[] backing =
+
+ final /*value*/float/*value*/[] backing =
new /*value*/float/*value*/[compNum];
- /*value2*/FloatBuffer/*value2*/ buf =
+ final /*value2*/FloatBuffer/*value2*/ buf =
/*value2*/FloatBuffer/*value2*/.wrap(backing);
-
+
fs0.getFromTop(buf, compNum);
if( 0 == i % 2) {
- Assert.assertTrue("Error "+fs0+", #"+i+": "+Arrays.toString(e1)+" != "+Arrays.toString(backing), Arrays.equals(e1, backing));
+ Assert.assertTrue("Error "+fs0+", #"+i+": "+Arrays.toString(e1)+" != "+Arrays.toString(backing), Arrays.equals(e1, backing));
} else {
Assert.assertTrue("Error "+fs0+", #"+i+": "+Arrays.toString(e0)+" != "+Arrays.toString(backing), Arrays.equals(e0, backing));
}
@@ -278,28 +278,28 @@ public class /*testname*/TestFloatStack01/*testname*/ extends JunitTracer {
buf.position(0);
}
Assert.assertTrue("Error "+fs0, fs0.remaining() == totalSizeComp);
- Assert.assertTrue("Error "+fs0, fs0.position() == 0);
-
+ Assert.assertTrue("Error "+fs0, fs0.position() == 0);
+
{
- final /*value*/float/*value*/[] backing =
+ final /*value*/float/*value*/[] backing =
new /*value*/float/*value*/[compNum];
- /*value2*/FloatBuffer/*value2*/ buf
+ final /*value2*/FloatBuffer/*value2*/ buf
= /*value2*/FloatBuffer/*value2*/.wrap(backing);
Exception expectedException = null;
try {
fs0.getFromTop(buf, compNum);
- } catch (Exception e) {
+ } catch (final Exception e) {
expectedException = e;
}
if(null == expectedException || !(expectedException instanceof IndexOutOfBoundsException) ) {
Assert.assertTrue("Error "+fs0+", exception "+expectedException, false);
}
}
-
+
}
-
- public static void main(String args[]) throws IOException {
- String tstname = /*testname*/TestFloatStack01/*testname*/.class.getName();
+
+ public static void main(final String args[]) throws IOException {
+ final String tstname = /*testname*/TestFloatStack01/*testname*/.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}