sjm.parse
Class ParserTester
java.lang.Object
|
+--sjm.parse.ParserTester
- Direct Known Subclasses:
- CharacterTester, TokenTester
- public abstract class ParserTester
- extends java.lang.Object
This class generates random language elements for a
parser and tests that the parser can accept them.
- Version:
- 1.0
- Author:
- Steven J. Metsker
Method Summary |
protected abstract Assembly |
assembly(java.lang.String s)
|
protected boolean |
canGenerateProblem(int depth)
|
static java.util.Vector |
completeMatches(java.util.Vector in)
Return a subset of the supplied vector of assemblies,
filtering for assemblies that have been completely
matched. |
protected PubliclyCloneable |
freshTarget()
|
protected void |
logDepthChange(int depth)
|
protected void |
logPassed()
|
protected void |
logProblemFound(java.lang.String s,
int matchSize)
|
protected void |
logTestString(java.lang.String s)
|
protected java.lang.String |
separator()
|
void |
setLogTestStrings(boolean logTestStrings)
Set the boolean which determines if this class displays
every test string. |
void |
test()
Create a series of random language elements, and test
that the parser can unambiguously parse each one. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
p
protected Parser p
logTestStrings
protected boolean logTestStrings
ParserTester
public ParserTester(Parser p)
- Constructs a tester for the given parser.
assembly
protected abstract Assembly assembly(java.lang.String s)
canGenerateProblem
protected boolean canGenerateProblem(int depth)
completeMatches
public static java.util.Vector completeMatches(java.util.Vector in)
- Return a subset of the supplied vector of assemblies,
filtering for assemblies that have been completely
matched.
- Parameters:
Vector
- a collection of partially or completely
matched assemblies- Returns:
- a collection of completely matched assemblies
freshTarget
protected PubliclyCloneable freshTarget()
logDepthChange
protected void logDepthChange(int depth)
logPassed
protected void logPassed()
logProblemFound
protected void logProblemFound(java.lang.String s,
int matchSize)
logTestString
protected void logTestString(java.lang.String s)
separator
protected java.lang.String separator()
setLogTestStrings
public void setLogTestStrings(boolean logTestStrings)
- Set the boolean which determines if this class displays
every test string.
- Parameters:
boolean
- true, if the user wants to see
every test string
test
public void test()
- Create a series of random language elements, and test
that the parser can unambiguously parse each one.