use of pcgen.base.formula.base.ManagerFactory in project pcgen by PCGen.
the class SetOrderedPairModifierTest method testInvalidConstruction.
@Test
public void testInvalidConstruction() {
try {
SetModifierFactory m = new SetModifierFactory();
m.getModifier(100, null, new ManagerFactory() {
}, null, null, null);
fail("Expected SetModifier with null set value to fail");
} catch (IllegalArgumentException | NullPointerException e) {
//Yep!
}
}
use of pcgen.base.formula.base.ManagerFactory in project pcgen by PCGen.
the class SetStringModifierTest method testInvalidConstruction.
@Test
public void testInvalidConstruction() {
try {
SetModifierFactory m = new SetModifierFactory();
m.getModifier(100, null, new ManagerFactory() {
}, null, null, null);
fail("Expected SetModifier with null set value to fail");
} catch (IllegalArgumentException | NullPointerException e) {
//Yep!
}
}
use of pcgen.base.formula.base.ManagerFactory in project pcgen by PCGen.
the class SetNumberModifierTest method testGetFormulaModifier.
@Test
public void testGetFormulaModifier() {
SplitFormulaSetup setup = new SplitFormulaSetup();
setup.loadBuiltIns();
setup.getLegalScopeLibrary().registerScope(varScope);
IndividualSetup iSetup = new IndividualSetup(setup, "Global", new SimpleVariableStore());
SetModifierFactory factory = new SetModifierFactory();
Modifier<Number> modifier = factory.getModifier(35, "6+5", new ManagerFactory() {
}, iSetup.getFormulaManager(), varScope, numManager);
assertEquals((35L << 32) + factory.getInherentPriority(), modifier.getPriority());
assertSame(Number.class, modifier.getVariableFormat());
EvaluationManager evalManager = EvalManagerUtilities.getInputEM(4.3);
assertEquals(11, modifier.process(evalManager.getWith(EvaluationManager.FMANAGER, iSetup.getFormulaManager())));
}
use of pcgen.base.formula.base.ManagerFactory in project pcgen by PCGen.
the class MultiplyNumberModifierTest method testInvalidConstruction.
@Test
public void testInvalidConstruction() {
try {
ModifierFactory m = new MultiplyModifierFactory();
m.getModifier(100, null, new ManagerFactory() {
}, null, null, null);
fail("Expected MultiplyModifier with null multiply value to fail");
} catch (IllegalArgumentException | NullPointerException e) {
//Yep!
}
}
use of pcgen.base.formula.base.ManagerFactory in project pcgen by PCGen.
the class MultiplyNumberModifierTest method testGetModifier.
@Test
public void testGetModifier() {
MultiplyModifierFactory factory = new MultiplyModifierFactory();
Modifier<Number> modifier = factory.getModifier(35, "6.5", new ManagerFactory() {
}, null, varScope, numManager);
assertEquals((35L << 32) + factory.getInherentPriority(), modifier.getPriority());
assertSame(Number.class, modifier.getVariableFormat());
assertEquals(27.95, modifier.process(EvalManagerUtilities.getInputEM(4.3)));
}
Aggregations