You can subscribe to this list here.
| 2006 |
Jan
|
Feb
(26) |
Mar
(493) |
Apr
(372) |
May
(131) |
Jun
(96) |
Jul
(87) |
Aug
(116) |
Sep
(68) |
Oct
(127) |
Nov
(158) |
Dec
(122) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(258) |
Feb
(148) |
Mar
(367) |
Apr
(202) |
May
(268) |
Jun
(182) |
Jul
(344) |
Aug
(324) |
Sep
(254) |
Oct
(264) |
Nov
(155) |
Dec
(169) |
| 2008 |
Jan
(266) |
Feb
(330) |
Mar
(371) |
Apr
(378) |
May
(259) |
Jun
(547) |
Jul
(319) |
Aug
(346) |
Sep
(198) |
Oct
(440) |
Nov
(230) |
Dec
(251) |
| 2009 |
Jan
(422) |
Feb
(344) |
Mar
(274) |
Apr
(70) |
May
(27) |
Jun
(86) |
Jul
(214) |
Aug
(158) |
Sep
(272) |
Oct
(235) |
Nov
(232) |
Dec
(155) |
| 2010 |
Jan
(147) |
Feb
(75) |
Mar
(93) |
Apr
(120) |
May
(317) |
Jun
(373) |
Jul
(324) |
Aug
(222) |
Sep
(274) |
Oct
(439) |
Nov
(358) |
Dec
(274) |
| 2011 |
Jan
(200) |
Feb
(167) |
Mar
(82) |
Apr
(159) |
May
(176) |
Jun
(120) |
Jul
(68) |
Aug
(85) |
Sep
(75) |
Oct
(40) |
Nov
(130) |
Dec
(106) |
| 2012 |
Jan
(254) |
Feb
(411) |
Mar
(274) |
Apr
(43) |
May
(136) |
Jun
(97) |
Jul
(64) |
Aug
(118) |
Sep
(465) |
Oct
(550) |
Nov
(424) |
Dec
(394) |
| 2013 |
Jan
(329) |
Feb
(289) |
Mar
(259) |
Apr
(236) |
May
(243) |
Jun
(379) |
Jul
(311) |
Aug
(296) |
Sep
(297) |
Oct
(422) |
Nov
(466) |
Dec
(254) |
| 2014 |
Jan
(364) |
Feb
(278) |
Mar
(208) |
Apr
(184) |
May
(248) |
Jun
(370) |
Jul
(396) |
Aug
(246) |
Sep
(156) |
Oct
(168) |
Nov
(331) |
Dec
(158) |
| 2015 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
1
(4) |
2
(7) |
3
|
4
(11) |
5
(31) |
6
(15) |
|
7
(15) |
8
(3) |
9
(1) |
10
(1) |
11
|
12
|
13
|
|
14
(4) |
15
(6) |
16
(5) |
17
(5) |
18
(7) |
19
(3) |
20
(3) |
|
21
(5) |
22
(9) |
23
(13) |
24
(14) |
25
(6) |
26
(4) |
27
|
|
28
(11) |
29
(4) |
30
(32) |
31
(32) |
|
|
|
|
From: <th...@us...> - 2008-12-31 23:47:21
|
Revision: 8768
http://pcgen.svn.sourceforge.net/pcgen/?rev=8768&view=rev
Author: thpr
Date: 2008-12-31 23:47:18 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
Kit Token Tests, part 3
Added Paths:
-----------
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/AbilityTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/CountTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/FeatTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/FreeTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/ClassTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/LevelTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/SubClassTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/CountTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/DeityTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/DomainTokenTest.java
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/AbilityTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/AbilityTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/AbilityTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2007 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.kit.ability;
+
+import org.junit.Test;
+
+import pcgen.core.Ability;
+import pcgen.core.AbilityCategory;
+import pcgen.core.kit.KitAbilities;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class AbilityTokenTest extends AbstractSubTokenTestCase<KitAbilities>
+{
+
+ static AbilityToken token = new AbilityToken();
+ static CDOMSubLineLoader<KitAbilities> loader = new CDOMSubLineLoader<KitAbilities>(
+ "*KITTOKEN", "SKILL", KitAbilities.class);
+
+ @Override
+ public Class<KitAbilities> getCDOMClass()
+ {
+ return KitAbilities.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitAbilities> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitAbilities> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("CATEGORY=Feat|Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ Ability ab = primaryContext.ref.constructCDOMObject(Ability.class,
+ "Fireball");
+ primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = secondaryContext.ref
+ .constructCDOMObject(Ability.class, "Fireball");
+ secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ runRoundRobin("CATEGORY=Feat|Fireball");
+ }
+
+ @Test
+ public void testRoundRobinTwo() throws PersistenceLayerException
+ {
+ Ability ab = primaryContext.ref.constructCDOMObject(Ability.class,
+ "Fireball");
+ primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = secondaryContext.ref
+ .constructCDOMObject(Ability.class, "Fireball");
+ secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = primaryContext.ref.constructCDOMObject(Ability.class, "English");
+ primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = secondaryContext.ref.constructCDOMObject(Ability.class, "English");
+ secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ runRoundRobin("CATEGORY=Feat|English" + getJoinCharacter() + "Fireball");
+ }
+
+ @Test
+ public void testInvalidListEnd() throws PersistenceLayerException
+ {
+ assertFalse(parse("CATEGORY=Feat|TestWP1" + getJoinCharacter()));
+ }
+
+ private char getJoinCharacter()
+ {
+ return '|';
+ }
+
+ @Test
+ public void testInvalidListStart() throws PersistenceLayerException
+ {
+ assertFalse(parse("CATEGORY=Feat|" + getJoinCharacter() + "TestWP1"));
+ }
+
+ @Test
+ public void testInvalidListDoubleJoin() throws PersistenceLayerException
+ {
+ assertFalse(parse("CATEGORY=Feat|TestWP2" + getJoinCharacter() + getJoinCharacter()
+ + "TestWP1"));
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/CountTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/CountTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/CountTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2007 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.kit.ability;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitAbilities;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class CountTokenTest extends AbstractSubTokenTestCase<KitAbilities>
+{
+
+ static CountToken token = new CountToken();
+ static CDOMSubLineLoader<KitAbilities> loader = new CDOMSubLineLoader<KitAbilities>(
+ "*KITTOKEN", "SPELLS", KitAbilities.class);
+
+ @Override
+ public Class<KitAbilities> getCDOMClass()
+ {
+ return KitAbilities.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitAbilities> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitAbilities> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testRoundRobinNumber() throws PersistenceLayerException
+ {
+ runRoundRobin("3");
+ }
+
+ @Test
+ public void testInvalidInputFormula() throws PersistenceLayerException
+ {
+ assertFalse(parse("FormulaProhibited"));
+ }
+
+ @Test
+ public void testInvalidInputZero() throws PersistenceLayerException
+ {
+ assertFalse(parse("0"));
+ }
+
+ @Test
+ public void testInvalidInputNegative() throws PersistenceLayerException
+ {
+ assertFalse(parse("-1"));
+ }
+
+ @Test
+ public void testInvalidInputDecimal() throws PersistenceLayerException
+ {
+ assertFalse(parse("1.5"));
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/FeatTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/FeatTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/FeatTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2007 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.kit.ability;
+
+import org.junit.Test;
+
+import pcgen.core.Ability;
+import pcgen.core.AbilityCategory;
+import pcgen.core.kit.KitAbilities;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class FeatTokenTest extends AbstractSubTokenTestCase<KitAbilities>
+{
+
+ static FeatToken token = new FeatToken();
+ static CDOMSubLineLoader<KitAbilities> loader = new CDOMSubLineLoader<KitAbilities>(
+ "*KITTOKEN", "SKILL", KitAbilities.class);
+
+ @Override
+ public Class<KitAbilities> getCDOMClass()
+ {
+ return KitAbilities.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitAbilities> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitAbilities> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ Ability ab = primaryContext.ref.constructCDOMObject(Ability.class,
+ "Fireball");
+ primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = secondaryContext.ref
+ .constructCDOMObject(Ability.class, "Fireball");
+ secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ runRoundRobin("Fireball");
+ }
+
+ @Test
+ public void testRoundRobinTwo() throws PersistenceLayerException
+ {
+ Ability ab = primaryContext.ref.constructCDOMObject(Ability.class,
+ "Fireball");
+ primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = secondaryContext.ref
+ .constructCDOMObject(Ability.class, "Fireball");
+ secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = primaryContext.ref.constructCDOMObject(Ability.class, "English");
+ primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = secondaryContext.ref.constructCDOMObject(Ability.class, "English");
+ secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ runRoundRobin("English" + getJoinCharacter() + "Fireball");
+ }
+
+ @Test
+ public void testInvalidListEnd() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP1" + getJoinCharacter()));
+ }
+
+ private char getJoinCharacter()
+ {
+ return '|';
+ }
+
+ @Test
+ public void testInvalidChangeCatetory() throws PersistenceLayerException
+ {
+ assertFalse(parse("CATEGORY=FEAT|TestWP1"));
+ }
+
+ @Test
+ public void testInvalidListStart() throws PersistenceLayerException
+ {
+ assertFalse(parse(getJoinCharacter() + "TestWP1"));
+ }
+
+ @Test
+ public void testInvalidListDoubleJoin() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP2" + getJoinCharacter() + getJoinCharacter()
+ + "TestWP1"));
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/FreeTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/FreeTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/FreeTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2007 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.kit.ability;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitAbilities;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class FreeTokenTest extends AbstractSubTokenTestCase<KitAbilities>
+{
+
+ static FreeToken token = new FreeToken();
+ static CDOMSubLineLoader<KitAbilities> loader = new CDOMSubLineLoader<KitAbilities>(
+ "*KITTOKEN", "SKILL", KitAbilities.class);
+
+ @Override
+ public Class<KitAbilities> getCDOMClass()
+ {
+ return KitAbilities.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitAbilities> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitAbilities> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputString() throws PersistenceLayerException
+ {
+ internalTestInvalidInputString(null);
+ }
+
+ @Test
+ public void testInvalidInputStringSet() throws PersistenceLayerException
+ {
+ assertTrue(parse("YES"));
+ assertTrue(parseSecondary("YES"));
+ assertEquals(Boolean.TRUE, getValue());
+ internalTestInvalidInputString(Boolean.TRUE);
+ }
+
+ public void internalTestInvalidInputString(Object val)
+ throws PersistenceLayerException
+ {
+ assertEquals(val, getValue());
+ assertFalse(parse("String"));
+ assertEquals(val, getValue());
+ assertFalse(parse("TYPE=TestType"));
+ assertEquals(val, getValue());
+ assertFalse(parse("TYPE.TestType"));
+ assertEquals(val, getValue());
+ assertFalse(parse("ALL"));
+ assertEquals(val, getValue());
+ assertFalse(parse("Yo!"));
+ assertEquals(val, getValue());
+ assertFalse(parse("Now"));
+ assertEquals(val, getValue());
+ }
+
+ @Test
+ public void testValidInputs() throws PersistenceLayerException
+ {
+ assertTrue(parse("YES"));
+ assertEquals(Boolean.TRUE, getValue());
+ assertTrue(parse("NO"));
+ assertEquals(Boolean.FALSE, getValue());
+ // We're nice enough to be case insensitive here...
+ assertTrue(parse("YeS"));
+ assertEquals(Boolean.TRUE, getValue());
+ assertTrue(parse("Yes"));
+ assertEquals(Boolean.TRUE, getValue());
+ assertTrue(parse("No"));
+ assertEquals(Boolean.FALSE, getValue());
+ // Allow abbreviations
+ assertTrue(parse("Y"));
+ assertEquals(Boolean.TRUE, getValue());
+ assertTrue(parse("N"));
+ assertEquals(Boolean.FALSE, getValue());
+ }
+
+ private Boolean getValue()
+ {
+ return primaryProf.getFree();
+ }
+
+ @Test
+ public void testRoundRobinYes() throws PersistenceLayerException
+ {
+ runRoundRobin("YES");
+ }
+
+ @Test
+ public void testRoundRobinNo() throws PersistenceLayerException
+ {
+ runRoundRobin("NO");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/ClassTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/ClassTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/ClassTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2007 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.kit.clazz;
+
+import org.junit.Test;
+
+import pcgen.core.PCClass;
+import pcgen.core.kit.KitClass;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class ClassTokenTest extends AbstractSubTokenTestCase<KitClass>
+{
+
+ static ClassToken token = new ClassToken();
+ static CDOMSubLineLoader<KitClass> loader = new CDOMSubLineLoader<KitClass>(
+ "*KITTOKEN", "SKILL", KitClass.class);
+
+ @Override
+ public Class<KitClass> getCDOMClass()
+ {
+ return KitClass.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitClass> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitClass> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testInvalidInputOnlyOne() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(PCClass.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(PCClass.class, "Fireball");
+ primaryContext.ref.constructCDOMObject(PCClass.class, "English");
+ secondaryContext.ref.constructCDOMObject(PCClass.class, "English");
+ assertTrue(parse("Fireball,English"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(PCClass.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(PCClass.class, "Fireball");
+ runRoundRobin("Fireball");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/LevelTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/LevelTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/LevelTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2007 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.kit.clazz;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitClass;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class LevelTokenTest extends AbstractSubTokenTestCase<KitClass>
+{
+
+ static LevelToken token = new LevelToken();
+ static CDOMSubLineLoader<KitClass> loader = new CDOMSubLineLoader<KitClass>(
+ "*KITTOKEN", "SPELLS", KitClass.class);
+
+ @Override
+ public Class<KitClass> getCDOMClass()
+ {
+ return KitClass.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitClass> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitClass> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testRoundRobinNumber() throws PersistenceLayerException
+ {
+ runRoundRobin("3");
+ }
+
+ @Test
+ public void testRoundRobinFormula() throws PersistenceLayerException
+ {
+ runRoundRobin("Formula");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/SubClassTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/SubClassTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/SubClassTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2007 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.kit.clazz;
+
+import java.net.URISyntaxException;
+
+import org.junit.Test;
+
+import pcgen.cdom.enumeration.SubClassCategory;
+import pcgen.core.PCClass;
+import pcgen.core.SubClass;
+import pcgen.core.kit.KitClass;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class SubClassTokenTest extends AbstractSubTokenTestCase<KitClass>
+{
+
+ static SubclassToken token = new SubclassToken();
+ static CDOMSubLineLoader<KitClass> loader = new CDOMSubLineLoader<KitClass>(
+ "*KITTOKEN", "SKILL", KitClass.class);
+
+ @Override
+ public void setUp() throws PersistenceLayerException, URISyntaxException
+ {
+ super.setUp();
+ primaryContext.ref.constructCDOMObject(PCClass.class, "Wizard");
+ secondaryContext.ref.constructCDOMObject(PCClass.class, "Wizard");
+ primaryProf.setPcclass(primaryContext.ref.getCDOMReference(
+ PCClass.class, "Wizard"));
+ secondaryProf.setPcclass(secondaryContext.ref.getCDOMReference(
+ PCClass.class, "Wizard"));
+ }
+
+ @Override
+ public Class<KitClass> getCDOMClass()
+ {
+ return KitClass.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitClass> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitClass> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testInvalidInputOnlyOne() throws PersistenceLayerException
+ {
+ SubClassCategory cat = SubClassCategory.getConstant("Wizard");
+ SubClass sc = primaryContext.ref.constructCDOMObject(SubClass.class, "Fireball");
+ primaryContext.ref.reassociateCategory(cat, sc);
+ sc = secondaryContext.ref.constructCDOMObject(SubClass.class, "Fireball");
+ secondaryContext.ref.reassociateCategory(cat, sc);
+ sc = primaryContext.ref.constructCDOMObject(SubClass.class, "English");
+ primaryContext.ref.reassociateCategory(cat, sc);
+ sc = secondaryContext.ref.constructCDOMObject(SubClass.class, "English");
+ secondaryContext.ref.reassociateCategory(cat, sc);
+ assertTrue(parse("Fireball,English"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ SubClassCategory cat = SubClassCategory.getConstant("Wizard");
+ SubClass sc = primaryContext.ref.constructCDOMObject(SubClass.class, "Fireball");
+ primaryContext.ref.reassociateCategory(cat, sc);
+ sc = secondaryContext.ref.constructCDOMObject(SubClass.class, "Fireball");
+ secondaryContext.ref.reassociateCategory(cat, sc);
+ runRoundRobin("Fireball");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/CountTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/CountTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/CountTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2007 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.kit.deity;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitDeity;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class CountTokenTest extends AbstractSubTokenTestCase<KitDeity>
+{
+
+ static CountToken token = new CountToken();
+ static CDOMSubLineLoader<KitDeity> loader = new CDOMSubLineLoader<KitDeity>(
+ "*KITTOKEN", "SPELLS", KitDeity.class);
+
+ @Override
+ public Class<KitDeity> getCDOMClass()
+ {
+ return KitDeity.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitDeity> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitDeity> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testRoundRobinNumber() throws PersistenceLayerException
+ {
+ runRoundRobin("3");
+ }
+
+ @Test
+ public void testRoundRobinFormula() throws PersistenceLayerException
+ {
+ runRoundRobin("Formula");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/DeityTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/DeityTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/DeityTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2007 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.kit.deity;
+
+import org.junit.Test;
+
+import pcgen.core.Deity;
+import pcgen.core.kit.KitDeity;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class DeityTokenTest extends AbstractSubTokenTestCase<KitDeity>
+{
+
+ static DeityToken token = new DeityToken();
+ static CDOMSubLineLoader<KitDeity> loader = new CDOMSubLineLoader<KitDeity>(
+ "*KITTOKEN", "SKILL", KitDeity.class);
+
+ @Override
+ public Class<KitDeity> getCDOMClass()
+ {
+ return KitDeity.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitDeity> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitDeity> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testInvalidInputOnlyOne() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Deity.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Deity.class, "Fireball");
+ primaryContext.ref.constructCDOMObject(Deity.class, "English");
+ secondaryContext.ref.constructCDOMObject(Deity.class, "English");
+ assertTrue(parse("Fireball,English"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Deity.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Deity.class, "Fireball");
+ runRoundRobin("Fireball");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/DomainTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/DomainTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/DomainTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2007 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.kit.deity;
+
+import org.junit.Test;
+
+import pcgen.core.Domain;
+import pcgen.core.kit.KitDeity;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class DomainTokenTest extends AbstractSubTokenTestCase<KitDeity>
+{
+
+ static DomainToken token = new DomainToken();
+ static CDOMSubLineLoader<KitDeity> loader = new CDOMSubLineLoader<KitDeity>(
+ "*KITTOKEN", "SKILL", KitDeity.class);
+
+ @Override
+ public Class<KitDeity> getCDOMClass()
+ {
+ return KitDeity.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitDeity> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitDeity> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Domain.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Domain.class, "Fireball");
+ runRoundRobin("Fireball");
+ }
+
+ @Test
+ public void testRoundRobinTwo() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Domain.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Domain.class, "Fireball");
+ primaryContext.ref.constructCDOMObject(Domain.class, "English");
+ secondaryContext.ref.constructCDOMObject(Domain.class, "English");
+ runRoundRobin("Fireball" + getJoinCharacter() + "English");
+ }
+
+ @Test
+ public void testInvalidListEnd() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP1" + getJoinCharacter()));
+ }
+
+ private char getJoinCharacter()
+ {
+ return '|';
+ }
+
+ @Test
+ public void testInvalidListStart() throws PersistenceLayerException
+ {
+ assertFalse(parse(getJoinCharacter() + "TestWP1"));
+ }
+
+ @Test
+ public void testInvalidListDoubleJoin() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP2" + getJoinCharacter() + getJoinCharacter()
+ + "TestWP1"));
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 23:47:00
|
Revision: 8767
http://pcgen.svn.sourceforge.net/pcgen/?rev=8767&view=rev
Author: thpr
Date: 2008-12-31 23:46:58 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
Kit Token Tests, part 2
Added Paths:
-----------
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/funds/
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/funds/FundsTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/funds/QtyTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/EqModTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/GearTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/LocationTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/MaxCostTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/QtyTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/SizeTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/prof/
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/prof/CountTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/prof/FreeTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/prof/ProfTokenTest.java
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/funds/FundsTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/funds/FundsTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/funds/FundsTokenTest.java 2008-12-31 23:46:58 UTC (rev 8767)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2007 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.kit.funds;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitFunds;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class FundsTokenTest extends AbstractSubTokenTestCase<KitFunds>
+{
+
+ static FundsToken token = new FundsToken();
+ static CDOMSubLineLoader<KitFunds> loader = new CDOMSubLineLoader<KitFunds>(
+ "*KITTOKEN", "TABLE", KitFunds.class);
+
+ @Override
+ public Class<KitFunds> getCDOMClass()
+ {
+ return KitFunds.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitFunds> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitFunds> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testRoundRobinName() throws PersistenceLayerException
+ {
+ runRoundRobin("Table Name");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/funds/QtyTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/funds/QtyTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/funds/QtyTokenTest.java 2008-12-31 23:46:58 UTC (rev 8767)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2007 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.kit.funds;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitFunds;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class QtyTokenTest extends AbstractSubTokenTestCase<KitFunds>
+{
+
+ static QtyToken token = new QtyToken();
+ static CDOMSubLineLoader<KitFunds> loader = new CDOMSubLineLoader<KitFunds>(
+ "*KITTOKEN", "SPELLS", KitFunds.class);
+
+ @Override
+ public Class<KitFunds> getCDOMClass()
+ {
+ return KitFunds.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitFunds> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitFunds> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testRoundRobinNumber() throws PersistenceLayerException
+ {
+ runRoundRobin("3");
+ }
+
+ @Test
+ public void testRoundRobinFormula() throws PersistenceLayerException
+ {
+ runRoundRobin("Formula");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/EqModTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/EqModTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/EqModTokenTest.java 2008-12-31 23:46:58 UTC (rev 8767)
@@ -0,0 +1,356 @@
+/*
+ * Copyright (c) 2007 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.kit.gear;
+
+import org.junit.Test;
+
+import pcgen.core.EquipmentModifier;
+import pcgen.core.kit.KitGear;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.context.LoadContext;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class EqModTokenTest extends AbstractSubTokenTestCase<KitGear>
+{
+
+ static EqmodToken token = new EqmodToken();
+ static CDOMSubLineLoader<KitGear> loader = new CDOMSubLineLoader<KitGear>(
+ "*KITTOKEN", "TABLE", KitGear.class);
+
+ @Override
+ public Class<KitGear> getCDOMClass()
+ {
+ return KitGear.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitGear> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitGear> getToken()
+ {
+ return token;
+ }
+
+ public char getJoinCharacter()
+ {
+ return '.';
+ }
+
+ // TODO Implement after 5.16
+ // @Test
+ // public void testInvalidMiddleNone() throws PersistenceLayerException
+ // {
+ // assertFalse(parse("EQMOD1.NONE.EQMOD2"));
+ // assertNoSideEffects();
+ // }
+ //
+ // @Test
+ // public void testInvalidStartingNone() throws PersistenceLayerException
+ // {
+ // assertFalse(parse("NONE.EQMOD2"));
+ // assertNoSideEffects();
+ // }
+ //
+ // @Test
+ // public void testInvalidEndingNone() throws PersistenceLayerException
+ // {
+ // assertFalse(parse("EQMOD2.NONE"));
+ // assertNoSideEffects();
+ // }
+
+ @Test
+ public void testInvalidEmptyAssociation() throws PersistenceLayerException
+ {
+ assertFalse(parse("EQMOD2|"));
+ }
+
+ @Test
+ public void testInvalidTrailingAssociation()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("EQMOD2|Assoc|"));
+ }
+
+ @Test
+ public void testInvalidEmptyModAssociation()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("|Assoc|Assoc2"));
+ }
+
+ @Test
+ public void testInvalidEmptySecondModAssociation()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("MOD1.|Assoc|Assoc2"));
+ }
+
+ @Test
+ public void testInvalidEmptySecondModAfterAssociation()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("MOD1|ModAssoc.|Assoc|Assoc2"));
+ }
+
+ @Test
+ public void testInvalidEmptyComplexAssociation()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("MOD1|ModAssoc[]"));
+ }
+
+ @Test
+ public void testInvalidNoOpenBracketComplexAssociation()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("MOD1|ModAssoc Assoc]"));
+ }
+
+ @Test
+ public void testInvalidTwoOpenBracketComplexAssociation()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("MOD1|ModAssoc[[Assoc]"));
+ }
+
+ @Test
+ public void testInvalidDoubleBarAssociation()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("EQMOD2|Assoc||Assoc2"));
+ }
+
+ public void testRoundRobinOnlyAssociation()
+ throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(EquipmentModifier.class,
+ "EQMOD2");
+ secondaryContext.ref.constructCDOMObject(EquipmentModifier.class,
+ "EQMOD2");
+ runRoundRobin("EQMOD2|9500");
+ }
+
+ public void testRoundRobinComplexAssociation()
+ throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(EquipmentModifier.class,
+ "EQMOD2");
+ secondaryContext.ref.constructCDOMObject(EquipmentModifier.class,
+ "EQMOD2");
+ runRoundRobin("EQMOD2|COST[9500]");
+ }
+
+ // public void testRoundRobinInnerBracketAssociation()
+ // throws PersistenceLayerException
+ // {
+ // runRoundRobin("EQMOD2|COST[[9500]]");
+ // }
+
+ public void testRoundRobinComplexMultipleAssociation()
+ throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(EquipmentModifier.class,
+ "EQMOD2");
+ secondaryContext.ref.constructCDOMObject(EquipmentModifier.class,
+ "EQMOD2");
+ runRoundRobin("EQMOD2|COST[9500]PLUS[+1]");
+ }
+
+ @Test
+ public void testInvalidInputEmptyString() throws PersistenceLayerException
+ {
+ assertFalse(parse(""));
+ }
+
+ @Test
+ public void testInvalidInputJoinOnly() throws PersistenceLayerException
+ {
+ assertFalse(parse(Character.toString(getJoinCharacter())));
+ }
+
+ @Test
+ public void testInvalidInputString() throws PersistenceLayerException
+ {
+ assertTrue(parse("String"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testInvalidInputType() throws PersistenceLayerException
+ {
+ assertTrue(parse("TestType"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testInvalidInputJoinedComma() throws PersistenceLayerException
+ {
+ if (getJoinCharacter() != ',')
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ assertTrue(parse("TestWP1,TestWP2"));
+ assertFalse(primaryContext.ref.validate());
+ }
+ }
+
+ private void construct(LoadContext context, String string)
+ {
+ context.ref.constructCDOMObject(EquipmentModifier.class, string);
+ }
+
+ // TODO Need to catch this someday - currently not caught as a problem
+ // TestWP2 is assumed to be an association
+ // @Test
+ // public void testInvalidInputJoinedPipe() throws PersistenceLayerException
+ // {
+ // if (getJoinCharacter() != '|')
+ // {
+ // construct(primaryContext, "TestWP1");
+ // construct(primaryContext, "TestWP2");
+ // boolean parse = parse("TestWP1|TestWP2");
+ // if (parse)
+ // {
+ // assertFalse(primaryContext.ref.validate());
+ // }
+ // else
+ // {
+ // }
+ // }
+ // }
+
+ @Test
+ public void testInvalidInputJoinedDot() throws PersistenceLayerException
+ {
+ if (getJoinCharacter() != '.')
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ assertTrue(parse("TestWP1.TestWP2"));
+ assertFalse(primaryContext.ref.validate());
+ }
+ }
+
+ // FIXME These are invalid due to RC being overly protective at the moment
+ // @Test
+ // public void testInvalidInputAny()
+ // {
+ // assertTrue(parse( "ANY"));
+ // assertFalse(primaryContext.ref.validate());
+ // }
+ // @Test
+ // public void testInvalidInputCheckType()
+ // {
+ // if (!isTypeLegal())
+ // {
+ // assertTrue(token.parse(primaryContext, primaryProf, "TYPE=TestType"));
+ // assertFalse(primaryContext.ref.validate());
+ // }
+ // }
+ //
+
+ @Test
+ public void testInvalidListEnd() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse("TestWP1" + getJoinCharacter()));
+ }
+
+ @Test
+ public void testInvalidListStart() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getJoinCharacter() + "TestWP1"));
+ }
+
+ @Test
+ public void testInvalidListDoubleJoin() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ assertFalse(parse("TestWP2" + getJoinCharacter() + getJoinCharacter()
+ + "TestWP1"));
+ }
+
+ @Test
+ public void testInvalidInputCheckMult() throws PersistenceLayerException
+ {
+ // Explicitly do NOT build TestWP2
+ construct(primaryContext, "TestWP1");
+ assertTrue(parse("TestWP1" + getJoinCharacter() + "TestWP2"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testValidInputs() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ assertTrue(parse("TestWP1"));
+ assertTrue(primaryContext.ref.validate());
+ assertTrue(parse("TestWP1" + getJoinCharacter() + "TestWP2"));
+ assertTrue(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinOne() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin("TestWP1");
+ }
+
+ @Test
+ public void testRoundRobinThree() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(primaryContext, "TestWP3");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP3");
+ runRoundRobin("TestWP1" + getJoinCharacter() + "TestWP2"
+ + getJoinCharacter() + "TestWP3");
+ }
+
+ @Test
+ public void testInputInvalidAddsBasicNoSideEffect()
+ throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP2");
+ construct(primaryContext, "TestWP3");
+ construct(secondaryContext, "TestWP3");
+ construct(primaryContext, "TestWP4");
+ construct(secondaryContext, "TestWP4");
+ assertTrue(parse("TestWP1" + getJoinCharacter() + "TestWP2"));
+ assertTrue(parseSecondary("TestWP1" + getJoinCharacter() + "TestWP2"));
+ assertFalse(parse("TestWP3" + getJoinCharacter() + getJoinCharacter()
+ + "TestWP4"));
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/GearTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/GearTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/GearTokenTest.java 2008-12-31 23:46:58 UTC (rev 8767)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2007 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.kit.gear;
+
+import org.junit.Test;
+
+import pcgen.core.Equipment;
+import pcgen.core.kit.KitGear;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class GearTokenTest extends AbstractSubTokenTestCase<KitGear>
+{
+
+ static GearToken token = new GearToken();
+ static CDOMSubLineLoader<KitGear> loader = new CDOMSubLineLoader<KitGear>(
+ "*KITTOKEN", "SKILL", KitGear.class);
+
+ @Override
+ public Class<KitGear> getCDOMClass()
+ {
+ return KitGear.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitGear> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitGear> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testInvalidInputOnlyOne() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Equipment.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Equipment.class, "Fireball");
+ primaryContext.ref.constructCDOMObject(Equipment.class, "English");
+ secondaryContext.ref.constructCDOMObject(Equipment.class, "English");
+ assertTrue(parse("Fireball,English"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Equipment.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Equipment.class, "Fireball");
+ runRoundRobin("Fireball");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/LocationTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/LocationTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/LocationTokenTest.java 2008-12-31 23:46:58 UTC (rev 8767)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2007 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.kit.gear;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitGear;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class LocationTokenTest extends AbstractSubTokenTestCase<KitGear>
+{
+
+ static LocationToken token = new LocationToken();
+ static CDOMSubLineLoader<KitGear> loader = new CDOMSubLineLoader<KitGear>(
+ "*KITTOKEN", "TABLE", KitGear.class);
+
+ @Override
+ public Class<KitGear> getCDOMClass()
+ {
+ return KitGear.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitGear> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitGear> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testRoundRobinName() throws PersistenceLayerException
+ {
+ runRoundRobin("Table Name");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/MaxCostTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/MaxCostTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/MaxCostTokenTest.java 2008-12-31 23:46:58 UTC (rev 8767)
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2007 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.kit.gear;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitGear;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class MaxCostTokenTest extends AbstractSubTokenTestCase<KitGear>
+{
+
+ static MaxCostToken token = new MaxCostToken();
+ static CDOMSubLineLoader<KitGear> loader = new CDOMSubLineLoader<KitGear>(
+ "*KITTOKEN", "SPELLS", KitGear.class);
+
+ @Override
+ public Class<KitGear> getCDOMClass()
+ {
+ return KitGear.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitGear> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitGear> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testRoundRobinNumber() throws PersistenceLayerException
+ {
+ runRoundRobin("3");
+ }
+
+ @Test
+ public void testInvalidInputFormula() throws PersistenceLayerException
+ {
+ assertFalse(parse("FormulaProhibited"));
+ }
+
+ @Test
+ public void testInvalidInputZero() throws PersistenceLayerException
+ {
+ assertFalse(parse("0"));
+ }
+
+ @Test
+ public void testInvalidInputNegative() throws PersistenceLayerException
+ {
+ assertFalse(parse("-1"));
+ }
+
+ @Test
+ public void testInvalidInputDecimal() throws PersistenceLayerException
+ {
+ assertFalse(parse("1.5"));
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/QtyTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/QtyTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/QtyTokenTest.java 2008-12-31 23:46:58 UTC (rev 8767)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2007 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.kit.gear;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitGear;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class QtyTokenTest extends AbstractSubTokenTestCase<KitGear>
+{
+
+ static QtyToken token = new QtyToken();
+ static CDOMSubLineLoader<KitGear> loader = new CDOMSubLineLoader<KitGear>(
+ "*KITTOKEN", "SPELLS", KitGear.class);
+
+ @Override
+ public Class<KitGear> getCDOMClass()
+ {
+ return KitGear.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitGear> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitGear> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testRoundRobinNumber() throws PersistenceLayerException
+ {
+ runRoundRobin("3");
+ }
+
+ @Test
+ public void testRoundRobinFormula() throws PersistenceLayerException
+ {
+ runRoundRobin("Formula");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/SizeTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/SizeTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/gear/SizeTokenTest.java 2008-12-31 23:46:58 UTC (rev 8767)
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2007 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.kit.gear;
+
+import java.net.URISyntaxException;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import pcgen.core.SizeAdjustment;
+import pcgen.core.kit.KitGear;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class SizeTokenTest extends AbstractSubTokenTestCase<KitGear>
+{
+
+ static SizeToken token = new SizeToken();
+ static CDOMSubLineLoader<KitGear> loader = new CDOMSubLineLoader<KitGear>(
+ "*KITTOKEN", "TABLE", KitGear.class);
+
+ @Override
+ public Class<KitGear> getCDOMClass()
+ {
+ return KitGear.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitGear> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitGear> getToken()
+ {
+ return token;
+ }
+
+ @Override
+ @Before
+ public void setUp() throws PersistenceLayerException, URISyntaxException
+ {
+ super.setUp();
+ SizeAdjustment ps = primaryContext.ref.constructCDOMObject(
+ SizeAdjustment.class, "Small");
+ ps.setAbbreviation("S");
+ primaryContext.ref.registerAbbreviation(ps, "S");
+ SizeAdjustment pm = primaryContext.ref.constructCDOMObject(
+ SizeAdjustment.class, "Medium");
+ pm.setAbbreviation("M");
+ primaryContext.ref.registerAbbreviation(pm, "M");
+ SizeAdjustment ss = secondaryContext.ref.constructCDOMObject(
+ SizeAdjustment.class, "Small");
+ ss.setAbbreviation("S");
+ secondaryContext.ref.registerAbbreviation(ss, "S");
+ SizeAdjustment sm = secondaryContext.ref.constructCDOMObject(
+ SizeAdjustment.class, "Medium");
+ sm.setAbbreviation("M");
+ secondaryContext.ref.registerAbbreviation(sm, "M");
+ }
+
+ @Test
+ public void testInvalidNotASize()
+ {
+ assertFalse(token.parse(primaryContext, primaryProf, "W"));
+ }
+
+ @Test
+ public void testRoundRobinS() throws PersistenceLayerException
+ {
+ runRoundRobin("S");
+ }
+
+ @Test
+ public void testRoundRobinPC() throws PersistenceLayerException
+ {
+ //Special Case
+ runRoundRobin("PC");
+ }
+
+ @Test
+ public void testRoundRobinM() throws PersistenceLayerException
+ {
+ runRoundRobin("M");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/prof/CountTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/prof/CountTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/prof/CountTokenTest.java 2008-12-31 23:46:58 UTC (rev 8767)
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2007 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.kit.prof;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitProf;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class CountTokenTest extends AbstractSubTokenTestCase<KitProf>
+{
+
+ static CountToken token = new CountToken();
+ static CDOMSubLineLoader<KitProf> loader = new CDOMSubLineLoader<KitProf>(
+ "*KITTOKEN", "PROF", KitProf.class);
+
+ @Override
+ public Class<KitProf> getCDOMClass()
+ {
+ return KitProf.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitProf> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitProf> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testRoundRobinNumber() throws PersistenceLayerException
+ {
+ runRoundRobin("3");
+ }
+
+ @Test
+ public void testInvalidInputFormula() throws PersistenceLayerException
+ {
+ assertFalse(parse("FormulaProhibited"));
+ }
+
+ @Test
+ public void testInvalidInputZero() throws PersistenceLayerException
+ {
+ assertFalse(parse("0"));
+ }
+
+ @Test
+ public void testInvalidInputNegative() throws PersistenceLayerException
+ {
+ assertFalse(parse("-1"));
+ }
+
+ @Test
+ public void testInvalidInputDecimal() throws PersistenceLayerException
+ {
+ assertFalse(parse("1.5"));
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/prof/FreeTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/prof/FreeTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/prof/FreeTokenTest.java 2008-12-31 23:46:58 UTC (rev 8767)
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2007 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.kit.prof;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitProf;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class FreeTokenTest extends AbstractSubTokenTestCase<KitProf>
+{
+
+ static RacialToken token = new RacialToken();
+ static CDOMSubLineLoader<KitProf> loader = new CDOMSubLineLoader<KitProf>(
+ "*KITTOKEN", "SKILL", KitProf.class);
+
+ @Override
+ public Class<KitProf> getCDOMClass()
+ {
+ return KitProf.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitProf> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitProf> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputString() throws PersistenceLayerException
+ {
+ internalTestInvalidInputString(null);
+ }
+
+ @Test
+ public void testInvalidInputStringSet() throws PersistenceLayerException
+ {
+ assertTrue(parse("YES"));
+ assertTrue(parseSecondary("YES"));
+ assertEquals(Boolean.TRUE, getValue());
+ internalTestInvalidInputString(Boolean.TRUE);
+ }
+
+ public void internalTestInvalidInputString(Object val)
+ throws PersistenceLayerException
+ {
+ assertEquals(val, getValue());
+ assertFalse(parse("String"));
+ assertEquals(val, getValue());
+ assertFalse(parse("TYPE=TestType"));
+ assertEquals(val, getValue());
+ assertFalse(parse("TYPE.TestType"));
+ assertEquals(val, getValue());
+ assertFalse(parse("ALL"));
+ assertEquals(val, getValue());
+ assertFalse(parse("Yo!"));
+ assertEquals(val, getValue());
+ assertFalse(parse("Now"));
+ assertEquals(val, getValue());
+ }
+
+ @Test
+ public void testValidInputs() throws PersistenceLayerException
+ {
+ assertTrue(parse("YES"));
+ assertEquals(Boolean.TRUE, getValue());
+ assertTrue(parse("NO"));
+ assertEquals(Boolean.FALSE, getValue());
+ // We're nice enough to be case insensitive here...
+ assertTrue(parse("YeS"));
+ assertEquals(Boolean.TRUE, getValue());
+ assertTrue(parse("Yes"));
+ assertEquals(Boolean.TRUE, getValue());
+ assertTrue(parse("No"));
+ assertEquals(Boolean.FALSE, getValue());
+ // Allow abbreviations
+ assertTrue(parse("Y"));
+ assertEquals(Boolean.TRUE, getValue());
+ assertTrue(parse("N"));
+ assertEquals(Boolean.FALSE, getValue());
+ }
+
+ private Boolean getValue()
+ {
+ return primaryProf.getRacialProf();
+ }
+
+ @Test
+ public void testRoundRobinYes() throws PersistenceLayerException
+ {
+ runRoundRobin("YES");
+ }
+
+ @Test
+ public void testRoundRobinNo() throws PersistenceLayerException
+ {
+ runRoundRobin("NO");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/prof/ProfTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/prof/ProfTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/prof/ProfTokenTest.java 2008-12-31 23:46:58 UTC (rev 8767)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2007 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.kit.prof;
+
+import org.junit.Test;
+
+import pcgen.core.WeaponProf;
+import pcgen.core.kit.KitProf;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class ProfTokenTest extends AbstractSubTokenTestCase<KitProf>
+{
+
+ static ProfToken token = new ProfToken();
+ static CDOMSubLineLoader<KitProf> loader = new CDOMSubLineLoader<KitProf>(
+ "*KITTOKEN", "PROF", KitProf.class);
+
+ @Override
+ public Class<KitProf> getCDOMClass()
+ {
+ return KitProf.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitProf> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitProf> getToken()
+ {
+ return token;
+ }
+
+ private char getJoinCharacter()
+ {
+ return '|';
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(WeaponProf.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(WeaponProf.class, "Fireball");
+ runRoundRobin("Fireball");
+ }
+
+ @Test
+ public void testRoundRobinTwo() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(WeaponProf.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(WeaponProf.class, "Fireball");
+ primaryContext.ref.constructCDOMObject(WeaponProf.class, "English");
+ secondaryContext.ref.constructCDOMObject(WeaponProf.class, "English");
+ runRoundRobin("Fireball" + getJoinCharacter() + "English");
+ }
+
+ @Test
+ public void testInvalidListEnd() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP1" + getJoinCharacter()));
+ }
+
+ @Test
+ public void testInvalidListStart() throws PersistenceLayerException
+ {
+ assertFalse(parse(getJoinCharacter() + "TestWP1"));
+ }
+
+ @Test
+ public void testInvalidListDoubleJoin() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP2" + getJoinCharacter() + getJoinCharacter()
+ + "TestWP1"));
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 23:46:39
|
Revision: 8766
http://pcgen.svn.sourceforge.net/pcgen/?rev=8766&view=rev
Author: thpr
Date: 2008-12-31 23:46:35 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
Kit Token Tests, part 1
Added Paths:
-----------
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/ClassTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/CountTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/FreeTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/RankTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/SelectionTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/SkillTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/spells/
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/spells/CountTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/spells/SpellsTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/startpack/
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/startpack/ApplyTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/startpack/EquipBuyTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/startpack/VisibleTokenTest.java
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/ClassTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/ClassTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/ClassTokenTest.java 2008-12-31 23:46:35 UTC (rev 8766)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2007 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.kit.skill;
+
+import org.junit.Test;
+
+import pcgen.core.PCClass;
+import pcgen.core.kit.KitSkill;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class ClassTokenTest extends AbstractSubTokenTestCase<KitSkill>
+{
+
+ static ClassToken token = new ClassToken();
+ static CDOMSubLineLoader<KitSkill> loader = new CDOMSubLineLoader<KitSkill>(
+ "*KITTOKEN", "SKILL", KitSkill.class);
+
+ @Override
+ public Class<KitSkill> getCDOMClass()
+ {
+ return KitSkill.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitSkill> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitSkill> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testInvalidInputOnlyOne() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(PCClass.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(PCClass.class, "Fireball");
+ primaryContext.ref.constructCDOMObject(PCClass.class, "English");
+ secondaryContext.ref.constructCDOMObject(PCClass.class, "English");
+ assertTrue(parse("Fireball,English"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(PCClass.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(PCClass.class, "Fireball");
+ runRoundRobin("Fireball");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/CountTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/CountTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/CountTokenTest.java 2008-12-31 23:46:35 UTC (rev 8766)
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2007 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.kit.skill;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitSkill;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class CountTokenTest extends AbstractSubTokenTestCase<KitSkill>
+{
+
+ static CountToken token = new CountToken();
+ static CDOMSubLineLoader<KitSkill> loader = new CDOMSubLineLoader<KitSkill>(
+ "*KITTOKEN", "SPELLS", KitSkill.class);
+
+ @Override
+ public Class<KitSkill> getCDOMClass()
+ {
+ return KitSkill.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitSkill> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitSkill> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testRoundRobinNumber() throws PersistenceLayerException
+ {
+ runRoundRobin("3");
+ }
+
+ @Test
+ public void testInvalidInputFormula() throws PersistenceLayerException
+ {
+ assertFalse(parse("FormulaProhibited"));
+ }
+
+ @Test
+ public void testInvalidInputZero() throws PersistenceLayerException
+ {
+ assertFalse(parse("0"));
+ }
+
+ @Test
+ public void testInvalidInputNegative() throws PersistenceLayerException
+ {
+ assertFalse(parse("-1"));
+ }
+
+ @Test
+ public void testInvalidInputDecimal() throws PersistenceLayerException
+ {
+ assertFalse(parse("1.5"));
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/FreeTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/FreeTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/FreeTokenTest.java 2008-12-31 23:46:35 UTC (rev 8766)
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2007 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.kit.skill;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitSkill;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class FreeTokenTest extends AbstractSubTokenTestCase<KitSkill>
+{
+
+ static FreeToken token = new FreeToken();
+ static CDOMSubLineLoader<KitSkill> loader = new CDOMSubLineLoader<KitSkill>(
+ "*KITTOKEN", "SKILL", KitSkill.class);
+
+ @Override
+ public Class<KitSkill> getCDOMClass()
+ {
+ return KitSkill.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitSkill> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitSkill> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputString() throws PersistenceLayerException
+ {
+ internalTestInvalidInputString(null);
+ }
+
+ @Test
+ public void testInvalidInputStringSet() throws PersistenceLayerException
+ {
+ assertTrue(parse("YES"));
+ assertTrue(parseSecondary("YES"));
+ assertEquals(Boolean.TRUE, getValue());
+ internalTestInvalidInputString(Boolean.TRUE);
+ }
+
+ public void internalTestInvalidInputString(Object val)
+ throws PersistenceLayerException
+ {
+ assertEquals(val, getValue());
+ assertFalse(parse("String"));
+ assertEquals(val, getValue());
+ assertFalse(parse("TYPE=TestType"));
+ assertEquals(val, getValue());
+ assertFalse(parse("TYPE.TestType"));
+ assertEquals(val, getValue());
+ assertFalse(parse("ALL"));
+ assertEquals(val, getValue());
+ assertFalse(parse("Yo!"));
+ assertEquals(val, getValue());
+ assertFalse(parse("Now"));
+ assertEquals(val, getValue());
+ }
+
+ @Test
+ public void testValidInputs() throws PersistenceLayerException
+ {
+ assertTrue(parse("YES"));
+ assertEquals(Boolean.TRUE, getValue());
+ assertTrue(parse("NO"));
+ assertEquals(Boolean.FALSE, getValue());
+ // We're nice enough to be case insensitive here...
+ assertTrue(parse("YeS"));
+ assertEquals(Boolean.TRUE, getValue());
+ assertTrue(parse("Yes"));
+ assertEquals(Boolean.TRUE, getValue());
+ assertTrue(parse("No"));
+ assertEquals(Boolean.FALSE, getValue());
+ // Allow abbreviations
+ assertTrue(parse("Y"));
+ assertEquals(Boolean.TRUE, getValue());
+ assertTrue(parse("N"));
+ assertEquals(Boolean.FALSE, getValue());
+ }
+
+ private Boolean getValue()
+ {
+ return primaryProf.getFree();
+ }
+
+ @Test
+ public void testRoundRobinYes() throws PersistenceLayerException
+ {
+ runRoundRobin("YES");
+ }
+
+ @Test
+ public void testRoundRobinNo() throws PersistenceLayerException
+ {
+ runRoundRobin("NO");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/RankTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/RankTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/RankTokenTest.java 2008-12-31 23:46:35 UTC (rev 8766)
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2007 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.kit.skill;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitSkill;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class RankTokenTest extends AbstractSubTokenTestCase<KitSkill>
+{
+
+ static RankToken token = new RankToken();
+ static CDOMSubLineLoader<KitSkill> loader = new CDOMSubLineLoader<KitSkill>(
+ "*KITTOKEN", "SPELLS", KitSkill.class);
+
+ @Override
+ public Class<KitSkill> getCDOMClass()
+ {
+ return KitSkill.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitSkill> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitSkill> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testRoundRobinNumber() throws PersistenceLayerException
+ {
+ runRoundRobin("3");
+ }
+
+ @Test
+ public void testRoundRobinDecimal() throws PersistenceLayerException
+ {
+ runRoundRobin("3.5");
+ }
+
+ @Test
+ public void testInvalidInputFormula() throws PersistenceLayerException
+ {
+ assertFalse(parse("FormulaProhibited"));
+ }
+
+// @Test
+// public void testInvalidInputZero() throws PersistenceLayerException
+// {
+// assertFalse(parse("0"));
+// }
+
+ @Test
+ public void testInvalidInputNegative() throws PersistenceLayerException
+ {
+ assertFalse(parse("-1"));
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/SelectionTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/SelectionTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/SelectionTokenTest.java 2008-12-31 23:46:35 UTC (rev 8766)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2007 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.kit.skill;
+
+import org.junit.Test;
+
+import pcgen.core.Language;
+import pcgen.core.kit.KitSkill;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class SelectionTokenTest extends AbstractSubTokenTestCase<KitSkill>
+{
+
+ static SelectionToken token = new SelectionToken();
+ static CDOMSubLineLoader<KitSkill> loader = new CDOMSubLineLoader<KitSkill>(
+ "*KITTOKEN", "SKILL", KitSkill.class);
+
+ @Override
+ public Class<KitSkill> getCDOMClass()
+ {
+ return KitSkill.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitSkill> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitSkill> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Language.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Language.class, "Fireball");
+ runRoundRobin("Fireball");
+ }
+
+ @Test
+ public void testRoundRobinTwo() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Language.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Language.class, "Fireball");
+ primaryContext.ref.constructCDOMObject(Language.class, "English");
+ secondaryContext.ref.constructCDOMObject(Language.class, "English");
+ runRoundRobin("Fireball" + getJoinCharacter() + "English");
+ }
+
+ @Test
+ public void testInvalidListEnd() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP1" + getJoinCharacter()));
+ }
+
+ private char getJoinCharacter()
+ {
+ return ',';
+ }
+
+ @Test
+ public void testInvalidListStart() throws PersistenceLayerException
+ {
+ assertFalse(parse(getJoinCharacter() + "TestWP1"));
+ }
+
+ @Test
+ public void testInvalidListDoubleJoin() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP2" + getJoinCharacter() + getJoinCharacter()
+ + "TestWP1"));
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/SkillTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/SkillTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/skill/SkillTokenTest.java 2008-12-31 23:46:35 UTC (rev 8766)
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2007 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.kit.skill;
+
+import org.junit.Test;
+
+import pcgen.core.Skill;
+import pcgen.core.kit.KitSkill;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class SkillTokenTest extends AbstractSubTokenTestCase<KitSkill>
+{
+
+ static SkillToken token = new SkillToken();
+ static CDOMSubLineLoader<KitSkill> loader = new CDOMSubLineLoader<KitSkill>(
+ "*KITTOKEN", "SKILL", KitSkill.class);
+
+ @Override
+ public Class<KitSkill> getCDOMClass()
+ {
+ return KitSkill.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitSkill> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitSkill> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Skill.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Skill.class, "Fireball");
+ runRoundRobin("Fireball");
+ }
+
+ @Test
+ public void testInvalidInputEmptyType() throws PersistenceLayerException
+ {
+ assertFalse(parse("TYPE="));
+ }
+
+ @Test
+ public void testInvalidInputTrailingType() throws PersistenceLayerException
+ {
+ assertFalse(parse("TYPE=One."));
+ }
+
+ @Test
+ public void testInvalidInputDoubleType() throws PersistenceLayerException
+ {
+ assertFalse(parse("TYPE=One..Two"));
+ }
+
+ @Test
+ public void testRoundRobinType() throws PersistenceLayerException
+ {
+ runRoundRobin("TYPE=Foo");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/spells/CountTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/spells/CountTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/spells/CountTokenTest.java 2008-12-31 23:46:35 UTC (rev 8766)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2007 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.kit.spells;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitSpells;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class CountTokenTest extends AbstractSubTokenTestCase<KitSpells>
+{
+
+ static CountToken token = new CountToken();
+ static CDOMSubLineLoader<KitSpells> loader = new CDOMSubLineLoader<KitSpells>(
+ "*KITTOKEN", "SPELLS", KitSpells.class);
+
+ @Override
+ public Class<KitSpells> getCDOMClass()
+ {
+ return KitSpells.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitSpells> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitSpells> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testRoundRobinNumber() throws PersistenceLayerException
+ {
+ runRoundRobin("3");
+ }
+
+ @Test
+ public void testRoundRobinFormula() throws PersistenceLayerException
+ {
+ runRoundRobin("Formula");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/spells/SpellsTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/spells/SpellsTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/spells/SpellsTokenTest.java 2008-12-31 23:46:35 UTC (rev 8766)
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2007 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.kit.spells;
+
+import org.junit.Test;
+
+import pcgen.core.Ability;
+import pcgen.core.AbilityCategory;
+import pcgen.core.PCClass;
+import pcgen.core.kit.KitSpells;
+import pcgen.core.spell.Spell;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class SpellsTokenTest extends AbstractSubTokenTestCase<KitSpells>
+{
+
+ static SpellsToken token = new SpellsToken();
+ static CDOMSubLineLoader<KitSpells> loader = new CDOMSubLineLoader<KitSpells>(
+ "*KITTOKEN", "SPELLS", KitSpells.class);
+
+ @Override
+ public Class<KitSpells> getCDOMClass()
+ {
+ return KitSpells.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitSpells> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitSpells> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptySpellbook()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("SPELLBOOK=|CLASS=Wizard|Fireball=2"));
+ }
+
+ @Test
+ public void testInvalidInputEmptyClass() throws PersistenceLayerException
+ {
+ assertFalse(parse("SPELLBOOK=Personal|CLASS=|Fireball=2"));
+ }
+
+ @Test
+ public void testInvalidInputTwoClass() throws PersistenceLayerException
+ {
+ assertFalse(parse("SPELLBOOK=Personal|CLASS=Wizard|CLASS=Cleric|Fireball=2"));
+ }
+
+ @Test
+ public void testInvalidInputTwoSpellbook() throws PersistenceLayerException
+ {
+ assertFalse(parse("SPELLBOOK=Personal|SPELLBOOK=Other|CLASS=Wizard|Fireball=2"));
+ }
+
+ @Test
+ public void testInvalidInputEmptySpell() throws PersistenceLayerException
+ {
+ assertFalse(parse("SPELLBOOK=Personal|CLASS=Wizard|=2"));
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertFalse(parse("SPELLBOOK=Personal|CLASS=Wizard|Fireball="));
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Spell.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Spell.class, "Fireball");
+ runRoundRobin("Fireball=2");
+ }
+
+ @Test
+ public void testInvalidInputEmptyType() throws PersistenceLayerException
+ {
+ assertFalse(parse("SPELLBOOK=Personal|CLASS=Wizard|TYPE."));
+ }
+
+ @Test
+ public void testInvalidInputTrailingType() throws PersistenceLayerException
+ {
+ assertFalse(parse("SPELLBOOK=Personal|CLASS=Wizard|TYPE.One."));
+ }
+
+ @Test
+ public void testInvalidInputDoubleType() throws PersistenceLayerException
+ {
+ assertFalse(parse("SPELLBOOK=Personal|CLASS=Wizard|TYPE.One..Two"));
+ }
+
+ @Test
+ public void testRoundRobinType() throws PersistenceLayerException
+ {
+ runRoundRobin("TYPE.Foo=2");
+ }
+
+ @Test
+ public void testRoundRobinFeat() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Spell.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Spell.class, "Fireball");
+ primaryContext.ref.constructCDOMObject(PCClass.class, "Wizard");
+ secondaryContext.ref.constructCDOMObject(PCClass.class, "Wizard");
+ Ability ab = primaryContext.ref.constructCDOMObject(Ability.class, "EnhancedFeat");
+ primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = secondaryContext.ref.constructCDOMObject(Ability.class, "EnhancedFeat");
+ secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ runRoundRobin("SPELLBOOK=Personal|CLASS=Wizard|Fireball[EnhancedFeat]=2");
+ }
+
+ @Test
+ public void testRoundRobinCount() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Spell.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Spell.class, "Fireball");
+ primaryContext.ref.constructCDOMObject(PCClass.class, "Wizard");
+ secondaryContext.ref.constructCDOMObject(PCClass.class, "Wizard");
+ runRoundRobin("SPELLBOOK=Personal|CLASS=Wizard|Fireball=2");
+ }
+
+ @Test
+ public void testRoundRobinSpellBookClass() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Spell.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Spell.class, "Fireball");
+ primaryContext.ref.constructCDOMObject(PCClass.class, "Wizard");
+ secondaryContext.ref.constructCDOMObject(PCClass.class, "Wizard");
+ runRoundRobin("SPELLBOOK=Personal|CLASS=Wizard|Fireball");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/startpack/ApplyTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/startpack/ApplyTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/startpack/ApplyTokenTest.java 2008-12-31 23:46:35 UTC (rev 8766)
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2007 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.kit.startpack;
+
+import org.junit.Test;
+
+import pcgen.cdom.enumeration.KitApply;
+import pcgen.cdom.enumeration.ObjectKey;
+import pcgen.core.Kit;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+
+public class ApplyTokenTest extends AbstractTokenTestCase<Kit>
+{
+
+ static ApplyToken token = new ApplyToken();
+
+ static CDOMTokenLoader<Kit> loader = new CDOMTokenLoader<Kit>(
+ Kit.class);
+
+ @Override
+ public Class<Kit> getCDOMClass()
+ {
+ return Kit.class;
+ }
+
+ @Override
+ public CDOMLoader<Kit> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMPrimaryToken<Kit> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputString() throws PersistenceLayerException
+ {
+ internalTestInvalidInputString(null);
+ }
+
+ @Test
+ public void testInvalidInputStringSet() throws PersistenceLayerException
+ {
+ assertTrue(parse("INSTANT"));
+ assertTrue(parseSecondary("INSTANT"));
+ assertEquals(KitApply.INSTANT, primaryProf.get(ObjectKey.APPLY_MODE));
+ internalTestInvalidInputString(KitApply.INSTANT);
+ }
+
+ public void internalTestInvalidInputString(Object val)
+ throws PersistenceLayerException
+ {
+ assertEquals(val, primaryProf.get(ObjectKey.APPLY_MODE));
+ assertFalse(parse("Always"));
+ assertEquals(val, primaryProf.get(ObjectKey.APPLY_MODE));
+ assertFalse(parse("String"));
+ assertEquals(val, primaryProf.get(ObjectKey.APPLY_MODE));
+ assertFalse(parse("TYPE=TestType"));
+ assertEquals(val, primaryProf.get(ObjectKey.APPLY_MODE));
+ assertFalse(parse("TYPE.TestType"));
+ assertEquals(val, primaryProf.get(ObjectKey.APPLY_MODE));
+ assertFalse(parse("ALL"));
+ assertEquals(val, primaryProf.get(ObjectKey.APPLY_MODE));
+ // Note case sensitivity
+ assertFalse(parse("Permanent"));
+ }
+
+ @Test
+ public void testValidInputs() throws PersistenceLayerException
+ {
+ assertTrue(parse("INSTANT"));
+ assertEquals(KitApply.INSTANT, primaryProf.get(ObjectKey.APPLY_MODE));
+ assertTrue(parse("PERMANENT"));
+ assertEquals(KitApply.PERMANENT, primaryProf.get(ObjectKey.APPLY_MODE));
+ }
+
+ @Test
+ public void testRoundRobinPermanent() throws PersistenceLayerException
+ {
+ runRoundRobin("PERMANENT");
+ }
+
+ @Test
+ public void testRoundRobinInstant() throws PersistenceLayerException
+ {
+ runRoundRobin("INSTANT");
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/startpack/EquipBuyTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/startpack/EquipBuyTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/startpack/EquipBuyTokenTest.java 2008-12-31 23:46:35 UTC (rev 8766)
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2007 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.kit.startpack;
+
+import java.net.URISyntaxException;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import pcgen.base.formula.Formula;
+import pcgen.cdom.enumeration.FormulaKey;
+import pcgen.cdom.enumeration.ObjectKey;
+import pcgen.core.Kit;
+import pcgen.core.QualifiedObject;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractFormulaTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+import plugin.lsttokens.testsupport.TokenRegistration;
+import plugin.pretokens.parser.PreClassParser;
+import plugin.pretokens.parser.PreRaceParser;
+import plugin.pretokens.writer.PreClassWriter;
+import plugin.pretokens.writer.PreRaceWriter;
+
+public class EquipBuyTokenTest extends AbstractFormulaTokenTestCase<Kit>
+{
+
+ PreClassParser preclass = new PreClassParser();
+ PreClassWriter preclasswriter = new PreClassWriter();
+ PreRaceParser prerace = new PreRaceParser();
+ PreRaceWriter preracewriter = new PreRaceWriter();
+
+ @Override
+ @Before
+ public void setUp() throws PersistenceLayerException, URISyntaxException
+ {
+ super.setUp();
+ TokenRegistration.register(preclass);
+ TokenRegistration.register(preclasswriter);
+ TokenRegistration.register(prerace);
+ TokenRegistration.register(preracewriter);
+ }
+
+ static EquipBuyToken token = new EquipBuyToken();
+ static CDOMTokenLoader<Kit> loader = new CDOMTokenLoader<Kit>(Kit.class);
+
+ @Override
+ public Class<Kit> getCDOMClass()
+ {
+ return Kit.class;
+ }
+
+ @Override
+ public CDOMLoader<Kit> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMPrimaryToken<Kit> getToken()
+ {
+ return token;
+ }
+
+ @Override
+ public FormulaKey getFormulaKey()
+ {
+ return null;
+ }
+
+ @Override
+ protected Formula getFormula()
+ {
+ QualifiedObject<Formula> qo = primaryProf.get(ObjectKey.EQUIP_BUY);
+ if (qo != null)
+ {
+ return qo.getObject(null);
+ }
+ return null;
+ }
+
+ @Test
+ public void testInvalidInputOnlyPre() throws PersistenceLayerException
+ {
+ try
+ {
+ assertFalse(parse("PRECLASS:1,Fighter=1"));
+ }
+ catch (IllegalArgumentException e)
+ {
+ // this is okay too :)
+ }
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidInputEmbeddedPre() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP1|PRECLASS:1,Fighter=1|TestWP2"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidInputDoublePipePre()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP1||PRECLASS:1,Fighter=1"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidInputPostPrePipe() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP1|PRECLASS:1,Fighter=1|"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRoundRobinPre() throws PersistenceLayerException
+ {
+ runRoundRobin("TestWP1|PRECLASS:1,Fighter=1");
+ }
+
+ @Test
+ public void testRoundRobinTwoPre() throws PersistenceLayerException
+ {
+ runRoundRobin("TestWP1|!PRERACE:1,Human|PRECLASS:1,Fighter=1");
+ }
+
+ @Test
+ public void testRoundRobinNotPre() throws PersistenceLayerException
+ {
+ runRoundRobin("TestWP1|!PRECLASS:1,Fighter=1");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/startpack/VisibleTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/startpack/VisibleTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/startpack/VisibleTokenTest.java 2008-12-31 23:46:35 UTC (rev 8766)
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2007 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.kit.startpack;
+
+import org.junit.Test;
+
+import pcgen.cdom.enumeration.ObjectKey;
+import pcgen.core.Kit;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import pcgen.util.enumeration.Visibility;
+import plugin.lsttokens.testsupport.AbstractTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+
+public class VisibleTokenTest extends AbstractTokenTestCase<Kit>
+{
+
+ static VisibleToken token = new VisibleToken();
+
+ static CDOMTokenLoader<Kit> loader = new CDOMTokenLoader<Kit>(
+ Kit.class);
+
+ @Override
+ public Class<Kit> getCDOMClass()
+ {
+ return Kit.class;
+ }
+
+ @Override
+ public CDOMLoader<Kit> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMPrimaryToken<Kit> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidOutput()
+ {
+ assertTrue(primaryContext.getWriteMessageCount() == 0);
+ primaryProf.put(ObjectKey.VISIBILITY, Visibility.OUTPUT_ONLY);
+ assertNull(token.unparse(primaryContext, primaryProf));
+ assertFalse(primaryContext.getWriteMessageCount() == 0);
+ }
+
+ @Test
+ public void testInvalidInputString() throws PersistenceLayerException
+ {
+ internalTestInvalidInputString(null);
+ }
+
+ @Test
+ public void testInvalidInputStringSet() throws PersistenceLayerException
+ {
+ assertTrue(parse("QUALIFY"));
+ assertTrue(parseSecondary("QUALIFY"));
+ assertEquals(Visibility.QUALIFY, primaryProf.get(ObjectKey.VISIBILITY));
+ internalTestInvalidInputString(Visibility.QUALIFY);
+ }
+
+ public void internalTestInvalidInputString(Object val)
+ throws PersistenceLayerException
+ {
+ assertEquals(val, primaryProf.get(ObjectKey.VISIBILITY));
+ assertFalse(parse("Always"));
+ assertEquals(val, primaryProf.get(ObjectKey.VISIBILITY));
+ assertFalse(parse("String"));
+ assertEquals(val, primaryProf.get(ObjectKey.VISIBILITY));
+ assertFalse(parse("TYPE=TestType"));
+ assertEquals(val, primaryProf.get(ObjectKey.VISIBILITY));
+ assertFalse(parse("TYPE.TestType"));
+ assertEquals(val, primaryProf.get(ObjectKey.VISIBILITY));
+ assertFalse(parse("ALL"));
+ assertEquals(val, primaryProf.get(ObjectKey.VISIBILITY));
+ // Note case sensitivity
+ assertFalse(parse("Display"));
+ }
+
+ @Test
+ public void testValidInputs() throws PersistenceLayerException
+ {
+ assertTrue(parse("QUALIFY"));
+ assertEquals(Visibility.QUALIFY, primaryProf.get(ObjectKey.VISIBILITY));
+ assertTrue(parse("YES"));
+ assertEquals(Visibility.DEFAULT, primaryProf.get(ObjectKey.VISIBILITY));
+ assertTrue(parse("NO"));
+ assertEquals(Visibility.HIDDEN, primaryProf.get(ObjectKey.VISIBILITY));
+ }
+
+ @Test
+ public void testRoundRobinQualify() throws PersistenceLayerException
+ {
+ runRoundRobin("QUALIFY");
+ }
+
+ @Test
+ public void testRoundRobinYes() throws PersistenceLayerException
+ {
+ runRoundRobin("YES");
+ }
+
+ @Test
+ public void testRoundRobinNo() throws PersistenceLayerException
+ {
+ runRoundRobin("NO");
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 23:46:07
|
Revision: 8765
http://pcgen.svn.sourceforge.net/pcgen/?rev=8765&view=rev
Author: thpr
Date: 2008-12-31 23:46:04 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
Kit Token updates & fixes part 1
Modified Paths:
--------------
Trunk/pcgen/code/src/java/pcgen/core/kit/KitSpells.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/ability/AbilityToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/ability/FeatToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/ability/FreeToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/clazz/ClassToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/clazz/LevelToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/clazz/SubclassToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/deity/CountToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/funds/FundsToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/funds/QtyToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/gear/LocationToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/gear/QtyToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/gear/SizeToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/prof/ProfToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/prof/RacialToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/ClassToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/FreeToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/RankToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/SelectionToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/SkillToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/spells/CountToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/spells/SpellsToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/startpack/ApplyToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/startpack/EquipBuyToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/startpack/StartpackToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/startpack/VisibleToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/kit/table/TableToken.java
Modified: Trunk/pcgen/code/src/java/pcgen/core/kit/KitSpells.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/core/kit/KitSpells.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/pcgen/core/kit/KitSpells.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -200,12 +200,9 @@
//
while (true)
{
- xs =
- Globals
- .getChoiceFromList("Choose " + aClass.getKeyName()
- + " spell(s) for " + workingBook, aSpellList,
- new ArrayList<KitSpellBookEntry>(),
- numberOfChoices);
+ xs = Globals.getChoiceFromList("Choose " + aClass.getKeyName()
+ + " spell(s) for " + workingBook, aSpellList,
+ new ArrayList<KitSpellBookEntry>(), numberOfChoices);
if (xs.size() != 0)
{
@@ -305,9 +302,8 @@
if (spLevel == 99)
{
- spLevel =
- SpellLevel.getFirstLevelForKey(spell, pcClass
- .getSpellLists(pc), pc);
+ spLevel = SpellLevel.getFirstLevelForKey(spell, pcClass
+ .getSpellLists(pc), pc);
owner = pcClass;
}
@@ -388,4 +384,21 @@
{
spells.put(ksi, featList, count);
}
+
+ public Collection<KnownSpellIdentifier> getSpells()
+ {
+ return spells.getKeySet();
+ }
+
+ public Collection<List<CDOMSingleRef<Ability>>> getAbilities(
+ KnownSpellIdentifier ksi)
+ {
+ return spells.getSecondaryKeySet(ksi);
+ }
+
+ public Integer getSpellCount(KnownSpellIdentifier ksi,
+ List<CDOMSingleRef<Ability>> abils)
+ {
+ return spells.get(ksi, abils);
+ }
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/ability/AbilityToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/ability/AbilityToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/ability/AbilityToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -88,13 +88,6 @@
+ "in a Kit requires CATEGORY=<cat>|<ability>,<ability>");
return false;
}
- if (pipeLoc != value.lastIndexOf(Constants.PIPE))
- {
- Logging.addParseMessage(Logging.LST_ERROR,
- "Two pipes found. ABILITY token "
- + "in a Kit requires CATEGORY=<cat>|<abilities>");
- return false;
- }
String catString = value.substring(0, pipeLoc);
if (!catString.startsWith("CATEGORY="))
{
@@ -123,7 +116,7 @@
+ "in a Kit requires CATEGORY=<cat>|<abilities>");
return false;
}
- StringTokenizer st = new StringTokenizer(rest, "|");
+ StringTokenizer st = new StringTokenizer(rest, Constants.PIPE);
while (st.hasMoreTokens())
{
@@ -157,7 +150,7 @@
{
Collection<CDOMReference<Ability>> references =
KitAbilities.getAbilityKeys();
- if (references == null)
+ if (references == null || references.isEmpty())
{
return null;
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/ability/FeatToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/ability/FeatToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/ability/FeatToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -74,7 +74,7 @@
public boolean parse(LoadContext context, KitAbilities kitAbil, String value)
{
- if (isEmpty(value))
+ if (isEmpty(value) || hasIllegalSeparator('|', value))
{
return false;
}
@@ -123,7 +123,7 @@
public String[] unparse(LoadContext context, KitAbilities KitAbilities)
{
Collection<CDOMReference<Ability>> ref = KitAbilities.getAbilityKeys();
- if (ref == null)
+ if (ref == null || ref.isEmpty())
{
return null;
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/ability/FreeToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/ability/FreeToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/ability/FreeToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -60,6 +60,10 @@
public boolean parse(LoadContext context, KitAbilities kitAbil, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
Boolean set;
char firstChar = value.charAt(0);
if (firstChar == 'y' || firstChar == 'Y')
@@ -76,13 +80,16 @@
{
if (firstChar != 'N' && firstChar != 'n')
{
- if (value.length() > 1 && !value.equalsIgnoreCase("NO"))
- {
- Logging.errorPrint("You should use 'YES' or 'NO' as the "
+ Logging.errorPrint("You should use 'YES' or 'NO' as the "
+ getTokenName() + ": " + value);
- return false;
- }
+ return false;
}
+ if (value.length() > 1 && !value.equalsIgnoreCase("NO"))
+ {
+ Logging.errorPrint("You should use 'YES' or 'NO' as the "
+ + getTokenName() + ": " + value);
+ return false;
+ }
set = Boolean.FALSE;
}
kitAbil.setFree(set);
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/clazz/ClassToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/clazz/ClassToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/clazz/ClassToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -65,6 +65,10 @@
public boolean parse(LoadContext context, KitClass kitClass, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
CDOMSingleRef<PCClass> ref =
context.ref.getCDOMReference(PCCLASS_CLASS, value);
kitClass.setPcclass(ref);
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/clazz/LevelToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/clazz/LevelToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/clazz/LevelToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -62,6 +62,10 @@
public boolean parse(LoadContext context, KitClass kitClass, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
kitClass.setLevel(FormulaFactory.getFormulaFor(value));
return true;
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/clazz/SubclassToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/clazz/SubclassToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/clazz/SubclassToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -63,6 +63,10 @@
public boolean parse(LoadContext context, KitClass kitClass, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
/*
* This call to kitClass.getPcclass() is safe, as the line is CLASS:
* and thus the CLASS: token is always encountered first
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/deity/CountToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/deity/CountToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/deity/CountToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -62,6 +62,10 @@
public boolean parse(LoadContext context, KitDeity kitDeity, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
kitDeity.setCount(FormulaFactory.getFormulaFor(value));
return true;
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/funds/FundsToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/funds/FundsToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/funds/FundsToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -60,6 +60,10 @@
public boolean parse(LoadContext context, KitFunds kitFunds, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
kitFunds.setName(value);
return true;
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/funds/QtyToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/funds/QtyToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/funds/QtyToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -61,6 +61,10 @@
public boolean parse(LoadContext context, KitFunds kitFunds, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
kitFunds.setQuantity(FormulaFactory.getFormulaFor(value));
return true;
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/gear/LocationToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/gear/LocationToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/gear/LocationToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -59,6 +59,10 @@
public boolean parse(LoadContext context, KitGear kitGear, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
kitGear.setLocation(value);
return true;
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/gear/QtyToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/gear/QtyToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/gear/QtyToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -61,6 +61,10 @@
public boolean parse(LoadContext context, KitGear kitGear, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
kitGear.setQuantity(FormulaFactory.getFormulaFor(value));
return true;
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/gear/SizeToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/gear/SizeToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/gear/SizeToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -30,6 +30,7 @@
import pcgen.rules.context.LoadContext;
import pcgen.rules.persistence.token.AbstractToken;
import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import pcgen.util.Logging;
/**
* SIZE token for KitGear
@@ -70,9 +71,14 @@
}
else
{
- SizeAdjustment size =
- context.ref.getAbbreviatedObject(SizeAdjustment.class,
- value);
+ SizeAdjustment size = context.ref.getAbbreviatedObject(
+ SizeAdjustment.class, value);
+ if (size == null)
+ {
+ Logging.errorPrint(getTokenName()
+ + " found invalid Size abbreviation: " + value);
+ return false;
+ }
kitGear.setSize(size);
}
return true;
@@ -88,8 +94,8 @@
{
return null;
}
- return new String[]{"PC"};
+ return new String[] { "PC" };
}
- return new String[]{sz.getAbbreviation()};
+ return new String[] { sz.getAbbreviation() };
}
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/prof/ProfToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/prof/ProfToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/prof/ProfToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -37,7 +37,6 @@
import pcgen.rules.context.LoadContext;
import pcgen.rules.persistence.token.AbstractToken;
import pcgen.rules.persistence.token.CDOMSecondaryToken;
-import pcgen.util.Logging;
/**
* PROF Token part of Kit Prof Lst Token
@@ -82,22 +81,15 @@
String tokText = tok.nextToken();
CDOMSingleRef<WeaponProf> ref =
context.ref.getCDOMReference(WEAPONPROF_CLASS, tokText);
- if (ref == null)
- {
- Logging
- .errorPrint(" Error was encountered while parsing KitProf. "
- + tokText + " is not a valid WeaponProf");
- continue;
- }
obj.addProficiency(ref);
}
- return false;
+ return true;
}
public String[] unparse(LoadContext context, KitProf obj)
{
Collection<CDOMSingleRef<WeaponProf>> ref = obj.getProficiencies();
- if (ref == null)
+ if (ref == null || ref.isEmpty())
{
return null;
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/prof/RacialToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/prof/RacialToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/prof/RacialToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -46,21 +46,6 @@
return "RACIAL";
}
- /**
- * parse
- *
- * @param kitProf
- * KitProf
- * @param value
- * String
- * @return boolean
- */
- public boolean parse(KitProf kitProf, String value)
- {
- kitProf.setRacialProf(value.startsWith("Y"));
- return true;
- }
-
public Class<KitProf> getTokenClass()
{
return KitProf.class;
@@ -74,6 +59,10 @@
public boolean parse(LoadContext context, KitProf obj, String value)
throws PersistenceLayerException
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
Boolean set;
char firstChar = value.charAt(0);
if (firstChar == 'y' || firstChar == 'Y')
@@ -90,13 +79,16 @@
{
if (firstChar != 'N' && firstChar != 'n')
{
- if (value.length() > 1 && !value.equalsIgnoreCase("NO"))
- {
- Logging.errorPrint("You should use 'YES' or 'NO' as the "
+ Logging.errorPrint("You should use 'YES' or 'NO' as the "
+ getTokenName() + ": " + value);
- return false;
- }
+ return false;
}
+ if (value.length() > 1 && !value.equalsIgnoreCase("NO"))
+ {
+ Logging.errorPrint("You should use 'YES' or 'NO' as the "
+ + getTokenName() + ": " + value);
+ return false;
+ }
set = Boolean.FALSE;
}
obj.setRacialProf(set);
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/ClassToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/ClassToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/ClassToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -64,6 +64,10 @@
public boolean parse(LoadContext context, KitSkill kitSkill, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
CDOMSingleRef<PCClass> ref =
context.ref.getCDOMReference(PCCLASS_CLASS, value);
kitSkill.setPcclass(ref);
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/FreeToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/FreeToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/FreeToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -60,6 +60,10 @@
public boolean parse(LoadContext context, KitSkill kitSkill, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
Boolean set;
char firstChar = value.charAt(0);
if (firstChar == 'y' || firstChar == 'Y')
@@ -67,7 +71,7 @@
if (value.length() > 1 && !value.equalsIgnoreCase("YES"))
{
Logging.errorPrint("You should use 'YES' as the "
- + getTokenName() + ": " + value);
+ + getTokenName() + ": " + value);
return false;
}
set = Boolean.TRUE;
@@ -76,13 +80,16 @@
{
if (firstChar != 'N' && firstChar != 'n')
{
- if (value.length() > 1 && !value.equalsIgnoreCase("NO"))
- {
- Logging.errorPrint("You should use 'YES' or 'NO' as the "
+ Logging.errorPrint("You should use 'YES' or 'NO' as the "
+ getTokenName() + ": " + value);
- return false;
- }
+ return false;
}
+ if (value.length() > 1 && !value.equalsIgnoreCase("NO"))
+ {
+ Logging.errorPrint("You should use 'YES' or 'NO' as the "
+ + getTokenName() + ": " + value);
+ return false;
+ }
set = Boolean.FALSE;
}
kitSkill.setFree(set);
@@ -96,6 +103,6 @@
{
return null;
}
- return new String[]{mult.booleanValue() ? "YES" : "NO"};
+ return new String[] { mult.booleanValue() ? "YES" : "NO" };
}
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/RankToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/RankToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/RankToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -62,6 +62,10 @@
public boolean parse(LoadContext context, KitSkill kitSkill, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
try
{
BigDecimal rank = new BigDecimal(value);
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/SelectionToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/SelectionToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/SelectionToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -91,7 +91,7 @@
public String[] unparse(LoadContext context, KitSkill kitSkill)
{
List<CDOMSingleRef<Language>> ref = kitSkill.getSelections();
- if (ref == null)
+ if (ref == null || ref.isEmpty())
{
return null;
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/SkillToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/SkillToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/skill/SkillToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -79,8 +79,13 @@
while (tok.hasMoreTokens())
{
String tokText = tok.nextToken();
- kitSkill.addSkill(TokenUtilities.getTypeOrPrimitive(context,
- SKILL_CLASS, tokText));
+ CDOMReference<Skill> ref = TokenUtilities.getTypeOrPrimitive(
+ context, SKILL_CLASS, tokText);
+ if (ref == null)
+ {
+ return false;
+ }
+ kitSkill.addSkill(ref);
}
return true;
}
@@ -88,11 +93,11 @@
public String[] unparse(LoadContext context, KitSkill kitSkill)
{
Collection<CDOMReference<Skill>> ref = kitSkill.getSkills();
- if (ref == null)
+ if (ref == null || ref.isEmpty())
{
return null;
}
- return new String[]{ReferenceUtilities.joinLstFormat(ref,
- Constants.PIPE)};
+ return new String[] { ReferenceUtilities.joinLstFormat(ref,
+ Constants.PIPE) };
}
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/spells/CountToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/spells/CountToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/spells/CountToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -61,6 +61,10 @@
public boolean parse(LoadContext context, KitSpells kitSpells, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
kitSpells.setCount(FormulaFactory.getFormulaFor(value));
return true;
}
@@ -72,6 +76,6 @@
{
return null;
}
- return new String[]{bd.toString()};
+ return new String[] { bd.toString() };
}
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/spells/SpellsToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/spells/SpellsToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/spells/SpellsToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -26,12 +26,16 @@
package plugin.lsttokens.kit.spells;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
import java.util.StringTokenizer;
+import pcgen.base.lang.StringUtil;
import pcgen.cdom.base.CDOMReference;
import pcgen.cdom.base.Constants;
import pcgen.cdom.content.KnownSpellIdentifier;
import pcgen.cdom.reference.CDOMSingleRef;
+import pcgen.cdom.reference.ReferenceUtilities;
import pcgen.core.Ability;
import pcgen.core.AbilityCategory;
import pcgen.core.Globals;
@@ -76,6 +80,10 @@
public boolean parse(LoadContext context, KitSpells kitSpell, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
StringTokenizer aTok = new StringTokenizer(value, Constants.PIPE);
while (aTok.hasMoreTokens())
{
@@ -85,30 +93,43 @@
if (kitSpell.getSpellBook() != null)
{
Logging.errorPrint("Cannot reset SPELLBOOK in SPELLS: "
- + value);
+ + value);
return false;
}
- kitSpell.setSpellBook(field.substring(10));
+ String spellBook = field.substring(10);
+ if (spellBook.length() == 0)
+ {
+ Logging.errorPrint("Cannot set SPELLBOOK "
+ + "to empty value in SPELLS: " + value);
+ return false;
+ }
+ kitSpell.setSpellBook(spellBook);
}
else if (field.startsWith("CLASS="))
{
if (kitSpell.getCastingClass() != null)
{
Logging.errorPrint("Cannot reset CLASS" + " in SPELLS: "
- + value);
+ + value);
return false;
}
String className = field.substring(6);
- if (className.equalsIgnoreCase("Default"))
+ if (className.length() == 0)
{
+ Logging.errorPrint("Cannot set CLASS "
+ + "to empty value in SPELLS: " + value);
+ return false;
+ }
+ else if (className.equalsIgnoreCase("Default"))
+ {
Logging
- .deprecationPrint("Use of Default for CLASS= in KIT "
- + "SPELLS line is unnecessary: Ignoring");
+ .deprecationPrint("Use of Default for CLASS= in KIT "
+ + "SPELLS line is unnecessary: Ignoring");
}
else
{
kitSpell.setCastingClass(context.ref.getCDOMReference(
- PCClass.class, className));
+ PCClass.class, className));
}
}
else
@@ -125,59 +146,40 @@
catch (NumberFormatException e)
{
Logging.errorPrint("Expected an Integer COUNT,"
- + " but found: " + countStr + " in " + value);
+ + " but found: " + countStr + " in " + value);
return false;
}
field = field.substring(0, equalLoc);
}
+ if (field.length() == 0)
+ {
+ Logging.errorPrint("Expected an Spell in SPELLS"
+ + " but found: " + value);
+ return false;
+ }
StringTokenizer subTok = new StringTokenizer(field, "[]");
String filterString = subTok.nextToken();
// must satisfy all elements in a comma delimited list
- Integer levelLim = null;
CDOMReference<Spell> sp = null;
- if (filterString.startsWith("LEVEL="))
+ sp = TokenUtilities.getTypeOrPrimitive(context, SPELL_CLASS,
+ filterString);
+ if (sp == null)
{
- // if the argument starts with LEVEL=, compare the level to
- // the desired spellLevel
- try
- {
- levelLim = Integer.valueOf(filterString.substring(6));
- }
- catch (NumberFormatException e)
- {
- Logging.errorPrint("Invalid Number in "
+ Logging.errorPrint(" encountered Invalid limit in "
+ getTokenName() + ": " + value);
- Logging.errorPrint(" Level must be an integer");
- return false;
- }
- sp = context.ref.getCDOMAllReference(SPELL_CLASS);
+ return false;
}
- else
- {
- sp =
- TokenUtilities.getTypeOrPrimitive(context,
- SPELL_CLASS, filterString);
- if (sp == null)
- {
- Logging.errorPrint(" encountered Invalid limit in "
- + getTokenName() + ": " + value);
- return false;
- }
- }
- KnownSpellIdentifier ksi =
- new KnownSpellIdentifier(sp, levelLim);
+ KnownSpellIdentifier ksi = new KnownSpellIdentifier(sp, null);
- ArrayList<CDOMSingleRef<Ability>> featList =
- new ArrayList<CDOMSingleRef<Ability>>();
+ ArrayList<CDOMSingleRef<Ability>> featList = new ArrayList<CDOMSingleRef<Ability>>();
while (subTok.hasMoreTokens())
{
String featName = subTok.nextToken();
- CDOMSingleRef<Ability> feat =
- context.ref.getCDOMReference(ABILITY_CLASS,
- AbilityCategory.FEAT, featName);
+ CDOMSingleRef<Ability> feat = context.ref.getCDOMReference(
+ ABILITY_CLASS, AbilityCategory.FEAT, featName);
featList.add(feat);
}
kitSpell.addSpell(ksi, featList, count);
@@ -190,19 +192,69 @@
return true;
}
- public String[] unparse(LoadContext context, KitSpells kitSkill)
+ public String[] unparse(LoadContext context, KitSpells kitSpell)
{
- return null;
+ StringBuilder sb = new StringBuilder();
+ String spellBook = kitSpell.getSpellBook();
+ String globalSpellbook = Globals.getDefaultSpellBook();
+ if (spellBook != null && !globalSpellbook.equals(spellBook))
+ {
+ sb.append("SPELLBOOK=").append(spellBook);
+ }
+ CDOMSingleRef<PCClass> castingClass = kitSpell.getCastingClass();
+ if (castingClass != null)
+ {
+ if (sb.length() != 0)
+ {
+ sb.append(Constants.PIPE);
+ }
+ sb.append("CLASS=").append(castingClass.getLSTformat());
+ }
+ Collection<KnownSpellIdentifier> spells = kitSpell.getSpells();
+ if (spells != null)
+ {
+ boolean needPipe = sb.length() > 0;
+ for (KnownSpellIdentifier ksi : spells)
+ {
+ if (needPipe)
+ {
+ sb.append(Constants.PIPE);
+ }
+ needPipe = true;
+ Collection<List<CDOMSingleRef<Ability>>> abilities = kitSpell
+ .getAbilities(ksi);
+ for (List<CDOMSingleRef<Ability>> abils : abilities)
+ {
+ StringBuilder spell = new StringBuilder();
+ spell.append(StringUtil.replaceAll(ksi.getLSTformat(),
+ Constants.LST_TYPE, Constants.LST_TYPE_OLD));
+ if (abils != null && !abils.isEmpty())
+ {
+ spell.append('[');
+ spell.append(ReferenceUtilities.joinLstFormat(abils,
+ "]["));
+ spell.append(']');
+ }
+ Integer count = kitSpell.getSpellCount(ksi, abils);
+ if (count != 1)
+ {
+ spell.append('=').append(count);
+ }
+ sb.append(spell);
+ }
+ }
+ }
+ if (sb.length() == 0)
+ {
+ return null;
+ }
+ return new String[] { sb.toString() };
}
-
- //TODO DeferredToken
+ // TODO DeferredToken
/*
- if (!aClass.getSafe(ObjectKey.MEMORIZE_SPELLS)
- && !spellBook.equals(Globals.getDefaultSpellBook()))
- {
- warnings.add("SPELLS: " + aClass.getDisplayName()
- + " can only add to " + Globals.getDefaultSpellBook());
- return false;
- }
+ * if (!aClass.getSafe(ObjectKey.MEMORIZE_SPELLS) &&
+ * !spellBook.equals(Globals.getDefaultSpellBook())) { warnings.add("SPELLS: " +
+ * aClass.getDisplayName() + " can only add to " +
+ * Globals.getDefaultSpellBook()); return false; }
*/
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/startpack/ApplyToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/startpack/ApplyToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/startpack/ApplyToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -31,12 +31,12 @@
import pcgen.rules.context.LoadContext;
import pcgen.rules.persistence.token.AbstractToken;
import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import pcgen.util.Logging;
/**
- * Deals with APPLY lst token within KitStartpack
+ * Deals with APPLY lst token within KitStartpack
*/
-public class ApplyToken extends AbstractToken implements
- CDOMPrimaryToken<Kit>
+public class ApplyToken extends AbstractToken implements CDOMPrimaryToken<Kit>
{
/**
* Gets the name of the tag this class will parse.
@@ -54,16 +54,24 @@
return Kit.class;
}
- public String getParentToken()
- {
- return "*KITTOKEN";
- }
-
public boolean parse(LoadContext context, Kit kit, String value)
{
- KitApply ka = KitApply.valueOf(value);
- kit.put(ObjectKey.APPLY_MODE, ka);
- return true;
+ if (isEmpty(value))
+ {
+ return false;
+ }
+ try
+ {
+ KitApply ka = KitApply.valueOf(value);
+ kit.put(ObjectKey.APPLY_MODE, ka);
+ return true;
+ }
+ catch (IllegalArgumentException e)
+ {
+ Logging.errorPrint(getTokenName()
+ + " encountered unexpected application type: " + value);
+ return false;
+ }
}
public String[] unparse(LoadContext context, Kit kit)
@@ -73,6 +81,6 @@
{
return null;
}
- return new String[]{bd.toString()};
+ return new String[] { bd.toString() };
}
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/startpack/EquipBuyToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/startpack/EquipBuyToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/startpack/EquipBuyToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -63,11 +63,6 @@
return Kit.class;
}
- public String getParentToken()
- {
- return "*KITTOKEN";
- }
-
public boolean parse(LoadContext context, Kit kit, String value)
{
if (isEmpty(value) || hasIllegalSeparator('|', value))
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/startpack/StartpackToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/startpack/StartpackToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/startpack/StartpackToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -29,13 +29,13 @@
import pcgen.persistence.PersistenceLayerException;
import pcgen.rules.context.LoadContext;
import pcgen.rules.persistence.token.AbstractToken;
-import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
/**
* STARTPACK token for Kit Startpack
*/
public class StartpackToken extends AbstractToken implements
- CDOMSecondaryToken<Kit>
+ CDOMPrimaryToken<Kit>
{
/**
* Gets the name of the tag this class will parse.
@@ -48,11 +48,6 @@
return "STARTPACK";
}
- public String getParentToken()
- {
- return "*KITTOKEN";
- }
-
public Class<Kit> getTokenClass()
{
return Kit.class;
@@ -61,6 +56,10 @@
public boolean parse(LoadContext context, Kit kit, String value)
throws PersistenceLayerException
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
return true;
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/startpack/VisibleToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/startpack/VisibleToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/startpack/VisibleToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -55,13 +55,12 @@
return Kit.class;
}
- public String getParentToken()
- {
- return "*KITTOKEN";
- }
-
public boolean parse(LoadContext context, Kit kit, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
Visibility vis;
if (value.equals("QUALIFY"))
{
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/kit/table/TableToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/kit/table/TableToken.java 2008-12-31 20:17:37 UTC (rev 8764)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/kit/table/TableToken.java 2008-12-31 23:46:04 UTC (rev 8765)
@@ -64,6 +64,10 @@
public boolean parse(LoadContext context, KitTable kitTable, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
kitTable.setTableName(value);
return true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 20:17:46
|
Revision: 8764
http://pcgen.svn.sourceforge.net/pcgen/?rev=8764&view=rev
Author: thpr
Date: 2008-12-31 20:17:37 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
followup on formula refactor
Modified Paths:
--------------
Trunk/pcgen/code/src/java/plugin/lsttokens/add/AbilityToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/ClassSkillsLevelToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/ClassSkillsToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/EquipToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/FeatToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/LanguageToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/SkillToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/SpellCasterToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/TemplateToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/VFeatToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/remove/FeatToken.java
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/AbilityToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/AbilityToken.java 2008-12-31 20:06:44 UTC (rev 8763)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/AbilityToken.java 2008-12-31 20:17:37 UTC (rev 8764)
@@ -335,11 +335,10 @@
+ " Count");
return null;
}
- String fString = f.toString();
StringBuilder sb = new StringBuilder();
- if (!"1".equals(fString))
+ if (!FormulaFactory.ONE.equals(f))
{
- sb.append(fString).append(Constants.PIPE);
+ sb.append(f).append(Constants.PIPE);
}
sb.append(ascs.getCategory().getKeyName());
sb.append(Constants.PIPE);
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/ClassSkillsLevelToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/ClassSkillsLevelToken.java 2008-12-31 20:06:44 UTC (rev 8763)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/ClassSkillsLevelToken.java 2008-12-31 20:17:37 UTC (rev 8764)
@@ -245,11 +245,10 @@
+ " Count");
return null;
}
- String fString = f.toString();
StringBuilder sb = new StringBuilder();
- if (!"1".equals(fString))
+ if (!FormulaFactory.ONE.equals(f))
{
- sb.append(fString).append(Constants.PIPE);
+ sb.append(f).append(Constants.PIPE);
}
sb.append(cs.getLSTformat());
ClassSkillChoiceActor actor = (ClassSkillChoiceActor) container
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/ClassSkillsToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/ClassSkillsToken.java 2008-12-31 20:06:44 UTC (rev 8763)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/ClassSkillsToken.java 2008-12-31 20:17:37 UTC (rev 8764)
@@ -241,11 +241,10 @@
+ " Count");
return null;
}
- String fString = f.toString();
StringBuilder sb = new StringBuilder();
- if (!"1".equals(fString))
+ if (!FormulaFactory.ONE.equals(f))
{
- sb.append(fString).append(Constants.PIPE);
+ sb.append(f).append(Constants.PIPE);
}
sb.append(cs.getLSTformat());
ClassSkillChoiceActor actor = (ClassSkillChoiceActor) container
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/EquipToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/EquipToken.java 2008-12-31 20:06:44 UTC (rev 8763)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/EquipToken.java 2008-12-31 20:17:37 UTC (rev 8764)
@@ -152,11 +152,10 @@
+ " Count");
return null;
}
- String fString = f.toString();
StringBuilder sb = new StringBuilder();
- if (!"1".equals(fString))
+ if (!FormulaFactory.ONE.equals(f))
{
- sb.append(fString).append(Constants.PIPE);
+ sb.append(f).append(Constants.PIPE);
}
sb.append(cs.getLSTformat());
addStrings.add(sb.toString());
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/FeatToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/FeatToken.java 2008-12-31 20:06:44 UTC (rev 8763)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/FeatToken.java 2008-12-31 20:17:37 UTC (rev 8764)
@@ -251,11 +251,10 @@
+ " Count");
return null;
}
- String fString = f.toString();
StringBuilder sb = new StringBuilder();
- if (!"1".equals(fString))
+ if (!FormulaFactory.ONE.equals(f))
{
- sb.append(fString).append(Constants.PIPE);
+ sb.append(f).append(Constants.PIPE);
}
if (container.allowsStacking())
{
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/LanguageToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/LanguageToken.java 2008-12-31 20:06:44 UTC (rev 8763)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/LanguageToken.java 2008-12-31 20:17:37 UTC (rev 8764)
@@ -169,11 +169,10 @@
+ " Count");
return null;
}
- String fString = f.toString();
StringBuilder sb = new StringBuilder();
- if (!"1".equals(fString))
+ if (!FormulaFactory.ONE.equals(f))
{
- sb.append(fString).append(Constants.PIPE);
+ sb.append(f).append(Constants.PIPE);
}
sb.append(cs.getLSTformat());
addStrings.add(sb.toString());
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/SkillToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/SkillToken.java 2008-12-31 20:06:44 UTC (rev 8763)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/SkillToken.java 2008-12-31 20:17:37 UTC (rev 8764)
@@ -166,11 +166,10 @@
+ " Count");
return null;
}
- String fString = f.toString();
StringBuilder sb = new StringBuilder();
- if (!"1".equals(fString))
+ if (!FormulaFactory.ONE.equals(f))
{
- sb.append(fString).append(Constants.PIPE);
+ sb.append(f).append(Constants.PIPE);
}
sb.append(cs.getLSTformat());
addStrings.add(sb.toString());
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/SpellCasterToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/SpellCasterToken.java 2008-12-31 20:06:44 UTC (rev 8763)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/SpellCasterToken.java 2008-12-31 20:17:37 UTC (rev 8764)
@@ -190,11 +190,10 @@
+ " Count");
return null;
}
- String fString = f.toString();
StringBuilder sb = new StringBuilder();
- if (!"1".equals(fString))
+ if (!FormulaFactory.ONE.equals(f))
{
- sb.append(fString).append(Constants.PIPE);
+ sb.append(f).append(Constants.PIPE);
}
sb.append(cs.getLSTformat());
addStrings.add(sb.toString());
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/TemplateToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/TemplateToken.java 2008-12-31 20:06:44 UTC (rev 8763)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/TemplateToken.java 2008-12-31 20:17:37 UTC (rev 8764)
@@ -139,11 +139,10 @@
+ " Count");
return null;
}
- String fString = f.toString();
StringBuilder sb = new StringBuilder();
- if (!"1".equals(fString))
+ if (!FormulaFactory.ONE.equals(f))
{
- sb.append(fString).append(Constants.PIPE);
+ sb.append(f).append(Constants.PIPE);
}
sb.append(cs.getLSTformat());
addStrings.add(sb.toString());
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/VFeatToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/VFeatToken.java 2008-12-31 20:06:44 UTC (rev 8763)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/VFeatToken.java 2008-12-31 20:17:37 UTC (rev 8764)
@@ -252,11 +252,10 @@
+ " Count");
return null;
}
- String fString = f.toString();
StringBuilder sb = new StringBuilder();
- if (!"1".equals(fString))
+ if (!FormulaFactory.ONE.equals(f))
{
- sb.append(fString).append(Constants.PIPE);
+ sb.append(f).append(Constants.PIPE);
}
if (container.allowsStacking())
{
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/remove/FeatToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/remove/FeatToken.java 2008-12-31 20:06:44 UTC (rev 8763)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/remove/FeatToken.java 2008-12-31 20:17:37 UTC (rev 8764)
@@ -245,11 +245,10 @@
+ " Count");
return null;
}
- String fString = f.toString();
StringBuilder sb = new StringBuilder();
- if (!"1".equals(fString))
+ if (!FormulaFactory.ONE.equals(f))
{
- sb.append(fString).append(Constants.PIPE);
+ sb.append(f).append(Constants.PIPE);
}
sb.append(cs.getLSTformat());
addStrings.add(sb.toString());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 20:06:47
|
Revision: 8763
http://pcgen.svn.sourceforge.net/pcgen/?rev=8763&view=rev
Author: thpr
Date: 2008-12-31 20:06:44 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
additional token tests
Modified Paths:
--------------
Trunk/pcgen/code/src/utest/plugin/lsttokens/AbilityLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/CCSkillLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/CSkillLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/CompanionListLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/DefineLstTest.java
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/AbilityLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/AbilityLstTest.java 2008-12-31 20:06:16 UTC (rev 8762)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/AbilityLstTest.java 2008-12-31 20:06:44 UTC (rev 8763)
@@ -27,6 +27,7 @@
import pcgen.core.PCTemplate;
import pcgen.core.SettingsHandler;
import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.context.LoadContext;
import pcgen.rules.persistence.CDOMLoader;
import pcgen.rules.persistence.token.CDOMPrimaryToken;
import plugin.lsttokens.testsupport.AbstractGlobalTokenTestCase;
@@ -181,88 +182,53 @@
@Test
public void testRoundRobinJustSpell() throws PersistenceLayerException
{
- Ability ab = primaryContext.ref.constructCDOMObject(
- Ability.class, "Abil1");
- primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = secondaryContext.ref.constructCDOMObject(Ability.class,
- "Abil1");
- secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ construct(primaryContext, "Abil1");
+ construct(secondaryContext, "Abil1");
runRoundRobin("Feat|NORMAL|Abil1");
}
@Test
public void testRoundRobinJustTwoPrereq() throws PersistenceLayerException
{
- Ability ab = primaryContext.ref.constructCDOMObject(
- Ability.class, "Abil1");
- primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = secondaryContext.ref.constructCDOMObject(Ability.class,
- "Abil1");
- secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ construct(primaryContext, "Abil1");
+ construct(secondaryContext, "Abil1");
runRoundRobin("Feat|NORMAL|Abil1|PRELEVEL:MIN=5|PRERACE:1,Human");
}
@Test
public void testRoundRobinTwoSpell() throws PersistenceLayerException
{
- Ability ab = primaryContext.ref.constructCDOMObject(
- Ability.class, "Abil1");
- primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = secondaryContext.ref.constructCDOMObject(Ability.class,
- "Abil1");
- secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = primaryContext.ref.constructCDOMObject(Ability.class, "Abil2");
- primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = secondaryContext.ref.constructCDOMObject(Ability.class,
- "Abil2");
- secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ construct(primaryContext, "Abil1");
+ construct(secondaryContext, "Abil1");
+ construct(primaryContext, "Abil2");
+ construct(secondaryContext, "Abil2");
runRoundRobin("Feat|NORMAL|Abil1|Abil2");
}
@Test
public void testRoundRobinTwoNature() throws PersistenceLayerException
{
- Ability ab = primaryContext.ref.constructCDOMObject(
- Ability.class, "Abil1");
- primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = secondaryContext.ref.constructCDOMObject(Ability.class,
- "Abil1");
- secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = primaryContext.ref.constructCDOMObject(Ability.class, "Abil2");
- primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = secondaryContext.ref.constructCDOMObject(Ability.class,
- "Abil2");
- secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = primaryContext.ref.constructCDOMObject(Ability.class, "Abil3");
- primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = secondaryContext.ref.constructCDOMObject(Ability.class,
- "Abil3");
- secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = primaryContext.ref.constructCDOMObject(Ability.class, "Abil4");
- primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = secondaryContext.ref.constructCDOMObject(Ability.class,
- "Abil4");
- secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ construct(primaryContext, "Abil1");
+ construct(secondaryContext, "Abil1");
+ construct(primaryContext, "Abil2");
+ construct(secondaryContext, "Abil2");
+ construct(primaryContext, "Abil3");
+ construct(secondaryContext, "Abil3");
+ construct(primaryContext, "Abil4");
+ construct(secondaryContext, "Abil4");
runRoundRobin("Feat|NORMAL|Abil1|Abil2", "Feat|VIRTUAL|Abil3|Abil4");
}
@Test
public void testRoundRobinTwoCategory() throws PersistenceLayerException
{
- Ability ab = primaryContext.ref.constructCDOMObject(
- Ability.class, "Abil1");
- primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = secondaryContext.ref.constructCDOMObject(Ability.class,
- "Abil1");
- secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = primaryContext.ref.constructCDOMObject(Ability.class, "Abil2");
- primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = secondaryContext.ref.constructCDOMObject(Ability.class,
- "Abil2");
- secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ construct(primaryContext, "Abil1");
+ construct(secondaryContext, "Abil1");
+ construct(primaryContext, "Abil2");
+ construct(secondaryContext, "Abil2");
AbilityCategory ac = new AbilityCategory("NEWCAT");
SettingsHandler.getGame().addAbilityCategory(ac);
- ab = primaryContext.ref.constructCDOMObject(Ability.class, "Abil3");
+ Ability ab = primaryContext.ref.constructCDOMObject(Ability.class, "Abil3");
primaryContext.ref.reassociateCategory(ac, ab);
ab = secondaryContext.ref.constructCDOMObject(Ability.class,
"Abil3");
@@ -278,36 +244,24 @@
@Test
public void testRoundRobinDupe() throws PersistenceLayerException
{
- Ability ab = primaryContext.ref.constructCDOMObject(
- Ability.class, "Abil1");
- primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = secondaryContext.ref.constructCDOMObject(Ability.class,
- "Abil1");
- secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ construct(primaryContext, "Abil1");
+ construct(secondaryContext, "Abil1");
runRoundRobin("Feat|VIRTUAL|Abil1|Abil1");
}
@Test
public void testRoundRobinDupeDiffNature() throws PersistenceLayerException
{
- Ability ab = primaryContext.ref.constructCDOMObject(
- Ability.class, "Abil1");
- primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = secondaryContext.ref.constructCDOMObject(Ability.class,
- "Abil1");
- secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ construct(primaryContext, "Abil1");
+ construct(secondaryContext, "Abil1");
runRoundRobin("Feat|NORMAL|Abil1", "Feat|VIRTUAL|Abil1");
}
@Test
public void testRoundRobinDupeOnePrereq() throws PersistenceLayerException
{
- Ability ab = primaryContext.ref.constructCDOMObject(
- Ability.class, "Abil1");
- primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = secondaryContext.ref.constructCDOMObject(Ability.class,
- "Abil1");
- secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ construct(primaryContext, "Abil1");
+ construct(secondaryContext, "Abil1");
runRoundRobin("Feat|VIRTUAL|Abil1|Abil1|PRERACE:1,Human");
assertTrue(primaryContext.ref.validate());
assertTrue(secondaryContext.ref.validate());
@@ -317,12 +271,8 @@
public void testRoundRobinDupeDiffPrereqs()
throws PersistenceLayerException
{
- Ability ab = primaryContext.ref.constructCDOMObject(
- Ability.class, "Abil1");
- primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = secondaryContext.ref.constructCDOMObject(Ability.class,
- "Abil1");
- secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ construct(primaryContext, "Abil1");
+ construct(secondaryContext, "Abil1");
runRoundRobin("Feat|VIRTUAL|Abil1",
"Feat|VIRTUAL|Abil1|PRERACE:1,Human");
assertTrue(primaryContext.ref.validate());
@@ -333,15 +283,150 @@
public void testRoundRobinDupeTwoDiffPrereqs()
throws PersistenceLayerException
{
- Ability ab = primaryContext.ref.constructCDOMObject(
- Ability.class, "Abil1");
- primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
- ab = secondaryContext.ref.constructCDOMObject(Ability.class,
- "Abil1");
- secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ construct(primaryContext, "Abil1");
+ construct(secondaryContext, "Abil1");
runRoundRobin("Feat|VIRTUAL|Abil1|Abil1|PRERACE:1,Elf",
"Feat|VIRTUAL|Abil1|PRERACE:1,Human");
assertTrue(primaryContext.ref.validate());
assertTrue(secondaryContext.ref.validate());
}
+
+ private void construct(LoadContext context, String name)
+ {
+ Ability ab = context.ref.constructCDOMObject(Ability.class, name);
+ context.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ }
+
+ @Test
+ public void testRoundRobinOneParen() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP1");
+ runRoundRobin("Feat|VIRTUAL|TestWP1 (Paren)");
+ }
+
+ @Test
+ public void testRoundRobinTwoParen() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin("Feat|VIRTUAL|TestWP1 (Paren)|TestWP2 (Other)");
+ }
+
+ @Test
+ public void testRoundRobinDupeParen() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP1");
+ runRoundRobin("Feat|VIRTUAL|TestWP1 (Other)|TestWP1 (That)");
+ }
+
+ @Test
+ public void testInputInvalidAddsTypeNoSideEffect()
+ throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP2");
+ construct(primaryContext, "TestWP3");
+ construct(secondaryContext, "TestWP3");
+ assertTrue(parse("Feat|VIRTUAL|TestWP1|TestWP2"));
+ assertTrue(parseSecondary("Feat|VIRTUAL|TestWP1|TestWP2"));
+ assertFalse(parse("Feat|VIRTUAL|TestWP3|TYPE="));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInputInvalidTypeClearDotNoSideEffect()
+ throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP2");
+ construct(primaryContext, "TestWP3");
+ construct(secondaryContext, "TestWP3");
+ assertTrue(parse("Feat|VIRTUAL|TestWP1|TestWP2"));
+ assertTrue(parseSecondary("Feat|VIRTUAL|TestWP1|TestWP2"));
+ assertFalse(parse("Feat|VIRTUAL|TestWP3|.CLEAR.TestWP1|.CLEAR.TYPE="));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRoundRobinTestEquals() throws PersistenceLayerException
+ {
+ runRoundRobin("Feat|VIRTUAL|TYPE=TestType");
+ }
+
+ @Test
+ public void testRoundRobinTestEqualThree() throws PersistenceLayerException
+ {
+ runRoundRobin("Feat|VIRTUAL|TYPE=TestAltType.TestThirdType.TestType");
+ }
+
+ @Test
+ public void testRoundRobinWithEqualType() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin("Feat|VIRTUAL|TestWP1|TestWP2|TYPE=OtherTestType|TYPE=TestType");
+ }
+
+ @Test
+ public void testInvalidInputCheckTypeEqualLength()
+ throws PersistenceLayerException
+ {
+ // Explicitly do NOT build TestWP2 (this checks that the TYPE= doesn't
+ // consume the |
+ construct(primaryContext, "TestWP1");
+ assertTrue(parse("Feat|VIRTUAL|TestWP1|TYPE=TestType|TestWP2"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testInvalidInputCheckTypeDotLength()
+ throws PersistenceLayerException
+ {
+ // Explicitly do NOT build TestWP2 (this checks that the TYPE= doesn't
+ // consume the |
+ construct(primaryContext, "TestWP1");
+ assertTrue(parse("Feat|VIRTUAL|TestWP1|TYPE.TestType.OtherTestType|TestWP2"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testInvalidInputTypeEmpty() throws PersistenceLayerException
+ {
+ assertFalse(parse("Feat|VIRTUAL|TYPE="));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidInputTypeUnterminated()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("Feat|VIRTUAL|TYPE=One."));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidInputTypeDoubleSeparator()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("Feat|VIRTUAL|TYPE=One..Two"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidInputTypeFalseStart()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("Feat|VIRTUAL|TYPE=.One"));
+ assertNoSideEffects();
+ }
}
\ No newline at end of file
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/CCSkillLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/CCSkillLstTest.java 2008-12-31 20:06:16 UTC (rev 8762)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/CCSkillLstTest.java 2008-12-31 20:06:44 UTC (rev 8763)
@@ -96,6 +96,12 @@
}
@Test
+ public void testRoundRobinPattern() throws PersistenceLayerException
+ {
+ runRoundRobin("Pattern%");
+ }
+
+ @Test
public void testRoundRobinListPlus() throws PersistenceLayerException
{
construct(primaryContext, "Foo");
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/CSkillLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/CSkillLstTest.java 2008-12-31 20:06:16 UTC (rev 8762)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/CSkillLstTest.java 2008-12-31 20:06:44 UTC (rev 8763)
@@ -102,4 +102,11 @@
construct(secondaryContext, "Foo");
runRoundRobin("Foo", "LIST");
}
+
+ @Test
+ public void testRoundRobinPattern() throws PersistenceLayerException
+ {
+ runRoundRobin("Pattern%");
+ }
+
}
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/CompanionListLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/CompanionListLstTest.java 2008-12-31 20:06:16 UTC (rev 8762)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/CompanionListLstTest.java 2008-12-31 20:06:44 UTC (rev 8763)
@@ -113,6 +113,13 @@
}
@Test
+ public void testInvalidTypeRaceTypeEmpty() throws PersistenceLayerException
+ {
+ assertFalse(parse("Familiar|RACETYPE="));
+ assertNoSideEffects();
+ }
+
+ @Test
public void testInvalidRaceCommaStarting() throws PersistenceLayerException
{
assertFalse(parse("Familiar|,Lion"));
@@ -275,6 +282,14 @@
}
@Test
+ public void testRoundRobinTwoWithRacetype() throws PersistenceLayerException
+ {
+ construct(Race.class, "Lion");
+ construct(Race.class, "Tiger");
+ runRoundRobin("Familiar|Lion,RACETYPE=Clawed");
+ }
+
+ @Test
public void testRoundRobinFA() throws PersistenceLayerException
{
construct(Race.class, "Lion");
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/DefineLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/DefineLstTest.java 2008-12-31 20:06:16 UTC (rev 8762)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/DefineLstTest.java 2008-12-31 20:06:44 UTC (rev 8763)
@@ -73,6 +73,13 @@
}
@Test
+ public void testInvalidInputUnlockArg() throws PersistenceLayerException
+ {
+ assertFalse(parse("UNLOCK.STR|3"));
+ assertNoSideEffects();
+ }
+
+ @Test
public void testInvalidInputNoResult() throws PersistenceLayerException
{
assertFalse(parse("Medium"));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 20:06:21
|
Revision: 8762
http://pcgen.svn.sourceforge.net/pcgen/?rev=8762&view=rev
Author: thpr
Date: 2008-12-31 20:06:16 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
additional token fixes
Modified Paths:
--------------
Trunk/pcgen/code/src/java/plugin/lsttokens/AbilityLst.java
Trunk/pcgen/code/src/java/plugin/lsttokens/CompanionListLst.java
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/AbilityLst.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/AbilityLst.java 2008-12-31 19:43:52 UTC (rev 8761)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/AbilityLst.java 2008-12-31 20:06:16 UTC (rev 8762)
@@ -200,6 +200,10 @@
CDOMReference<Ability> ref =
TokenUtilities.getTypeOrPrimitive(context,
ABILITY_CLASS, category, clearText);
+ if (ref == null)
+ {
+ return false;
+ }
context.getListContext().removeFromList(getTokenName(), obj,
abilList, ref);
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/CompanionListLst.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/CompanionListLst.java 2008-12-31 19:43:52 UTC (rev 8761)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/CompanionListLst.java 2008-12-31 20:06:16 UTC (rev 8762)
@@ -161,10 +161,17 @@
}
else if (tokString.startsWith("RACETYPE="))
{
+ String raceType = tokString.substring(9);
+ if (raceType.length() == 0)
+ {
+ Logging.log(Logging.LST_ERROR, getTokenName()
+ + " Error: RaceType was not specified.");
+ return false;
+ }
races.add(new ObjectMatchingReference<Race, RaceType>(tokString,
Race.class,
context.ref.getCDOMAllReference(Race.class),
- ObjectKey.RACETYPE, RaceType.getConstant(value)));
+ ObjectKey.RACETYPE, RaceType.getConstant(raceType)));
}
else
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 19:43:56
|
Revision: 8761
http://pcgen.svn.sourceforge.net/pcgen/?rev=8761&view=rev
Author: thpr
Date: 2008-12-31 19:43:52 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
additional token tests
Modified Paths:
--------------
Trunk/pcgen/code/src/utest/plugin/lsttokens/KitLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/MoveLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/QualifyTokenTest.java
Added Paths:
-----------
Trunk/pcgen/code/src/utest/plugin/lsttokens/ChangeProfLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/PreTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/ServesAsTokenTest.java
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/ChangeProfLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/ChangeProfLstTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/ChangeProfLstTest.java 2008-12-31 19:43:52 UTC (rev 8761)
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2007 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;
+
+import org.junit.Test;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.core.PCTemplate;
+import pcgen.core.WeaponProf;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractGlobalTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+
+public class ChangeProfLstTest extends AbstractGlobalTokenTestCase
+{
+
+ static CDOMPrimaryToken<CDOMObject> token = new ChangeprofLst();
+ static CDOMTokenLoader<PCTemplate> loader = new CDOMTokenLoader<PCTemplate>(
+ PCTemplate.class);
+
+ @Override
+ public CDOMLoader<PCTemplate> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidEmpty() throws PersistenceLayerException
+ {
+ assertFalse(parse(""));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidSourceOnly() throws PersistenceLayerException
+ {
+ assertFalse(parse("Hammer"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidSourceEqualOnly() throws PersistenceLayerException
+ {
+ assertFalse(parse("Hammer="));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidSourceEqualOnlyTypeTwo()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("Hammer=Martial|Pipe="));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptySource() throws PersistenceLayerException
+ {
+ assertFalse(parse("=Martial"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidTwoEquals() throws PersistenceLayerException
+ {
+ assertFalse(parse("Hammer==Martial"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidTwoEqualsTypeTwo() throws PersistenceLayerException
+ {
+ assertFalse(parse("Hammer=TYPE.Heavy=Martial"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidBarEnding() throws PersistenceLayerException
+ {
+ assertFalse(parse("Hammer=Martial|"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidBarStarting() throws PersistenceLayerException
+ {
+ assertFalse(parse("|Hammer=Martial"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidDoublePipe() throws PersistenceLayerException
+ {
+ assertFalse(parse("Hammer=Martial||Pipe=Exotic"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidReversed() throws PersistenceLayerException
+ {
+ assertTrue(parse("Martial=Hammer"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testInvalidResultPrimitive() throws PersistenceLayerException
+ {
+ assertTrue(parse("Hammer=Pipe"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testInvalidResultType() throws PersistenceLayerException
+ {
+ try
+ {
+ assertFalse(parse("Hammer=TYPE.Heavy"));
+ }
+ catch (IllegalArgumentException e)
+ {
+ // This is okay too
+ }
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(WeaponProf.class, "Hammer");
+ secondaryContext.ref.constructCDOMObject(WeaponProf.class, "Hammer");
+ runRoundRobin("Hammer=Martial");
+ }
+
+ @Test
+ public void testRoundRobinTwo() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(WeaponProf.class, "Hammer");
+ secondaryContext.ref.constructCDOMObject(WeaponProf.class, "Hammer");
+ primaryContext.ref.constructCDOMObject(WeaponProf.class, "Pipe");
+ secondaryContext.ref.constructCDOMObject(WeaponProf.class, "Pipe");
+ runRoundRobin("Hammer,Pipe=Martial");
+ }
+
+ @Test
+ public void testRoundRobinType() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(WeaponProf.class, "Hammer");
+ secondaryContext.ref.constructCDOMObject(WeaponProf.class, "Hammer");
+ runRoundRobin("Hammer,TYPE.Heavy=Martial");
+ }
+
+ @Test
+ public void testRoundRobinTwoResult() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(WeaponProf.class, "Hammer");
+ secondaryContext.ref.constructCDOMObject(WeaponProf.class, "Hammer");
+ primaryContext.ref.constructCDOMObject(WeaponProf.class, "Pipe");
+ secondaryContext.ref.constructCDOMObject(WeaponProf.class, "Pipe");
+ runRoundRobin("Hammer=Martial|Pipe=Exotic");
+ }
+
+ @Test
+ public void testRoundRobinComplex() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(WeaponProf.class, "Hammer");
+ secondaryContext.ref.constructCDOMObject(WeaponProf.class, "Hammer");
+ primaryContext.ref.constructCDOMObject(WeaponProf.class, "Nail");
+ secondaryContext.ref.constructCDOMObject(WeaponProf.class, "Nail");
+ runRoundRobin("Hammer,TYPE.Heavy,TYPE.Medium=Martial|Nail,TYPE.Crazy,TYPE.Disposable=Exotic");
+ }
+}
\ No newline at end of file
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/KitLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/KitLstTest.java 2008-12-31 19:43:22 UTC (rev 8760)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/KitLstTest.java 2008-12-31 19:43:52 UTC (rev 8761)
@@ -70,6 +70,13 @@
}
@Test
+ public void testInvalidInputOnlyNumber() throws PersistenceLayerException
+ {
+ assertFalse(parse("2"));
+ assertNoSideEffects();
+ }
+
+ @Test
public void testInvalidInputMissingItem() throws PersistenceLayerException
{
assertFalse(parse("2|"));
@@ -213,4 +220,41 @@
loadContext.ref.constructCDOMObject(Kit.class, one);
}
+ @Test
+ public void testInputInvalidAddsAllNoSideEffect()
+ throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP2");
+ construct(primaryContext, "TestWP3");
+ construct(secondaryContext, "TestWP3");
+ assertTrue(parse("1|TestWP1" + getJoinCharacter() + "TestWP2"));
+ assertTrue(parseSecondary("1|TestWP1" + getJoinCharacter() + "TestWP2"));
+ assertFalse(parse("1|TestWP3" + getJoinCharacter() + "ALL"));
+ assertNoSideEffects();
+ }
+
+ private char getJoinCharacter()
+ {
+ return '|';
+ }
+
+ @Test
+ public void testInvalidInputAllItem() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse("1|ALL" + getJoinCharacter() + "TestWP1"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidInputItemAll() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse("1|TestWP1" + getJoinCharacter() + "ALL"));
+ assertNoSideEffects();
+ }
+
}
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/MoveLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/MoveLstTest.java 2008-12-31 19:43:22 UTC (rev 8760)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/MoveLstTest.java 2008-12-31 19:43:52 UTC (rev 8761)
@@ -20,6 +20,7 @@
import org.junit.Test;
import pcgen.cdom.base.CDOMObject;
+import pcgen.core.Equipment;
import pcgen.core.PCTemplate;
import pcgen.persistence.PersistenceLayerException;
import pcgen.rules.persistence.CDOMLoader;
@@ -52,6 +53,13 @@
}
@Test
+ public void testInvalidObject() throws PersistenceLayerException
+ {
+ assertFalse(token.parse(primaryContext, new Equipment(),
+ "Fly,40"));
+ }
+
+ @Test
public void testInvalidInputEmpty() throws PersistenceLayerException
{
assertFalse(parse(""));
@@ -110,6 +118,17 @@
}
@Test
+ public void testValidInputNumber()
+ throws PersistenceLayerException
+ {
+ assertTrue(parse("30"));
+ String[] unparsed = getToken().unparse(primaryContext, primaryProf);
+ assertNotNull(unparsed);
+ assertEquals(1, unparsed.length);
+ assertEquals("Expected item to be equal", "Walk,30", unparsed[0]);
+ }
+
+ @Test
public void testRoundRobinSimple() throws PersistenceLayerException
{
runRoundRobin("Walk,30");
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/PreTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/PreTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/PreTokenTest.java 2008-12-31 19:43:52 UTC (rev 8761)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2007 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;
+
+import java.net.URISyntaxException;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.core.PCTemplate;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractGlobalTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+
+public class PreTokenTest extends AbstractGlobalTokenTestCase
+{
+
+ static CDOMPrimaryToken<CDOMObject> token = new PreLst();
+ static CDOMTokenLoader<PCTemplate> loader = new CDOMTokenLoader<PCTemplate>(
+ PCTemplate.class);
+
+ @Override
+ @Before
+ public void setUp() throws PersistenceLayerException, URISyntaxException
+ {
+ super.setUp();
+ }
+
+ @Override
+ public CDOMLoader<PCTemplate> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidEmpty() throws PersistenceLayerException
+ {
+ assertFalse(parse(""));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidOther() throws PersistenceLayerException
+ {
+ assertFalse(parse("SPELL"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testValidTypeBarOnly() throws PersistenceLayerException
+ {
+ assertTrue(parse(".CLEAR"));
+ }
+}
\ No newline at end of file
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/QualifyTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/QualifyTokenTest.java 2008-12-31 19:43:22 UTC (rev 8760)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/QualifyTokenTest.java 2008-12-31 19:43:52 UTC (rev 8761)
@@ -25,6 +25,7 @@
import pcgen.cdom.base.CDOMObject;
import pcgen.core.Ability;
import pcgen.core.AbilityCategory;
+import pcgen.core.EquipmentModifier;
import pcgen.core.PCTemplate;
import pcgen.core.spell.Spell;
import pcgen.persistence.PersistenceLayerException;
@@ -66,6 +67,13 @@
}
@Test
+ public void testInvalidObject() throws PersistenceLayerException
+ {
+ assertFalse(token.parse(primaryContext, new EquipmentModifier(),
+ "SPELL|Fireball"));
+ }
+
+ @Test
public void testInvalidEmpty() throws PersistenceLayerException
{
assertFalse(parse(""));
@@ -94,6 +102,13 @@
}
@Test
+ public void testInvalidBadType() throws PersistenceLayerException
+ {
+ assertFalse(parse("CAMPAIGN|Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
public void testInvalidCatTypeNoEqual() throws PersistenceLayerException
{
assertFalse(parse("ABILITY|Abil"));
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/ServesAsTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/ServesAsTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/ServesAsTokenTest.java 2008-12-31 19:43:52 UTC (rev 8761)
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2007 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;
+
+import java.net.URISyntaxException;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.core.Ability;
+import pcgen.core.AbilityCategory;
+import pcgen.core.EquipmentModifier;
+import pcgen.core.PCClass;
+import pcgen.core.Skill;
+import pcgen.core.SubClass;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractGlobalTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+
+public class ServesAsTokenTest extends AbstractGlobalTokenTestCase
+{
+
+ static CDOMPrimaryToken<CDOMObject> token = new ServesAsToken();
+ static CDOMTokenLoader<Skill> loader = new CDOMTokenLoader<Skill>(
+ Skill.class);
+
+ @Override
+ @Before
+ public void setUp() throws PersistenceLayerException, URISyntaxException
+ {
+ super.setUp();
+ }
+
+ @Override
+ public CDOMLoader<Skill> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public Class<Skill> getCDOMClass()
+ {
+ return Skill.class;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidObject() throws PersistenceLayerException
+ {
+ assertFalse(token.parse(primaryContext, new EquipmentModifier(),
+ "Fireball"));
+ }
+
+ @Test
+ public void testInvalidEmpty() throws PersistenceLayerException
+ {
+ assertFalse(parse(""));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidTypeOnly() throws PersistenceLayerException
+ {
+ assertFalse(parse("SKILL"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidTypeBarOnly() throws PersistenceLayerException
+ {
+ assertFalse(parse("SKILL|"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyType() throws PersistenceLayerException
+ {
+ assertFalse(parse("|Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidBadType() throws PersistenceLayerException
+ {
+ assertFalse(parse("CAMPAIGN|Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidCatTypeNoEqual() throws PersistenceLayerException
+ {
+ assertFalse(parse("ABILITY|Abil"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidNonCatTypeEquals() throws PersistenceLayerException
+ {
+ assertFalse(parse("SKILL=Arcane|Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidDoubleEquals() throws PersistenceLayerException
+ {
+ assertFalse(parse("ABILITY=FEAT=Mutation|Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidUnbuiltCategory() throws PersistenceLayerException
+ {
+ try
+ {
+ assertFalse(parse("ABILITY=Crazy|Fireball"));
+ }
+ catch (IllegalArgumentException e)
+ {
+ //OK as well
+ }
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidSpellbookAndSpellBarOnly()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("SKILL|Fireball|"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidSpellBarStarting() throws PersistenceLayerException
+ {
+ assertFalse(parse("SKILL||Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidWrongType() throws PersistenceLayerException
+ {
+ assertFalse(parse("SPELL|Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRoundRobinJustSkill() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Skill.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Skill.class, "Fireball");
+ runRoundRobin("SKILL|Fireball");
+ }
+
+ @Test
+ public void testRoundRobinJustAbility() throws PersistenceLayerException
+ {
+ primaryProf = new Ability();
+ secondaryProf = new Ability();
+ Ability a = primaryContext.ref.constructCDOMObject(
+ Ability.class, "My Feat");
+ primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, a);
+ a = secondaryContext.ref.constructCDOMObject(Ability.class,
+ "My Feat");
+ secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, a);
+ runRoundRobin("ABILITY=Feat|My Feat");
+ }
+
+ // @Test
+ // public void testRoundRobinJustSubClass() throws PersistenceLayerException
+ // {
+ // primaryProf = new SubClass();
+ // secondaryProf = new SubClass();
+ // primaryContext.ref.constructCDOMObject(PCClass.class, "Fireball");
+ // secondaryContext.ref.constructCDOMObject(PCClass.class, "Fireball");
+ // runRoundRobin("CLASS|Fireball");
+ // }
+
+ @Test
+ public void testRoundRobinTwoSpell() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Skill.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Skill.class, "Fireball");
+ primaryContext.ref.constructCDOMObject(Skill.class,
+ "Lightning Bolt");
+ secondaryContext.ref.constructCDOMObject(Skill.class,
+ "Lightning Bolt");
+ runRoundRobin("SKILL|Fireball|Lightning Bolt");
+ }
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 19:43:24
|
Revision: 8760
http://pcgen.svn.sourceforge.net/pcgen/?rev=8760&view=rev
Author: thpr
Date: 2008-12-31 19:43:22 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
additional fixes
Modified Paths:
--------------
Trunk/pcgen/code/src/java/plugin/lsttokens/QualifyToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/ServesAsToken.java
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/QualifyToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/QualifyToken.java 2008-12-31 19:40:49 UTC (rev 8759)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/QualifyToken.java 2008-12-31 19:43:22 UTC (rev 8760)
@@ -77,7 +77,8 @@
{
if (!getLegalTypes().contains(obj.getClass()))
{
- Logging.log(Logging.LST_ERROR, "Cannot use QUALIFY on a " + obj.getClass());
+ Logging.log(Logging.LST_ERROR, "Cannot use QUALIFY on a "
+ + obj.getClass());
return false;
}
if (isEmpty(value) || hasIllegalSeparator('|', value))
@@ -118,6 +119,12 @@
categoryName = firstToken.substring(equalLoc + 1);
}
Class<? extends CDOMObject> c = StringPClassUtil.getClassFor(className);
+ if (c == null)
+ {
+ Logging.log(Logging.LST_ERROR, getTokenName()
+ + " does not understand object type: " + className);
+ return false;
+ }
ReferenceManufacturer<? extends CDOMObject, ?> rm;
if (CategorizedCDOMObject.class.isAssignableFrom(c))
{
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/ServesAsToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/ServesAsToken.java 2008-12-31 19:40:49 UTC (rev 8759)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/ServesAsToken.java 2008-12-31 19:43:22 UTC (rev 8760)
@@ -108,6 +108,13 @@
+ " expecting a POBJECT Type, found: " + key);
return false;
}
+ if (!servingClass.equals(obj.getClass()))
+ {
+ Logging.log(Logging.LST_ERROR, getTokenName()
+ + " expecting a POBJECT Type valid for "
+ + obj.getClass().getSimpleName() + ", found: " + key);
+ return false;
+ }
mfg = context.ref.getManufacturer(servingClass);
}
else
@@ -122,6 +129,13 @@
key = key.substring(0, equalLoc);
AbilityCategory cat = SettingsHandler.getGame().getAbilityCategory(
category);
+ if (cat == null)
+ {
+ Logging.log(Logging.LST_ERROR,
+ "Could not find AbilityCategory " + category + " in "
+ + getTokenName());
+ return false;
+ }
mfg = context.ref.getManufacturer(Ability.class, cat);
}
if (!st.hasMoreTokens())
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 19:40:55
|
Revision: 8759
http://pcgen.svn.sourceforge.net/pcgen/?rev=8759&view=rev
Author: thpr
Date: 2008-12-31 19:40:49 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
missing items for test from previous SVN
Modified Paths:
--------------
Trunk/pcgen/code/src/test/pcgen/core/PCClassTest.java
Trunk/pcgen/code/src/test/pcgen/core/PlayerCharacterTest.java
Trunk/pcgen/code/src/test/pcgen/core/bonus/BonusTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/ArmorProfChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/FeatAddChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/FeatListChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/HPChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/MiscChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/ProficiencyChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/SAListChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillListNonClassChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillsChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillsNamedChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillsNamedToCCSkillChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillsNamedToCSkillChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/SpellClassesChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/SpellLevelChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/SpellListChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/SpellsChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/StatChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/WeaponFocusChoiceManagerTest.java
Trunk/pcgen/code/src/test/pcgen/core/chooser/WeaponProfChoiceManagerTest.java
Modified: Trunk/pcgen/code/src/test/pcgen/core/PCClassTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/PCClassTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/PCClassTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -38,7 +38,6 @@
import junit.framework.TestSuite;
import pcgen.AbstractCharacterTestCase;
import pcgen.PCGenTestCase;
-import pcgen.base.formula.Formula;
import pcgen.base.lang.UnreachableError;
import pcgen.cdom.base.AssociatedPrereqObject;
import pcgen.cdom.base.CDOMReference;
@@ -266,7 +265,7 @@
final PCClass aNqClass = new PCClass();
aNqClass.setName("NonQualClass");
aNqClass.put(StringKey.KEY_NAME, "KEY_NonQualClass");
- aNqClass.put(VariableKey.getConstant("Foo"), Formula.ONE);
+ aNqClass.put(VariableKey.getConstant("Foo"), FormulaFactory.ONE);
aNqClass.getClassLevel(2).put(VariableKey.getConstant("Foo"),
FormulaFactory.getFormulaFor(2));
@@ -344,7 +343,7 @@
final PCClass aNqClass = new PCClass();
aNqClass.setName("NonQualClass");
aNqClass.put(StringKey.KEY_NAME, "KEY_NonQualClass");
- aNqClass.put(VariableKey.getConstant("Foo"), Formula.ONE);
+ aNqClass.put(VariableKey.getConstant("Foo"), FormulaFactory.ONE);
aNqClass.getClassLevel(2).put(VariableKey.getConstant("Foo"),
FormulaFactory.getFormulaFor(2));
@@ -914,7 +913,7 @@
nqClass = new PCClass();
nqClass.setName("NonQualClass");
nqClass.put(StringKey.KEY_NAME, "KEY_NonQualClass");
- nqClass.put(VariableKey.getConstant("Foo"), Formula.ONE);
+ nqClass.put(VariableKey.getConstant("Foo"), FormulaFactory.ONE);
nqClass.getClassLevel(2).put(VariableKey.getConstant("Foo"),
FormulaFactory.getFormulaFor(2));
}
Modified: Trunk/pcgen/code/src/test/pcgen/core/PlayerCharacterTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/PlayerCharacterTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/PlayerCharacterTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -38,7 +38,6 @@
import junit.framework.TestSuite;
import junit.textui.TestRunner;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
import pcgen.cdom.base.CDOMReference;
import pcgen.cdom.base.Constants;
import pcgen.cdom.base.FormulaFactory;
@@ -348,12 +347,12 @@
{
//Logging.setDebugMode(true);
Logging.debugPrint("\n\n\ntestGetVariableValue1()");
- giantRace.put(VariableKey.getConstant("GiantVar1"), Formula.ZERO);
+ giantRace.put(VariableKey.getConstant("GiantVar1"), FormulaFactory.ZERO);
final BonusObj raceBonus = Bonus.newBonus("1|VAR|GiantVar1|7+HD");
giantClass.addToListFor(ListKey.BONUS, raceBonus);
giantClass.getClassLevel(1).put(VariableKey.getConstant("GiantClass1"),
- Formula.ZERO);
+ FormulaFactory.ZERO);
final BonusObj babClassBonus =
Bonus.newBonus("1|VAR|GiantClass1|CL=Giant");
giantClass.addToListFor(ListKey.BONUS, babClassBonus);
Modified: Trunk/pcgen/code/src/test/pcgen/core/bonus/BonusTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/bonus/BonusTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/bonus/BonusTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -27,7 +27,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.ListKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.cdom.enumeration.Type;
@@ -127,7 +127,7 @@
Globals.setCurrentPC(pc);
// Create a variable
- dummyFeat.put(VariableKey.getConstant("NegLevels"), Formula.ZERO);
+ dummyFeat.put(VariableKey.getConstant("NegLevels"), FormulaFactory.ZERO);
// Create a bonus to it
Ability dummyFeat2 = new Ability();
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/ArmorProfChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/ArmorProfChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/ArmorProfChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -30,7 +30,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.Equipment;
@@ -64,7 +64,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "ARMORPROF|TYPE=Light");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING), strEq("ARMORPROF|TYPE=Light"));
PlayerCharacter aPC = getCharacter();
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/FeatAddChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/FeatAddChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/FeatAddChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -61,7 +61,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "FEATADD|choice");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING), strEq("FEATADD|choice"));
PlayerCharacter aPC = getCharacter();
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/FeatListChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/FeatListChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/FeatListChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -61,7 +61,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "FEATLIST|Wellie Throwing|Sheep Shearing|Synchronised Mincing");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(
pObj.getSafe(StringKey.CHOICE_STRING),
strEq("FEATLIST|Wellie Throwing|Sheep Shearing|Synchronised Mincing"));
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/HPChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/HPChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/HPChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -61,7 +61,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "HP|Foo|Bar|Baz");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING), strEq("HP|Foo|Bar|Baz"));
PlayerCharacter aPC = getCharacter();
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/MiscChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/MiscChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/MiscChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -31,7 +31,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -63,7 +63,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "Foo|Bar|Baz");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING), strEq("Foo|Bar|Baz"));
PlayerCharacter aPC = getCharacter();
@@ -104,7 +104,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "Foo|Bar|Baz");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING), strEq("Foo|Bar|Baz"));
PlayerCharacter aPC = getCharacter();
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/ProficiencyChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/ProficiencyChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/ProficiencyChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -61,7 +61,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "PROFICIENCY|WEAPON|UNIQUE|TYPE=Martial");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING),
strEq("PROFICIENCY|WEAPON|UNIQUE|TYPE=Martial"));
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/SAListChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/SAListChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/SAListChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -61,7 +61,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "SALIST|Foo|Bar|Baz");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING), strEq("SALIST|Foo|Bar|Baz"));
PlayerCharacter aPC = getCharacter();
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillListNonClassChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillListNonClassChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillListNonClassChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -62,7 +62,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "NONCLASSSKILLLIST|Foo,Bar,Baz,Qux");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING),
strEq("NONCLASSSKILLLIST|Foo,Bar,Baz,Qux"));
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillsChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillsChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillsChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -61,7 +61,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "SKILLS|Foo|Bar|Baz");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING), strEq("SKILLS|Foo|Bar|Baz"));
PlayerCharacter aPC = getCharacter();
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillsNamedChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillsNamedChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillsNamedChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -61,7 +61,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "SKILLSNAMED|Foo|Bar|Baz");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING),
strEq("SKILLSNAMED|Foo|Bar|Baz"));
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillsNamedToCCSkillChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillsNamedToCCSkillChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillsNamedToCCSkillChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -62,7 +62,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "SKILLSNAMEDTOCCSKILL|Foo|Bar|Baz");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING),
strEq("SKILLSNAMEDTOCCSKILL|Foo|Bar|Baz"));
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillsNamedToCSkillChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillsNamedToCSkillChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/SkillsNamedToCSkillChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -62,7 +62,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "SKILLSNAMEDTOCSKILL|Foo|Bar|Baz");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING),
strEq("SKILLSNAMEDTOCSKILL|Foo|Bar|Baz"));
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/SpellClassesChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/SpellClassesChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/SpellClassesChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -61,7 +61,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "SPELLCLASSES|Foo|Bar|Baz");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING),
strEq("SPELLCLASSES|Foo|Bar|Baz"));
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/SpellLevelChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/SpellLevelChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/SpellLevelChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -62,7 +62,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "SPELLLEVEL|Foo|Bar|Baz");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING), strEq("SPELLLEVEL|Foo|Bar|Baz"));
PlayerCharacter aPC = getCharacter();
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/SpellListChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/SpellListChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/SpellListChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -61,7 +61,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "SPELLLIST|Foo|Bar|Baz");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING), strEq("SPELLLIST|Foo|Bar|Baz"));
PlayerCharacter aPC = getCharacter();
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/SpellsChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/SpellsChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/SpellsChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -61,7 +61,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "SPELLS|Foo|Bar|Baz");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING), strEq("SPELLS|Foo|Bar|Baz"));
PlayerCharacter aPC = getCharacter();
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/StatChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/StatChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/StatChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -61,7 +61,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "STAT|Foo|Bar|Baz");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING), strEq("STAT|Foo|Bar|Baz"));
PlayerCharacter aPC = getCharacter();
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/WeaponFocusChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/WeaponFocusChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/WeaponFocusChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -61,7 +61,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "WEAPONFOCUS|Foo");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING),
strEq("WEAPONFOCUS|Foo"));
Modified: Trunk/pcgen/code/src/test/pcgen/core/chooser/WeaponProfChoiceManagerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/chooser/WeaponProfChoiceManagerTest.java 2008-12-31 18:51:51 UTC (rev 8758)
+++ Trunk/pcgen/code/src/test/pcgen/core/chooser/WeaponProfChoiceManagerTest.java 2008-12-31 19:40:49 UTC (rev 8759)
@@ -29,7 +29,7 @@
import java.util.List;
import pcgen.AbstractCharacterTestCase;
-import pcgen.base.formula.Formula;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.cdom.enumeration.StringKey;
import pcgen.core.PObject;
@@ -61,7 +61,7 @@
PObject pObj = new PObject();
pObj.setName("My PObject");
pObj.put(StringKey.CHOICE_STRING, "WEAPONPROFS|Foo|Bar|Baz");
- pObj.put(FormulaKey.NUMCHOICES, Formula.ONE);
+ pObj.put(FormulaKey.NUMCHOICES, FormulaFactory.ONE);
is(pObj.getSafe(StringKey.CHOICE_STRING),
strEq("WEAPONPROFS|Foo|Bar|Baz"));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 18:51:55
|
Revision: 8758
http://pcgen.svn.sourceforge.net/pcgen/?rev=8758&view=rev
Author: thpr
Date: 2008-12-31 18:51:51 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
cleanup
Modified Paths:
--------------
Trunk/pcgen/code/src/java/plugin/lsttokens/RegionLst.java
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/RegionLst.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/RegionLst.java 2008-12-31 18:49:31 UTC (rev 8757)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/RegionLst.java 2008-12-31 18:51:51 UTC (rev 8758)
@@ -76,7 +76,6 @@
}
item = tok.nextToken();
}
-System.err.println(regions);
SimpleChoiceSet<Region> rcs = new SimpleChoiceSet<Region>(regions);
ChoiceSet<Region> cs = new ChoiceSet<Region>(getTokenName(), rcs);
TransitionChoice<Region> tc = new TransitionChoice<Region>(cs, count);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 18:49:35
|
Revision: 8757
http://pcgen.svn.sourceforge.net/pcgen/?rev=8757&view=rev
Author: thpr
Date: 2008-12-31 18:49:31 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
additional token tests
Modified Paths:
--------------
Trunk/pcgen/code/src/utest/plugin/lsttokens/TypeLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/VFeatLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalFormulaTokenTestCase.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalListTokenTestCase.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalStringTokenTestCase.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalTypeSafeListTestCase.java
Added Paths:
-----------
Trunk/pcgen/code/src/utest/plugin/lsttokens/RegionLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/SabLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/SelectTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/SourcelongLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/SourcepageLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/SourceshortLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/SourcewebLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/SpellsLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/SrLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/UdamLstTest.java
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/RegionLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/RegionLstTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/RegionLstTest.java 2008-12-31 18:49:31 UTC (rev 8757)
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2007 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;
+
+import org.junit.Test;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.cdom.list.ClassSkillList;
+import pcgen.core.Domain;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.context.LoadContext;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractGlobalTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+
+public class RegionLstTest extends AbstractGlobalTokenTestCase
+{
+ static RegionLst token = new RegionLst();
+ static CDOMTokenLoader<Domain> loader = new CDOMTokenLoader<Domain>(
+ Domain.class);
+
+ @Override
+ public Class<Domain> getCDOMClass()
+ {
+ return Domain.class;
+ }
+
+ @Override
+ public CDOMLoader<Domain> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputOnlyNumber() throws PersistenceLayerException
+ {
+ assertFalse(parse("1"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidInputNaN() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse("NaN|TestWP1"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidNoObject() throws PersistenceLayerException
+ {
+ assertFalse(parse("1|"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidNoCount() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse("|TestWP1"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidDoublePipe() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse("1||TestWP1"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidInputNoCount() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ assertFalse(parse("|TestWP1|TestWP2"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidListEnd() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse("1|TestWP1|"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidZeroCount() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse("0|TestWP1"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidNegativeCount() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ assertFalse(parse("-1|TestWP1|TestWP2"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidListDoubleJoin() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ assertFalse(parse("1|TestWP2||TestWP1"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testValidInputs() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ assertTrue(parse("1|TestWP1"));
+ assertTrue(primaryContext.ref.validate());
+ assertTrue(parse("1|TestWP1|TestWP2"));
+ assertTrue(primaryContext.ref.validate());
+ assertTrue(primaryContext.ref.validate());
+ assertTrue(parse("2|TestWP1|TestWP2"));
+ assertTrue(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinOne() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin("TestWP1");
+ }
+
+ @Test
+ public void testRoundRobinTwo() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin("TestWP1|TestWP2");
+ }
+
+ @Test
+ public void testRoundRobinThree() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(primaryContext, "TestWP3");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP3");
+ runRoundRobin("2|TestWP1|TestWP2|TestWP3");
+ }
+
+ protected void construct(LoadContext loadContext, String one)
+ {
+ loadContext.ref.constructCDOMObject(ClassSkillList.class, one);
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/SabLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/SabLstTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/SabLstTest.java 2008-12-31 18:49:31 UTC (rev 8757)
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2007 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;
+
+import java.net.URISyntaxException;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.core.PCTemplate;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractGlobalTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+import plugin.lsttokens.testsupport.TokenRegistration;
+import plugin.pretokens.parser.PreClassParser;
+import plugin.pretokens.parser.PreRaceParser;
+import plugin.pretokens.writer.PreClassWriter;
+import plugin.pretokens.writer.PreRaceWriter;
+
+public class SabLstTest extends AbstractGlobalTokenTestCase
+{
+ static CDOMPrimaryToken<CDOMObject> token = new SabLst();
+ static CDOMTokenLoader<PCTemplate> loader = new CDOMTokenLoader<PCTemplate>(
+ PCTemplate.class);
+
+ @Override
+ public CDOMLoader<PCTemplate> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ PreClassParser preclass = new PreClassParser();
+ PreClassWriter preclasswriter = new PreClassWriter();
+ PreRaceParser prerace = new PreRaceParser();
+ PreRaceWriter preracewriter = new PreRaceWriter();
+
+ @Override
+ @Before
+ public void setUp() throws PersistenceLayerException, URISyntaxException
+ {
+ super.setUp();
+ TokenRegistration.register(preclass);
+ TokenRegistration.register(prerace);
+ TokenRegistration.register(preclasswriter);
+ TokenRegistration.register(preracewriter);
+ }
+
+ @Test
+ public void testInvalidDoublePipe() throws PersistenceLayerException
+ {
+ assertFalse(parse("SA Number %||VarF"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEndingPipe() throws PersistenceLayerException
+ {
+ assertFalse(parse("SA Number|"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidStartingPipe() throws PersistenceLayerException
+ {
+ assertFalse(parse("|Var"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidVarAfterPre() throws PersistenceLayerException
+ {
+ assertFalse(parse("SA % plus %|Var|PRECLASS:1,Fighter|Var2"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidDotClear() throws PersistenceLayerException
+ {
+ assertFalse(parse("SA % plus %|Var|.CLEAR|Var2"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidOnlyPre() throws PersistenceLayerException
+ {
+ assertFalse(parse("PRECLASS:1,Fighter"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRoundRobinBase() throws PersistenceLayerException
+ {
+ runRoundRobin("SA Number One");
+ }
+
+ @Test
+ public void testRoundRobinVariable() throws PersistenceLayerException
+ {
+ runRoundRobin("SA Number %|Variab");
+ }
+
+ @Test
+ public void testRoundRobinPre() throws PersistenceLayerException
+ {
+ runRoundRobin("SA Number One|PRECLASS:1,Fighter=1");
+ }
+
+ @Test
+ public void testRoundRobinDoublePre() throws PersistenceLayerException
+ {
+ runRoundRobin("SA Number One|PRECLASS:1,Fighter=1|PRERACE:1,Human");
+ }
+
+ @Test
+ public void testRoundRobinVarDoublePre() throws PersistenceLayerException
+ {
+ runRoundRobin("SA Number % before %|Var|TwoVar|PRECLASS:1,Fighter=1|PRERACE:1,Human");
+ }
+
+ @Test
+ public void testRoundRobinCompound() throws PersistenceLayerException
+ {
+ runRoundRobin(
+ "SA Number % before %|Var|TwoVar|PRECLASS:1,Fighter=1|PRERACE:1,Human",
+ "SA Number One|PRECLASS:1,Fighter=1");
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/SelectTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/SelectTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/SelectTokenTest.java 2008-12-31 18:49:31 UTC (rev 8757)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2007 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;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.cdom.enumeration.FormulaKey;
+import pcgen.core.PCTemplate;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractGlobalFormulaTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+
+public class SelectTokenTest extends AbstractGlobalFormulaTokenTestCase
+{
+
+ static SelectLst token = new SelectLst();
+ static CDOMTokenLoader<PCTemplate> loader = new CDOMTokenLoader<PCTemplate>(
+ PCTemplate.class);
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMLoader<PCTemplate> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Override
+ public FormulaKey getFormulaKey()
+ {
+ return FormulaKey.SELECT;
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/SourcelongLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/SourcelongLstTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/SourcelongLstTest.java 2008-12-31 18:49:31 UTC (rev 8757)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2007 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;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.cdom.enumeration.StringKey;
+import pcgen.core.PCTemplate;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractGlobalStringTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+
+public class SourcelongLstTest extends AbstractGlobalStringTokenTestCase
+{
+
+ static SourcelongLst token = new SourcelongLst();
+ static CDOMTokenLoader<PCTemplate> loader = new CDOMTokenLoader<PCTemplate>(
+ PCTemplate.class);
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMLoader<PCTemplate> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Override
+ public StringKey getStringKey()
+ {
+ return StringKey.SOURCE_LONG;
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/SourcepageLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/SourcepageLstTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/SourcepageLstTest.java 2008-12-31 18:49:31 UTC (rev 8757)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2007 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;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.cdom.enumeration.StringKey;
+import pcgen.core.PCTemplate;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractGlobalStringTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+
+public class SourcepageLstTest extends AbstractGlobalStringTokenTestCase
+{
+
+ static SourcepageLst token = new SourcepageLst();
+ static CDOMTokenLoader<PCTemplate> loader = new CDOMTokenLoader<PCTemplate>(
+ PCTemplate.class);
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMLoader<PCTemplate> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Override
+ public StringKey getStringKey()
+ {
+ return StringKey.SOURCE_PAGE;
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/SourceshortLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/SourceshortLstTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/SourceshortLstTest.java 2008-12-31 18:49:31 UTC (rev 8757)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2007 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;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.cdom.enumeration.StringKey;
+import pcgen.core.PCTemplate;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractGlobalStringTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+
+public class SourceshortLstTest extends AbstractGlobalStringTokenTestCase
+{
+
+ static SourceshortLst token = new SourceshortLst();
+ static CDOMTokenLoader<PCTemplate> loader = new CDOMTokenLoader<PCTemplate>(
+ PCTemplate.class);
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMLoader<PCTemplate> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Override
+ public StringKey getStringKey()
+ {
+ return StringKey.SOURCE_SHORT;
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/SourcewebLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/SourcewebLstTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/SourcewebLstTest.java 2008-12-31 18:49:31 UTC (rev 8757)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2007 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;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.cdom.enumeration.StringKey;
+import pcgen.core.PCTemplate;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractGlobalStringTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+
+public class SourcewebLstTest extends AbstractGlobalStringTokenTestCase
+{
+
+ static SourcewebLst token = new SourcewebLst();
+ static CDOMTokenLoader<PCTemplate> loader = new CDOMTokenLoader<PCTemplate>(
+ PCTemplate.class);
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMLoader<PCTemplate> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Override
+ public StringKey getStringKey()
+ {
+ return StringKey.SOURCE_WEB;
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/SpellsLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/SpellsLstTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/SpellsLstTest.java 2008-12-31 18:49:31 UTC (rev 8757)
@@ -0,0 +1,385 @@
+/*
+ * Copyright (c) 2007 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;
+
+import java.net.URISyntaxException;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.core.PCTemplate;
+import pcgen.core.SettingsHandler;
+import pcgen.core.TimeUnit;
+import pcgen.core.spell.Spell;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractGlobalTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+import plugin.lsttokens.testsupport.TokenRegistration;
+import plugin.pretokens.parser.PreClassParser;
+import plugin.pretokens.parser.PreRaceParser;
+import plugin.pretokens.writer.PreClassWriter;
+import plugin.pretokens.writer.PreRaceWriter;
+
+public class SpellsLstTest extends AbstractGlobalTokenTestCase
+{
+
+ static CDOMPrimaryToken<CDOMObject> token = new SpellsLst();
+ static CDOMTokenLoader<PCTemplate> loader = new CDOMTokenLoader<PCTemplate>(
+ PCTemplate.class);
+
+ PreClassParser preclass = new PreClassParser();
+ PreClassWriter preclasswriter = new PreClassWriter();
+ PreRaceParser prerace = new PreRaceParser();
+ PreRaceWriter preracewriter = new PreRaceWriter();
+
+ @Override
+ @Before
+ public void setUp() throws PersistenceLayerException, URISyntaxException
+ {
+ super.setUp();
+ TokenRegistration.register(preclass);
+ TokenRegistration.register(preclasswriter);
+ TokenRegistration.register(prerace);
+ TokenRegistration.register(preracewriter);
+ primaryContext.ref.constructCDOMObject(Spell.class, "Fireball");
+ primaryContext.ref.constructCDOMObject(Spell.class, "Lightning Bolt");
+ secondaryContext.ref.constructCDOMObject(Spell.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Spell.class, "Lightning Bolt");
+ SettingsHandler.getGame().addTimeUnit(new TimeUnit("Week"));
+ SettingsHandler.getGame().addTimeUnit(new TimeUnit("Hour"));
+ SettingsHandler.getGame().addTimeUnit(new TimeUnit("Day"));
+ }
+
+ @Override
+ public CDOMLoader<PCTemplate> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidEmpty() throws PersistenceLayerException
+ {
+ assertFalse(parse(""));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidSpellbookOnly() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidSpellbookBarOnly() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptySpellbook() throws PersistenceLayerException
+ {
+ assertFalse(parse("|Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidSpellbookAndSpellBarOnly()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|Fireball|"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidSpellCommaStarting()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|,Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidSpellCommaEnding() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|Fireball,"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidSpellDoubleComma() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|Fireball,,DCFormula"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidSpellDoublePipe() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|Fireball||Lightning Bolt"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidSpellEmbeddedPre() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|Fireball|PRERACE:1,Human|Lightning Bolt"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidBadTimes() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|TIMES=|Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidOnlyTimes() throws PersistenceLayerException
+ {
+ try
+ {
+ assertFalse(parse("SpellBook|TIMES=3"));
+ }
+ catch (IllegalArgumentException iae)
+ {
+ // OK
+ }
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidOnlyTimesBar() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|TIMES=3|"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidOnlyLevel() throws PersistenceLayerException
+ {
+ try
+ {
+ assertFalse(parse("SpellBook|CASTERLEVEL=3"));
+ }
+ catch (IllegalArgumentException iae)
+ {
+ // This is ok too
+ }
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyTimeUnit() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|TIMEUNIT=|Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidTwoTimeUnit() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|TIMEUNIT=Hour|TIMEUNIT=Day|Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidTimeUnit() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|TIMEUNIT=Fortnight|Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidTimeUnitNoSpell() throws PersistenceLayerException
+ {
+ try
+ {
+ assertFalse(parse("SpellBook|TIMEUNIT=Day"));
+ }
+ catch (IllegalArgumentException iae)
+ {
+ // This is ok too
+ }
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyTimes() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|TIMES=|Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyCasterLevel() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|CASTERLEVEL=|Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidTwoTimes() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|TIMES=3|TIMES=4|Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidTwoCasterLevel() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|CASTERLEVEL=3|CASTERLEVEL=4|Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidOnlyLevelBar() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|CASTERLEVEL=3|"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidDoubleBar() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook||Fireball"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidBadCasterLevel() throws PersistenceLayerException
+ {
+ assertFalse(parse("SpellBook|CASTERLEVEL=|Fireball"));
+ assertNoSideEffects();
+ }
+
+ // @Test
+ // public void testInvalidOutOfOrder() throws PersistenceLayerException
+ // {
+ // try
+ // {
+ // assertFalse(parse("SpellBook|CASTERLEVEL=4|TIMES=2|Fireball"));
+ // }
+ // catch (IllegalArgumentException iae)
+ // {
+ // // This is ok too
+ // }
+ // assertNoSideEffects();
+ // }
+
+ @Test
+ public void testInvalidOnlyPre() throws PersistenceLayerException
+ {
+ try
+ {
+ assertFalse(parse("SpellBook|TIMES=2|PRERACE:1,Human"));
+ }
+ catch (IllegalArgumentException iae)
+ {
+ // This is ok too
+ }
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRoundRobinJustSpell() throws PersistenceLayerException
+ {
+ runRoundRobin("SpellBook|Fireball");
+ }
+
+ @Test
+ public void testRoundRobinTwoSpell() throws PersistenceLayerException
+ {
+ runRoundRobin("SpellBook|Fireball|Lightning Bolt");
+ }
+
+ @Test
+ public void testRoundRobinTimes() throws PersistenceLayerException
+ {
+ runRoundRobin("SpellBook|TIMES=3|Fireball");
+ }
+
+ @Test
+ public void testRoundRobinDC() throws PersistenceLayerException
+ {
+ runRoundRobin("SpellBook|Fireball,CL+5");
+ }
+
+ @Test
+ public void testRoundRobinPre() throws PersistenceLayerException
+ {
+ runRoundRobin("SpellBook|Fireball|PRERACE:1,Human");
+ }
+
+ @Test
+ public void testRoundRobinTimeUnit() throws PersistenceLayerException
+ {
+ runRoundRobin("SpellBook|TIMEUNIT=Hour|Fireball");
+ }
+
+ @Test
+ public void testRoundRobinCasterLevel() throws PersistenceLayerException
+ {
+ runRoundRobin("SpellBook|CASTERLEVEL=15|Fireball");
+ }
+
+ @Test
+ public void testRoundRobinComplex() throws PersistenceLayerException
+ {
+ runRoundRobin("SpellBook|TIMES=2|TIMEUNIT=Week|CASTERLEVEL=15|Fireball,CL+5|Lightning Bolt,25|!PRECLASS:1,Cleric=1|PRERACE:1,Human");
+ }
+
+ @Test
+ public void testRoundRobinTwoBooksJustSpell()
+ throws PersistenceLayerException
+ {
+ runRoundRobin("OtherBook|Lightning Bolt", "SpellBook|Fireball");
+ }
+
+ @Test
+ public void testRoundRobinTwoTimesJustSpell()
+ throws PersistenceLayerException
+ {
+ runRoundRobin("SpellBook|TIMES=2|Fireball",
+ "SpellBook|TIMES=3|Lightning Bolt");
+ }
+
+ @Test
+ public void testRoundRobinTwoLevelJustSpell()
+ throws PersistenceLayerException
+ {
+ runRoundRobin("SpellBook|CASTERLEVEL=12|Fireball",
+ "SpellBook|CASTERLEVEL=15|Lightning Bolt");
+ }
+}
\ No newline at end of file
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/SrLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/SrLstTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/SrLstTest.java 2008-12-31 18:49:31 UTC (rev 8757)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2007 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;
+
+import pcgen.base.formula.Formula;
+import pcgen.cdom.base.CDOMObject;
+import pcgen.cdom.enumeration.FormulaKey;
+import pcgen.cdom.enumeration.ObjectKey;
+import pcgen.core.PCTemplate;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractGlobalFormulaTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+
+public class SrLstTest extends AbstractGlobalFormulaTokenTestCase
+{
+
+ static SrLst token = new SrLst();
+ static CDOMTokenLoader<PCTemplate> loader = new CDOMTokenLoader<PCTemplate>(
+ PCTemplate.class);
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMLoader<PCTemplate> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Override
+ public FormulaKey getFormulaKey()
+ {
+ return null;
+ }
+
+ @Override
+ protected Formula getFormula()
+ {
+ return primaryProf.get(ObjectKey.SR).getReduction();
+ }
+
+}
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/TypeLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/TypeLstTest.java 2008-12-31 18:48:56 UTC (rev 8756)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/TypeLstTest.java 2008-12-31 18:49:31 UTC (rev 8757)
@@ -81,7 +81,7 @@
@Override
public boolean isClearLegal()
{
- return false;
+ return true;
}
@Test
@@ -148,4 +148,37 @@
assertFalse(parse("TestWP1.REMOVE.ADD.TestWP2"));
assertNoSideEffects();
}
+
+ @Test
+ public void testInputInvalidEmbeddedClear() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP1.CLEAR.TestWP2"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInputInvalidDotClearDot() throws PersistenceLayerException
+ {
+ assertFalse(parse(".CLEAR."));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInputInvalidDotClearStuff() throws PersistenceLayerException
+ {
+ assertFalse(parse(".CLEARSTUFF"));
+ assertNoSideEffects();
+ }
+
+ @Override
+ protected boolean isAllLegal()
+ {
+ return false;
+ }
+
+ @Override
+ protected boolean requiresPreconstruction()
+ {
+ return false;
+ }
}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/UdamLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/UdamLstTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/UdamLstTest.java 2008-12-31 18:49:31 UTC (rev 8757)
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2007 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;
+
+import org.junit.Test;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.core.PCTemplate;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractGlobalTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+
+public class UdamLstTest extends AbstractGlobalTokenTestCase
+{
+ static CDOMPrimaryToken<CDOMObject> token = new UdamLst();
+ static CDOMTokenLoader<PCTemplate> loader = new CDOMTokenLoader<PCTemplate>(
+ PCTemplate.class);
+
+ @Override
+ public CDOMLoader<PCTemplate> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidNotEnoughValues() throws PersistenceLayerException
+ {
+ assertFalse(parse("1,2,3,4,5,6,7,8"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidTooManyValues() throws PersistenceLayerException
+ {
+ assertFalse(parse("1,2,3,4,5,6,7,8,9,0"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyValue1() throws PersistenceLayerException
+ {
+ assertFalse(parse(",2,3,4,5,6,7,8,9"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyValue2() throws PersistenceLayerException
+ {
+ assertFalse(parse("1,,3,4,5,6,7,8,9"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyValue3() throws PersistenceLayerException
+ {
+ assertFalse(parse("1,2,,4,5,6,7,8,9"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyValue4() throws PersistenceLayerException
+ {
+ assertFalse(parse("1,2,3,,5,6,7,8,9"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyValue5() throws PersistenceLayerException
+ {
+ assertFalse(parse("1,2,3,4,,6,7,8,9"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyValue6() throws PersistenceLayerException
+ {
+ assertFalse(parse("1,2,3,4,5,,7,8,9"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyValue7() throws PersistenceLayerException
+ {
+ assertFalse(parse("1,2,3,4,5,6,,8,9"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyValue8() throws PersistenceLayerException
+ {
+ assertFalse(parse("1,2,3,4,5,6,7,,9"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyValue9() throws PersistenceLayerException
+ {
+ assertFalse(parse("1,2,3,4,5,6,7,8,"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ this.runRoundRobin("1,2,3,4,5,6,7,8,9");
+ }
+
+ @Test
+ public void testRoundRobinComplex() throws PersistenceLayerException
+ {
+ this.runRoundRobin("1,2,3,4*form,5*form,6,7*form,8,9");
+ }
+}
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/VFeatLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/VFeatLstTest.java 2008-12-31 18:48:56 UTC (rev 8756)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/VFeatLstTest.java 2008-12-31 18:49:31 UTC (rev 8757)
@@ -85,7 +85,7 @@
@Override
public boolean isClearLegal()
{
- return false;
+ return true;
}
static CDOMPrimaryToken<CDOMObject> token = new VFeatLst();
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalFormulaTokenTestCase.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalFormulaTokenTestCase.java 2008-12-31 18:48:56 UTC (rev 8756)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalFormulaTokenTestCase.java 2008-12-31 18:49:31 UTC (rev 8757)
@@ -19,6 +19,7 @@
import org.junit.Test;
+import pcgen.base.formula.Formula;
import pcgen.cdom.enumeration.FormulaKey;
import pcgen.persistence.PersistenceLayerException;
@@ -30,14 +31,18 @@
public void testValidInputs() throws PersistenceLayerException
{
assertTrue(parse("Variable1"));
- assertEquals("Variable1", primaryProf.get(getFormulaKey()).toString());
+ assertEquals("Variable1", getFormula().toString());
assertTrue(parse("3"));
- assertEquals("3", primaryProf.get(getFormulaKey()).toString());
+ assertEquals("3", getFormula().toString());
assertTrue(parse("3+CL(\"Fighter\""));
- assertEquals("3+CL(\"Fighter\"", primaryProf.get(getFormulaKey())
- .toString());
+ assertEquals("3+CL(\"Fighter\"", getFormula().toString());
}
+ protected Formula getFormula()
+ {
+ return primaryProf.get(getFormulaKey());
+ }
+
public abstract FormulaKey getFormulaKey();
@Test
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalListTokenTestCase.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalListTokenTestCase.java 2008-12-31 18:48:56 UTC (rev 8756)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalListTokenTestCase.java 2008-12-31 18:49:31 UTC (rev 8757)
@@ -467,7 +467,7 @@
public void testInputInvalidAddsAfterClearNoSideEffect()
throws PersistenceLayerException
{
- if (isClearLegal())
+ if (isClearLegal() && isAllLegal())
{
construct(primaryContext, "TestWP1");
construct(secondaryContext, "TestWP1");
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalStringTokenTestCase.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalStringTokenTestCase.java 2008-12-31 18:48:56 UTC (rev 8756)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalStringTokenTestCase.java 2008-12-31 18:49:31 UTC (rev 8757)
@@ -27,6 +27,14 @@
{
@Test
+ public void testInvalidInputEmpty() throws PersistenceLayerException
+ {
+ assertFalse(parse(""));
+ assertEquals(null, primaryProf.get(getStringKey()));
+ assertNoSideEffects();
+ }
+
+ @Test
public void testValidInputs() throws PersistenceLayerException
{
assertTrue(parse("Nieder\xF6sterreich"));
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalTypeSafeListTestCase.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalTypeSafeListTestCase.java 2008-12-31 18:48:56 UTC (rev 8756)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalTypeSafeListTestCase.java 2008-12-31 18:49:31 UTC (rev 8757)
@@ -289,7 +289,7 @@
@Test
public void testInputInvalidClearDot() throws PersistenceLayerException
{
- if (isClearDotLegal())
+ if (isClearDotLegal() && requiresPreconstruction())
{
// DoNotConstruct TestWP1
assertTrue(parse(".CLEAR.TestWP1"));
@@ -297,6 +297,8 @@
}
}
+ protected abstract boolean requiresPreconstruction();
+
@Test
public void testInputInvalidAddsAfterClearDotNoSideEffect()
throws PersistenceLayerException
@@ -327,7 +329,7 @@
public void testInputInvalidAddsAfterClearNoSideEffect()
throws PersistenceLayerException
{
- if (isClearLegal())
+ if (isClearLegal() && isAllLegal())
{
assertTrue(parse("TestWP1" + getJoinCharacter() + "TestWP2"));
assertTrue(parseSecondary("TestWP1" + getJoinCharacter()
@@ -337,4 +339,6 @@
assertNoSideEffects();
}
}
+
+ protected abstract boolean isAllLegal();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 18:49:00
|
Revision: 8756
http://pcgen.svn.sourceforge.net/pcgen/?rev=8756&view=rev
Author: thpr
Date: 2008-12-31 18:48:56 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
refactor to make what was Formula.ONE and Formula.ZERO into IntegerFormula thus can be compared with equals without converting toString()
Also some token fixes
Modified Paths:
--------------
Trunk/pcgen/code/src/java/pcgen/base/formula/Formula.java
Trunk/pcgen/code/src/java/pcgen/cdom/base/FormulaFactory.java
Trunk/pcgen/code/src/java/pcgen/cdom/content/SpellResistance.java
Trunk/pcgen/code/src/java/pcgen/cdom/enumeration/FormulaKey.java
Trunk/pcgen/code/src/java/pcgen/core/bonus/BonusObj.java
Trunk/pcgen/code/src/java/plugin/lsttokens/OutputnameLst.java
Trunk/pcgen/code/src/java/plugin/lsttokens/RegionLst.java
Trunk/pcgen/code/src/java/plugin/lsttokens/SpellsLst.java
Trunk/pcgen/code/src/java/plugin/lsttokens/SrLst.java
Trunk/pcgen/code/src/java/plugin/lsttokens/TempdescLst.java
Trunk/pcgen/code/src/java/plugin/lsttokens/ability/ModifyabilitychoiceToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/ability/ModifyfeatchoiceToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/AbilityToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/ClassSkillsLevelToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/ClassSkillsToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/EquipToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/FeatToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/LanguageToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/SkillToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/SpellCasterToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/TemplateToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/VFeatToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/race/ChooseLangautoToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/race/FavclassToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/remove/FeatToken.java
Trunk/pcgen/code/src/java/plugin/lsttokens/template/ChooseLangautoToken.java
Modified: Trunk/pcgen/code/src/java/pcgen/base/formula/Formula.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/base/formula/Formula.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/pcgen/base/formula/Formula.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -27,89 +27,10 @@
*/
public interface Formula
{
-
- /**
- * An Integer for the constant ONE. This is done in order to minimize
- * processing time in fetching this constant during formula resolution
- */
- public static final Integer INT_ONE = Integer.valueOf(1);
-
- /**
- * An Integer for the constant ZERO. This is done in order to minimize
- * processing time in fetching this constant during formula resolution
- */
- public static final Integer INT_ZERO = Integer.valueOf(0);
-
- /**
- * A Formula for the integer constant ZERO. This is done in order to
- * minimize memory usage in the many cases where a default Formula of ZERO
- * is required.
- */
- public final Formula ZERO = new Formula()
- {
- public Integer resolve(PlayerCharacter pc, String source)
- {
- return INT_ZERO;
- }
-
- public Integer resolve(Equipment equipment, boolean primary,
- PlayerCharacter apc, String string)
- {
- return INT_ZERO;
- }
-
- public boolean isStatic()
- {
- return true;
- }
-
- @Override
- public String toString()
- {
- return "0";
- }
- };
-
- /**
- * A Formula for the integer constant ONE. This is done in order to minimize
- * memory usage in the many cases where a default Formula of ONE is
- * required.
- */
- public final Formula ONE = new Formula()
- {
- public Integer resolve(PlayerCharacter pc, String source)
- {
- return INT_ONE;
- }
-
- public Integer resolve(Equipment equipment, boolean primary,
- PlayerCharacter apc, String string)
- {
- return INT_ONE;
- }
-
- public boolean isStatic()
- {
- return true;
- }
-
- @Override
- public String toString()
- {
- return "1";
- }
-
- };
-
- /*
- * The idea is to hide JEP behind this interface, so that Formula are type
- * safe and other optimizations can be performed that may help speed up
- * PCGen... long way off, but at least the type safety will help out.
- */
-
public Number resolve(PlayerCharacter pc, String source);
public boolean isStatic();
- public Number resolve(Equipment equipment, boolean primary, PlayerCharacter apc, String string);
+ public Number resolve(Equipment equipment, boolean primary,
+ PlayerCharacter apc, String string);
}
Modified: Trunk/pcgen/code/src/java/pcgen/cdom/base/FormulaFactory.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/cdom/base/FormulaFactory.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/pcgen/cdom/base/FormulaFactory.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -28,6 +28,20 @@
public final class FormulaFactory
{
+ /**
+ * A Formula for the integer constant ZERO. This is done in order to
+ * minimize memory usage in the many cases where a default Formula of ZERO
+ * is required.
+ */
+ public final static Formula ZERO = new IntegerFormula(0);
+
+ /**
+ * A Formula for the integer constant ONE. This is done in order to minimize
+ * memory usage in the many cases where a default Formula of ONE is
+ * required.
+ */
+ public final static Formula ONE = new IntegerFormula(1);
+
private FormulaFactory()
{
// Can't instantiate Utility Class
Modified: Trunk/pcgen/code/src/java/pcgen/cdom/content/SpellResistance.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/cdom/content/SpellResistance.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/pcgen/cdom/content/SpellResistance.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -19,11 +19,12 @@
import pcgen.base.formula.Formula;
import pcgen.cdom.base.ConcretePrereqObject;
+import pcgen.cdom.base.FormulaFactory;
public class SpellResistance extends ConcretePrereqObject
{
- public static final SpellResistance NONE = new SpellResistance(Formula.ZERO);
+ public static final SpellResistance NONE = new SpellResistance(FormulaFactory.ZERO);
private final Formula reduction;
Modified: Trunk/pcgen/code/src/java/pcgen/cdom/enumeration/FormulaKey.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/cdom/enumeration/FormulaKey.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/pcgen/cdom/enumeration/FormulaKey.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -23,6 +23,7 @@
import pcgen.base.enumeration.TypeSafeConstant;
import pcgen.base.formula.Formula;
import pcgen.base.util.CaseInsensitiveMap;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.formula.FixedSizeFormula;
import pcgen.core.SettingsHandler;
@@ -60,7 +61,7 @@
public static final FormulaKey CR = getConstant("CR");
- public static final FormulaKey SELECT = getConstant("SELECT", Formula.ONE);
+ public static final FormulaKey SELECT = getConstant("SELECT", FormulaFactory.ONE);
public static final FormulaKey NUMCHOICES = getConstant("NUMCHOICES");
@@ -72,7 +73,7 @@
static
{
- SIZE = new FormulaKey("SIZE", Formula.ZERO)
+ SIZE = new FormulaKey("SIZE", FormulaFactory.ZERO)
{
@Override
public Formula getDefault()
@@ -151,7 +152,7 @@
FormulaKey o = typeMap.get(s);
if (o == null)
{
- o = new FormulaKey(s, Formula.ZERO);
+ o = new FormulaKey(s, FormulaFactory.ZERO);
typeMap.put(s, o);
}
return o;
Modified: Trunk/pcgen/code/src/java/pcgen/core/bonus/BonusObj.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/core/bonus/BonusObj.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/pcgen/core/bonus/BonusObj.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -58,7 +58,7 @@
{
private List<Object> bonusInfo = new ArrayList<Object>();
private Map<String, String> dependMap = new HashMap<String, String>();
- private Formula bonusFormula = Formula.ZERO;
+ private Formula bonusFormula = FormulaFactory.ZERO;
private Object creatorObj;
private Object targetObj;
/** The name of the bonus e.g. STAT or COMBAT */
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/OutputnameLst.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/OutputnameLst.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/OutputnameLst.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -20,37 +20,42 @@
import pcgen.cdom.base.CDOMObject;
import pcgen.cdom.enumeration.StringKey;
import pcgen.rules.context.LoadContext;
+import pcgen.rules.persistence.token.AbstractToken;
import pcgen.rules.persistence.token.CDOMPrimaryToken;
/**
* @author djones4
- *
+ *
*/
-public class OutputnameLst implements CDOMPrimaryToken<CDOMObject>
+public class OutputnameLst extends AbstractToken implements
+ CDOMPrimaryToken<CDOMObject>
{
+ @Override
public String getTokenName()
{
return "OUTPUTNAME";
}
-
public boolean parse(LoadContext context, CDOMObject obj, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
context.getObjectContext().put(obj, StringKey.OUTPUT_NAME, value);
return true;
}
public String[] unparse(LoadContext context, CDOMObject obj)
{
- String oname =
- context.getObjectContext()
- .getString(obj, StringKey.OUTPUT_NAME);
+ String oname = context.getObjectContext().getString(obj,
+ StringKey.OUTPUT_NAME);
if (oname == null)
{
return null;
}
- return new String[]{oname};
+ return new String[] { oname };
}
public Class<CDOMObject> getTokenClass()
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/RegionLst.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/RegionLst.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/RegionLst.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -48,21 +48,24 @@
Formula count = FormulaFactory.getFormulaFor(item);
if (count.isStatic())
{
+ if (!tok.hasMoreTokens())
+ {
+ Logging.addParseMessage(Logging.LST_ERROR, getTokenName()
+ + " cannot have only a count: " + value);
+ return false;
+ }
item = tok.nextToken();
if (count.resolve(null, "").intValue() <= 0)
{
Logging.addParseMessage(Logging.LST_ERROR, "Count in "
- + getTokenName() + " must be > 0");
+ + getTokenName() + " must be > 0: " + value);
return false;
}
- if (!tok.hasMoreTokens())
- {
- Logging.addParseMessage(Logging.LST_ERROR, getTokenName()
- + " must have a | separating "
- + "count from the list of possible values: " + value);
- return false;
- }
}
+ else
+ {
+ count = FormulaFactory.ONE;
+ }
List<Region> regions = new ArrayList<Region>();
while (true)
{
@@ -73,7 +76,7 @@
}
item = tok.nextToken();
}
-
+System.err.println(regions);
SimpleChoiceSet<Region> rcs = new SimpleChoiceSet<Region>(regions);
ChoiceSet<Region> cs = new ChoiceSet<Region>(getTokenName(), rcs);
TransitionChoice<Region> tc = new TransitionChoice<Region>(cs, count);
@@ -94,8 +97,8 @@
return null;
}
StringBuilder sb = new StringBuilder();
- String count = tc.getCount().toString();
- if (!"1".equals(count))
+ Formula count = tc.getCount();
+ if (!FormulaFactory.ONE.equals(count))
{
sb.append(count);
sb.append(Constants.PIPE);
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/SpellsLst.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/SpellsLst.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/SpellsLst.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -232,8 +232,17 @@
dkm.put(spell, AssociationKey.CASTER_LEVEL, casterLevel);
dkm.put(spell, AssociationKey.TIMES_PER_UNIT, FormulaFactory
.getFormulaFor(times));
- dkm.put(spell, AssociationKey.TIME_UNIT, SettingsHandler.getGame()
- .getTimeUnit(timeunit));
+ if (timeunit != null)
+ {
+ TimeUnit unit = SettingsHandler.getGame().getTimeUnit(timeunit);
+ if (unit == null)
+ {
+ Logging.errorPrint(getTokenName() + "found invalid Time Unit: "
+ + timeunit);
+ return false;
+ }
+ dkm.put(spell, AssociationKey.TIME_UNIT, unit);
+ }
dkm.put(spell, AssociationKey.SPELLBOOK, spellBook);
if (commaLoc != -1)
{
@@ -351,7 +360,7 @@
sb.append(am.get(AssociationKey.SPELLBOOK));
Formula times = AssociationKey.TIMES_PER_UNIT.cast(am
.get(AssociationKey.TIMES_PER_UNIT));
- if (!Formula.ONE.equals(times))
+ if (!FormulaFactory.ONE.equals(times))
{
sb.append(Constants.PIPE).append("TIMES=").append(times);
}
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/SrLst.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/SrLst.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/SrLst.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -45,16 +45,11 @@
else
{
context.getObjectContext().put(obj, ObjectKey.SR,
- getSpellResistance(value));
+ new SpellResistance(FormulaFactory.getFormulaFor(value)));
}
return true;
}
- private SpellResistance getSpellResistance(String value)
- {
- return new SpellResistance(FormulaFactory.getFormulaFor(value));
- }
-
public String[] unparse(LoadContext context, CDOMObject obj)
{
SpellResistance sr = context.getObjectContext().getObject(obj,
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/TempdescLst.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/TempdescLst.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/TempdescLst.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -21,15 +21,18 @@
import pcgen.cdom.enumeration.StringKey;
import pcgen.io.EntityEncoder;
import pcgen.rules.context.LoadContext;
+import pcgen.rules.persistence.token.AbstractToken;
import pcgen.rules.persistence.token.CDOMPrimaryToken;
/**
* @author djones4
- *
+ *
*/
-public class TempdescLst implements CDOMPrimaryToken<CDOMObject>
+public class TempdescLst extends AbstractToken implements
+ CDOMPrimaryToken<CDOMObject>
{
+ @Override
public String getTokenName()
{
return "TEMPDESC";
@@ -37,21 +40,24 @@
public boolean parse(LoadContext context, CDOMObject obj, String value)
{
+ if (isEmpty(value))
+ {
+ return false;
+ }
context.getObjectContext().put(obj, StringKey.TEMP_DESCRIPTION,
- EntityEncoder.decode(value));
+ EntityEncoder.decode(value));
return true;
}
public String[] unparse(LoadContext context, CDOMObject obj)
{
- String descr =
- context.getObjectContext().getString(obj,
- StringKey.TEMP_DESCRIPTION);
+ String descr = context.getObjectContext().getString(obj,
+ StringKey.TEMP_DESCRIPTION);
if (descr == null)
{
return null;
}
- return new String[]{EntityEncoder.encode(descr)};
+ return new String[] { EntityEncoder.encode(descr) };
}
public Class<CDOMObject> getTokenClass()
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/ability/ModifyabilitychoiceToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/ability/ModifyabilitychoiceToken.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/ability/ModifyabilitychoiceToken.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -21,12 +21,12 @@
import java.util.List;
import java.util.StringTokenizer;
-import pcgen.base.formula.Formula;
import pcgen.cdom.base.CDOMObject;
import pcgen.cdom.base.CDOMReference;
import pcgen.cdom.base.ChoiceActor;
import pcgen.cdom.base.ChoiceSet;
import pcgen.cdom.base.Constants;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.base.TransitionChoice;
import pcgen.cdom.choiceset.ModifyChoiceDecorator;
import pcgen.cdom.choiceset.ReferenceChoiceSet;
@@ -91,7 +91,7 @@
ModifyChoiceDecorator gfd = new ModifyChoiceDecorator(rcs);
ChoiceSet<Ability> cs = new ChoiceSet<Ability>("MODIFYFEATCHOICE", gfd);
TransitionChoice<Ability> tc = new TransitionChoice<Ability>(cs,
- Formula.ONE);
+ FormulaFactory.ONE);
tc.setTitle("Select a "
+ SettingsHandler.getGame().getSingularTabName(Tab.ABILITIES)
+ " to modify");
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/ability/ModifyfeatchoiceToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/ability/ModifyfeatchoiceToken.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/ability/ModifyfeatchoiceToken.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -21,13 +21,13 @@
import java.util.List;
import java.util.StringTokenizer;
-import pcgen.base.formula.Formula;
import pcgen.base.lang.StringUtil;
import pcgen.cdom.base.CDOMObject;
import pcgen.cdom.base.CDOMReference;
import pcgen.cdom.base.ChoiceActor;
import pcgen.cdom.base.ChoiceSet;
import pcgen.cdom.base.Constants;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.base.TransitionChoice;
import pcgen.cdom.choiceset.ModifyChoiceDecorator;
import pcgen.cdom.choiceset.ReferenceChoiceSet;
@@ -90,7 +90,7 @@
ModifyChoiceDecorator gfd = new ModifyChoiceDecorator(rcs);
ChoiceSet<Ability> cs = new ChoiceSet<Ability>(getTokenName(), gfd);
TransitionChoice<Ability> tc = new TransitionChoice<Ability>(cs,
- Formula.ONE);
+ FormulaFactory.ONE);
tc.setTitle("Select a "
+ SettingsHandler.getGame().getSingularTabName(Tab.ABILITIES)
+ " to modify");
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/AbilityToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/AbilityToken.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/AbilityToken.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -132,7 +132,7 @@
}
else if (tokenCount == 3)
{
- count = Formula.ONE;
+ count = FormulaFactory.ONE;
}
else
{
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/ClassSkillsLevelToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/ClassSkillsLevelToken.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/ClassSkillsLevelToken.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -78,7 +78,7 @@
String items;
if (pipeLoc == -1)
{
- count = Formula.ONE;
+ count = FormulaFactory.ONE;
items = value;
}
else
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/ClassSkillsToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/ClassSkillsToken.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/ClassSkillsToken.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -77,7 +77,7 @@
String items;
if (pipeLoc == -1)
{
- count = Formula.ONE;
+ count = FormulaFactory.ONE;
items = value;
}
else
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/EquipToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/EquipToken.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/EquipToken.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -78,7 +78,7 @@
String items;
if (pipeLoc == -1)
{
- count = Formula.ONE;
+ count = FormulaFactory.ONE;
items = value;
}
else
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/FeatToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/FeatToken.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/FeatToken.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -88,7 +88,7 @@
String items;
if (pipeLoc == -1)
{
- count = Formula.ONE;
+ count = FormulaFactory.ONE;
items = value;
}
else
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/LanguageToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/LanguageToken.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/LanguageToken.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -77,7 +77,7 @@
String items;
if (pipeLoc == -1)
{
- count = Formula.ONE;
+ count = FormulaFactory.ONE;
items = value;
}
else
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/SkillToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/SkillToken.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/SkillToken.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -74,7 +74,7 @@
String items;
if (pipeLoc == -1)
{
- count = Formula.ONE;
+ count = FormulaFactory.ONE;
items = value;
}
else
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/SpellCasterToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/SpellCasterToken.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/SpellCasterToken.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -75,7 +75,7 @@
String items;
if (pipeLoc == -1)
{
- count = Formula.ONE;
+ count = FormulaFactory.ONE;
items = value;
}
else
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/TemplateToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/TemplateToken.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/TemplateToken.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -76,7 +76,7 @@
String items;
if (pipeLoc == -1)
{
- count = Formula.ONE;
+ count = FormulaFactory.ONE;
items = value;
}
else
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/VFeatToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/VFeatToken.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/VFeatToken.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -89,7 +89,7 @@
String items;
if (pipeLoc == -1)
{
- count = Formula.ONE;
+ count = FormulaFactory.ONE;
items = value;
}
else
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/race/ChooseLangautoToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/race/ChooseLangautoToken.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/race/ChooseLangautoToken.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -27,6 +27,7 @@
import pcgen.cdom.base.CDOMReference;
import pcgen.cdom.base.ChoiceSet;
import pcgen.cdom.base.Constants;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.base.PersistentChoiceActor;
import pcgen.cdom.base.PersistentTransitionChoice;
import pcgen.cdom.base.TransitionChoice;
@@ -112,7 +113,7 @@
new ReferenceChoiceSet<Language>(refs);
ChoiceSet<Language> cs = new ChoiceSet<Language>(getTokenName(), rcs);
PersistentTransitionChoice<Language> tc =
- new PersistentTransitionChoice<Language>(cs, Formula.ONE);
+ new PersistentTransitionChoice<Language>(cs, FormulaFactory.ONE);
context.getObjectContext().addToList(race, ListKey.ADD, tc);
tc.setTitle("Pick a Language");
tc.setChoiceActor(this);
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/race/FavclassToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/race/FavclassToken.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/race/FavclassToken.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -24,7 +24,6 @@
import java.util.StringTokenizer;
import java.util.TreeSet;
-import pcgen.base.formula.Formula;
import pcgen.base.lang.StringUtil;
import pcgen.cdom.base.CDOMObject;
import pcgen.cdom.base.CDOMReference;
@@ -32,6 +31,7 @@
import pcgen.cdom.base.ChoiceSet;
import pcgen.cdom.base.ChooseResultActor;
import pcgen.cdom.base.Constants;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.base.PrimitiveChoiceSet;
import pcgen.cdom.base.TransitionChoice;
import pcgen.cdom.choiceset.ClassReferenceChoiceSet;
@@ -135,7 +135,7 @@
ChoiceSet<? extends PCClass> cs = new ChoiceSet<PCClass>(
getTokenName(), rcs);
TransitionChoice<PCClass> tc = new TransitionChoice<PCClass>(cs,
- Formula.ONE);
+ FormulaFactory.ONE);
context.getObjectContext().put(race, ObjectKey.FAVCLASS_CHOICE, tc);
tc.setTitle("Select favored class");
tc.setRequired(true);
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/remove/FeatToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/remove/FeatToken.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/remove/FeatToken.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -95,7 +95,7 @@
String items;
if (pipeLoc == -1)
{
- count = Formula.ONE;
+ count = FormulaFactory.ONE;
items = value;
}
else
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/template/ChooseLangautoToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/template/ChooseLangautoToken.java 2008-12-31 18:33:35 UTC (rev 8755)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/template/ChooseLangautoToken.java 2008-12-31 18:48:56 UTC (rev 8756)
@@ -27,6 +27,7 @@
import pcgen.cdom.base.CDOMReference;
import pcgen.cdom.base.ChoiceSet;
import pcgen.cdom.base.Constants;
+import pcgen.cdom.base.FormulaFactory;
import pcgen.cdom.base.PersistentChoiceActor;
import pcgen.cdom.base.PersistentTransitionChoice;
import pcgen.cdom.base.TransitionChoice;
@@ -113,7 +114,7 @@
new ReferenceChoiceSet<Language>(refs);
ChoiceSet<Language> cs = new ChoiceSet<Language>(getTokenName(), rcs);
PersistentTransitionChoice<Language> tc =
- new PersistentTransitionChoice<Language>(cs, Formula.ONE);
+ new PersistentTransitionChoice<Language>(cs, FormulaFactory.ONE);
context.getObjectContext().addToList(template, ListKey.ADD, tc);
tc.setTitle("Pick a Language");
tc.setChoiceActor(this);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <edd...@us...> - 2008-12-31 18:33:41
|
Revision: 8755
http://pcgen.svn.sourceforge.net/pcgen/?rev=8755&view=rev
Author: eddyanthony
Date: 2008-12-31 18:33:35 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
Add required disclaimer
Modified Paths:
--------------
Trunk/content/notfordistribution/paizo/pathfinder/D1-5/pfm_d1-5_revenge_of_the_kobold_king.pcc
Trunk/pcgen/data/d20ogl/paizo/gamemastery/D0/gmm_d0_hollows_last_hope.pcc
Trunk/pcgen/data/d20ogl/paizo/gamemastery/D1/gmm_d1_crown_of_the_kobold_king.pcc
Modified: Trunk/content/notfordistribution/paizo/pathfinder/D1-5/pfm_d1-5_revenge_of_the_kobold_king.pcc
===================================================================
--- Trunk/content/notfordistribution/paizo/pathfinder/D1-5/pfm_d1-5_revenge_of_the_kobold_king.pcc 2008-12-31 16:01:04 UTC (rev 8754)
+++ Trunk/content/notfordistribution/paizo/pathfinder/D1-5/pfm_d1-5_revenge_of_the_kobold_king.pcc 2008-12-31 18:33:35 UTC (rev 8755)
@@ -20,6 +20,7 @@
COPYRIGHT:System Reference Document. Copyright 2000. Wizards of the Coast, Inc; Authors Jonathan Tweet, Monte Cook, Skip Williams, based on material by E. Gary Gygax and Dave Arneson.
COPYRIGHT:Pathfinder Module D1.5: Revenge of the Kobold King, Copyright 2008, Paizo Publishing, LLC. Author: Nicolas Logue.
COPYRIGHT:Advanced Bestiary, Copyright 2004, Green Ronin Publishing, LLC; Author Matthew Sernett.
+COPYRIGHT:These data sets use trademarks and/or copyrights owned by Paizo Publishing, LLC, used with permission. These datasets are not published, endorsed, or specifically approved by Paizo Publishing. For more information about Pathfinder, Paizo Publishing and Paizo products, please visit paizo.com
COPYRIGHT:PCGen Data Set Conversion of "Pathfinder Module D1.5: Revenge of the Kobold King" Copyright 2008, PCGen Data Team (including, but not limited to Eric C. Smith)
# Do not remove the EXTRAFILE comment.
Modified: Trunk/pcgen/data/d20ogl/paizo/gamemastery/D0/gmm_d0_hollows_last_hope.pcc
===================================================================
--- Trunk/pcgen/data/d20ogl/paizo/gamemastery/D0/gmm_d0_hollows_last_hope.pcc 2008-12-31 16:01:04 UTC (rev 8754)
+++ Trunk/pcgen/data/d20ogl/paizo/gamemastery/D0/gmm_d0_hollows_last_hope.pcc 2008-12-31 18:33:35 UTC (rev 8755)
@@ -19,6 +19,7 @@
COPYRIGHT:Open Game License v 1.0a Copyright 2000, Wizards of the Coast, Inc.
COPYRIGHT:System Reference Document. Copyright 2000. Wizards of the Coast, Inc; Authors Jonathan Tweet, Monte Cook, Skip Williams, based on material by E. Gary Gygax and Dave Arneson.
COPYRIGHT:GameMastery Module D0: Hollow's Last Hope, Copyright 2007 Paizo Publishing, LLC. Author: Jason Bulmahn and F. Wesley Schneider.
+COPYRIGHT:These data sets use trademarks and/or copyrights owned by Paizo Publishing, LLC, used with permission. These datasets are not published, endorsed, or specifically approved by Paizo Publishing. For more information about Pathfinder, Paizo Publishing and Paizo products, please visit paizo.com
COPYRIGHT:PCGen Data Set Conversion for "GameMastery Module D0: Hollow's Last Hope", Copyright 2008 PCGen Data Team (including, but not limited to Eric C. Smith)
# Do not remove the EXTRAFILE comment.
Modified: Trunk/pcgen/data/d20ogl/paizo/gamemastery/D1/gmm_d1_crown_of_the_kobold_king.pcc
===================================================================
--- Trunk/pcgen/data/d20ogl/paizo/gamemastery/D1/gmm_d1_crown_of_the_kobold_king.pcc 2008-12-31 16:01:04 UTC (rev 8754)
+++ Trunk/pcgen/data/d20ogl/paizo/gamemastery/D1/gmm_d1_crown_of_the_kobold_king.pcc 2008-12-31 18:33:35 UTC (rev 8755)
@@ -19,6 +19,7 @@
COPYRIGHT:Open Game License v 1.0 Copyright 2000, Wizards of the Coast, Inc.
COPYRIGHT:System Reference Document. Copyright 2000. Wizards of the Coast, Inc; Authors Jonathan Tweet, Monte Cook, Skip Williams, based on material by E. Gary Gygax and Dave Arneson.
COPYRIGHT:GameMastery Module D1: Crown of the Kobold King, Copyright 2007 Paizo Publishing, LLC. Author: Nicolas Logue.
+COPYRIGHT:These data sets use trademarks and/or copyrights owned by Paizo Publishing, LLC, used with permission. These datasets are not published, endorsed, or specifically approved by Paizo Publishing. For more information about Pathfinder, Paizo Publishing and Paizo products, please visit paizo.com
COPYRIGHT:PCGen Data Set Conversion of "GameMastery Module D1: Crown of the Kobold King" Copyright 2008, PCGen Data Team (including, but not limited to Eric C. Smith)
# Do not remove the EXTRAFILE comment.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <edd...@us...> - 2008-12-31 16:01:09
|
Revision: 8754
http://pcgen.svn.sourceforge.net/pcgen/?rev=8754&view=rev
Author: eddyanthony
Date: 2008-12-31 16:01:04 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
[ 1812299 ] [En Publishing] Elements of Magic (Revised), added OGL and publisher data
Modified Paths:
--------------
Trunk/content/notfordistribution/en_publishing/elements_of_magic_revised/OGL.txt
Trunk/content/notfordistribution/en_publishing/elements_of_magic_revised/elements_of_magic_revised.pcc
Added Paths:
-----------
Trunk/content/notfordistribution/en_publishing/elements_of_magic_revised/elements_of_magic_revised.jpg
Modified: Trunk/content/notfordistribution/en_publishing/elements_of_magic_revised/OGL.txt
===================================================================
--- Trunk/content/notfordistribution/en_publishing/elements_of_magic_revised/OGL.txt 2008-12-31 09:31:40 UTC (rev 8753)
+++ Trunk/content/notfordistribution/en_publishing/elements_of_magic_revised/OGL.txt 2008-12-31 16:01:04 UTC (rev 8754)
@@ -63,28 +63,13 @@
15 COPYRIGHT NOTICE
-
-Open Game License v 1.0a Copyright 2000, Wizards of the Coast, Inc.
-
-Path of Faith Copyright 2002, Fantasy Flight Publishing, Inc.
-
-Arcana: Societies of Magic, Copyright 2001, Kevin Brennan and James Maliszewski
-
-System Reference Document Copyright 2000-2003, Wizards of the Coast, Inc.; Authors Jonathan Tweet, Monte Cook, Skip Williams, Rich Baker, Andy Collins, David Noonan, Rich Redman, Bruce R. Cordell, based on original material by E. Gary Gygax and Dave Arneson.
-
-Modern System Reference Document Copyright 2002, Wizards of the Coast, Inc.; Authors Bill Slavicsek, Jeff Grubb, Rich Redman, Charles Ryan, based on material by Jonathan Tweet, Monte Cook, Skip Williams, Richard Baker, Peter Adkison, Bruce R. Cordell, John Tynes, Andy Collins, and JD Wiker.
-
-Swords of Our Fathers Copyright 2003, The Game Mechanics
-
-Mutants & Masterminds Copyright 2002, Green Ronin Publishing
-
-Unearthed Arcana Copyright 2004, Wizards of the Coast, Inc.; Andy Collins, Jesse Decker,David Noonan, Rich Redman.
-
-Character Portraits: Fantasy Heroes copyright 2003, Mongoose Publishing
-
-Character Portraits: Fantasy Heroines s copyright 2003, Mongoose Publishing
-
-Secrets of Theurgy Copyright 2004, E.N.Publishing; M Jason Parent
-
-PCGen dataset conversion for Secrets of Theurgy Copyright 2004-5, PCgen Data team (Including, but not limited to Paul W. King)
-
+
+ Open Game License v 1.0 Copyright 2000, Wizards of the Coast, Inc.
+
+ d20 Revised System Reference Document, Copyright 2003, Wizards of the Coast, Inc.
+
+ Elements of Magic, Revised Edition, Copyright 2004, EN Publishing.
+
+ The Elements of Magic, Copyright 2002, Natural 20 Press
+
+ PCGen dataset conversion for EN Publishing - Elements of Magic Copyright 2008, PCGen Data Team (including, but not limited to, Joe Frazier, Andrew Maitland, Eddy Abthony (MoSaT))
Added: Trunk/content/notfordistribution/en_publishing/elements_of_magic_revised/elements_of_magic_revised.jpg
===================================================================
(Binary files differ)
Property changes on: Trunk/content/notfordistribution/en_publishing/elements_of_magic_revised/elements_of_magic_revised.jpg
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Date Revision Author Id
Modified: Trunk/content/notfordistribution/en_publishing/elements_of_magic_revised/elements_of_magic_revised.pcc
===================================================================
--- Trunk/content/notfordistribution/en_publishing/elements_of_magic_revised/elements_of_magic_revised.pcc 2008-12-31 09:31:40 UTC (rev 8753)
+++ Trunk/content/notfordistribution/en_publishing/elements_of_magic_revised/elements_of_magic_revised.pcc 2008-12-31 16:01:04 UTC (rev 8754)
@@ -6,16 +6,32 @@
BOOKTYPE:Supplement
SETTING:Generic
TYPE:Alpha Datasets
+#TYPE:EN Publishing.EN Spellcraft
+PRECAMPAIGN:1,BOOKTYPE=Core Rules
PUBNAMELONG:E.N. Publishing
PUBNAMESHORT:ENPub
-PUBNAMEWEB:http://www.enworld.org/index.php?page=enpublishing
+PUBNAMEWEB:http://www.enworld.org/forum/e-n-publishing/
SOURCELONG:Elements of Magic (Revised)
SOURCESHORT:EOM
-SOURCEWEB:http://www.enworld.org/index.php?page=enpublishing
+SOURCEWEB:http://www.enworld.org/forum/e-n-publishing/
ISOGL:YES
-SHOWINMENU:NO
-ISLICENSED:NO
+COPYRIGHT:Open Game License v 1.0 Copyright 2000, Wizards of the Coast, Inc.
+COPYRIGHT:d20 Revised System Reference Document, Copyright 2003, Wizards of the Coast, Inc.
+COPYRIGHT:Elements of Magic, Revised Edition, Copyright 2004, EN Publishing.
+COPYRIGHT:The Elements of Magic, Copyright 2002, Natural 20 Press
+COPYRIGHT:PCGen dataset conversion for EN Publishing - Elements of Magic Copyright 2008, PCGen Data Team (including, but not limited to, Joe Frazier, Andrew Maitland, Eddy Abthony (MoSaT))
+COVER:elements_of_magic_revised.jpg
+LOGO:@/publisher_logos/EN_Publishing.png
+COPYRIGHT:Included artwork is Product Identity and is included by permission. Copyright 2008, E.N. Publishing
+DESC:Elements of Magic is a rules module designed to replace the "fire and forget" spell system of the d20 Core Rules. The d20 spell system, while balanced and usable, is not flexible enough to model the magic users from most fantasy books and movies. Few wizards have ever memorized or prepared a spell, and even fewer forget them immediately afterwards. In Elements of Magic, each character has only a single spellcasting level, no matter how many types of magic she learns in her career. The Elements of Magic gives characters many times the options of the standard d20 rules. Individual spells are replaced by spell lists. Instead of learning a fireball spell, for example, a mage could learn the Evoke Fire spell list, which is very flexible as to its usage and appearance. Nor is the mage limited to fire evocations - with 20 elements to choose from, she could learn Evoke Lightning to stun and damage your foes, Transform Light to make them evaporate into a dim glow, or even exotic combinations of spell lists, such as Create Force/Drain Time, to lock them in a bubble of stasis. It would take thousands of standard spells to duplicate the effects of the spell lists in this 94-page book.
+URL:WEBSITE|http://www.enworld.org/forum/e-n-publishing/|Visit E.N. Publishing.
+URL:RPG Now|http://enworld.rpgnow.com/product_info.php?products_id=2554&it=1|Buy this pdf from RPGNow.com!
+
+# Do not remove the EXTRAFILE comment.
+#EXTRAFILE:OGL.txt
+
+
ABILITYCATEGORY:eomr_abilitycategories.lst
ABILITY:eomr_abilities.lst
CLASS:eomr_class_core.lst
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cpm...@us...> - 2008-12-31 09:31:48
|
Revision: 8753
http://pcgen.svn.sourceforge.net/pcgen/?rev=8753&view=rev
Author: cpmeister
Date: 2008-12-31 09:31:40 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
Update pom.xml to reflect djep removal
Modified Paths:
--------------
Trunk/pcgen/pom.xml
Modified: Trunk/pcgen/pom.xml
===================================================================
--- Trunk/pcgen/pom.xml 2008-12-31 05:26:44 UTC (rev 8752)
+++ Trunk/pcgen/pom.xml 2008-12-31 09:31:40 UTC (rev 8753)
@@ -1,43 +1,43 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
+
<modelVersion>4.0.0</modelVersion>
<groupId>net.sourceforge.pcgen</groupId>
<artifactId>pcgen</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>PCGen</name>
-
+
<repositories>
<repository>
<id>ibiblio.repo</id>
<url>http://www.ibiblio.org/maven</url>
<layout>legacy</layout>
</repository>
-
+
<repository>
<id>pcgen.repo</id>
<url>http://pcgen.sourceforge.net/maven</url>
<layout>legacy</layout>
</repository>
-
+
<repository>
<id>maven-plugins.repo</id>
<url>http://maven-plugins.sourceforge.net/maven</url>
<layout>legacy</layout>
</repository>
-
+
<repository>
<id>emma.repo</id>
<url>http://emma.sourceforge.net/maven</url>
<layout>legacy</layout>
</repository>
-
+
</repositories>
-
+
<build>
<sourceDirectory>code/src/java</sourceDirectory>
<testSourceDirectory>code/src/test</testSourceDirectory>
-
+
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -47,78 +47,72 @@
</configuration>
</plugin>
</plugins>
-
+
</build>
-
- <dependencies>
- <!-- Compiling -->
-
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.4</version>
- </dependency>
+
+ <dependencies>
+ <!-- Compiling -->
<dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.4</version>
+ </dependency>
+
+ <dependency>
<groupId>mrj</groupId>
<artifactId>MRJ141Stubs</artifactId>
<version>0</version>
- </dependency>
-
+ </dependency>
+
<dependency>
<groupId>skinlf</groupId>
<artifactId>skinlf</artifactId>
<version>1.2.3</version>
</dependency>
-
+
<dependency>
<groupId>wraplf</groupId>
<artifactId>wraplf</artifactId>
<version>0.2</version>
- </dependency>
-
+ </dependency>
+
<dependency>
<groupId>fop</groupId>
<artifactId>fop</artifactId>
<version>0.20.5</version>
</dependency>
-
+
<dependency>
<groupId>jep</groupId>
<artifactId>jep</artifactId>
<version>2.24</version>
</dependency>
-
+
<dependency>
- <groupId>jep</groupId>
- <artifactId>djep</artifactId>
- <version>2.24</version>
- </dependency>
-
- <dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.0b8</version>
</dependency>
-
+
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.6.0</version>
</dependency>
-
+
<dependency>
<groupId>xerces</groupId>
<artifactId>xmlParserAPIs</artifactId>
<version>2.6.2</version>
</dependency>
-
+
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.6.2</version>
</dependency>
-
+
<!-- Testing -->
<dependency>
<scope>test</scope>
@@ -126,27 +120,27 @@
<artifactId>easymock</artifactId>
<version>1.1</version>
</dependency>
-
+
<dependency>
<scope>test</scope>
<groupId>easymock</groupId>
<artifactId>easymockclassextension</artifactId>
<version>1.1</version>
</dependency>
-
+
<dependency>
<scope>test</scope>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
- </dependency>
+ </dependency>
<dependency>
<scope>test</scope>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<version>1.0</version>
- </dependency>
+ </dependency>
</dependencies>
-
+
</project>
-
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 05:26:49
|
Revision: 8752
http://pcgen.svn.sourceforge.net/pcgen/?rev=8752&view=rev
Author: thpr
Date: 2008-12-31 05:26:44 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
doh
Modified Paths:
--------------
Trunk/pcgen/code/src/java/plugin/lsttokens/SpelllevelLst.java
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/SpelllevelLst.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/SpelllevelLst.java 2008-12-31 05:25:07 UTC (rev 8751)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/SpelllevelLst.java 2008-12-31 05:26:44 UTC (rev 8752)
@@ -317,7 +317,6 @@
// TODO Error message - unexpected?
return null;
}
- System.err.println(mtl.getKeySet());
for (CDOMReference<Spell> added : mtl.getKeySet())
{
for (AssociatedPrereqObject assoc : mtl.getListFor(added))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 05:25:11
|
Revision: 8751
http://pcgen.svn.sourceforge.net/pcgen/?rev=8751&view=rev
Author: thpr
Date: 2008-12-31 05:25:07 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
fix & initial test for SPELLLEVEL
Modified Paths:
--------------
Trunk/pcgen/code/src/java/plugin/lsttokens/SpelllevelLst.java
Added Paths:
-----------
Trunk/pcgen/code/src/utest/plugin/lsttokens/SpellLevelLstTest.java
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/SpelllevelLst.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/SpelllevelLst.java 2008-12-31 05:17:44 UTC (rev 8750)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/SpelllevelLst.java 2008-12-31 05:25:07 UTC (rev 8751)
@@ -225,7 +225,7 @@
Collection<CDOMReference<? extends CDOMList<? extends PrereqObject>>> changedDomainLists = context
.getListContext().getChangedLists(obj, DomainSpellList.class);
- TripleKeyMapToList<String, Integer, CDOMReference<? extends CDOMList<? extends PrereqObject>>, Spell> domainMap = getMap(
+ TripleKeyMapToList<String, Integer, CDOMReference<? extends CDOMList<? extends PrereqObject>>, CDOMReference<Spell>> domainMap = getMap(
context, obj, changedDomainLists);
for (String prereqs : domainMap.getKeySet())
{
@@ -234,7 +234,7 @@
Collection<CDOMReference<? extends CDOMList<? extends PrereqObject>>> changedClassLists = context
.getListContext().getChangedLists(obj, ClassSpellList.class);
- TripleKeyMapToList<String, Integer, CDOMReference<? extends CDOMList<? extends PrereqObject>>, Spell> classMap = getMap(
+ TripleKeyMapToList<String, Integer, CDOMReference<? extends CDOMList<? extends PrereqObject>>, CDOMReference<Spell>> classMap = getMap(
context, obj, changedClassLists);
for (String prereqs : classMap.getKeySet())
{
@@ -250,7 +250,7 @@
private StringBuilder processUnparse(
String type,
- TripleKeyMapToList<String, Integer, CDOMReference<? extends CDOMList<? extends PrereqObject>>, Spell> domainMap,
+ TripleKeyMapToList<String, Integer, CDOMReference<? extends CDOMList<? extends PrereqObject>>, CDOMReference<Spell>> domainMap,
String prereqs)
{
StringBuilder sb = new StringBuilder(type);
@@ -265,9 +265,9 @@
sb.append(Constants.EQUALS);
sb.append(level);
sb.append(Constants.PIPE);
- List<Spell> refs = domainMap.getListFor(prereqs, level, list);
+ List<CDOMReference<Spell>> refs = domainMap.getListFor(prereqs, level, list);
boolean first = true;
- for (Spell lw : refs)
+ for (CDOMReference<Spell> lw : refs)
{
if (!first)
{
@@ -290,12 +290,12 @@
return sb;
}
- private TripleKeyMapToList<String, Integer, CDOMReference<? extends CDOMList<? extends PrereqObject>>, Spell> getMap(
+ private TripleKeyMapToList<String, Integer, CDOMReference<? extends CDOMList<? extends PrereqObject>>, CDOMReference<Spell>> getMap(
LoadContext context,
CDOMObject obj,
Collection<CDOMReference<? extends CDOMList<? extends PrereqObject>>> changedLists)
{
- TripleKeyMapToList<String, Integer, CDOMReference<? extends CDOMList<? extends PrereqObject>>, Spell> map = new TripleKeyMapToList<String, Integer, CDOMReference<? extends CDOMList<? extends PrereqObject>>, Spell>();
+ TripleKeyMapToList<String, Integer, CDOMReference<? extends CDOMList<? extends PrereqObject>>, CDOMReference<Spell>> map = new TripleKeyMapToList<String, Integer, CDOMReference<? extends CDOMList<? extends PrereqObject>>, CDOMReference<Spell>>();
for (CDOMReference listRef : changedLists)
{
@@ -309,7 +309,7 @@
+ " does not support .CLEAR");
return null;
}
- MapToList<Spell, AssociatedPrereqObject> mtl = changes
+ MapToList<CDOMReference<Spell>, AssociatedPrereqObject> mtl = changes
.getAddedAssociations();
if (mtl == null || mtl.isEmpty())
{
@@ -317,7 +317,8 @@
// TODO Error message - unexpected?
return null;
}
- for (Spell added : mtl.getKeySet())
+ System.err.println(mtl.getKeySet());
+ for (CDOMReference<Spell> added : mtl.getKeySet())
{
for (AssociatedPrereqObject assoc : mtl.getListFor(added))
{
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/SpellLevelLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/SpellLevelLstTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/SpellLevelLstTest.java 2008-12-31 05:25:07 UTC (rev 8751)
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2007 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;
+
+import java.net.URISyntaxException;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.cdom.list.ClassSpellList;
+import pcgen.core.PCTemplate;
+import pcgen.core.spell.Spell;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractGlobalTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+import plugin.lsttokens.testsupport.TokenRegistration;
+import plugin.pretokens.parser.PreClassParser;
+import plugin.pretokens.parser.PreRaceParser;
+import plugin.pretokens.writer.PreClassWriter;
+import plugin.pretokens.writer.PreRaceWriter;
+
+public class SpellLevelLstTest extends AbstractGlobalTokenTestCase
+{
+ static CDOMPrimaryToken<CDOMObject> token = new SpelllevelLst();
+ static CDOMTokenLoader<PCTemplate> loader = new CDOMTokenLoader<PCTemplate>(
+ PCTemplate.class);
+
+ @Override
+ public CDOMLoader<PCTemplate> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ PreClassParser preclass = new PreClassParser();
+ PreClassWriter preclasswriter = new PreClassWriter();
+ PreRaceParser prerace = new PreRaceParser();
+ PreRaceWriter preracewriter = new PreRaceWriter();
+
+ @Override
+ @Before
+ public void setUp() throws PersistenceLayerException, URISyntaxException
+ {
+ super.setUp();
+ TokenRegistration.register(preclass);
+ TokenRegistration.register(prerace);
+ TokenRegistration.register(preclasswriter);
+ TokenRegistration.register(preracewriter);
+ }
+
+ @Test
+ public void testRoundRobinSingleSpell() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Spell.class, "Bless");
+ secondaryContext.ref.constructCDOMObject(Spell.class, "Bless");
+ primaryContext.ref.constructCDOMObject(ClassSpellList.class, "Wizard");
+ secondaryContext.ref.constructCDOMObject(ClassSpellList.class, "Wizard");
+ runRoundRobin("CLASS|Wizard=3|Bless");
+ }
+
+ // @Test
+ // public void testInvalidDoublePipe() throws PersistenceLayerException
+ // {
+ // assertFalse(parse("CLASS||Cleric=1|Fireball"));
+ // assertNoSideEffects();
+ // }
+ //
+ // @Test
+ // public void testInvalidEndingPipe() throws PersistenceLayerException
+ // {
+ // assertFalse(parse("SA Number|"));
+ // assertNoSideEffects();
+ // }
+ //
+ // @Test
+ // public void testInvalidStartingPipe() throws PersistenceLayerException
+ // {
+ // assertFalse(parse("|Var"));
+ // assertNoSideEffects();
+ // }
+ //
+ // @Test
+ // public void testInvalidVarAfterPre() throws PersistenceLayerException
+ // {
+ // assertFalse(parse("SA % plus %|Var|PRECLASS:1,Fighter|Var2"));
+ // assertNoSideEffects();
+ // }
+ //
+ // @Test
+ // public void testInvalidOnlyPre() throws PersistenceLayerException
+ // {
+ // assertFalse(parse("PRECLASS:1,Fighter"));
+ // assertNoSideEffects();
+ // }
+ //
+ // @Test
+ // public void testRoundRobinBase() throws PersistenceLayerException
+ // {
+ // runRoundRobin("SA Number One");
+ // }
+ //
+ // @Test
+ // public void testRoundRobinVariable() throws PersistenceLayerException
+ // {
+ // runRoundRobin("SA Number %|Variab");
+ // }
+ //
+ // @Test
+ // public void testRoundRobinPre() throws PersistenceLayerException
+ // {
+ // runRoundRobin("SA Number One|PRECLASS:1,Fighter=1");
+ // }
+ //
+ // @Test
+ // public void testRoundRobinDoublePre() throws PersistenceLayerException
+ // {
+ // runRoundRobin("SA Number One|PRECLASS:1,Fighter=1|PRERACE:1,Human");
+ // }
+ //
+ // @Test
+ // public void testRoundRobinVarDoublePre() throws PersistenceLayerException
+ // {
+ // runRoundRobin("SA Number % before
+ // %|Var|TwoVar|PRECLASS:1,Fighter=1|PRERACE:1,Human");
+ // }
+ //
+ // @Test
+ // public void testRoundRobinCompound() throws PersistenceLayerException
+ // {
+ // runRoundRobin(
+ // "SA Number % before %|Var|TwoVar|PRECLASS:1,Fighter=1|PRERACE:1,Human",
+ // "SA Number One|PRECLASS:1,Fighter=1");
+ // }
+ //
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 05:17:52
|
Revision: 8750
http://pcgen.svn.sourceforge.net/pcgen/?rev=8750&view=rev
Author: thpr
Date: 2008-12-31 05:17:44 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
additional token testing
Modified Paths:
--------------
Trunk/pcgen/code/src/utest/plugin/lsttokens/TemplateLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/UnencumberedmoveLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/VFeatLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/VisionLstTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalTypeSafeListTestCase.java
Added Paths:
-----------
Trunk/pcgen/code/src/utest/plugin/lsttokens/TypeLstTest.java
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/TemplateLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/TemplateLstTest.java 2008-12-31 05:16:59 UTC (rev 8749)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/TemplateLstTest.java 2008-12-31 05:17:44 UTC (rev 8750)
@@ -295,4 +295,91 @@
// + getJoinCharacter() + "TestWP3");
// }
//
+
+ @Test
+ public void testRemoveInvalidInputString() throws PersistenceLayerException
+ {
+ assertTrue(parse("String.REMOVE"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRemoveInvalidInputJoinedComma()
+ throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ assertTrue(parse("TestWP1.REMOVE,TestWP2.REMOVE"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRemoveInvalidInputJoinedDot()
+ throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ assertTrue(parse("TestWP1.REMOVE.TestWP2.REMOVE"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRemoveInvalidListEnd() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse("TestWP1.REMOVE" + getJoinCharacter()));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRemoveInvalidListStart() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getJoinCharacter() + "TestWP1.REMOVE"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRemoveInvalidListDoubleJoin()
+ throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ assertFalse(parse("TestWP2.REMOVE" + getJoinCharacter()
+ + getJoinCharacter() + "TestWP1.REMOVE"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRemoveInvalidInputCheckMult()
+ throws PersistenceLayerException
+ {
+ // Explicitly do NOT build testChooseWP2
+ construct(primaryContext, "TestWP1");
+ assertTrue(parse("TestWP1.REMOVE" + getJoinCharacter() + "TestWP2.REMOVE"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRemoveRoundRobinOne() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin("TestWP1.REMOVE");
+ }
+
+ @Test
+ public void testRemoveRoundRobinThree() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(primaryContext, "TestWP3");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP3");
+ runRoundRobin("TestWP1.REMOVE" + getJoinCharacter() + "TestWP2.REMOVE"
+ + getJoinCharacter() + "TestWP3.REMOVE");
+ }
}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/TypeLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/TypeLstTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/TypeLstTest.java 2008-12-31 05:17:44 UTC (rev 8750)
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2007 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;
+
+import org.junit.Test;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.cdom.enumeration.ListKey;
+import pcgen.cdom.enumeration.Type;
+import pcgen.core.PCTemplate;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import plugin.lsttokens.testsupport.AbstractGlobalTypeSafeListTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+
+public class TypeLstTest extends AbstractGlobalTypeSafeListTestCase
+{
+
+ static TypeLst token = new TypeLst();
+ static CDOMTokenLoader<PCTemplate> loader = new CDOMTokenLoader<PCTemplate>(
+ PCTemplate.class);
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMLoader<PCTemplate> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Override
+ public Object getConstant(String string)
+ {
+ return Type.getConstant(string);
+ }
+
+ @Override
+ public char getJoinCharacter()
+ {
+ return '.';
+ }
+
+ @Override
+ public ListKey<?> getListKey()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isClearDotLegal()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isClearLegal()
+ {
+ return false;
+ }
+
+ @Test
+ public void testReplacementRemove() throws PersistenceLayerException
+ {
+ String[] unparsed;
+ assertTrue(parse("REMOVE.TestWP1"));
+ unparsed = getToken().unparse(primaryContext, primaryProf);
+ assertNull("Expected item to be equal", unparsed);
+
+ assertTrue(parse("TestWP1"));
+ assertTrue(parse("ADD.TestWP2"));
+ unparsed = getToken().unparse(primaryContext, primaryProf);
+ assertEquals("Expected item to be equal", "TestWP1"
+ + getJoinCharacter() + "TestWP2", unparsed[0]);
+ if (isClearLegal())
+ {
+ assertTrue(parse(".CLEAR"));
+ unparsed = getToken().unparse(primaryContext, primaryProf);
+ assertNull("Expected item to be null", unparsed);
+ }
+ }
+
+ @Test
+ public void testReplacementRemoveTwo() throws PersistenceLayerException
+ {
+ String[] unparsed;
+ assertTrue(parse("TestWP1"));
+ assertTrue(parse("TestWP2"));
+ unparsed = getToken().unparse(primaryContext, primaryProf);
+ assertEquals("Expected item to be equal", "TestWP1"
+ + getJoinCharacter() + "TestWP2", unparsed[0]);
+ assertTrue(parse("REMOVE.TestWP1"));
+ unparsed = getToken().unparse(primaryContext, primaryProf);
+ assertEquals("Expected item to be equal", "TestWP2", unparsed[0]);
+ }
+
+ @Test
+ public void testInputInvalidRemoveNoTrailing()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP1.REMOVE"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInputInvalidAddNoTrailing()
+ throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP1.ADD"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInputInvalidAddRemove() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP1.ADD.REMOVE.TestWP2"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInputInvalidRemoveAdd() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP1.REMOVE.ADD.TestWP2"));
+ assertNoSideEffects();
+ }
+}
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/UnencumberedmoveLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/UnencumberedmoveLstTest.java 2008-12-31 05:16:59 UTC (rev 8749)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/UnencumberedmoveLstTest.java 2008-12-31 05:17:44 UTC (rev 8750)
@@ -95,6 +95,27 @@
}
@Test
+ public void testInvalidInputDoubleLoad2() throws PersistenceLayerException
+ {
+ assertFalse(parse("MediumLoad|HeavyLoad"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidInputDoubleLoad3() throws PersistenceLayerException
+ {
+ assertFalse(parse("HeavyLoad|Overload"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidInputDoubleLoad4() throws PersistenceLayerException
+ {
+ assertFalse(parse("HeavyLoad|LightLoad"));
+ assertNoSideEffects();
+ }
+
+ @Test
public void testInvalidInputDoubleArmor() throws PersistenceLayerException
{
assertFalse(parse("MediumArmor|HeavyArmor"));
@@ -102,6 +123,20 @@
}
@Test
+ public void testInvalidInputDoubleArmor2() throws PersistenceLayerException
+ {
+ assertFalse(parse("HeavyArmor|MediumArmor"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidInputDoubleArmor3() throws PersistenceLayerException
+ {
+ assertFalse(parse("MediumArmor|LightArmor"));
+ assertNoSideEffects();
+ }
+
+ @Test
public void testValidInputDoubleArmor() throws PersistenceLayerException
{
assertTrue(parse("LightArmor"));
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/VFeatLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/VFeatLstTest.java 2008-12-31 05:16:59 UTC (rev 8749)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/VFeatLstTest.java 2008-12-31 05:17:44 UTC (rev 8750)
@@ -67,7 +67,7 @@
@Override
public boolean isTypeLegal()
{
- return false;
+ return true;
}
@Override
@@ -247,4 +247,30 @@
runRoundRobin("TestWP1|PRECLASS:1,Fighter=1",
"TestWP2|PRECLASS:1,Wizard=1");
}
+
+ @Test
+ public void testRoundRobinOneParen() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP1");
+ runRoundRobin("TestWP1 (Paren)");
+ }
+
+ @Test
+ public void testRoundRobinTwoParen() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin("TestWP1 (Paren)|TestWP2 (Other)");
+ }
+
+ @Test
+ public void testRoundRobinDupeParen() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP1");
+ runRoundRobin("TestWP1 (Other)|TestWP1 (That)");
+ }
}
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/VisionLstTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/VisionLstTest.java 2008-12-31 05:16:59 UTC (rev 8749)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/VisionLstTest.java 2008-12-31 05:17:44 UTC (rev 8750)
@@ -17,6 +17,9 @@
*/
package plugin.lsttokens;
+import java.net.URISyntaxException;
+
+import org.junit.Before;
import org.junit.Test;
import pcgen.cdom.base.CDOMObject;
@@ -26,15 +29,36 @@
import pcgen.rules.persistence.token.CDOMPrimaryToken;
import plugin.lsttokens.testsupport.AbstractGlobalTokenTestCase;
import plugin.lsttokens.testsupport.CDOMTokenLoader;
+import plugin.lsttokens.testsupport.TokenRegistration;
+import plugin.pretokens.parser.PreClassParser;
+import plugin.pretokens.parser.PreRaceParser;
+import plugin.pretokens.writer.PreClassWriter;
+import plugin.pretokens.writer.PreRaceWriter;
public class VisionLstTest extends AbstractGlobalTokenTestCase
{
+ PreClassParser preclass = new PreClassParser();
+ PreClassWriter preclasswriter = new PreClassWriter();
+ PreRaceParser prerace = new PreRaceParser();
+ PreRaceWriter preracewriter = new PreRaceWriter();
+
static CDOMPrimaryToken<CDOMObject> token = new VisionLst();
static CDOMTokenLoader<PCTemplate> loader = new CDOMTokenLoader<PCTemplate>(
PCTemplate.class);
@Override
+ @Before
+ public void setUp() throws PersistenceLayerException, URISyntaxException
+ {
+ super.setUp();
+ TokenRegistration.register(preclass);
+ TokenRegistration.register(preclasswriter);
+ TokenRegistration.register(prerace);
+ TokenRegistration.register(preracewriter);
+ }
+
+ @Override
public CDOMLoader<PCTemplate> getLoader()
{
return loader;
@@ -160,6 +184,41 @@
}
@Test
+ public void testInvalidOnlyPre() throws PersistenceLayerException
+ {
+ assertFalse(parse("PRERACE:1,Dwarf"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidTrailingPipe() throws PersistenceLayerException
+ {
+ assertFalse(parse("Darkvision|"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidLeadingPipe() throws PersistenceLayerException
+ {
+ assertFalse(parse("|Darkvision"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidDoublePipe() throws PersistenceLayerException
+ {
+ assertFalse(parse("Darkvision||PRERACE:1,Dwarf"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidMiddlePre() throws PersistenceLayerException
+ {
+ assertFalse(parse("Darkvision|PRERACE:1,Dwarf|Normal (100')"));
+ assertNoSideEffects();
+ }
+
+ @Test
public void testValidDistanceFormula() throws PersistenceLayerException
{
assertTrue(parse("Darkvision (zzzb32)"));
@@ -186,6 +245,12 @@
}
@Test
+ public void testRoundRobinSimplePre() throws PersistenceLayerException
+ {
+ runRoundRobin("Darkvision|PRERACE:1,Dwarf");
+ }
+
+ @Test
public void testRoundRobinNumber() throws PersistenceLayerException
{
runRoundRobin("Darkvision (30')");
@@ -236,4 +301,10 @@
runRoundRobin("Darkvision (CL*10)|Normal (Form)");
}
+ @Test
+ public void testRoundRobinTwoPre() throws PersistenceLayerException
+ {
+ runRoundRobin("arkvision (20')|TestWP1|PRECLASS:1,Fighter=3|PRERACE:1,Dwarf");
+ }
+
}
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalTypeSafeListTestCase.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalTypeSafeListTestCase.java 2008-12-31 05:16:59 UTC (rev 8749)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractGlobalTypeSafeListTestCase.java 2008-12-31 05:17:44 UTC (rev 8750)
@@ -37,79 +37,107 @@
@Test
public void testValidInputSimple() throws PersistenceLayerException
{
- List<?> coll;
- assertTrue(parse("Rheinhessen"));
- coll = primaryProf.getListFor(getListKey());
- assertEquals(1, coll.size());
- assertTrue(coll.contains(getConstant("Rheinhessen")));
+ ListKey<?> listKey = getListKey();
+ if (listKey != null)
+ {
+ List<?> coll;
+ assertTrue(parse("Rheinhessen"));
+ coll = primaryProf.getListFor(getListKey());
+ assertEquals(1, coll.size());
+ assertTrue(coll.contains(getConstant("Rheinhessen")));
+ }
}
@Test
public void testValidInputNonEnglish() throws PersistenceLayerException
{
- List<?> coll;
- assertTrue(parse("Nieder\xF6sterreich"));
- coll = primaryProf.getListFor(getListKey());
- assertEquals(1, coll.size());
- assertTrue(coll.contains(getConstant("Nieder\xF6sterreich")));
+ ListKey<?> listKey = getListKey();
+ if (listKey != null)
+ {
+ List<?> coll;
+ assertTrue(parse("Nieder\xF6sterreich"));
+ coll = primaryProf.getListFor(getListKey());
+ assertEquals(1, coll.size());
+ assertTrue(coll.contains(getConstant("Nieder\xF6sterreich")));
+ }
}
@Test
public void testValidInputSpace() throws PersistenceLayerException
{
- List<?> coll;
- assertTrue(parse("Finger Lakes"));
- coll = primaryProf.getListFor(getListKey());
- assertEquals(1, coll.size());
- assertTrue(coll.contains(getConstant("Finger Lakes")));
+ ListKey<?> listKey = getListKey();
+ if (listKey != null)
+ {
+ List<?> coll;
+ assertTrue(parse("Finger Lakes"));
+ coll = primaryProf.getListFor(getListKey());
+ assertEquals(1, coll.size());
+ assertTrue(coll.contains(getConstant("Finger Lakes")));
+ }
}
@Test
public void testValidInputHyphen() throws PersistenceLayerException
{
- List<?> coll;
- assertTrue(parse("Languedoc-Roussillon"));
- coll = primaryProf.getListFor(getListKey());
- assertEquals(1, coll.size());
- assertTrue(coll.contains(getConstant("Languedoc-Roussillon")));
+ ListKey<?> listKey = getListKey();
+ if (listKey != null)
+ {
+ List<?> coll;
+ assertTrue(parse("Languedoc-Roussillon"));
+ coll = primaryProf.getListFor(getListKey());
+ assertEquals(1, coll.size());
+ assertTrue(coll.contains(getConstant("Languedoc-Roussillon")));
+ }
}
@Test
public void testValidInputY() throws PersistenceLayerException
{
- List<?> coll;
- assertTrue(parse("Yarra Valley"));
- coll = primaryProf.getListFor(getListKey());
- assertEquals(1, coll.size());
- assertTrue(coll.contains(getConstant("Yarra Valley")));
+ ListKey<?> listKey = getListKey();
+ if (listKey != null)
+ {
+ List<?> coll;
+ assertTrue(parse("Yarra Valley"));
+ coll = primaryProf.getListFor(getListKey());
+ assertEquals(1, coll.size());
+ assertTrue(coll.contains(getConstant("Yarra Valley")));
+ }
}
@Test
public void testValidInputList() throws PersistenceLayerException
{
- List<?> coll;
- assertTrue(parse("Nieder\xF6sterreich" + getJoinCharacter()
- + "Finger Lakes"));
- coll = primaryProf.getListFor(getListKey());
- assertEquals(2, coll.size());
- assertTrue(coll.contains(getConstant("Nieder\xF6sterreich")));
- assertTrue(coll.contains(getConstant("Finger Lakes")));
+ ListKey<?> listKey = getListKey();
+ if (listKey != null)
+ {
+ List<?> coll;
+ assertTrue(parse("Nieder\xF6sterreich" + getJoinCharacter()
+ + "Finger Lakes"));
+ coll = primaryProf.getListFor(getListKey());
+ assertEquals(2, coll.size());
+ assertTrue(coll.contains(getConstant("Nieder\xF6sterreich")));
+ assertTrue(coll.contains(getConstant("Finger Lakes")));
+ }
}
@Test
public void testValidInputMultList() throws PersistenceLayerException
{
- List<?> coll;
- assertTrue(parse("Nieder\xF6sterreich" + getJoinCharacter()
- + "Finger Lakes"));
- assertTrue(parse("Languedoc-Roussillon" + getJoinCharacter()
- + "Rheinhessen"));
- coll = primaryProf.getListFor(getListKey());
- assertEquals(4, coll.size());
- assertTrue(coll.contains(getConstant("Nieder\xF6sterreich")));
- assertTrue(coll.contains(getConstant("Finger Lakes")));
- assertTrue(coll.contains(getConstant("Languedoc-Roussillon")));
- assertTrue(coll.contains(getConstant("Rheinhessen")));
+ ListKey<?> listKey = getListKey();
+ if (listKey != null)
+ {
+ List<?> coll;
+ assertTrue(parse("Nieder\xF6sterreich" + getJoinCharacter()
+ + "Finger Lakes"));
+ assertTrue(parse("Languedoc-Roussillon" + getJoinCharacter()
+ + "Rheinhessen"));
+ coll = primaryProf.getListFor(getListKey());
+ assertEquals(4, coll.size());
+ assertTrue(coll.contains(getConstant("Nieder\xF6sterreich")));
+ assertTrue(coll.contains(getConstant("Finger Lakes")));
+ assertTrue(coll.contains(getConstant("Languedoc-Roussillon")));
+ assertTrue(coll.contains(getConstant("Rheinhessen")));
+ }
}
// FIXME Someday, when PCGen doesn't write out crappy stuff into custom
@@ -151,7 +179,7 @@
primaryContext.ref.constructCDOMObject(getCDOMClass(), "TestWP1");
primaryContext.ref.constructCDOMObject(getCDOMClass(), "TestWP2");
assertFalse(parse("TestWP2" + getJoinCharacter() + getJoinCharacter()
- + "TestWP1"));
+ + "TestWP1"));
assertNoSideEffects();
}
@@ -189,13 +217,13 @@
public void testRoundRobinThree() throws PersistenceLayerException
{
runRoundRobin("Rheinhessen" + getJoinCharacter() + "Yarra Valley"
- + getJoinCharacter() + "Languedoc-Roussillon");
+ + getJoinCharacter() + "Languedoc-Roussillon");
}
public static String[] getConstants()
{
- return new String[]{"Nieder\xF6sterreich", "Finger Lakes",
- "Languedoc-Roussillon", "Rheinhessen", "Yarra Valley"};
+ return new String[] { "Nieder\xF6sterreich", "Finger Lakes",
+ "Languedoc-Roussillon", "Rheinhessen", "Yarra Valley" };
}
public abstract boolean isClearLegal();
@@ -222,7 +250,7 @@
assertTrue(parse("TestWP2"));
unparsed = getToken().unparse(primaryContext, primaryProf);
assertEquals("Expected item to be equal", "TestWP1"
- + getJoinCharacter() + "TestWP2", unparsed[0]);
+ + getJoinCharacter() + "TestWP2", unparsed[0]);
if (isClearLegal())
{
assertTrue(parse(".CLEAR"));
@@ -239,7 +267,7 @@
assertTrue(parse("TestWP2"));
unparsed = getToken().unparse(primaryContext, primaryProf);
assertEquals("Expected item to be equal", "TestWP1"
- + getJoinCharacter() + "TestWP2", unparsed[0]);
+ + getJoinCharacter() + "TestWP2", unparsed[0]);
if (isClearDotLegal())
{
assertTrue(parse(".CLEAR.TestWP1"));
@@ -271,41 +299,41 @@
@Test
public void testInputInvalidAddsAfterClearDotNoSideEffect()
- throws PersistenceLayerException
+ throws PersistenceLayerException
{
if (isClearDotLegal())
{
assertTrue(parse("TestWP1" + getJoinCharacter() + "TestWP2"));
assertTrue(parseSecondary("TestWP1" + getJoinCharacter()
- + "TestWP2"));
+ + "TestWP2"));
assertFalse(parse("TestWP3" + getJoinCharacter() + ".CLEAR.TestWP2"
- + getJoinCharacter() + "ALL"));
+ + getJoinCharacter() + "ALL"));
assertNoSideEffects();
}
}
@Test
public void testInputInvalidAddsBasicNoSideEffect()
- throws PersistenceLayerException
+ throws PersistenceLayerException
{
assertTrue(parse("TestWP1" + getJoinCharacter() + "TestWP2"));
assertTrue(parseSecondary("TestWP1" + getJoinCharacter() + "TestWP2"));
assertFalse(parse("TestWP3" + getJoinCharacter() + getJoinCharacter()
- + "TestWP4"));
+ + "TestWP4"));
assertNoSideEffects();
}
@Test
public void testInputInvalidAddsAfterClearNoSideEffect()
- throws PersistenceLayerException
+ throws PersistenceLayerException
{
if (isClearLegal())
{
assertTrue(parse("TestWP1" + getJoinCharacter() + "TestWP2"));
assertTrue(parseSecondary("TestWP1" + getJoinCharacter()
- + "TestWP2"));
+ + "TestWP2"));
assertFalse(parse(".CLEAR" + getJoinCharacter() + "TestWP3"
- + getJoinCharacter() + "ALL"));
+ + getJoinCharacter() + "ALL"));
assertNoSideEffects();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 05:17:02
|
Revision: 8749
http://pcgen.svn.sourceforge.net/pcgen/?rev=8749&view=rev
Author: thpr
Date: 2008-12-31 05:16:59 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
unparse .REMOVE
Modified Paths:
--------------
Trunk/pcgen/code/src/java/plugin/lsttokens/TemplateLst.java
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/TemplateLst.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/TemplateLst.java 2008-12-31 05:16:43 UTC (rev 8748)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/TemplateLst.java 2008-12-31 05:16:59 UTC (rev 8749)
@@ -28,7 +28,6 @@
import pcgen.cdom.enumeration.ListKey;
import pcgen.cdom.reference.CDOMCompoundOrReference;
import pcgen.cdom.reference.ReferenceUtilities;
-import pcgen.core.Campaign;
import pcgen.core.PCTemplate;
import pcgen.rules.context.Changes;
import pcgen.rules.context.LoadContext;
@@ -53,11 +52,6 @@
public boolean parse(LoadContext context, CDOMObject cdo, String value)
{
- if (cdo instanceof Campaign)
- {
- return false;
- }
-
ListKey<CDOMReference<PCTemplate>> lk;
String remaining;
boolean consolidate = false;
@@ -134,6 +128,9 @@
{
Changes<CDOMReference<PCTemplate>> changes = context.getObjectContext()
.getListChanges(cdo, ListKey.TEMPLATE);
+ Changes<CDOMReference<PCTemplate>> removechanges = context
+ .getObjectContext().getListChanges(cdo,
+ ListKey.REMOVE_TEMPLATES);
List<String> list = new ArrayList<String>();
@@ -194,6 +191,24 @@
+ ReferenceUtilities.joinLstFormat(addedItems,
Constants.PIPE));
}
+
+ Collection<CDOMReference<PCTemplate>> radd = removechanges.getAdded();
+ if (radd != null && !radd.isEmpty())
+ {
+ sb = new StringBuilder();
+ boolean needPipe = false;
+ for (CDOMReference<PCTemplate> ref : radd)
+ {
+ if (needPipe)
+ {
+ sb.append(Constants.PIPE);
+ }
+ needPipe = true;
+ sb.append(ref.getLSTformat()).append(".REMOVE");
+ }
+ list.add(sb.toString());
+ }
+
if (list.isEmpty())
{
// Possible if none triggered
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 05:16:48
|
Revision: 8748
http://pcgen.svn.sourceforge.net/pcgen/?rev=8748&view=rev
Author: thpr
Date: 2008-12-31 05:16:43 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
catch additional bad behavior
Modified Paths:
--------------
Trunk/pcgen/code/src/java/plugin/lsttokens/TypeLst.java
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/TypeLst.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/TypeLst.java 2008-12-31 05:16:15 UTC (rev 8747)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/TypeLst.java 2008-12-31 05:16:43 UTC (rev 8748)
@@ -33,7 +33,7 @@
/**
* @author djones4
- *
+ *
*/
public class TypeLst extends AbstractToken implements
CDOMPrimaryToken<CDOMObject>
@@ -87,50 +87,74 @@
StringTokenizer aTok = new StringTokenizer(value, Constants.DOT);
boolean bRemove = false;
+ boolean bAdd = false;
while (aTok.hasMoreTokens())
{
final String aType = aTok.nextToken();
- if (bRemove)
+ if ("ADD".equals(aType))
{
- Type type = Type.getConstant(aType);
- context.getObjectContext().removeFromList(cdo, ListKey.TYPE,
- type);
+ if (bRemove)
+ {
+ Logging.log(Logging.LST_ERROR,
+ "Non-sensical use of .REMOVE.ADD. in "
+ + getTokenName() + ": " + value);
+ return false;
+ }
bRemove = false;
+ bAdd = true;
}
- else if ("ADD".equals(aType))
- {
- bRemove = false;
- }
else if ("REMOVE".equals(aType))
{
+ if (bAdd)
+ {
+ Logging.log(Logging.LST_ERROR,
+ "Non-sensical use of .ADD.REMOVE. in "
+ + getTokenName() + ": " + value);
+ return false;
+ }
bRemove = true;
}
else if ("CLEAR".equals(aType))
{
Logging.errorPrint("Non-sensical use of .CLEAR in "
- + getTokenName() + ": " + value);
+ + getTokenName() + ": " + value);
return false;
}
+ else if (bRemove)
+ {
+ Type type = Type.getConstant(aType);
+ context.getObjectContext().removeFromList(cdo, ListKey.TYPE,
+ type);
+ bRemove = false;
+ }
else
{
Type type = Type.getConstant(aType);
context.getObjectContext().addToList(cdo, ListKey.TYPE, type);
+ bAdd = false;
}
}
if (bRemove)
{
Logging.errorPrint(getTokenName()
- + "ended with REMOVE, so didn't have any Type to remove: "
- + value);
+ + "ended with REMOVE, so didn't have any Type to remove: "
+ + value);
return false;
}
+ if (bAdd)
+ {
+ Logging.log(Logging.LST_ERROR, getTokenName()
+ + "ended with ADD, so didn't have any Type to add: "
+ + value);
+ return false;
+ }
return true;
}
public String[] unparse(LoadContext context, CDOMObject cdo)
{
- Changes<Type> changes =
- context.getObjectContext().getListChanges(cdo, ListKey.TYPE);
+ Changes<Type> changes = context.getObjectContext().getListChanges(cdo,
+ ListKey.TYPE);
if (changes == null || changes.isEmpty())
{
return null;
@@ -153,11 +177,11 @@
if (sb.length() == 0)
{
context.addWriteMessage(getTokenName()
- + " was expecting non-empty changes to include "
- + "added items or global clear");
+ + " was expecting non-empty changes to include "
+ + "added items or global clear");
return null;
}
- return new String[]{sb.toString()};
+ return new String[] { sb.toString() };
}
public Class<CDOMObject> getTokenClass()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 05:16:19
|
Revision: 8747
http://pcgen.svn.sourceforge.net/pcgen/?rev=8747&view=rev
Author: thpr
Date: 2008-12-31 05:16:15 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
bug fix Armor v. Move
Modified Paths:
--------------
Trunk/pcgen/code/src/java/plugin/lsttokens/UnencumberedmoveLst.java
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/UnencumberedmoveLst.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/UnencumberedmoveLst.java 2008-12-31 05:15:59 UTC (rev 8746)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/UnencumberedmoveLst.java 2008-12-31 05:16:15 UTC (rev 8747)
@@ -116,7 +116,7 @@
}
else if (loadString.equalsIgnoreCase("LightArmor"))
{
- if (!validateOnlyMove(hasMove))
+ if (!validateOnlyMove(hasArmor))
{
return false;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 05:16:03
|
Revision: 8746
http://pcgen.svn.sourceforge.net/pcgen/?rev=8746&view=rev
Author: thpr
Date: 2008-12-31 05:15:59 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
replace PRE support in Vision
Modified Paths:
--------------
Trunk/pcgen/code/src/java/plugin/lsttokens/VisionLst.java
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/VisionLst.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/VisionLst.java 2008-12-31 04:51:55 UTC (rev 8745)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/VisionLst.java 2008-12-31 05:15:59 UTC (rev 8746)
@@ -67,13 +67,24 @@
public boolean parse(LoadContext context, CDOMObject obj, String value)
{
+ if (isEmpty(value) || hasIllegalSeparator('|', value))
+ {
+ return false;
+ }
StringTokenizer aTok = new StringTokenizer(value, Constants.PIPE);
+ String visionString = aTok.nextToken();
+ if (visionString.startsWith("PRE") || visionString.startsWith("!PRE"))
+ {
+ Logging.log(Logging.LST_ERROR,
+ "Cannot have only PRExxx subtoken in " + getTokenName()
+ + ": " + value);
+ return false;
+ }
- List<Vision> list = new ArrayList<Vision>();
- while (aTok.hasMoreTokens())
+ ArrayList<AssociatedPrereqObject> edgeList = new ArrayList<AssociatedPrereqObject>();
+
+ while (true)
{
- String visionString = aTok.nextToken();
-
if (".CLEAR".equals(visionString))
{
context.getListContext().removeAllFromList(getTokenName(), obj,
@@ -99,18 +110,28 @@
return false;
}
}
+ else if (visionString.startsWith("PRE")
+ || visionString.startsWith("!PRE"))
+ {
+ break;
+ }
else
{
if (visionString.startsWith(".SET."))
{
- // TODO Need a deprecation warning here
+ Logging.deprecationPrint(".SET. in " + getTokenName()
+ + " has been deprecated, please use .CLEAR,x");
context.getListContext().removeAllFromList(getTokenName(),
obj, Vision.VISIONLIST);
visionString = visionString.substring(5);
}
try
{
- list.add(Vision.getVision(visionString));
+ Vision vision = Vision.getVision(visionString);
+ AssociatedPrereqObject edge = context.getListContext()
+ .addToList(getTokenName(), obj, Vision.VISIONLIST,
+ new CDOMDirectSingleRef<Vision>(vision));
+ edgeList.add(edge);
}
catch (IllegalArgumentException e)
{
@@ -120,11 +141,31 @@
return false;
}
}
+ if (!aTok.hasMoreTokens())
+ {
+ return true;
+ }
+ visionString = aTok.nextToken();
}
- for (Vision vis : list)
+ while (true)
{
- context.getListContext().addToList(getTokenName(), obj,
- Vision.VISIONLIST, new CDOMDirectSingleRef<Vision>(vis));
+ Prerequisite prereq = getPrerequisite(visionString);
+ if (prereq == null)
+ {
+ Logging.log(Logging.LST_ERROR,
+ " (Did you put vision after the " + "PRExxx tags in "
+ + getTokenName() + ":?)");
+ return false;
+ }
+ for (AssociatedPrereqObject edge : edgeList)
+ {
+ edge.addPrerequisite(prereq);
+ }
+ if (!aTok.hasMoreTokens())
+ {
+ break;
+ }
+ visionString = aTok.nextToken();
}
return true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 04:51:58
|
Revision: 8745
http://pcgen.svn.sourceforge.net/pcgen/?rev=8745&view=rev
Author: thpr
Date: 2008-12-31 04:51:55 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
refactor
Modified Paths:
--------------
Trunk/pcgen/code/src/java/plugin/lsttokens/equipment/AlttypeToken.java
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/equipment/AlttypeToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/equipment/AlttypeToken.java 2008-12-31 03:55:56 UTC (rev 8744)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/equipment/AlttypeToken.java 2008-12-31 04:51:55 UTC (rev 8745)
@@ -47,15 +47,11 @@
public boolean parse(LoadContext context, Equipment eq, String value)
{
- if (isEmpty(value))
+ if (isEmpty(value) || hasIllegalSeparator('.', value))
{
return false;
}
EquipmentHead head = eq.getEquipmentHead(2);
- if (hasIllegalSeparator('.', value))
- {
- return false;
- }
StringTokenizer aTok = new StringTokenizer(value, Constants.DOT);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2008-12-31 03:56:05
|
Revision: 8744
http://pcgen.svn.sourceforge.net/pcgen/?rev=8744&view=rev
Author: thpr
Date: 2008-12-31 03:55:56 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
additional token tests
Modified Paths:
--------------
Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractAddTokenTestCase.java
Added Paths:
-----------
Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/
Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/ArmorProfTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/EquipTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/FeatTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/ShieldProfTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/WeaponProfTokenTest.java
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/ArmorProfTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/ArmorProfTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/ArmorProfTokenTest.java 2008-12-31 03:55:56 UTC (rev 8744)
@@ -0,0 +1,206 @@
+/*
+ *
+ * Copyright (c) 2007 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.auto;
+
+import org.junit.Test;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.core.ArmorProf;
+import pcgen.core.PCTemplate;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.AutoLst;
+import plugin.lsttokens.testsupport.AbstractAddTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+
+public class ArmorProfTokenTest extends
+ AbstractAddTokenTestCase<CDOMObject, ArmorProf>
+{
+
+ static AutoLst token = new AutoLst();
+ static ArmorProfToken subtoken = new ArmorProfToken();
+ static CDOMTokenLoader<CDOMObject> loader = new CDOMTokenLoader<CDOMObject>(
+ CDOMObject.class);
+
+ @Override
+ public char getJoinCharacter()
+ {
+ return '|';
+ }
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMLoader<CDOMObject> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Override
+ public CDOMSecondaryToken<?> getSubToken()
+ {
+ return subtoken;
+ }
+
+ @Override
+ public Class<ArmorProf> getTargetClass()
+ {
+ return ArmorProf.class;
+ }
+
+ @Override
+ public boolean isAllLegal()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isTypeLegal()
+ {
+ return true;
+ }
+
+ @Test
+ public void testEmpty()
+ {
+ // Just to get Eclipse to recognize this as a JUnit 4.0 Test Case
+ }
+
+ @Override
+ public boolean allowsParenAsSub()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean allowsFormula()
+ {
+ return false;
+ }
+
+ @Override
+ public String getTypePrefix()
+ {
+ return "ARMOR";
+ }
+
+ @Test
+ public void testRoundRobinList() throws PersistenceLayerException
+ {
+ runRoundRobin(getSubTokenName() + '|' + "%LIST");
+ }
+
+
+ @Test
+ public void testInvalidEmptyPre() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1[]"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyPre2() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1["));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyPre3() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ boolean parse = parse(getSubTokenName() + '|' + "TestWP1]");
+ if (parse)
+ {
+ assertFalse(primaryContext.ref.validate());
+ }
+ else
+ {
+ assertNoSideEffects();
+ }
+ }
+
+ @Test
+ public void testInvalidMismatchedBracket() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1[PRERACE:Dwarf"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidTrailingAfterBracket()
+ throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1[PRERACE:Dwarf]Hi"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRoundRobinOnePre() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin(getSubTokenName() + '|' + "TestWP1[PRERACE:1,Dwarf]");
+ }
+
+ @Test
+ public void testRoundRobinDupeTwoPrereqs() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin(getSubTokenName() + '|' + "TestWP1[PRERACE:1,Dwarf]",
+ getSubTokenName() + '|' + "TestWP1[PRERACE:1,Human]");
+ }
+
+ @Test
+ public void testInvalidInputBadPrerequisite()
+ throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1[PREFOO:1,Human]"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRoundRobinListPre() throws PersistenceLayerException
+ {
+ runRoundRobin(getSubTokenName() + '|' + "%LIST[PRERACE:1,Dwarf]");
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/EquipTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/EquipTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/EquipTokenTest.java 2008-12-31 03:55:56 UTC (rev 8744)
@@ -0,0 +1,223 @@
+/*
+ *
+ * Copyright (c) 2007 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.auto;
+
+import java.net.URISyntaxException;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.core.Equipment;
+import pcgen.core.PCTemplate;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.AutoLst;
+import plugin.lsttokens.testsupport.AbstractAddTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+import plugin.lsttokens.testsupport.TokenRegistration;
+import plugin.pretokens.parser.PreClassParser;
+import plugin.pretokens.parser.PreRaceParser;
+import plugin.pretokens.writer.PreClassWriter;
+import plugin.pretokens.writer.PreRaceWriter;
+
+public class EquipTokenTest extends
+ AbstractAddTokenTestCase<CDOMObject, Equipment>
+{
+
+ PreClassParser preclass = new PreClassParser();
+ PreClassWriter preclasswriter = new PreClassWriter();
+ PreRaceParser prerace = new PreRaceParser();
+ PreRaceWriter preracewriter = new PreRaceWriter();
+
+ static AutoLst token = new AutoLst();
+ static EquipToken subtoken = new EquipToken();
+ static CDOMTokenLoader<CDOMObject> loader = new CDOMTokenLoader<CDOMObject>(
+ CDOMObject.class);
+
+ @Override
+ @Before
+ public void setUp() throws PersistenceLayerException, URISyntaxException
+ {
+ super.setUp();
+ TokenRegistration.register(preclass);
+ TokenRegistration.register(preclasswriter);
+ TokenRegistration.register(prerace);
+ TokenRegistration.register(preracewriter);
+ }
+
+ @Override
+ public char getJoinCharacter()
+ {
+ return '|';
+ }
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMLoader<CDOMObject> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Override
+ public CDOMSecondaryToken<?> getSubToken()
+ {
+ return subtoken;
+ }
+
+ @Override
+ public Class<Equipment> getTargetClass()
+ {
+ return Equipment.class;
+ }
+
+ @Override
+ public boolean isAllLegal()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isTypeLegal()
+ {
+ return true;
+ }
+
+ @Test
+ public void testEmpty()
+ {
+ // Just to get Eclipse to recognize this as a JUnit 4.0 Test Case
+ }
+
+ @Override
+ public boolean allowsParenAsSub()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean allowsFormula()
+ {
+ return false;
+ }
+
+ @Test
+ public void testRoundRobinList() throws PersistenceLayerException
+ {
+ runRoundRobin(getSubTokenName() + '|' + "%LIST");
+ }
+
+ @Test
+ public void testInvalidEmptyPre() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1[]"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyPre2() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1["));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyPre3() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ boolean parse = parse(getSubTokenName() + '|' + "TestWP1]");
+ if (parse)
+ {
+ assertFalse(primaryContext.ref.validate());
+ }
+ else
+ {
+ assertNoSideEffects();
+ }
+ }
+
+ @Test
+ public void testInvalidMismatchedBracket() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1[PRERACE:Dwarf"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidTrailingAfterBracket()
+ throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1[PRERACE:Dwarf]Hi"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRoundRobinOnePre() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin(getSubTokenName() + '|' + "TestWP1[PRERACE:1,Dwarf]");
+ }
+
+ @Test
+ public void testRoundRobinListPre() throws PersistenceLayerException
+ {
+ runRoundRobin(getSubTokenName() + '|' + "%LIST[PRERACE:1,Dwarf]");
+ }
+
+ @Test
+ public void testRoundRobinDupeTwoPrereqs() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin(getSubTokenName() + '|' + "TestWP1[PRERACE:1,Dwarf]",
+ getSubTokenName() + '|' + "TestWP1[PRERACE:1,Human]");
+ }
+
+ @Test
+ public void testInvalidInputBadPrerequisite()
+ throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1[PREFOO:1,Human]"));
+ assertNoSideEffects();
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/FeatTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/FeatTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/FeatTokenTest.java 2008-12-31 03:55:56 UTC (rev 8744)
@@ -0,0 +1,199 @@
+/*
+ *
+ * Copyright (c) 2007 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.auto;
+
+import java.net.URISyntaxException;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.core.Ability;
+import pcgen.core.AbilityCategory;
+import pcgen.core.Equipment;
+import pcgen.core.PCTemplate;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.context.LoadContext;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.AutoLst;
+import plugin.lsttokens.testsupport.AbstractAddTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+import plugin.lsttokens.testsupport.TokenRegistration;
+import plugin.pretokens.parser.PreClassParser;
+import plugin.pretokens.parser.PreRaceParser;
+import plugin.pretokens.writer.PreClassWriter;
+import plugin.pretokens.writer.PreRaceWriter;
+
+public class FeatTokenTest extends
+ AbstractAddTokenTestCase<CDOMObject, Equipment>
+{
+
+ PreClassParser preclass = new PreClassParser();
+ PreClassWriter preclasswriter = new PreClassWriter();
+ PreRaceParser prerace = new PreRaceParser();
+ PreRaceWriter preracewriter = new PreRaceWriter();
+
+ @Override
+ @Before
+ public void setUp() throws PersistenceLayerException, URISyntaxException
+ {
+ super.setUp();
+ TokenRegistration.register(preclass);
+ TokenRegistration.register(preclasswriter);
+ TokenRegistration.register(prerace);
+ TokenRegistration.register(preracewriter);
+ }
+
+ static AutoLst token = new AutoLst();
+ static FeatToken subtoken = new FeatToken();
+ static CDOMTokenLoader<CDOMObject> loader = new CDOMTokenLoader<CDOMObject>(
+ CDOMObject.class);
+
+ @Override
+ protected void construct(LoadContext loadContext, String one)
+ {
+ Ability obj = loadContext.ref.constructCDOMObject(Ability.class, one);
+ loadContext.ref.reassociateCategory(AbilityCategory.FEAT, obj);
+ }
+
+ @Override
+ public char getJoinCharacter()
+ {
+ return '|';
+ }
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMLoader<CDOMObject> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Override
+ public CDOMSecondaryToken<?> getSubToken()
+ {
+ return subtoken;
+ }
+
+ @Override
+ public Class<Equipment> getTargetClass()
+ {
+ return Equipment.class;
+ }
+
+ @Override
+ public boolean isAllLegal()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isTypeLegal()
+ {
+ return true;
+ }
+
+ @Test
+ public void testEmpty()
+ {
+ // Just to get Eclipse to recognize this as a JUnit 4.0 Test Case
+ }
+
+ @Override
+ public boolean allowsParenAsSub()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean allowsFormula()
+ {
+ return false;
+ }
+
+ @Test
+ public void testInvalidEmptyPre() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1|"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidOnlyPre() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "PRERACE:1,Dwarf"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRoundRobinOnePre() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin(getSubTokenName() + '|' + "TestWP1|PRERACE:1,Dwarf");
+ }
+
+ @Test
+ public void testRoundRobinTwoPre() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin(getSubTokenName() + '|' + "TestWP1|PRECLASS:1,Fighter=3|PRERACE:1,Dwarf");
+ }
+
+ @Test
+ public void testRoundRobinDupeTwoPrereqs() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin(getSubTokenName() + '|' + "TestWP1|PRERACE:1,Dwarf",
+ getSubTokenName() + '|' + "TestWP1|PRERACE:1,Human");
+ }
+
+ @Test
+ public void testInvalidInputBadPrerequisite()
+ throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1|PREFOO:1,Human"));
+ assertNoSideEffects();
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/ShieldProfTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/ShieldProfTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/ShieldProfTokenTest.java 2008-12-31 03:55:56 UTC (rev 8744)
@@ -0,0 +1,229 @@
+/*
+ *
+ * Copyright (c) 2007 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.auto;
+
+import java.net.URISyntaxException;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.core.PCTemplate;
+import pcgen.core.ShieldProf;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.AutoLst;
+import plugin.lsttokens.testsupport.AbstractAddTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+import plugin.lsttokens.testsupport.TokenRegistration;
+import plugin.pretokens.parser.PreClassParser;
+import plugin.pretokens.parser.PreRaceParser;
+import plugin.pretokens.writer.PreClassWriter;
+import plugin.pretokens.writer.PreRaceWriter;
+
+public class ShieldProfTokenTest extends
+ AbstractAddTokenTestCase<CDOMObject, ShieldProf>
+{
+
+ PreClassParser preclass = new PreClassParser();
+ PreClassWriter preclasswriter = new PreClassWriter();
+ PreRaceParser prerace = new PreRaceParser();
+ PreRaceWriter preracewriter = new PreRaceWriter();
+
+ static AutoLst token = new AutoLst();
+ static ShieldProfToken subtoken = new ShieldProfToken();
+ static CDOMTokenLoader<CDOMObject> loader = new CDOMTokenLoader<CDOMObject>(
+ CDOMObject.class);
+
+ @Override
+ @Before
+ public void setUp() throws PersistenceLayerException, URISyntaxException
+ {
+ super.setUp();
+ TokenRegistration.register(preclass);
+ TokenRegistration.register(preclasswriter);
+ TokenRegistration.register(prerace);
+ TokenRegistration.register(preracewriter);
+ }
+
+ @Override
+ public char getJoinCharacter()
+ {
+ return '|';
+ }
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMLoader<CDOMObject> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Override
+ public CDOMSecondaryToken<?> getSubToken()
+ {
+ return subtoken;
+ }
+
+ @Override
+ public Class<ShieldProf> getTargetClass()
+ {
+ return ShieldProf.class;
+ }
+
+ @Override
+ public boolean isAllLegal()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isTypeLegal()
+ {
+ return true;
+ }
+
+ @Test
+ public void testEmpty()
+ {
+ // Just to get Eclipse to recognize this as a JUnit 4.0 Test Case
+ }
+
+ @Override
+ public boolean allowsParenAsSub()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean allowsFormula()
+ {
+ return false;
+ }
+
+ @Override
+ public String getTypePrefix()
+ {
+ return "SHIELD";
+ }
+
+ @Test
+ public void testRoundRobinList() throws PersistenceLayerException
+ {
+ runRoundRobin(getSubTokenName() + '|' + "%LIST");
+ }
+
+ @Test
+ public void testInvalidEmptyPre() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1[]"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyPre2() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1["));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyPre3() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ boolean parse = parse(getSubTokenName() + '|' + "TestWP1]");
+ if (parse)
+ {
+ assertFalse(primaryContext.ref.validate());
+ }
+ else
+ {
+ assertNoSideEffects();
+ }
+ }
+
+ @Test
+ public void testInvalidMismatchedBracket() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1[PRERACE:Dwarf"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidTrailingAfterBracket()
+ throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1[PRERACE:Dwarf]Hi"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRoundRobinOnePre() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin(getSubTokenName() + '|' + "TestWP1[PRERACE:1,Dwarf]");
+ }
+
+ @Test
+ public void testRoundRobinListPre() throws PersistenceLayerException
+ {
+ runRoundRobin(getSubTokenName() + '|' + "%LIST[PRERACE:1,Dwarf]");
+ }
+
+ @Test
+ public void testRoundRobinDupeTwoPrereqs() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin(getSubTokenName() + '|' + "TestWP1[PRERACE:1,Dwarf]",
+ getSubTokenName() + '|' + "TestWP1[PRERACE:1,Human]");
+ }
+
+ @Test
+ public void testInvalidInputBadPrerequisite()
+ throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1[PREFOO:1,Human]"));
+ assertNoSideEffects();
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/WeaponProfTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/WeaponProfTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/auto/WeaponProfTokenTest.java 2008-12-31 03:55:56 UTC (rev 8744)
@@ -0,0 +1,211 @@
+/*
+ *
+ * Copyright (c) 2007 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.auto;
+
+import org.junit.Test;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.core.PCTemplate;
+import pcgen.core.WeaponProf;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMLoader;
+import pcgen.rules.persistence.token.CDOMPrimaryToken;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.AutoLst;
+import plugin.lsttokens.testsupport.AbstractAddTokenTestCase;
+import plugin.lsttokens.testsupport.CDOMTokenLoader;
+
+public class WeaponProfTokenTest extends
+ AbstractAddTokenTestCase<CDOMObject, WeaponProf>
+{
+
+ static AutoLst token = new AutoLst();
+ static WeaponProfToken subtoken = new WeaponProfToken();
+ static CDOMTokenLoader<CDOMObject> loader = new CDOMTokenLoader<CDOMObject>(
+ CDOMObject.class);
+
+ @Override
+ public char getJoinCharacter()
+ {
+ return '|';
+ }
+
+ @Override
+ public Class<PCTemplate> getCDOMClass()
+ {
+ return PCTemplate.class;
+ }
+
+ @Override
+ public CDOMLoader<CDOMObject> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMPrimaryToken<CDOMObject> getToken()
+ {
+ return token;
+ }
+
+ @Override
+ public CDOMSecondaryToken<?> getSubToken()
+ {
+ return subtoken;
+ }
+
+ @Override
+ public Class<WeaponProf> getTargetClass()
+ {
+ return WeaponProf.class;
+ }
+
+ @Override
+ public boolean isAllLegal()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isTypeLegal()
+ {
+ return true;
+ }
+
+ @Test
+ public void testEmpty()
+ {
+ // Just to get Eclipse to recognize this as a JUnit 4.0 Test Case
+ }
+
+ @Override
+ public boolean allowsParenAsSub()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean allowsFormula()
+ {
+ return false;
+ }
+
+ @Test
+ public void testRoundRobinList() throws PersistenceLayerException
+ {
+ runRoundRobin(getSubTokenName() + '|' + "%LIST");
+ }
+
+ @Test
+ public void testRoundRobinDeityWeapons() throws PersistenceLayerException
+ {
+ runRoundRobin(getSubTokenName() + '|' + "DEITYWEAPONS");
+ }
+
+
+ @Test
+ public void testInvalidEmptyPre() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1[]"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyPre2() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1["));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidEmptyPre3() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ boolean parse = parse(getSubTokenName() + '|' + "TestWP1]");
+ if (parse)
+ {
+ assertFalse(primaryContext.ref.validate());
+ }
+ else
+ {
+ assertNoSideEffects();
+ }
+ }
+
+ @Test
+ public void testInvalidMismatchedBracket() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1[PRERACE:Dwarf"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testInvalidTrailingAfterBracket()
+ throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1[PRERACE:Dwarf]Hi"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRoundRobinOnePre() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin(getSubTokenName() + '|' + "TestWP1[PRERACE:1,Dwarf]");
+ }
+
+ @Test
+ public void testRoundRobinDupeTwoPrereqs() throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(primaryContext, "TestWP2");
+ construct(secondaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP2");
+ runRoundRobin(getSubTokenName() + '|' + "TestWP1[PRERACE:1,Dwarf]",
+ getSubTokenName() + '|' + "TestWP1[PRERACE:1,Human]");
+ }
+
+ @Test
+ public void testInvalidInputBadPrerequisite()
+ throws PersistenceLayerException
+ {
+ construct(primaryContext, "TestWP1");
+ construct(secondaryContext, "TestWP1");
+ assertFalse(parse(getSubTokenName() + '|' + "TestWP1[PREFOO:1,Human]"));
+ assertNoSideEffects();
+ }
+
+ @Test
+ public void testRoundRobinListPre() throws PersistenceLayerException
+ {
+ runRoundRobin(getSubTokenName() + '|' + "%LIST[PRERACE:1,Dwarf]");
+ }
+
+ @Test
+ public void testRoundRobinDeityWeaponsPre() throws PersistenceLayerException
+ {
+ runRoundRobin(getSubTokenName() + '|' + "DEITYWEAPONS[PRERACE:1,Dwarf]");
+ }
+}
Modified: Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractAddTokenTestCase.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractAddTokenTestCase.java 2008-12-31 03:55:19 UTC (rev 8743)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/testsupport/AbstractAddTokenTestCase.java 2008-12-31 03:55:56 UTC (rev 8744)
@@ -48,6 +48,11 @@
return "ALL";
}
+ public String getTypePrefix()
+ {
+ return "";
+ }
+
public abstract boolean allowsParenAsSub();
public abstract boolean allowsFormula();
@@ -168,7 +173,7 @@
{
if (isTypeLegal())
{
- assertFalse(parse(getSubTokenName() + '|' + "TYPE="));
+ assertFalse(parse(getSubTokenName() + '|' + getTypePrefix() + "TYPE="));
assertNoSideEffects();
}
}
@@ -179,7 +184,7 @@
{
if (isTypeLegal())
{
- assertFalse(parse(getSubTokenName() + '|' + "TYPE=One."));
+ assertFalse(parse(getSubTokenName() + '|' + getTypePrefix() + "TYPE=One."));
assertNoSideEffects();
}
}
@@ -190,7 +195,7 @@
{
if (isTypeLegal())
{
- assertFalse(parse(getSubTokenName() + '|' + "TYPE=One..Two"));
+ assertFalse(parse(getSubTokenName() + '|' + getTypePrefix() + "TYPE=One..Two"));
assertNoSideEffects();
}
}
@@ -201,7 +206,7 @@
{
if (isTypeLegal())
{
- assertFalse(parse(getSubTokenName() + '|' + "TYPE=.One"));
+ assertFalse(parse(getSubTokenName() + '|' + getTypePrefix() + "TYPE=.One"));
assertNoSideEffects();
}
}
@@ -239,7 +244,7 @@
{
try
{
- boolean parse = parse(getSubTokenName() + '|' + "TYPE=Foo");
+ boolean parse = parse(getSubTokenName() + '|' + getTypePrefix() + "TYPE=Foo");
if (parse)
{
// Only need to check if parsed as true
@@ -270,7 +275,7 @@
// {
// if (!isTypeLegal())
// {
- // assertTrue(token.parse(primaryContext, primaryProf, "TYPE=TestType"));
+ // assertTrue(token.parse(primaryContext, primaryProf, getTypePrefix() + "TYPE=TestType"));
// assertFalse(primaryContext.ref.validate());
// }
// }
@@ -337,7 +342,7 @@
{
construct(primaryContext, "TestWP1");
assertTrue(parse(getSubTokenName() + '|' + "TestWP1"
- + getJoinCharacter() + "TYPE=TestType" + getJoinCharacter()
+ + getJoinCharacter() + getTypePrefix() + "TYPE=TestType" + getJoinCharacter()
+ "TestWP2"));
assertFalse(primaryContext.ref.validate());
}
@@ -353,7 +358,7 @@
{
construct(primaryContext, "TestWP1");
assertTrue(parse(getSubTokenName() + '|' + "TestWP1"
- + getJoinCharacter() + "TYPE.TestType.OtherTestType"
+ + getJoinCharacter() + getTypePrefix() + "TYPE.TestType.OtherTestType"
+ getJoinCharacter() + "TestWP2"));
assertFalse(primaryContext.ref.validate());
}
@@ -371,17 +376,17 @@
assertTrue(primaryContext.ref.validate());
if (isTypeLegal())
{
- assertTrue(parse(getSubTokenName() + '|' + "TYPE=TestType"));
+ assertTrue(parse(getSubTokenName() + '|' + getTypePrefix() + "TYPE=TestType"));
assertTrue(primaryContext.ref.validate());
- assertTrue(parse(getSubTokenName() + '|' + "TYPE.TestType"));
+ assertTrue(parse(getSubTokenName() + '|' + getTypePrefix() + "TYPE.TestType"));
assertTrue(primaryContext.ref.validate());
assertTrue(parse(getSubTokenName() + '|' + "TestWP1"
+ getJoinCharacter() + "TestWP2" + getJoinCharacter()
- + "TYPE=TestType"));
+ + getTypePrefix() + "TYPE=TestType"));
assertTrue(primaryContext.ref.validate());
assertTrue(parse(getSubTokenName() + '|' + "TestWP1"
+ getJoinCharacter() + "TestWP2" + getJoinCharacter()
- + "TYPE=TestType.OtherTestType"));
+ + getTypePrefix() + "TYPE=TestType.OtherTestType"));
assertTrue(primaryContext.ref.validate());
}
if (isAllLegal())
@@ -475,7 +480,7 @@
construct(secondaryContext, "TestWP2");
runRoundRobin(getSubTokenName() + '|' + "TestWP1"
+ getJoinCharacter() + "TestWP2" + getJoinCharacter()
- + "TYPE=OtherTestType" + getJoinCharacter() + "TYPE=TestType");
+ + getTypePrefix() + "TYPE=OtherTestType" + getJoinCharacter() + getTypePrefix() + "TYPE=TestType");
}
}
@@ -484,7 +489,7 @@
{
if (isTypeLegal())
{
- runRoundRobin(getSubTokenName() + '|' + "TYPE=TestType");
+ runRoundRobin(getSubTokenName() + '|' + getTypePrefix() + "TYPE=TestType");
}
}
@@ -494,7 +499,7 @@
if (isTypeLegal())
{
runRoundRobin(getSubTokenName() + '|'
- + "TYPE=TestAltType.TestThirdType.TestType");
+ + getTypePrefix() + "TYPE=TestAltType.TestThirdType.TestType");
}
}
@@ -530,7 +535,7 @@
if (isTypeLegal() && isAllLegal())
{
assertFalse(parse(getSubTokenName() + '|' + getAllString()
- + getJoinCharacter() + "TYPE=TestType"));
+ + getJoinCharacter() + getTypePrefix() + "TYPE=TestType"));
assertNoSideEffects();
}
}
@@ -540,7 +545,7 @@
{
if (isTypeLegal() && isAllLegal())
{
- assertFalse(parse(getSubTokenName() + '|' + "TYPE=TestType"
+ assertFalse(parse(getSubTokenName() + '|' + getTypePrefix() + "TYPE=TestType"
+ getJoinCharacter() + getAllString()));
assertNoSideEffects();
}
@@ -563,7 +568,7 @@
assertTrue(parseSecondary(getSubTokenName() + '|' + "TestWP1"
+ getJoinCharacter() + "TestWP2"));
assertFalse(parse(getSubTokenName() + '|' + "TestWP3"
- + getJoinCharacter() + "TYPE="));
+ + getJoinCharacter() + getTypePrefix() + "TYPE="));
assertNoSideEffects();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|