use of org.nfunk.jep.function.PostfixMathCommandI in project pcgen by PCGen.
the class IfCommandTest method testIf03.
/* Test the case where the condition is a false boolean */
public void testIf03() {
final PostfixMathCommandI c = new IfCommand();
final Stack<Boolean> s = new Stack<>();
s.push(false);
s.push(false);
s.push(true);
runIf(s, c);
final Boolean result = s.pop();
is(result, eq(true), "if (false,false,true) returns true");
}
use of org.nfunk.jep.function.PostfixMathCommandI in project pcgen by PCGen.
the class OrCommandTest method testOr04.
/* Test the case where false and zero are skipped */
public void testOr04() {
final PostfixMathCommandI c = new OrCommand();
final Stack s = new Stack();
s.push(0.0);
s.push(false);
s.push(true);
c.setCurNumberOfParameters(3);
runOr(s, c);
final Object result = s.pop();
is(result, eq(true), "if (0.0,false,true) returns true");
}
use of org.nfunk.jep.function.PostfixMathCommandI in project pcgen by PCGen.
the class IfCommandTest method testIf01.
/* Test the case where the condition is a zero double */
public void testIf01() {
final PostfixMathCommandI c = new IfCommand();
final Stack<Double> s = new Stack<>();
s.push(0.0);
s.push(1.0);
s.push(2.0);
runIf(s, c);
final Double result = s.pop();
is(result, eq(2.0, 0.1), "if (0.0,1.0,2.0) returns 2.0");
}
use of org.nfunk.jep.function.PostfixMathCommandI in project pcgen by PCGen.
the class IsgamemodeCommandTest method runIsgamemode.
/**
* Run isgamemode.
*
* @param stack the stack
*
* @return true, if successful
*/
private static boolean runIsgamemode(final Stack stack) {
final PostfixMathCommandI pCommand = new IsgamemodeCommand();
boolean b;
try {
pCommand.run(stack);
b = true;
} catch (ParseException e) {
b = false;
}
return b;
}
use of org.nfunk.jep.function.PostfixMathCommandI in project pcgen by PCGen.
the class OrCommandTest method testOr03.
/* Test the case where the first two operands are false*/
public void testOr03() {
final PostfixMathCommandI c = new OrCommand();
final Stack<Boolean> s = new Stack<>();
s.push(false);
s.push(false);
s.push(true);
c.setCurNumberOfParameters(3);
runOr(s, c);
final Boolean result = s.pop();
is(result, eq(true), "if (false,false,true) returns true");
}
Aggregations