use of pcgen.base.formula.parse.SimpleNode in project pcgen by PCGen.
the class DropIntoContextFunctionTest method testInvalidWrongFormat1.
@Test
public void testInvalidWrongFormat1() {
String formula = "dropIntoContext(3,\"EquipKey\",3)";
SimpleNode node = TestUtilities.doParse(formula);
isNotValid(formula, node, numberManager, null);
}
use of pcgen.base.formula.parse.SimpleNode in project pcgen by PCGen.
the class InputFunctionTest method testGlobalChannelStrength.
@Test
public void testGlobalChannelStrength() {
VariableLibrary varLib = variableLibraryFacet.get(id.getDatasetID());
ScopeInstanceFactory instFactory = scopeFacet.get(id);
ScopeInstance globalInstance = instFactory.getGlobalInstance("Global");
varLib.assertLegalVariableID(ChannelUtilities.createVarName("STR"), globalInstance.getLegalScope(), numberManager);
VariableChannel<Number> strChannel = (VariableChannel<Number>) ChannelUtilities.getGlobalChannel(id, "STR");
String formula = "input(\"STR\")";
SimpleNode node = TestUtilities.doParse(formula);
isValid(formula, node, numberManager, null);
isStatic(formula, node, false);
evaluatesTo(formula, node, 0);
strChannel.set(2);
evaluatesTo(formula, node, 2);
Object rv = new ReconstructionVisitor().visit(node, new StringBuilder());
assertEquals(formula, rv.toString());
}
use of pcgen.base.formula.parse.SimpleNode in project pcgen by PCGen.
the class InputFunctionTest method testNotValidNoChannel.
@Test
public void testNotValidNoChannel() {
String formula = "input(\"notvalid\")";
SimpleNode node = TestUtilities.doParse(formula);
isNotValid(formula, node, numberManager, null);
}
use of pcgen.base.formula.parse.SimpleNode in project pcgen by PCGen.
the class InputFunctionTest method testNotValidNoVar.
@Test
public void testNotValidNoVar() {
String formula = "input(ab)";
SimpleNode node = TestUtilities.doParse(formula);
isNotValid(formula, node, numberManager, null);
}
use of pcgen.base.formula.parse.SimpleNode in project pcgen by PCGen.
the class InputFunctionTest method testInvalidTooFewArg.
@Test
public void testInvalidTooFewArg() {
String formula = "input()";
SimpleNode node = TestUtilities.doParse(formula);
isNotValid(formula, node, numberManager, null);
formula = "if(\"a\", \"b\")";
node = TestUtilities.doParse(formula);
isNotValid(formula, node, numberManager, null);
}
Aggregations