}
public void runTest() throws Throwable
{
// Test for terminals
Terminal a = new Terminal("a");
Terminal b = new Terminal("b");
assertEquals("Test if symbol names are equal", "a", a.getName());
assertEquals("Test if symbol names are equal", "b", b.getName());
assertEquals("Test if symbols are equal", a, a);
assertNotEquals("Test if symbols are not equal", a, b);
assertEquals("Test if hashcodes are equals", a.hashCode(), a.hashCode());
Terminal a2 = new Terminal("a");
assertEquals("Test if symbols are equal", a, a2);
assertNotEquals("Test if symbols are not equal", a2, b);
assertEquals("Test if hashcodes are equals", a.hashCode(), a2.hashCode());
assertTrue("Test if hashcodes are no equal", a2.hashCode()!=b.hashCode());
// Test for nonterminals
Nonterminal A = new Nonterminal("A");
Nonterminal B = new Nonterminal("B");
assertEquals("Test if symbol names are equal", "A", A.getName());
assertEquals("Test if symbol names are equal", "B", B.getName());
assertEquals("Test if symbols are equal", A, A);
assertNotEquals("Test if symbols are not equal", A, B);
assertEquals("Test if hashcodes are equals", A.hashCode(), A.hashCode());
Nonterminal A2 = new Nonterminal("A");
assertEquals("Test if symbols are equal", A, A2);
assertNotEquals("Test if symbols are not equal", A2, B);
assertEquals("Test if hashcodes are equal", A.hashCode(), A2.hashCode());
assertTrue("Test if hashcodes are no equal", A2.hashCode()!=B.hashCode());
// Test for emptylist symbols
EmptyList emptylist = new EmptyList();
EmptyList emptylist2 = new EmptyList();
assertEquals("Test if symbols are equal", emptylist, emptylist);
assertEquals("Test if symbols are equal", emptylist, emptylist2);
// Composite tests
Terminal a3 = new Terminal("A");
Nonterminal A3 = new Nonterminal("a");
assertNotEquals("Test if symbols are not equal", a3, A);
assertNotEquals("Test if symbols are not equal", a, A3);
assertNotEquals("Test if symbols are not equal", a, emptylist);
assertNotEquals("Test if symbols are not equal", A, emptylist);
assertTrue("Test if hashcodes are no equal", a.hashCode()!=emptylist.hashCode());
assertTrue("Test if hashcodes are no equal", A.hashCode()!=emptylist.hashCode());
try
{
Terminal a4 = new Terminal(null);
fail("Test if exception occurs");
}
catch (Exception e) {}
try
{
Nonterminal A4 = new Nonterminal(null);
fail("Test if exception occurs");
}
catch (Exception e) {}
try
{
Terminal a4 = new Terminal("");
fail("Test if exception occurs");
}
catch (Exception e) {}
try