r431 - trunk/nuiton-matrix/src/test/java/org/nuiton/math/matrix
Author: echatellier Date: 2012-08-10 15:07:07 +0200 (Fri, 10 Aug 2012) New Revision: 431 Url: http://nuiton.org/repositories/revision/nuiton-matrix/431 Log: Fix test Modified: trunk/nuiton-matrix/src/test/java/org/nuiton/math/matrix/ImportExportMatrixTest.java Modified: trunk/nuiton-matrix/src/test/java/org/nuiton/math/matrix/ImportExportMatrixTest.java =================================================================== --- trunk/nuiton-matrix/src/test/java/org/nuiton/math/matrix/ImportExportMatrixTest.java 2012-08-10 12:57:11 UTC (rev 430) +++ trunk/nuiton-matrix/src/test/java/org/nuiton/math/matrix/ImportExportMatrixTest.java 2012-08-10 13:07:07 UTC (rev 431) @@ -218,7 +218,7 @@ * @throws IOException */ @Test - public void testMatrix2DImport() throws IOException { + public void testMatrix3DImport() throws IOException { String matrix3D = "[2, 2, 2]\n" + "java.lang.String:2009,2010\n" + @@ -230,16 +230,21 @@ "1;0;0;-4.0E-7\n" + "1;0;1;2.0\n" + "1;1;0;4.0\n" + - "1;1;1;42.0"; + "1;1;1;42.0\n"; - MatrixND m = MatrixFactory.getInstance().create(new int[]{2, 2, 2}); + MatrixND m = MatrixFactory.getInstance().create(new List[]{ + Arrays.asList("2009", "2010"), + Arrays.asList("Nantes", "Lille"), + Arrays.asList("Informatique", "Administration") + }); m.importCSV(new StringReader(matrix3D), null); + // dim Assert.assertArrayEquals(new int[]{2, 2, 2}, m.getDim()); // default value Assert.assertEquals(0.0, m.getValue(0, 1, 0), 0.0001); // some test - Assert.assertEquals(-4.0e-7, m.getValue(1, 0, 0), 0.0001); + Assert.assertEquals(-4.0e-7, m.getValue(1, 0, 0), 1e-8); Assert.assertEquals(42, m.getValue(1, 1, 1), 0.0001); } @@ -277,7 +282,7 @@ * @throws IOException */ @Test(expected=MatrixException.class) - public void testMatrix2DImportSemError() throws IOException { + public void testMatrix3DImportSemError() throws IOException { String matrix3D = "[2, 2, 2] , 3.14159265 \n" + "java.lang.String:2009,2010\n" + @@ -302,7 +307,7 @@ * @throws IOException */ @Test - public void testMatrix2DImportReader() throws IOException { + public void testMatrix3DImportReader() throws IOException { String matrix3D = "[2, 2, 2] , 3.14159265 \n" + "java.lang.String:2009,2010\n" + @@ -329,7 +334,7 @@ * @throws IOException */ @Test(expected=MatrixException.class) - public void testMatrix2DImportSemError2() throws IOException { + public void testMatrix3DImportSemError2() throws IOException { String matrix3D = "[2, 2, 2]\n" + "java.lang.String:2009,2010\n" + @@ -354,7 +359,7 @@ * @throws IOException */ @Test(expected=MatrixException.class) - public void testMatrix2DImportSemError3() throws IOException { + public void testMatrix3DImportSemError3() throws IOException { String matrix3D = "[2, 2, 2] , 3.14159265 \n" + "0;0;0;0.0\n" +
participants (1)
-
echatellier@users.nuiton.org