|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
lp.trans.LpSolverTest
public class LpSolverTest
Contains tests of the LpSolver
class.
LpSolver
Field Summary | |
---|---|
private CollectingModelConsumer |
consumer
Object for collecting the computed models. |
private LpGrounder |
grounder
The grounder used in the tests. |
private LpParser |
parser
The parser used in the tests. |
private LpSolver |
solver
The instance of LpSolver that is being tested. |
Constructor Summary | |
---|---|
LpSolverTest(String testName)
A default test case constructor. |
Method Summary | |
---|---|
private void |
doTest(String programSource,
Set<String> expModelSources)
Performs a single call of solver.solve(program); where program is the logic program obtained by parsing
programSource . |
void |
testEmptyInput()
Tests LpGrounder on an empty input program. |
void |
testKillerRule()
Tests LpGrounder on a program containing only the rule
"a :- not a.". |
void |
testOrdinaryInput()
Tests LpGrounder on a typical program. |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final LpParser parser
private final LpGrounder grounder
private final LpSolver solver
LpSolver
that is being tested.
private final CollectingModelConsumer consumer
Constructor Detail |
---|
public LpSolverTest(String testName)
testName
- the name of the test caseMethod Detail |
---|
public void testEmptyInput()
LpGrounder
on an empty input program.
This test can only pass if both the lparse binary and the smodels binary
can be executed by issuing simple "lparse"
and
"smodels"
commands, respectively.
public void testKillerRule()
LpGrounder
on a program containing only the rule
"a :- not a.".
This test can only pass if both the lparse binary and the smodels binary
can be executed by issuing simple "lparse"
and
"smodels"
commands, respectively.
public void testOrdinaryInput()
LpGrounder
on a typical program.
This test can only pass if both the lparse binary and the smodels binary
can be executed by issuing simple "lparse"
and
"smodels"
commands, respectively.
private void doTest(String programSource, Set<String> expModelSources)
solver.solve(program);where
program
is the logic program obtained by parsing
programSource
. Then it tests if the expected set of models is
computed.
programSource
- the string with the input programexpModelSources
- string representations of the expected models
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |