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

## lp.struct.util
Class LpPrettyPrinterTest

    java.lang.Object
      junit.framework.Assert
          junit.framework.TestCase
              lp.struct.util.LpPrettyPrinterTest

All Implemented Interfaces:
  Test

Direct Known Subclasses:
  EvolpPrettyPrinterTest, LpParserTest2

    public class LpPrettyPrinterTest

extends TestCase

Contains tests of the `LpPrettyPrinter` class.

Version:
  1.0.0
Author:
  Martin Slota
See Also:
  `LpPrettyPrinter`

Field Summary
`protected StringBuilder` | `expContents` A container for the expected contents of `pp` during the tests.
`protected StringBuilder` | `expContents2` A container for the expected contents of `pp2` during the tests.
`protected LpBuffer` | `pp` An instance of `LpPrettyPrinter` used in the tests.
`protected LpBuffer` | `pp2` An instance of `LpPrettyPrinter` used in the tests.
`protected Random` | `r` A random number generator used in `doTest(String, LpStructureUnit)` to randomize the tests.

Constructor Summary
`LpPrettyPrinterTest(String testName)` A default test case constructor.

Method Summary
`protected void` | `doTest(String expected, LpStructureUnit unit)` Tests the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods when called with `unit` as input.
`protected void` | `setUp()` Reinitializes all members (`r`, `pp`, `pp2`, `expContents` and `expContents2`).
`void` | `testAppendCompoundTerm()` Tests passing `LpCompoundTerm` instances to the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods.
`void` | `testAppendConstant()` Tests passing `LpConstant` instances to the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods.
`void` | `testAppendFunction()` Tests passing `LpFunction` instances to the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods.
`void` | `testAppendLiteral()` Tests passing `LpLiteral` instances to the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods.
`void` | `testAppendNull()` Tests passing `null` to the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods.
`void` | `testAppendPredicate()` Tests passing `LpPredicate` instances to the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods.
`void` | `testAppendRule()` Tests passing `LpRule` instances to the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods.
`void` | `testAppendVariable()` Tests passing `LpVariable` instances to the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods.
`void` | `testAsString()` Tests the `LpBuffer.asString(LpStructureUnit)` method.

Methods inherited from class junit.framework.TestCase
`countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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

### r

    protected Random r

  A random number generator used in `doTest(String, LpStructureUnit)` to randomize the tests.

### pp

    protected LpBuffer pp

  An instance of `LpPrettyPrinter` used in the tests.

### pp2

    protected LpBuffer pp2

  An instance of `LpPrettyPrinter` used in the tests.

### expContents

    protected StringBuilder expContents

  A container for the expected contents of `pp` during the tests.

### expContents2

    protected StringBuilder expContents2

  A container for the expected contents of `pp2` during the tests.

Constructor Detail

### LpPrettyPrinterTest

    public LpPrettyPrinterTest(String testName)

  A default test case constructor.

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

Method Detail

### setUp

    protected void setUp()

  Reinitializes all members (`r`, `pp`, `pp2`, `expContents` and `expContents2`).

  Overrides:
    `setUp` in class `TestCase`

### testAsString

    public void testAsString()

  Tests the `LpBuffer.asString(LpStructureUnit)` method.

### testAppendNull

    public void testAppendNull()

  Tests passing `null` to the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods.

### testAppendConstant

    public void testAppendConstant()

  Tests passing `LpConstant` instances to the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods.

### testAppendVariable

    public void testAppendVariable()

  Tests passing `LpVariable` instances to the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods.

### testAppendFunction

    public void testAppendFunction()

  Tests passing `LpFunction` instances to the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods.

### testAppendCompoundTerm

    public void testAppendCompoundTerm()

  Tests passing `LpCompoundTerm` instances to the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods.

### testAppendPredicate

    public void testAppendPredicate()

  Tests passing `LpPredicate` instances to the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods.

### testAppendLiteral

    public void testAppendLiteral()

  Tests passing `LpLiteral` instances to the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods.

### testAppendRule

    public void testAppendRule()

  Tests passing `LpRule` instances to the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods.

### doTest

    protected void doTest(String expected,
                          LpStructureUnit unit)

  Tests the `LpBuffer.asString(LpStructureUnit)` and `LpPrinter.append(LpStructureUnit)` methods when called with `unit` as input.

  Parameters:
    `expected` - the expected string that should be returned/appended
    `unit` - the tested `LpStructureUnit`

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