|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
lp.parse.LpLexerTest
public class LpLexerTest
Contains tests of the LpLexer class.
LpLexer| Field Summary | |
|---|---|
protected LpLexer |
lexer
|
| Constructor Summary | |
|---|---|
LpLexerTest(String testName)
A default test case constructor. |
|
| Method Summary | |
|---|---|
protected void |
doTest(String source,
List<LpToken> expectedTokens)
Uses lexer to tokenize source and compares the results
with contents of expectedTokens. |
void |
testAfterClose()
Tests the default values the lexer should return after LpLexer.close() is called. |
void |
testComments()
Tests the lexer on an input containing some comments. |
void |
testDefaultValues()
Tests the default values the lexer should return before LpLexer.nextToken() is called for the first time. |
protected void |
testEqual(LpToken expected,
LpToken actual)
Tests whether actual is as expected. |
protected void |
testEqual(LpToken expected,
LpTokenType type,
String lexem,
int lineNumber,
int position)
Tests whether a type, lexem, position and
lineNumber are as expected. |
void |
testSetInputExceptions()
Tests the lexer on null input (a IllegalArgumentException should be
thrown). |
void |
testTokens()
Tests the lexer on a more complicated input. |
void |
testTokensSimple()
Tests the lexer on an input containing all types of tokens. |
void |
testWhiteSpace()
Tests the lexer on an input with lots of whitespace. |
| 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 |
|---|
protected LpLexer lexer
| Constructor Detail |
|---|
public LpLexerTest(String testName)
testName - the name of the test case| Method Detail |
|---|
public void testWhiteSpace()
IOException - if an I/O error occurs while reading the input
(should never happen)public void testComments()
IOException - if an I/O error occurs while reading the input
(should never happen)public void testTokensSimple()
IOException - if an I/O error occurs while reading the input
(should never happen)public void testTokens()
IOException - if an I/O error occurs while reading the input
(should never happen)public void testDefaultValues()
LpLexer.nextToken() is called for the first time.
IOException - if an I/O error occurs while reading the input
(should never happen)public void testAfterClose()
LpLexer.close() is called.
IOException - if an I/O error occurs while reading the input
(should never happen)public void testSetInputExceptions()
IllegalArgumentException should be
thrown).
IOException - if an I/O error occurs while reading the input
(should never happen)
protected void doTest(String source,
List<LpToken> expectedTokens)
lexer to tokenize source and compares the results
with contents of expectedTokens.
IOException - (wrapped in an ExceptionAdapter)
if an I/O error occurs while reading the input (should never happen)
protected void testEqual(LpToken expected,
LpToken actual)
actual is as expected.
expected - the expected valueactual - the tested LpToken.
protected void testEqual(LpToken expected,
LpTokenType type,
String lexem,
int lineNumber,
int position)
type, lexem, position and
lineNumber are as expected.
expected - a LpToken instance containg the correct valuestype - the tested LpTokenTypelexem - the tested lexemlineNumber - the tested line numberposition - the tested position
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||