| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| TestGRows |
|
| 0.0;0 | ||||
| TestGRows$_setUp_closure1 |
|
| 0.0;0 | ||||
| TestGRows$_setUp_closure2 |
|
| 0.0;0 | ||||
| TestGRows$_setUp_closure2_closure4 |
|
| 0.0;0 | ||||
| TestGRows$_testGetLPConstraint_closure3 |
|
| 0.0;0 |
| 1 | /* | |
| 2 | This file is part of Combean. | |
| 3 | ||
| 4 | Combean is free software; you can redistribute it and/or modify | |
| 5 | it under the terms of the GNU General Public License as published by | |
| 6 | the Free Software Foundation; either version 2 of the License, or | |
| 7 | (at your option) any later version. | |
| 8 | ||
| 9 | Combean is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 | GNU General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU General Public License | |
| 15 | along with Foobar; if not, write to the Free Software | |
| 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 17 | */ | |
| 18 | package net.sourceforge.combean.test.mathprog.grooml; | |
| 19 | ||
| 20 | import net.sourceforge.combean.mathprog.grooml.GRows; | |
| 21 | import net.sourceforge.combean.mathprog.grooml.GVariables; | |
| 22 | import net.sourceforge.combean.mathprog.grooml.GLPModel; | |
| 23 | import net.sourceforge.combean.mathprog.grooml.GConstraint; | |
| 24 | import net.sourceforge.combean.mathprog.grooml.GDynamicExpression; | |
| 25 | ||
| 26 | class TestGRows extends GroovyTestCase { | |
| 27 | ||
| 28 | private GLPModel lpModel; | |
| 29 | private GRows rows; | |
| 30 | ||
| 31 | private static final double[] rhs = [1.0, 3.0] | |
| 32 | ||
| 33 | void setUp() { | |
| 34 | 6 | GVariables vars = new GVariables("x", 1..10, [:]) { 1.0 }; |
| 35 | 6 | this.lpModel = new GLPModel(); |
| 36 | 6 | this.lpModel.addVariables(vars); |
| 37 | ||
| 38 | 6 | this.rows = new GRows("row", 1..2, this.lpModel, [:]) { |
| 39 | 12 | [new GDynamicExpression() { "2.0 x[1]" }, "= ${rhs[it]}"] |
| 40 | } | |
| 41 | } | |
| 42 | ||
| 43 | void testGetLPConstraint() { | |
| 44 | 3 | (0..rhs.length-1).each{ |
| 45 | 6 | assertEquals("= ${rhs[it]} 'row[$it]'", |
| 46 | 6 | this.rows.getLPConstraint(it).toString()) |
| 47 | } | |
| 48 | } | |
| 49 | ||
| 50 | void testGetRowVector() { | |
| 51 | 3 | for (row in 0..rhs.length-1) { |
| 52 | 6 | assertNotNull(this.rows.getRowVector(row)); |
| 53 | } | |
| 54 | } | |
| 55 | ||
| 56 | } |