use of pcgen.cdom.formula.VariableChannel 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());
}
Aggregations