Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## lp.trans
Class LpSolverTest

    java.lang.Object
      junit.framework.Assert
          junit.framework.TestCase
              lp.trans.LpSolverTest

All Implemented Interfaces:
  Test

    public class LpSolverTest

extends TestCase

Contains tests of the `LpSolver` class.

Version:
  1.0.0
Author:
  Martin Slota
See Also:
  `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

### parser

    private final LpParser parser

  The parser used in the tests.

### grounder

    private final LpGrounder grounder

  The grounder used in the tests.

### solver

    private final LpSolver solver

  The instance of `LpSolver` that is being tested.

### consumer

    private final CollectingModelConsumer consumer

  Object for collecting the computed models.

Constructor Detail

### LpSolverTest

    public LpSolverTest(String testName)

  A default test case constructor.

  Parameters:
    `testName` - the name of the test case

Method Detail

### testEmptyInput

    public void testEmptyInput()

  Tests `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.

### testKillerRule

    public void testKillerRule()

  Tests `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.

### testOrdinaryInput

    public void testOrdinaryInput()

  Tests `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.

### doTest

    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`. Then it tests if the expected set of models is computed.

  Parameters:
    `programSource` - the string with the input program
    `expModelSources` - string representations of the expected models

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD