Author: bpoussin Date: 2014-04-10 20:32:50 +0200 (Thu, 10 Apr 2014) New Revision: 474 Url: http://forge.nuiton.org/projects/nuiton-matrix/repository/revisions/474 Log: add test for LazyVector Added: trunk/nuiton-matrix/src/test/java/org/nuiton/math/matrix/LazyVectorTest.java Added: trunk/nuiton-matrix/src/test/java/org/nuiton/math/matrix/LazyVectorTest.java =================================================================== --- trunk/nuiton-matrix/src/test/java/org/nuiton/math/matrix/LazyVectorTest.java (rev 0) +++ trunk/nuiton-matrix/src/test/java/org/nuiton/math/matrix/LazyVectorTest.java 2014-04-10 18:32:50 UTC (rev 474) @@ -0,0 +1,50 @@ +package org.nuiton.math.matrix; + + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.junit.Assert; +import org.junit.Test; + +/** + * + * @author poussin + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ +public class LazyVectorTest { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(LazyVectorTest.class); + + @Test + public void testCopy() { + LazyVector l1 = new LazyVector(new DoubleBigVector(), 10); + LazyVector l2 = new LazyVector(new DoubleBigVector(), 10); + + l2.paste(l1); + + l1.setValue(5, 5); + l2.setValue(5, -5); + + Assert.assertEquals(5, l1.getValue(5), 0); + Assert.assertEquals(-5, l2.getValue(5), 0); + + LazyVector l3 = new LazyVector(new DoubleBigVector(), 10); + l3.paste(l1); + + l1.setValue(5, -5); + + Assert.assertEquals(-5, l1.getValue(5), 0); + Assert.assertEquals(5, l3.getValue(5), 0); + + l3.setValue(4, 4); + + Assert.assertEquals(-5, l1.getValue(5), 0); + Assert.assertEquals(5, l3.getValue(5), 0); + Assert.assertEquals(0, l1.getValue(4), 0); + Assert.assertEquals(4, l3.getValue(4), 0); + } +} Property changes on: trunk/nuiton-matrix/src/test/java/org/nuiton/math/matrix/LazyVectorTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL
participants (1)
-
bpoussin@users.nuiton.org