r2984 - in isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity: . domain
Author: chatellier Date: 2010-02-04 16:06:06 +0000 (Thu, 04 Feb 2010) New Revision: 2984 Added: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomainTest.java isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomainTest.java Log: Add tests on clone for domain (equation & matrix) Added: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomainTest.java =================================================================== --- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomainTest.java (rev 0) +++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomainTest.java 2010-02-04 16:06:06 UTC (rev 2984) @@ -0,0 +1,66 @@ +/* *##% + * Copyright (C) 2010 Ifremer, Code Lutin, Chatellier Eric + * + * 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. + *##%*/ + +package fr.ifremer.isisfish.simulator.sensitivity.domain; + +import junit.framework.Assert; + +import org.junit.Test; + +/** + * Test on {@link EquationContinuousDomain}. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class EquationContinuousDomainTest { + + /** + * Assert that clone do work (with inheritance). + */ + @Test + public void testClone() { + EquationContinuousDomain domain = new EquationContinuousDomain(); + // parent + domain.setMinBound(0.55); + domain.setMaxBound(0.74); + domain.setCardinality(5); + // child + domain.setVariableName("varname"); + domain.setOperator("/"); + domain.setCoefficient(0.05); + domain.setReferenceValue(90.0); + domain.setValue(89.5); + + // clone + EquationContinuousDomain clone = domain.clone(); + + // test on clone + Assert.assertEquals(0.55, clone.minBound); // getter return 0.0 + Assert.assertEquals(0.74, clone.maxBound); // getter return 1.0 + Assert.assertEquals(5, clone.getCardinality()); + Assert.assertEquals("varname", clone.getVariableName()); + Assert.assertEquals("/", clone.getOperator()); + Assert.assertEquals(0.05, clone.getCoefficient()); + Assert.assertEquals(90.0, clone.getReferenceValue()); + Assert.assertEquals(89.5, clone.getValue()); + } +} Property changes on: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomainTest.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Added: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomainTest.java =================================================================== --- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomainTest.java (rev 0) +++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomainTest.java 2010-02-04 16:06:06 UTC (rev 2984) @@ -0,0 +1,71 @@ +/* *##% + * Copyright (C) 2010 Ifremer, Code Lutin, Chatellier Eric + * + * 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. + *##%*/ + +package fr.ifremer.isisfish.simulator.sensitivity.domain; + +import junit.framework.Assert; + +import org.junit.Test; +import org.nuiton.math.matrix.MatrixFactory; +import org.nuiton.math.matrix.MatrixND; + +/** + * Test on {@link MatrixContinuousDomain}. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class MatrixContinuousDomainTest { + + /** + * Assert that clone do work (with inheritance). + */ + @Test + public void testClone() { + + // test matrix + MatrixND matrix = MatrixFactory.getInstance().create("test", new int[] { 4, 5 }, new String[] {"dim1", "dim2"}); + matrix.setValue(2, 2, 42); + + MatrixContinuousDomain domain = new MatrixContinuousDomain(); + // parent + domain.setMinBound(0.55); + domain.setMaxBound(0.74); + domain.setCardinality(5); + // child + domain.setMatrix(matrix); + domain.setOperator("/"); + domain.setCoefficient(0.05); + domain.setValue(89.5); + + // clone + MatrixContinuousDomain clone = domain.clone(); + + // test on clone + Assert.assertEquals(0.55, clone.minBound); // getter return 0.0 + Assert.assertEquals(0.74, clone.maxBound); // getter return 1.0 + Assert.assertEquals(5, clone.getCardinality()); + Assert.assertEquals(matrix, clone.getMatrix()); + Assert.assertEquals("/", clone.getOperator()); + Assert.assertEquals(0.05, clone.getCoefficient()); + Assert.assertEquals(89.5, clone.getValue()); + } +} Property changes on: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomainTest.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL"
participants (1)
-
chatellierï¼ users.labs.libre-entreprise.org