use of pcgen.core.PlayerCharacter in project pcgen by PCGen.
the class ExportHandlerTest method testWpnLoop.
/**
* Test the behaviour of the weapon loop
* @throws IOException
*/
public void testWpnLoop() throws IOException {
PlayerCharacter character = getCharacter();
// Test each token for old and new syntax processing.
assertEquals("New format SKILL Token", "****", evaluateToken("FOR.0,100,1,**\\WEAPON.%.NAME\\**,NONE,NONE,1", character));
// Now assign a weapon
character.addEquipment(weapon);
EquipSet es = new EquipSet("1", "Default", "", weapon);
character.addEquipSet(es);
assertEquals("New format SKILL Token", "**TestWpn**", evaluateToken("FOR.0,100,1,**\\WEAPON.%.NAME\\**,NONE,NONE,1", character));
}
use of pcgen.core.PlayerCharacter in project pcgen by PCGen.
the class ExportHandlerTest method testEqtypeLoop.
/**
* Test the export of equipment using the eqtype token in a loop.
*
* @throws Exception
*/
public void testEqtypeLoop() throws Exception {
PlayerCharacter character = getCharacter();
final String gemLoop = "FOR.0,COUNT[EQTYPE.Gem],1,\\EQTYPE.Gem.%.NAME\\: \\EQTYPE.Gem.%.QTY\\, ,<br/>,1";
assertEquals("Gem Loop - no gems", "", evaluateToken(gemLoop, character));
// Now assign a gem
character.addEquipment(gem);
EquipSet es = new EquipSet("1", "Default", "", gem);
character.addEquipSet(es);
character.setDirty(true);
assertEquals("Gem loop - 1 gem", " TestGem: 1<br/>", evaluateToken(gemLoop, character));
}
use of pcgen.core.PlayerCharacter in project pcgen by PCGen.
the class ExportHandlerTest method testJepIif.
public void testJepIif() throws IOException {
PlayerCharacter character = getCharacter();
assertEquals("Basic JEP boolean", new Float(1.0), character.getVariableValue("max(0,2)==2", ""));
assertEquals("JEP boolean in IF", "true", evaluateToken("OIF(max(0,2)==2,true,false)", character));
// assertEquals("JEP boolean in IF", "true", evaluateToken(
// "|OIF(max(0,2)==2)|\ntrue\n|ELSE|\nfalse\n|ENDIF|", character));
}
use of pcgen.core.PlayerCharacter in project pcgen by PCGen.
the class ExportHandlerTest method testForNoMoreItems.
public void testForNoMoreItems() throws IOException {
PlayerCharacter pc = getCharacter();
assertEquals("Test for evaluates correctly", "SF", evaluateToken("FOR.0,100,1,\\ARMOR.SUIT.ALL.%.NAME\\,S,F,1", pc));
// Now assign a gem
pc.addEquipment(armor);
EquipSet es = new EquipSet("1", "Default", "", armor);
pc.addEquipSet(es);
assertEquals("Test for evaluates correctly", "STestArmorSuitFSF", evaluateToken("FOR.0,100,1,\\ARMOR.SUIT.ALL.%.NAME\\,S,F,1", pc));
}
use of pcgen.core.PlayerCharacter in project pcgen by PCGen.
the class TextTokenTest method testTextFormatting.
/**
* Test the output for positive numbers with fractions.
*/
public void testTextFormatting() {
TextToken tok = new TextToken();
ExportHandler eh = new ExportHandler(null);
PlayerCharacter character = getCharacter();
assertEquals("TEXT.LOWER.NAME", "the vitamins are in my fresh brussels sprouts", tok.getToken("TEXT.LOWER.NAME", character, eh));
assertEquals("TEXT.UPPER.NAME", "THE VITAMINS ARE IN MY FRESH BRUSSELS SPROUTS", tok.getToken("TEXT.UPPER.NAME", character, eh));
assertEquals("TEXT.SENTENCE.NAME", "The vitamins are in my fresh brussels sprouts", tok.getToken("TEXT.SENTENCE.NAME", character, eh));
assertEquals("TEXT.SENTENCE.NAME", "The vitamins are in my fresh brussels sprouts", tok.getToken("TEXT.SENTENCE.NAME", character, eh));
character.setPCAttribute(PCAttribute.NAME, "The Vitamins are in my Fresh Brussels Sprouts");
assertEquals("TEXT.SENTENCE.INTERESTS", "One potatoe. Two potatoe. More", tok.getToken("TEXT.SENTENCE.INTERESTS", character, eh));
assertEquals("TEXT.TITLE.NAME", "The Vitamins Are In My Fresh Brussels Sprouts", tok.getToken("TEXT.TITLE.NAME", getCharacter(), eh));
assertEquals("TEXT.TITLE.NAME", "One Potatoe. Two Potatoe. More", tok.getToken("TEXT.TITLE.INTERESTS", character, eh));
}
Aggregations