Search in sources :

Example 91 with Prerequisite

use of pcgen.core.prereq.Prerequisite in project pcgen by PCGen.

the class PreSkillParserTest method test1.

/**
	 * @throws Exception
	 */
@Test
public void test1() throws Exception {
    PreSkillParser producer = new PreSkillParser();
    Prerequisite prereq = producer.parse("SKILL", "3,Decipher Script=7,Disable Device=7,Escape Artist=7", false, false);
    assertEquals("<prereq operator=\"GTEQ\" operand=\"3\" >\n" + "<prereq kind=\"skill\" count-multiples=\"true\" key=\"Decipher Script\" operator=\"GTEQ\" operand=\"7\" >\n" + "</prereq>\n" + "<prereq kind=\"skill\" count-multiples=\"true\" key=\"Disable Device\" operator=\"GTEQ\" operand=\"7\" >\n" + "</prereq>\n" + "<prereq kind=\"skill\" count-multiples=\"true\" key=\"Escape Artist\" operator=\"GTEQ\" operand=\"7\" >\n" + "</prereq>\n" + "</prereq>\n", prereq.toString());
}
Also used : PreSkillParser(plugin.pretokens.parser.PreSkillParser) Prerequisite(pcgen.core.prereq.Prerequisite) Test(org.junit.Test)

Example 92 with Prerequisite

use of pcgen.core.prereq.Prerequisite in project pcgen by PCGen.

the class PreSkillParserTest method test3.

@Test
public void test3() throws Exception {
    PreSkillParser producer = new PreSkillParser();
    Prerequisite prereq = producer.parse("SKILL", "3,TYPE.Knowledge=10", false, false);
    assertEquals("<prereq operator=\"GTEQ\" operand=\"3\" >\n" + "<prereq kind=\"skill\" count-multiples=\"true\" key=\"TYPE.Knowledge\" operator=\"GTEQ\" operand=\"10\" >\n" + "</prereq>\n" + "</prereq>\n", prereq.toString());
}
Also used : PreSkillParser(plugin.pretokens.parser.PreSkillParser) Prerequisite(pcgen.core.prereq.Prerequisite) Test(org.junit.Test)

Example 93 with Prerequisite

use of pcgen.core.prereq.Prerequisite in project pcgen by PCGen.

the class PreSkillParserTest method testTypeEquals.

@Test
public void testTypeEquals() throws Exception {
    PreSkillParser producer = new PreSkillParser();
    Prerequisite prereq = producer.parse("SKILL", "3,TYPE=Knowledge=10", false, false);
    assertEquals("<prereq operator=\"GTEQ\" operand=\"3\" >\n" + "<prereq kind=\"skill\" count-multiples=\"true\" key=\"TYPE=Knowledge\" operator=\"GTEQ\" operand=\"10\" >\n" + "</prereq>\n" + "</prereq>\n", prereq.toString());
}
Also used : PreSkillParser(plugin.pretokens.parser.PreSkillParser) Prerequisite(pcgen.core.prereq.Prerequisite) Test(org.junit.Test)

Example 94 with Prerequisite

use of pcgen.core.prereq.Prerequisite in project pcgen by PCGen.

the class PreSkillTotParserTest method testNot.

/**
	 * @throws Exception
	 */
@Test
public void testNot() throws Exception {
    PreSkillTotalParser producer = new PreSkillTotalParser();
    Prerequisite prereq = producer.parse("SKILLTOT", "Spot,Listen,Search=30", true, false);
    assertEquals("<prereq operator=\"LT\" operand=\"30\" >\n" + "<prereq kind=\"skill\" total-values=\"true\" key=\"Spot\" operator=\"GTEQ\" operand=\"1\" >\n" + "</prereq>\n" + "<prereq kind=\"skill\" total-values=\"true\" key=\"Listen\" operator=\"GTEQ\" operand=\"1\" >\n" + "</prereq>\n" + "<prereq kind=\"skill\" total-values=\"true\" key=\"Search\" operator=\"GTEQ\" operand=\"1\" >\n" + "</prereq>\n" + "</prereq>\n", prereq.toString());
}
Also used : PreSkillTotalParser(plugin.pretokens.parser.PreSkillTotalParser) Prerequisite(pcgen.core.prereq.Prerequisite) Test(org.junit.Test)

Example 95 with Prerequisite

use of pcgen.core.prereq.Prerequisite in project pcgen by PCGen.

the class PreSkillTotParserTest method testTypeKnowledge.

@Test
public void testTypeKnowledge() throws Exception {
    PreSkillTotalParser producer = new PreSkillTotalParser();
    Prerequisite prereq = producer.parse("SKILLTOT", "TYPE.Knowledge=20", false, false);
    assertEquals("<prereq operator=\"GTEQ\" operand=\"20\" >\n" + "<prereq kind=\"skill\" total-values=\"true\" key=\"TYPE.Knowledge\" operator=\"GTEQ\" operand=\"1\" >\n" + "</prereq>\n" + "</prereq>\n", prereq.toString());
}
Also used : PreSkillTotalParser(plugin.pretokens.parser.PreSkillTotalParser) Prerequisite(pcgen.core.prereq.Prerequisite) Test(org.junit.Test)

Aggregations

Prerequisite (pcgen.core.prereq.Prerequisite)267 PersistenceLayerException (pcgen.persistence.PersistenceLayerException)62 Test (org.junit.Test)61 PrerequisiteOperator (pcgen.core.prereq.PrerequisiteOperator)50 StringTokenizer (java.util.StringTokenizer)36 ArrayList (java.util.ArrayList)35 StringWriter (java.io.StringWriter)19 AssociatedPrereqObject (pcgen.cdom.base.AssociatedPrereqObject)19 CDOMReference (pcgen.cdom.base.CDOMReference)18 ParseResult (pcgen.rules.persistence.token.ParseResult)18 BonusObj (pcgen.core.bonus.BonusObj)13 TreeSet (java.util.TreeSet)12 PreParserFactory (pcgen.persistence.lst.prereq.PreParserFactory)12 CDOMSingleRef (pcgen.cdom.reference.CDOMSingleRef)10 Domain (pcgen.core.Domain)10 QualifiedObject (pcgen.core.QualifiedObject)10 PrerequisiteWriterInterface (pcgen.persistence.lst.output.prereq.PrerequisiteWriterInterface)10 PrerequisiteWriter (pcgen.persistence.lst.output.prereq.PrerequisiteWriter)9 Ungranted (pcgen.cdom.base.Ungranted)8 PrerequisiteException (pcgen.core.prereq.PrerequisiteException)8