Index: lutinmatrix/src/test/org/codelutin/math/matrix/MatrixNDTest.java diff -u lutinmatrix/src/test/org/codelutin/math/matrix/MatrixNDTest.java:1.4 lutinmatrix/src/test/org/codelutin/math/matrix/MatrixNDTest.java:1.5 --- lutinmatrix/src/test/org/codelutin/math/matrix/MatrixNDTest.java:1.4 Thu Oct 20 20:58:04 2005 +++ lutinmatrix/src/test/org/codelutin/math/matrix/MatrixNDTest.java Fri Oct 21 14:27:23 2005 @@ -21,9 +21,9 @@ * * Created: 10 mai 2004 * -* @version $Revision: 1.4 $ +* @version $Revision: 1.5 $ * -* Mise a jour: $Date: 2005/10/20 20:58:04 $ +* Mise a jour: $Date: 2005/10/21 14:27:23 $ * par : $Author: bpoussin $ */ @@ -365,6 +365,11 @@ assertEquals(9, mat1.getValue(0,0,0), 0); assertEquals(9, mat1.getValue(1,2,0), 0); assertEquals(0, mat2.getValue(2,2,2), 0); + + MatrixND mat0 = getFactory().create(new int[]{4,4}); + MatrixND matId = getFactory().matrixId(4); + matId.mults(0); + assertEquals(mat0, matId); } public void testDivs() throws Exception { Index: lutinmatrix/src/test/org/codelutin/math/matrix/BasicMatrixBigTest.java diff -u /dev/null lutinmatrix/src/test/org/codelutin/math/matrix/BasicMatrixBigTest.java:1.1 --- /dev/null Fri Oct 21 14:27:28 2005 +++ lutinmatrix/src/test/org/codelutin/math/matrix/BasicMatrixBigTest.java Fri Oct 21 14:27:23 2005 @@ -0,0 +1,45 @@ +/* *##% + * Copyright (C) 2002, 2003 Code Lutin, Cédric Pineau, + Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * MatriceTest.java + * + * Created: 27 oct. 2004 + * + * @author Benjamin Poussin + * @version $Revision: 1.1 $ + * + * Mise a jour: $Date: 2005/10/21 14:27:23 $ + * par : $Author: bpoussin $ + */ + +package org.codelutin.math.matrix; + +import java.util.Arrays; +import java.util.NoSuchElementException; +import junit.framework.TestCase; + +public class BasicMatrixBigTest extends BasicMatrixTest { // BasicMatrixTest + + public MatrixFactory getFactory() throws Exception { + return MatrixFactory.getInstance(FloatBigVector.class); + } + +} // BasicMatrixTest + Index: lutinmatrix/src/test/org/codelutin/math/matrix/FloatVectorTest.java diff -u /dev/null lutinmatrix/src/test/org/codelutin/math/matrix/FloatVectorTest.java:1.1 --- /dev/null Fri Oct 21 14:27:28 2005 +++ lutinmatrix/src/test/org/codelutin/math/matrix/FloatVectorTest.java Fri Oct 21 14:27:23 2005 @@ -0,0 +1,88 @@ +/* *##% + * Copyright (C) 2005 + * Code Lutin, Cédric Pineau, Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * FloatVectorTest.java + * + * Created: 6 octobre 2005 01:54:49 CEST + * + * @author Benjamin POUSSIN + * @version $Revision: 1.1 $ + * + * Last update: $Date: 2005/10/21 14:27:23 $ + * by : $Author: bpoussin $ + */ + +package org.codelutin.math.matrix; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import junit.framework.TestCase; + +public class FloatVectorTest extends TestCase { // FloatVectorTest + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(FloatVectorTest.class); + + public void testAll() throws Exception { + FloatVector v = new FloatVector(16); + assertEquals(0.0, v.getMaxOccurence()); + + v.setValue(0, 1); + assertEquals(1.0, v.getValue(0)); + + v.setValue(15, 16); + assertEquals(16.0, v.getValue(15)); + + assertEquals(2, v.positionSize); + v.setValue(0, 0); + assertEquals(0.0, v.getValue(0)); + assertEquals(1, v.positionSize); + + v.setValue(0, 4); + v.setValue(1, 4); + v.setValue(2, 4); + v.setValue(3, 4); + v.setValue(4, 4); + v.setValue(5, 4); + v.setValue(6, 4); + assertEquals(0.0, v.getMaxOccurence()); + v.setValue(8, 4); + assertEquals(4.0, v.getMaxOccurence()); + v.setValue(0, 0); + assertEquals(0.0, v.getMaxOccurence()); + + try { + v.getValue(-1); + assertTrue(false); + } catch (IllegalArgumentException eee) { + assertTrue(true); + } + + try { + v.getValue(20); + assertTrue(false); + } catch (IllegalArgumentException eee) { + assertTrue(true); + } + + } + +} // FloatVectorTest +