Search in sources :

Example 1 with PreRaceParser

use of plugin.pretokens.parser.PreRaceParser in project pcgen by PCGen.

the class PreRaceParserTest method testExclusions.

/**
	 * Test that exclusions are parsed properly.
	 * @throws Exception
	 */
@Test
public void testExclusions() throws Exception {
    PreRaceParser parser = new PreRaceParser();
    Prerequisite prereq = parser.parse("race", "1,Elf%,[Elf (aquatic)]", false, false);
    assertEquals("PRERACE with an excluded race", "<prereq operator=\"GTEQ\" operand=\"2\" >\n" + "<prereq kind=\"race\" count-multiples=\"true\" key=\"Elf%\" operator=\"GTEQ\" operand=\"1\" >\n" + "</prereq>\n" + "<prereq kind=\"race\" count-multiples=\"true\" key=\"Elf (aquatic)\" operator=\"LT\" operand=\"1\" >\n" + "</prereq>\n</prereq>\n", prereq.toString());
}
Also used : PreRaceParser(plugin.pretokens.parser.PreRaceParser) Prerequisite(pcgen.core.prereq.Prerequisite) Test(org.junit.Test)

Example 2 with PreRaceParser

use of plugin.pretokens.parser.PreRaceParser in project pcgen by PCGen.

the class AbilityLstTest method setUp.

@Override
public void setUp() throws PersistenceLayerException, URISyntaxException {
    super.setUp();
    TokenRegistration.register(new PreRaceParser());
    TokenRegistration.register(new PreRaceWriter());
    TokenRegistration.register(new PreLevelParser());
    TokenRegistration.register(new PreLevelWriter());
    TokenRegistration.register(new PreClassParser());
    TokenRegistration.register(new PreClassWriter());
}
Also used : PreClassParser(plugin.pretokens.parser.PreClassParser) PreRaceWriter(plugin.pretokens.writer.PreRaceWriter) PreRaceParser(plugin.pretokens.parser.PreRaceParser) PreLevelWriter(plugin.pretokens.writer.PreLevelWriter) PreClassWriter(plugin.pretokens.writer.PreClassWriter) PreLevelParser(plugin.pretokens.parser.PreLevelParser)

Example 3 with PreRaceParser

use of plugin.pretokens.parser.PreRaceParser in project pcgen by PCGen.

the class PreRaceParserTest method testInvalidSeparators.

/**
	 * Test that an error is produced if separators are incorrect
	 * @throws Exception
	 */
@Test
public void testInvalidSeparators() throws Exception {
    try {
        PreRaceParser parser = new PreRaceParser();
        Prerequisite prereq = parser.parse("race", "1,,KEY_a", false, false);
        fail("Should have thrown a PersistenceLayerException.");
    } catch (PersistenceLayerException e) {
    // Ignore, this is the expected result.
    }
}
Also used : PersistenceLayerException(pcgen.persistence.PersistenceLayerException) PreRaceParser(plugin.pretokens.parser.PreRaceParser) Prerequisite(pcgen.core.prereq.Prerequisite) Test(org.junit.Test)

Example 4 with PreRaceParser

use of plugin.pretokens.parser.PreRaceParser in project pcgen by PCGen.

the class PreRaceParserTest method testInvalidCharacter.

/**
	 * Test that an error is produced if separators are incorrect
	 * @throws Exception
	 */
@Test
public void testInvalidCharacter() throws Exception {
    try {
        PreRaceParser parser = new PreRaceParser();
        Prerequisite prereq = parser.parse("race", "1,KEY_a|Key_b", false, false);
        fail("Should have thrown a PersistenceLayerException.");
    } catch (PersistenceLayerException e) {
    // Ignore, this is the expected result.
    }
}
Also used : PersistenceLayerException(pcgen.persistence.PersistenceLayerException) PreRaceParser(plugin.pretokens.parser.PreRaceParser) Prerequisite(pcgen.core.prereq.Prerequisite) Test(org.junit.Test)

Example 5 with PreRaceParser

use of plugin.pretokens.parser.PreRaceParser in project pcgen by PCGen.

the class PreRaceRoundRobin method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    TokenRegistration.register(new PreRaceParser());
    TokenRegistration.register(new PreRaceWriter());
}
Also used : PreRaceWriter(plugin.pretokens.writer.PreRaceWriter) PreRaceParser(plugin.pretokens.parser.PreRaceParser)

Aggregations

PreRaceParser (plugin.pretokens.parser.PreRaceParser)5 Test (org.junit.Test)3 Prerequisite (pcgen.core.prereq.Prerequisite)3 PersistenceLayerException (pcgen.persistence.PersistenceLayerException)2 PreRaceWriter (plugin.pretokens.writer.PreRaceWriter)2 PreClassParser (plugin.pretokens.parser.PreClassParser)1 PreLevelParser (plugin.pretokens.parser.PreLevelParser)1 PreClassWriter (plugin.pretokens.writer.PreClassWriter)1 PreLevelWriter (plugin.pretokens.writer.PreLevelWriter)1