Search in sources :

Example 36 with ParseResult

use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.

the class GlobalCcSkillTest method testList.

@Test
public void testList() throws PersistenceLayerException {
    PCTemplate source = create(PCTemplate.class, "Source");
    ParseResult result = token.parseToken(context, source, "LIST");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    result = CHOOSE_SKILL_TOKEN.parseToken(context, source, "Granted");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    PCClass wizard = create(PCClass.class, "Wizard");
    new ExclusiveToken().parseToken(context, granted, "Yes");
    finishLoad();
    pc.incrementClassLevel(1, wizard);
    assertFalse(globalAddedSkillCostFacet.contains(id, SkillCost.CROSS_CLASS, granted));
    assertEquals(SkillCost.EXCLUSIVE, pc.getSkillCostForClass(granted, wizard));
    templateInputFacet.directAdd(id, source, granted);
    pc.calcActiveBonuses();
    assertEquals(SkillCost.CROSS_CLASS, pc.getSkillCostForClass(granted, wizard));
    assertTrue(globalAddedSkillCostFacet.contains(id, SkillCost.CROSS_CLASS, granted));
    templateInputFacet.remove(id, source);
    pc.calcActiveBonuses();
    assertFalse(globalAddedSkillCostFacet.contains(id, SkillCost.CROSS_CLASS, granted));
}
Also used : ParseResult(pcgen.rules.persistence.token.ParseResult) PCTemplate(pcgen.core.PCTemplate) PCClass(pcgen.core.PCClass) ExclusiveToken(plugin.lsttokens.skill.ExclusiveToken) Test(org.junit.Test) AbstractContentTokenTest(tokencontent.testsupport.AbstractContentTokenTest)

Example 37 with ParseResult

use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.

the class DomainCSkillTest method testDirect.

@Test
public void testDirect() throws PersistenceLayerException {
    Domain source = create(Domain.class, "Source");
    ParseResult result = token.parseToken(context, source, "MySkill");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    finishLoad();
    assertEquals(SkillCost.CROSS_CLASS, pc.getSkillCostForClass(sk, dragon));
    domainInputFacet.add(id, source, new ClassSource(dragon, 0));
    assertTrue(lscFacet.contains(id, dragon, SkillCost.CLASS, sk));
    pc.addClass(dragon);
    pc.setDirty(true);
    assertEquals(SkillCost.CLASS, pc.getSkillCostForClass(sk, dragon));
    domainInputFacet.remove(id, source);
    assertFalse(lscFacet.contains(id, dragon, SkillCost.CLASS, sk));
}
Also used : ParseResult(pcgen.rules.persistence.token.ParseResult) Domain(pcgen.core.Domain) ClassSource(pcgen.cdom.helper.ClassSource) Test(org.junit.Test) AbstractTokenModelTest(tokenmodel.testsupport.AbstractTokenModelTest)

Example 38 with ParseResult

use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.

the class GlobalCompanionListTest method processToken.

@Override
public void processToken(CDOMObject source) {
    ParseResult result = token.parseToken(context, source, "Animal Companion|Ape|FOLLOWERADJUSTMENT:-3");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    finishLoad();
}
Also used : ParseResult(pcgen.rules.persistence.token.ParseResult)

Example 39 with ParseResult

use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.

the class GlobalDefineUnlockedStatTest method processToken.

@Override
public void processToken(CDOMObject source) {
    ParseResult result = token.parseToken(context, source, "UNLOCK|INT");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    finishLoad();
}
Also used : ParseResult(pcgen.rules.persistence.token.ParseResult)

Example 40 with ParseResult

use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.

the class GlobalMoveCloneTest method processToken.

@Override
public void processToken(CDOMObject source) {
    ParseResult result = token.parseToken(context, source, "Walk,Fly,*2");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    finishLoad();
}
Also used : ParseResult(pcgen.rules.persistence.token.ParseResult)

Aggregations

ParseResult (pcgen.rules.persistence.token.ParseResult)210 StringTokenizer (java.util.StringTokenizer)68 Test (org.junit.Test)45 CDOMReference (pcgen.cdom.base.CDOMReference)30 AbstractTokenModelTest (tokenmodel.testsupport.AbstractTokenModelTest)26 Ability (pcgen.core.Ability)21 ArrayList (java.util.ArrayList)18 Formula (pcgen.base.formula.Formula)18 ParsingSeparator (pcgen.base.text.ParsingSeparator)18 Prerequisite (pcgen.core.prereq.Prerequisite)18 PCClass (pcgen.core.PCClass)17 Ungranted (pcgen.cdom.base.Ungranted)15 PCTemplate (pcgen.core.PCTemplate)14 CNAbility (pcgen.cdom.content.CNAbility)13 PersistenceLayerException (pcgen.persistence.PersistenceLayerException)11 ComplexParseResult (pcgen.rules.persistence.token.ComplexParseResult)11 BigDecimal (java.math.BigDecimal)10 Race (pcgen.core.Race)10 ConcretePersistentTransitionChoice (pcgen.cdom.base.ConcretePersistentTransitionChoice)9 LegalScope (pcgen.base.formula.base.LegalScope)8