use of pcgen.core.prereq.Prerequisite in project pcgen by PCGen.
the class PreMoveParserTest method testNotFlyAndWalk.
/**
* @throws Exception
*/
@Test
public void testNotFlyAndWalk() throws Exception {
PreMoveParser parser = new PreMoveParser();
Prerequisite prereq = parser.parse("MOVE", "1,Walk=30,Fly=20", true, false);
assertEquals("<prereq operator=\"LT\" operand=\"1\" >\n" + "<prereq kind=\"move\" count-multiples=\"true\" key=\"Walk\" operator=\"GTEQ\" operand=\"30\" >\n" + "</prereq>\n" + "<prereq kind=\"move\" count-multiples=\"true\" key=\"Fly\" operator=\"GTEQ\" operand=\"20\" >\n" + "</prereq>\n" + "</prereq>\n", prereq.toString());
}
use of pcgen.core.prereq.Prerequisite in project pcgen by PCGen.
the class PreMoveParserTest method testNotFly1.
/**
* @throws Exception
*/
@Test
public void testNotFly1() throws Exception {
PreMoveParser parser = new PreMoveParser();
Prerequisite prereq = parser.parse("MOVE", "1,Fly=1", true, false);
assertEquals("<prereq kind=\"move\" key=\"Fly\" operator=\"LT\" operand=\"1\" >\n</prereq>\n", prereq.toString());
}
use of pcgen.core.prereq.Prerequisite in project pcgen by PCGen.
the class PreMultParserTest method testUnbalancedBracket.
@Test
public void testUnbalancedBracket() {
PreMultParser parser = new PreMultParser();
try {
Prerequisite prereq = parser.parse("mult", "1,[PREPROFWITHARMOR:1,TYPE.Medium],[PREFEAT:1,Armor Proficiency (Medium)", false, false);
fail("Expected unbalanced bracket to be detected.");
} catch (PersistenceLayerException e) {
assertEquals("Unbalanced [] in PREMULT '[PREPROFWITHARMOR:1,TYPE.Medium],[PREFEAT:1,Armor Proficiency (Medium)'.", e.getMessage());
}
}
use of pcgen.core.prereq.Prerequisite in project pcgen by PCGen.
the class PreParserFactoryTest method testOverrideQualifies.
/**
* @throws Exception
*/
public void testOverrideQualifies() throws Exception {
PreParserFactory factory = PreParserFactory.getInstance();
Prerequisite prereq = factory.parse("PREVARNEQ:Q:Enraged,1");
assertEquals("<prereq kind=\"var\" key=\"Enraged\" operator=\"NEQ\" operand=\"1\" override-qualify=\"true\" >\n</prereq>\n", prereq.toString());
}
use of pcgen.core.prereq.Prerequisite in project pcgen by PCGen.
the class PreParserFactoryTest method testInvertResult.
public void testInvertResult() throws Exception {
PreParserFactory factory = PreParserFactory.getInstance();
Prerequisite prereq = factory.parse("!PREALIGN:LG,LN,LE");
assertEquals("<prereq operator=\"LT\" operand=\"1\" >\n" + "<prereq kind=\"align\" key=\"LG\" operator=\"EQ\" operand=\"1\" >\n</prereq>\n" + "<prereq kind=\"align\" key=\"LN\" operator=\"EQ\" operand=\"1\" >\n</prereq>\n" + "<prereq kind=\"align\" key=\"LE\" operator=\"EQ\" operand=\"1\" >\n</prereq>\n" + "</prereq>\n", prereq.toString());
prereq = factory.parse("PREALIGN:NG,TN,NE,CG,CN,CE");
assertEquals("<prereq operator=\"GTEQ\" operand=\"1\" >\n" + "<prereq kind=\"align\" key=\"NG\" operator=\"EQ\" operand=\"1\" >\n</prereq>\n" + "<prereq kind=\"align\" key=\"TN\" operator=\"EQ\" operand=\"1\" >\n</prereq>\n" + "<prereq kind=\"align\" key=\"NE\" operator=\"EQ\" operand=\"1\" >\n</prereq>\n" + "<prereq kind=\"align\" key=\"CG\" operator=\"EQ\" operand=\"1\" >\n</prereq>\n" + "<prereq kind=\"align\" key=\"CN\" operator=\"EQ\" operand=\"1\" >\n</prereq>\n" + "<prereq kind=\"align\" key=\"CE\" operator=\"EQ\" operand=\"1\" >\n</prereq>\n" + "</prereq>\n", prereq.toString());
}
Aggregations