Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
TestGConstraint |
|
| 0.0;0 | ||||
TestGConstraint$_testIllegalConstraintDefinition_closure1 |
|
| 0.0;0 | ||||
TestGConstraint$_testIllegalConstraintDefinition_closure2 |
|
| 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.except.GModelException; | |
21 | import net.sourceforge.combean.mathprog.grooml.GConstraint; | |
22 | ||
23 | class TestGConstraint extends GroovyTestCase { | |
24 | ||
25 | void testConstructFromString() { | |
26 | 3 | GConstraint constr = new GConstraint("foo", "= 2"); |
27 | 3 | assertToString(constr, "= 2.0 'foo'"); |
28 | 3 | constr = new GConstraint("foo", "=-3.123"); |
29 | 3 | assertToString(constr, "= -3.123 'foo'"); |
30 | } | |
31 | ||
32 | void testIllegalConstraintDefinition() { | |
33 | 3 | shouldFail(GModelException) { |
34 | 3 | GConstraint constr = new GConstraint("foo", "== 3"); |
35 | } | |
36 | 3 | shouldFail(GModelException) { |
37 | 3 | GConstraint constr = new GConstraint("foo", "<= x"); |
38 | } | |
39 | } | |
40 | } |