From: <th...@us...> - 2010-08-09 20:38:12
|
Revision: 12762 http://pcgen.svn.sourceforge.net/pcgen/?rev=12762&view=rev Author: thpr Date: 2010-08-09 20:38:05 +0000 (Mon, 09 Aug 2010) Log Message: ----------- Add additional token tests Modified Paths: -------------- Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractSelectionTokenTestCase.java Added Paths: ----------- Trunk/pcgen/code/src/utest/plugin/lsttokens/pcclass/CCSkillTokenTest.java Trunk/pcgen/code/src/utest/plugin/lsttokens/pcclass/CSkillTokenTest.java Trunk/pcgen/code/src/utest/plugin/lsttokens/pcclass/level/CCSkillTokenTest.java Trunk/pcgen/code/src/utest/plugin/lsttokens/pcclass/level/CSkillTokenTest.java Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/pcclass/CCSkillTokenTest.java =================================================================== --- Trunk/pcgen/code/src/utest/plugin/lsttokens/pcclass/CCSkillTokenTest.java (rev 0) +++ Trunk/pcgen/code/src/utest/plugin/lsttokens/pcclass/CCSkillTokenTest.java 2010-08-09 20:38:05 UTC (rev 12762) @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2010 Tom Parker <th...@us...> + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package plugin.lsttokens.pcclass; + +import org.junit.Test; + +import pcgen.core.PCClass; +import pcgen.core.Skill; +import pcgen.persistence.PersistenceLayerException; +import pcgen.rules.persistence.CDOMLoader; +import pcgen.rules.persistence.token.CDOMPrimaryToken; +import plugin.lsttokens.testsupport.AbstractListTokenTestCase; +import plugin.lsttokens.testsupport.CDOMTokenLoader; + +public class CCSkillTokenTest extends AbstractListTokenTestCase<PCClass, Skill> +{ + + @Override + public char getJoinCharacter() + { + return '|'; + } + + @Override + public Class<Skill> getTargetClass() + { + return Skill.class; + } + + @Override + public boolean isTypeLegal() + { + return true; + } + + @Override + public boolean isAllLegal() + { + return true; + } + + @Override + public boolean isClearDotLegal() + { + return true; + } + + @Override + public boolean isClearLegal() + { + return true; + } + + static CDOMPrimaryToken<PCClass> token = new CcskillToken(); + static CDOMTokenLoader<PCClass> loader = + new CDOMTokenLoader<PCClass>(PCClass.class); + + @Override + public CDOMLoader<PCClass> getLoader() + { + return loader; + } + + @Override + public Class<PCClass> getCDOMClass() + { + return PCClass.class; + } + + @Override + public CDOMPrimaryToken<PCClass> getToken() + { + return token; + } + + @Test + public void testRoundRobinList() throws PersistenceLayerException + { + boolean result = parse("LIST"); + if (result) + { + assertFalse(primaryContext.ref.validate(null)); + } + else + { + assertNoSideEffects(); + } + } + + @Test + public void testRoundRobinPattern() throws PersistenceLayerException + { + runRoundRobin("Pattern%"); + } + + @Override + public boolean allowDups() + { + return false; + } + +} Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/pcclass/CSkillTokenTest.java =================================================================== --- Trunk/pcgen/code/src/utest/plugin/lsttokens/pcclass/CSkillTokenTest.java (rev 0) +++ Trunk/pcgen/code/src/utest/plugin/lsttokens/pcclass/CSkillTokenTest.java 2010-08-09 20:38:05 UTC (rev 12762) @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2010 Tom Parker <th...@us...> + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package plugin.lsttokens.pcclass; + +import org.junit.Test; + +import pcgen.core.PCClass; +import pcgen.core.Skill; +import pcgen.persistence.PersistenceLayerException; +import pcgen.rules.persistence.CDOMLoader; +import pcgen.rules.persistence.token.CDOMPrimaryToken; +import plugin.lsttokens.testsupport.AbstractListTokenTestCase; +import plugin.lsttokens.testsupport.CDOMTokenLoader; + +public class CSkillTokenTest extends AbstractListTokenTestCase<PCClass, Skill> +{ + + @Override + public char getJoinCharacter() + { + return '|'; + } + + @Override + public Class<Skill> getTargetClass() + { + return Skill.class; + } + + @Override + public boolean isTypeLegal() + { + return true; + } + + @Override + public boolean isAllLegal() + { + return true; + } + + @Override + public boolean isClearDotLegal() + { + return true; + } + + @Override + public boolean isClearLegal() + { + return true; + } + + static CDOMPrimaryToken<PCClass> token = new CskillToken(); + static CDOMTokenLoader<PCClass> loader = + new CDOMTokenLoader<PCClass>(PCClass.class); + + @Override + public CDOMLoader<PCClass> getLoader() + { + return loader; + } + + @Override + public Class<PCClass> getCDOMClass() + { + return PCClass.class; + } + + @Override + public CDOMPrimaryToken<PCClass> getToken() + { + return token; + } + + @Test + public void testRoundRobinList() throws PersistenceLayerException + { + boolean result = parse("LIST"); + if (result) + { + assertFalse(primaryContext.ref.validate(null)); + } + else + { + assertNoSideEffects(); + } + } + + @Test + public void testRoundRobinPattern() throws PersistenceLayerException + { + runRoundRobin("Pattern%"); + } + + @Override + public boolean allowDups() + { + return false; + } + +} Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/pcclass/level/CCSkillTokenTest.java =================================================================== --- Trunk/pcgen/code/src/utest/plugin/lsttokens/pcclass/level/CCSkillTokenTest.java (rev 0) +++ Trunk/pcgen/code/src/utest/plugin/lsttokens/pcclass/level/CCSkillTokenTest.java 2010-08-09 20:38:05 UTC (rev 12762) @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2010 Tom Parker <th...@us...> + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package plugin.lsttokens.pcclass.level; + +import org.junit.Test; + +import pcgen.cdom.inst.PCClassLevel; +import pcgen.core.Skill; +import pcgen.persistence.PersistenceLayerException; +import pcgen.rules.persistence.CDOMLoader; +import pcgen.rules.persistence.token.CDOMPrimaryToken; +import plugin.lsttokens.testsupport.AbstractListTokenTestCase; +import plugin.lsttokens.testsupport.CDOMTokenLoader; + +public class CCSkillTokenTest extends + AbstractListTokenTestCase<PCClassLevel, Skill> +{ + + @Override + public char getJoinCharacter() + { + return '|'; + } + + @Override + public Class<Skill> getTargetClass() + { + return Skill.class; + } + + @Override + public boolean isTypeLegal() + { + return true; + } + + @Override + public boolean isAllLegal() + { + return true; + } + + @Override + public boolean isClearDotLegal() + { + return true; + } + + @Override + public boolean isClearLegal() + { + return true; + } + + static CDOMPrimaryToken<PCClassLevel> token = new CcskillToken(); + static CDOMTokenLoader<PCClassLevel> loader = + new CDOMTokenLoader<PCClassLevel>(PCClassLevel.class); + + @Override + public CDOMLoader<PCClassLevel> getLoader() + { + return loader; + } + + @Override + public Class<PCClassLevel> getCDOMClass() + { + return PCClassLevel.class; + } + + @Override + public CDOMPrimaryToken<PCClassLevel> getToken() + { + return token; + } + + @Test + public void testRoundRobinList() throws PersistenceLayerException + { + boolean result = parse("LIST"); + if (result) + { + assertFalse(primaryContext.ref.validate(null)); + } + else + { + assertNoSideEffects(); + } + } + + @Test + public void testRoundRobinPattern() throws PersistenceLayerException + { + runRoundRobin("Pattern%"); + } + + @Override + public boolean allowDups() + { + return false; + } + +} Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/pcclass/level/CSkillTokenTest.java =================================================================== --- Trunk/pcgen/code/src/utest/plugin/lsttokens/pcclass/level/CSkillTokenTest.java (rev 0) +++ Trunk/pcgen/code/src/utest/plugin/lsttokens/pcclass/level/CSkillTokenTest.java 2010-08-09 20:38:05 UTC (rev 12762) @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2010 Tom Parker <th...@us...> + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package plugin.lsttokens.pcclass.level; + +import org.junit.Test; + +import pcgen.cdom.inst.PCClassLevel; +import pcgen.core.Skill; +import pcgen.persistence.PersistenceLayerException; +import pcgen.rules.persistence.CDOMLoader; +import pcgen.rules.persistence.token.CDOMPrimaryToken; +import plugin.lsttokens.testsupport.AbstractListTokenTestCase; +import plugin.lsttokens.testsupport.CDOMTokenLoader; + +public class CSkillTokenTest extends + AbstractListTokenTestCase<PCClassLevel, Skill> +{ + + @Override + public char getJoinCharacter() + { + return '|'; + } + + @Override + public Class<Skill> getTargetClass() + { + return Skill.class; + } + + @Override + public boolean isTypeLegal() + { + return true; + } + + @Override + public boolean isAllLegal() + { + return true; + } + + @Override + public boolean isClearDotLegal() + { + return true; + } + + @Override + public boolean isClearLegal() + { + return true; + } + + static CDOMPrimaryToken<PCClassLevel> token = new CskillToken(); + static CDOMTokenLoader<PCClassLevel> loader = + new CDOMTokenLoader<PCClassLevel>(PCClassLevel.class); + + @Override + public CDOMLoader<PCClassLevel> getLoader() + { + return loader; + } + + @Override + public Class<PCClassLevel> getCDOMClass() + { + return PCClassLevel.class; + } + + @Override + public CDOMPrimaryToken<PCClassLevel> getToken() + { + return token; + } + + @Test + public void testRoundRobinList() throws PersistenceLayerException + { + boolean result = parse("LIST"); + if (result) + { + assertFalse(primaryContext.ref.validate(null)); + } + else + { + assertNoSideEffects(); + } + } + + @Test + public void testRoundRobinPattern() throws PersistenceLayerException + { + runRoundRobin("Pattern%"); + } + + @Override + public boolean allowDups() + { + return false; + } + +} Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractSelectionTokenTestCase.java =================================================================== --- Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractSelectionTokenTestCase.java 2010-08-09 20:34:35 UTC (rev 12761) +++ Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractSelectionTokenTestCase.java 2010-08-09 20:38:05 UTC (rev 12762) @@ -143,6 +143,22 @@ // } // } + @Test + public void testInvalidTooManyPipe() throws PersistenceLayerException + { + construct(primaryContext, "TestWP1"); + construct(primaryContext, "TestWP2"); + boolean parse = parse(getSubTokenName() + "|Formula|TestWP1|TestWP2"); + if (parse) + { + assertFalse(primaryContext.ref.validate(null)); + } + else + { + assertNoSideEffects(); + } + } + @Test public void testInvalidInputJoinedDot() throws PersistenceLayerException { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |