*/\r
package nom.tam.util.test;\r
\r
+import org.junit.Test;\r
+import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertTrue;\r
+import static org.junit.Assert.assertFalse;\r
+import static org.junit.Assert.assertSame;\r
+import static org.junit.Assert.assertNotSame;\r
import junit.framework.*;\r
import java.lang.reflect.*;\r
import java.util.Arrays;\r
*\r
* @author Thomas McGlynn\r
*/\r
-public class ArrayFuncsTest extends TestCase {\r
-\r
- public ArrayFuncsTest(String testName) {\r
- super(testName);\r
- }\r
-\r
- protected void setUp() throws Exception {\r
- }\r
-\r
- protected void tearDown() throws Exception {\r
- }\r
+public class ArrayFuncsTest {\r
\r
/**\r
* Test of computeSize method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testComputeSize() {\r
System.out.println("computeSize");\r
\r
/**\r
* Test of nElements method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testNElements() {\r
System.out.println("nElements");\r
\r
/**\r
* Test of deepClone method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testDeepClone() {\r
int[][] test = {{0, 1}, {2, 3}, {4, 5}};\r
int[][] result = (int[][]) nom.tam.util.ArrayFuncs.deepClone(test);\r
}\r
\r
public boolean equals(Object x) {\r
+ System.out.println("checking equality");\r
return (x instanceof CloneTest)\r
&& (((CloneTest) x).value == this.value);\r
}\r
/**\r
* Test of genericClone method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testGenericClone() {\r
System.out.println("genericClone");\r
\r
/**\r
* Test of copyArray method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testCopyArray() {\r
System.out.println("copyArray");\r
\r
/**\r
* Test of getDimensions method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testGetDimensions() {\r
System.out.println("getDimensions");\r
\r
/**\r
* Test of getBaseArray method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testGetBaseArray() {\r
\r
int[][][] test = new int[2][3][4];\r
/**\r
* Test of getBaseClass method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testGetBaseClass() {\r
System.out.println("getBaseClass");\r
\r
/**\r
* Test of getBaseLength method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testGetBaseLength() {\r
\r
assertEquals(ArrayFuncs.getBaseLength(new int[2][3]), 4);\r
/**\r
* Test of generateArray method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testGenerateArray() {\r
System.out.println("generateArray");\r
\r
/**\r
* Test of testPattern method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testTestPattern() {\r
System.out.println("testPattern");\r
\r
/**\r
* Test of flatten method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testFlatten() {\r
System.out.println("flatten");\r
\r
/**\r
* Test of curl method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testCurl() {\r
System.out.println("curl");\r
\r
/**\r
* Test of mimicArray method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testMimicArray() {\r
System.out.println("mimicArray");\r
\r
/**\r
* Test of convertArray method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testConvertArray() {\r
System.out.println("convertArray");\r
\r
\r
newType = int.class;\r
int[][] ires = (int[][]) ArrayFuncs.convertArray(array, newType, true);\r
- assertEquals(array, ires);\r
+ assertSame(array, ires);\r
\r
ires = (int[][]) ArrayFuncs.convertArray(array, newType, false);\r
assertNotSame(array, ires);\r
/**\r
* Test of copyInto method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testCopyInto() {\r
System.out.println("copyInto");\r
\r
\r
ArrayFuncs.copyInto(x, y);\r
\r
- assertEquals((double) x[0][0], y[0][0]);\r
- assertEquals((double) x[1][2], y[1][2]);\r
+ assertEquals((double) x[0][0], y[0][0], 0.01);\r
+ assertEquals((double) x[1][2], y[1][2], 0.01);\r
}\r
\r
/**\r
* Test of arrayEquals method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testArrayEquals() {\r
System.out.println("arrayEquals");\r
\r
/**\r
* Test of doubleArrayEquals method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testDoubleArrayEquals() {\r
\r
double x[] = {1, 2, 3};\r
/**\r
* Test of floatArrayEquals method, of class nom.tam.util.ArrayFuncs.\r
*/\r
+ @Test\r
public void testFloatArrayEquals() {\r
float x[] = {1f, 2f, 3f};\r
float y[] = {1f, 2f, 3f};\r