lp.trans
Class DlpTransformerTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by lp.trans.DlpTransformerTest
All Implemented Interfaces:
Test

public class DlpTransformerTest
extends TestCase

Contains tests of the DlpTransformer class.

Version:
0.9.0
Author:
Martin Slota
See Also:
DlpTransformer

Field Summary
private  LpParser parser
          A LpParser instance used in the tests to convert create object representations of rules.
private  DlpTransformer transformer
          A DlpTransformer instance used in the tests.
 
Constructor Summary
DlpTransformerTest(String testName)
          A default test case constructor.
 
Method Summary
private  void doTest(String[] dlpSource, String expTransformedSource, Map<TransDlpRuleType,String> expRuleGroupsSource)
          Performs a single test.
 void testConstraint()
          The simplest DLP without a model.
 void testConstraint2()
          A more complicated input requiring a constraint in the output.
 void testRejectionRules()
          Tests the transformer on input that requires generation of introducing rejection rules.
 void testRejectionsAndDefaults()
          Here the input is more complicated.
 void testTransformedRules()
          Tests the transformer on simple input.
 void testTransformedRules2()
          Tests the transformer on simple input.
 
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
A LpParser instance used in the tests to convert create object representations of rules.


transformer

private final DlpTransformer transformer
A DlpTransformer instance used in the tests.

Constructor Detail

DlpTransformerTest

public DlpTransformerTest(String testName)
A default test case constructor.

Parameters:
testName - the name of the test case
Method Detail

testTransformedRules

public void testTransformedRules()
Tests the transformer on simple input. No rejection, default or constraint rules are expectected in the output.


testTransformedRules2

public void testTransformedRules2()
Tests the transformer on simple input. No rejection, default or constraint rules are expectected in the output. But this time the literals are more complicated.


testRejectionRules

public void testRejectionRules()
Tests the transformer on input that requires generation of introducing rejection rules. No propagation rejection rules, default rules or constraints are expectected in the output.


testRejectionsAndDefaults

public void testRejectionsAndDefaults()
Here the input is more complicated. All types of rules are expected, except constraints.


testConstraint

public void testConstraint()
The simplest DLP without a model. A constraint is required in the output.


testConstraint2

public void testConstraint2()
A more complicated input requiring a constraint in the output.


doTest

private void doTest(String[] dlpSource,
                    String expTransformedSource,
                    Map<TransDlpRuleType,String> expRuleGroupsSource)
Performs a single test. Parses dlpSource into a DynamicLogicProgram instance, performs the transformation and compares the resulting rules with rules found in expTransformedSource.

Parameters:
dlpSource - source of a dynamic logic program
expTransformedSource - representation of the expected transformational equivalent