org.jtr.testcase
Class JtrTestSuite

org.jtr.testcase.JtrTestSuite

public class JtrTestSuite

A test suite for the "jtr" library. This uses the JUnit framework to perform testing over aspects of jtr. Known to be compatible with JUnit 3.7 and 3.8.1, and may be compatible with other versions.

JUnit can be found at the JUnit web site.

Version:
$Id: JtrTestSuite.java,v 1.15 2005/03/14 06:03:41 run2000 Exp $
Author:
Nicholas Cull

Constructor Summary
JtrTestSuite(java.lang.String aName)
          Creates new JtrTestSuite
 
Method Summary
static void main(java.lang.String[] args)
          Runs the test cases using the text-based JUnit test runner.
 void setUp()
          Set up for a couple of the test cases that explicitly use a parser.
static junit.framework.Test suite()
          Automatic test suite generator for JUnit.
 void testCloneMethod()
          Tests the clone method of CharacterReplacer.
 void testComplementAndSquash()
          Tests the combination of complement and squashing duplicate matches.
 void testComplementAndSquash2()
          Tests the combination of complement and squashing duplicate matches.
 void testComplementAndUnreplaceable()
          Tests the combination of deletion and complement modifiers.
 void testComplementAndUnreplaceable2()
          Tests the combination of deletion and complement modifiers.
 void testComplementAndUnreplaceable3()
          Tests the combination of deletion and complement modifiers.
 void testComplementAndUnreplaceable4()
          Tests the combination of deletion and complement modifiers.
 void testComplementAndUnreplaceable5()
          Tests the combination of deletion and complement modifiers.
 void testControlCharacterReplacement()
          Test control character handling.
 void testControlCharacterReplacement2()
          Test control character handling.
 void testControlCharacterReplacement3()
          Test control character handling.
 void testControlCharacterReplacement4()
          Test control character handling.
 void testControlCharacterReplacement5()
          Test control character handling.
 void testControlCharacterReplacement6()
          Test control character handling.
 void testDegenerateAllModifiers()
          Tests the combination of all the modifiers.
 void testDegenerateAllModifiers2()
          Tests the combination of all the modifiers.
 void testDegenerateComplementAndUnreplaceable()
          Tests the combination of deletion and complement modifiers.
 void testDegenerateComplementAndUnreplaceable2()
          Tests the combination of deletion and complement modifiers.
 void testHexCharacterReplacement()
          Tests hexadecimal character support.
 void testHexCharacterReplacement2()
          Tests hexadecimal character support.
 void testHexCharacterReplacement3()
          Tests hexadecimal character support.
 void testLongStringReplacement()
          Test transliteration on long strings.
 void testNullUnreplaceable()
          Tests the deletion modifier.
 void testNullUnreplaceable2()
          Tests the deletion modifier.
 void testNullUnreplaceable3()
          Tests the deletion modifier.
 void testOctalCharacterReplacement()
          Tests octal character support.
 void testOctalCharacterReplacement2()
          Tests octal character support.
 void testOctalCharacterReplacement3()
          Tests octal character support.
 void testOtherSpecialCharacters()
          Tests wide character translation support.
 void testOtherSpecialCharacters2()
          Test other special characters.
 void testOtherSpecialCharacters3()
          Test other special characters.
 void testOtherSpecialCharacters4()
          Test other special characters.
 void testSimpleComplement()
          Tests a simple complement operation.
 void testSimpleComplement2()
          Tests a simple complement operation.
 void testSimpleDuplicateSearchList()
          Tests what happens when a character in the search list is duplicated.
 void testSimpleDuplicateSearchList2()
          Tests what happens when a character in the search list is duplicated.
 void testSimpleNullReplacement()
          Tests what happens when the replacement string is empty.
 void testSimpleNullReplacement2()
          Tests what happens when the replacement string is empty.
 void testSimpleNullReplacement3()
          Tests what happens when the replacement string is empty.
 void testSimpleNullReplacement4()
          Tests what happens when the replacement string is empty.
 void testSimpleNullReplacement5()
          Tests what happens when the replacement string is empty.
 void testSimpleShortReplacement()
          Tests what happens when the replacement string is shorter than the matching string.
 void testSimpleShortReplacement2()
          Tests what happens when the replacement string is shorter than the matching string.
 void testSimpleShortReplacement3()
          Tests what happens when the replacement string is shorter than the matching string.
 void testSimpleSquash()
          Tests the squashing of duplicate matches.
 void testSimpleSquash2()
          Tests the squashing of duplicate matches.
 void testSimpleTransliterate()
          Performs a simple transliteration.
 void testSimpleTransliterate2()
          Performs a simple transliteration using the Perl5Parser class.
 void testSpecialRange()
          Test control character handling.
 void testSpecialRange2()
          Test control character handling.
 void testUnreplaceable()
          Tests the deletion modifier.
 void testUnreplaceable2()
          Tests the deletion modifier.
 void testUnreplaceable3()
          Tests the deletion modifier.
 void testWideHexCharacterReplacement()
          Tests wide character translation support.
 void testWideHexCharacterReplacement2()
          Tests wide character translation support.
 void testWideHexCharacterReplacement3()
          Tests wide character translation support.
 

Constructor Detail

JtrTestSuite

public JtrTestSuite(java.lang.String aName)
Creates new JtrTestSuite
Method Detail

setUp

public void setUp()
Set up for a couple of the test cases that explicitly use a parser. Most cases simply use the parser included in the CharacterReplacer construction call.

testSimpleTransliterate

public void testSimpleTransliterate()
Performs a simple transliteration.

testSimpleTransliterate2

public void testSimpleTransliterate2()
Performs a simple transliteration using the Perl5Parser class.

testSimpleShortReplacement

public void testSimpleShortReplacement()
Tests what happens when the replacement string is shorter than the matching string. By default, the last character of the replacement string is used.

testSimpleShortReplacement2

public void testSimpleShortReplacement2()
Tests what happens when the replacement string is shorter than the matching string. By default, the last character of the replacement string is used. This uses the Perl5Parser utility class.

testSimpleShortReplacement3

public void testSimpleShortReplacement3()
Tests what happens when the replacement string is shorter than the matching string. By default, the last character of the replacement string is used. This uses the Perl5Parser utility class.

testSimpleNullReplacement

public void testSimpleNullReplacement()
Tests what happens when the replacement string is empty. By default, search string is simply replicated.

testSimpleNullReplacement2

public void testSimpleNullReplacement2()
Tests what happens when the replacement string is empty. By default, search string is simply replicated. This uses the Perl5Parser utility class.

testSimpleNullReplacement3

public void testSimpleNullReplacement3()
Tests what happens when the replacement string is empty. By default, search string is simply replicated. This variation tests what happens when the single string constructor is used.

testSimpleNullReplacement4

public void testSimpleNullReplacement4()
Tests what happens when the replacement string is empty. By default, search string is simply replicated.

testSimpleNullReplacement5

public void testSimpleNullReplacement5()
Tests what happens when the replacement string is empty. By default, search string is simply replicated. This variation tests what happens when the single string constructor is used. This uses the Perl5Parse utility class.

testSimpleDuplicateSearchList

public void testSimpleDuplicateSearchList()
Tests what happens when a character in the search list is duplicated. Behaviour should be that the first replacement is always used.

testSimpleDuplicateSearchList2

public void testSimpleDuplicateSearchList2()
Tests what happens when a character in the search list is duplicated. Behaviour should be that the first replacement is always used. This uses the Perl5Parser utility class.

testSimpleComplement

public void testSimpleComplement()
Tests a simple complement operation. Anything not found in the search list is replaced with the replacement list.

testSimpleComplement2

public void testSimpleComplement2()
Tests a simple complement operation. Anything not found in the search list is replaced with the replacement list. This uses the Perl5Parser utility class.

testComplementAndSquash

public void testComplementAndSquash()
Tests the combination of complement and squashing duplicate matches.

testComplementAndSquash2

public void testComplementAndSquash2()
Tests the combination of complement and squashing duplicate matches. This uses the Perl5Parser utility class.

testSimpleSquash

public void testSimpleSquash()
Tests the squashing of duplicate matches. This uses an example from the perlop documentation to verify the behaviour is correct.

testSimpleSquash2

public void testSimpleSquash2()
Tests the squashing of duplicate matches. This uses an example from the perlop documentation to verify the behaviour is correct. This uses the Perl5Parser utility class.

testUnreplaceable

public void testUnreplaceable()
Tests the deletion modifier. When the replacement list is shorter than the search list, delete the matched characters with no replacement.

testUnreplaceable2

public void testUnreplaceable2()
Tests the deletion modifier. When the replacement list is shorter than the search list, delete the matched characters with no replacement. This uses the Perl5Parser utility class.

testUnreplaceable3

public void testUnreplaceable3()
Tests the deletion modifier. When the replacement list is shorter than the search list, delete the matched characters with no replacement. This variation uses the CharacterList constructor.

testNullUnreplaceable

public void testNullUnreplaceable()
Tests the deletion modifier. When the replacement list is null, delete everything that matches the searchlist.

testNullUnreplaceable2

public void testNullUnreplaceable2()
Tests the deletion modifier. When the replacement list is null, delete everything that matches the searchlist. This uses the Perl5Parser utility class.

testNullUnreplaceable3

public void testNullUnreplaceable3()
Tests the deletion modifier. When the replacement list is null, delete everything that matches the searchlist. This special case tests the trivial case where search and replacement lists are equal. This uses the Perl5Parser utility class.

testComplementAndUnreplaceable

public void testComplementAndUnreplaceable()
Tests the combination of deletion and complement modifiers. When a character appears that is not in the search list, and the replacement list is empty, delete them.

testComplementAndUnreplaceable2

public void testComplementAndUnreplaceable2()
Tests the combination of deletion and complement modifiers. When a character appears that is not in the search list, and the replacement list is empty, delete them. This uses the Perl5Parser utility class.

testComplementAndUnreplaceable3

public void testComplementAndUnreplaceable3()
Tests the combination of deletion and complement modifiers. When a character appears that is not in the search list, and the replacement list is empty, delete them. This variation tests the single string constructor.

testComplementAndUnreplaceable4

public void testComplementAndUnreplaceable4()
Tests the combination of deletion and complement modifiers. When a character appears that is not in the search list, and the replacement list is empty, delete them. This variation uses the CharacterList constructor.

testComplementAndUnreplaceable5

public void testComplementAndUnreplaceable5()
Tests the combination of deletion and complement modifiers. When a character appears that is not in the search list, and the replacement list is empty, delete them. This variation uses the CharacterList constructor.

testDegenerateComplementAndUnreplaceable

public void testDegenerateComplementAndUnreplaceable()
Tests the combination of deletion and complement modifiers. When a character appears that is not in the search list, and the replacement list is not empty, never perform the deletion.

testDegenerateComplementAndUnreplaceable2

public void testDegenerateComplementAndUnreplaceable2()
Tests the combination of deletion and complement modifiers. When a character appears that is not in the search list, and the replacement list is not empty, never perform the deletion. This uses the Perl5Parse utility class.

testDegenerateAllModifiers

public void testDegenerateAllModifiers()
Tests the combination of all the modifiers. When a character appears that is not in the search list, but the replacement list is not empty, we never perform a delete. Instead, we simply perform the squash operation, if it is needed.

testDegenerateAllModifiers2

public void testDegenerateAllModifiers2()
Tests the combination of all the modifiers. When a character appears that is not in the search list, but the replacement list is not empty, we never perform a delete. Instead, we simply perform the squash operation, if it is needed. This uses the Perl5Parse utility class.

testOctalCharacterReplacement

public void testOctalCharacterReplacement()
Tests octal character support. In Perl, octal characters are supported by the \ddd escape sequence.

testOctalCharacterReplacement2

public void testOctalCharacterReplacement2()
Tests octal character support. In Perl, octal characters are supported by the \ddd escape sequence. This uses the Perl5Parse utility class.

testOctalCharacterReplacement3

public void testOctalCharacterReplacement3()
Tests octal character support. In Perl, octal characters are supported by the \ddd escape sequence. This uses the Perl5Parse utility class.

testHexCharacterReplacement

public void testHexCharacterReplacement()
Tests hexadecimal character support. In Perl, hexadecmal characters are supported by the \xdd escape sequence.

testHexCharacterReplacement2

public void testHexCharacterReplacement2()
Tests hexadecimal character support. In Perl, hexadecmal characters are supported by the \xdd escape sequence. This uses the Perl5Parse utility class.

testHexCharacterReplacement3

public void testHexCharacterReplacement3()
Tests hexadecimal character support. In Perl, hexadecmal characters are supported by the \xdd escape sequence. This uses the Perl5Parse utility class.

testWideHexCharacterReplacement

public void testWideHexCharacterReplacement()
Tests wide character translation support. Perl wide characters are supported by the \x{dddd} escape sequence.

testWideHexCharacterReplacement2

public void testWideHexCharacterReplacement2()
Tests wide character translation support. Perl wide characters are supported by the \x{dddd} escape sequence. This uses the Perl5Parse utility class.

testWideHexCharacterReplacement3

public void testWideHexCharacterReplacement3()
Tests wide character translation support. Perl wide characters are supported by the \x{dddd} escape sequence. This uses the Perl5Parse utility class.

testOtherSpecialCharacters

public void testOtherSpecialCharacters()
Tests wide character translation support. Perl wide characters are supported by the \x{dddd} escape sequence.

testOtherSpecialCharacters2

public void testOtherSpecialCharacters2()
Test other special characters.

testOtherSpecialCharacters3

public void testOtherSpecialCharacters3()
Test other special characters.

testOtherSpecialCharacters4

public void testOtherSpecialCharacters4()
Test other special characters.

testLongStringReplacement

public void testLongStringReplacement()
Test transliteration on long strings. This is mainly a performance test rather than a correctness test.

testControlCharacterReplacement

public void testControlCharacterReplacement()
Test control character handling. Control characters in Perl are escaped using the \cx escape sequence.

testControlCharacterReplacement2

public void testControlCharacterReplacement2()
Test control character handling. Control characters in Perl are escaped using the \cx escape sequence. This uses the Perl5Parse utility class.

testControlCharacterReplacement3

public void testControlCharacterReplacement3()
Test control character handling. Control characters in Perl are escaped using the \cx escape sequence.

testControlCharacterReplacement4

public void testControlCharacterReplacement4()
Test control character handling. Control characters in Perl are escaped using the \cx escape sequence. This uses the Perl5Parse utility class.

testControlCharacterReplacement5

public void testControlCharacterReplacement5()
Test control character handling. Control characters in Perl are escaped using the \cx escape sequence. This uses the Perl5Parse utility class.

testControlCharacterReplacement6

public void testControlCharacterReplacement6()
Test control character handling. Control characters in Perl are escaped using the \cx escape sequence. This uses the Perl5Parse utility class.

testSpecialRange

public void testSpecialRange()
Test control character handling. Control characters in Perl are escaped using the \cx escape sequence.

testSpecialRange2

public void testSpecialRange2()
Test control character handling. Control characters in Perl are escaped using the \cx escape sequence. This uses the Perl5Parse utility class.

testCloneMethod

public void testCloneMethod()
Tests the clone method of CharacterReplacer. The cloned object should be capable of performing the same replacement as the original. This uses the Perl5Parser utility class.

suite

public static junit.framework.Test suite()
Automatic test suite generator for JUnit. This picks up any methods that start with "test".
Returns:
a JUnit test suite containing all the test cases in this class.

main

public static void main(java.lang.String[] args)
Runs the test cases using the text-based JUnit test runner.
Parameters:
args - the command line arguments