use of pcgen.base.formula.base.ManagerFactory in project pcgen by PCGen.
the class DivideNumberModifierTest method testInvalidConstruction.
@Test
public void testInvalidConstruction() {
try {
DivideModifierFactory m = new DivideModifierFactory();
m.getModifier(100, null, new ManagerFactory() {
}, null, null, null);
fail("Expected DivideModifierFactory with null divide value to fail");
} catch (IllegalArgumentException | NullPointerException e) {
//Yep!
}
}
use of pcgen.base.formula.base.ManagerFactory in project pcgen by PCGen.
the class SetOrderedPairModifierTest method testGetModifier.
@Test
public void testGetModifier() {
ModifierFactory<OrderedPair> factory = new SetModifierFactory();
Modifier<OrderedPair> modifier = factory.getModifier(5, "3,2", new ManagerFactory() {
}, null, varScope, opManager);
assertEquals(5L << 32, modifier.getPriority());
assertSame(OrderedPair.class, modifier.getVariableFormat());
assertEquals(new OrderedPair(3, 2), modifier.process(EvalManagerUtilities.getInputEM(new OrderedPair(5, 6))));
}
use of pcgen.base.formula.base.ManagerFactory in project pcgen by PCGen.
the class SetStringModifierTest method testGetModifier.
@Test
public void testGetModifier() {
ModifierFactory<String> factory = new SetModifierFactory();
Modifier<String> modifier = factory.getModifier(5, "MyString", new ManagerFactory() {
}, null, varScope, stringManager);
assertEquals(5L << 32, modifier.getPriority());
assertSame(String.class, modifier.getVariableFormat());
assertEquals("MyString", modifier.process(EvalManagerUtilities.getInputEM("Wrong Answer")));
}
use of pcgen.base.formula.base.ManagerFactory in project pcgen by PCGen.
the class MinNumberModifierTest method testInvalidConstruction.
@Test
public void testInvalidConstruction() {
try {
ModifierFactory m = new MinModifierFactory();
m.getModifier(100, null, new ManagerFactory() {
}, null, null, null);
fail("Expected MaxModifier with null compare value to fail");
} catch (IllegalArgumentException | NullPointerException e) {
//Yep!
}
}
use of pcgen.base.formula.base.ManagerFactory in project pcgen by PCGen.
the class SetNumberModifierTest method testGetModifier.
@Test
public void testGetModifier() {
SetModifierFactory factory = new SetModifierFactory();
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(6.5, modifier.process(EvalManagerUtilities.getInputEM(4.3)));
}
Aggregations