[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model/test MatrixTest.java, NONE, 1.1
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2007-11-26 18:09:05
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24444/src/net/sourceforge/bprocessor/model/test Added Files: MatrixTest.java Log Message: added invert on matrix and made a small but for now useless test of it --- NEW FILE: MatrixTest.java --- //--------------------------------------------------------------------------------- // $Id: MatrixTest.java,v 1.1 2007/11/26 18:09:08 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model.test; import net.sourceforge.bprocessor.model.Matrix; import junit.framework.TestCase; /** * The vertex test class */ public class MatrixTest extends TestCase { /** * Test method for 'net.sourceforge.bprocessor.model.Matrix.inverse()' */ public void testInverse() { Matrix m = new Matrix(new double[]{ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}); Matrix inv = m.invert(); assertTrue(inv.equals(m)); assertEquals(m.determinant(), 1, 0.00000001); m = new Matrix(new double[]{ 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 6, 5, 2, 1}); inv = m.invert(); Matrix result = new Matrix(new double[]{ 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, -5, -6, -2, 1}); assertTrue(inv.equals(result)); } } |