use of org.matheclipse.parser.client.eval.BooleanVariable in project symja_android_library by axkr.
the class EvalDoubleTestCase method testEval009.
public void testEval009() {
try {
DoubleEvaluator engine = new DoubleEvaluator();
BooleanVariable vb = new BooleanVariable(true);
engine.defineVariable("$1", vb);
double d = engine.evaluate("If[$1, 1, 0]");
Assert.assertEquals(d, 1d, DoubleEvaluator.EPSILON);
vb.setValue(false);
d = engine.evaluate();
Assert.assertEquals(d, 0d, DoubleEvaluator.EPSILON);
} catch (Exception e) {
e.printStackTrace();
Assert.assertEquals("", e.getMessage());
}
}
use of org.matheclipse.parser.client.eval.BooleanVariable in project symja_android_library by axkr.
the class EvalDoubleTestCase method testEval006.
public void testEval006() {
try {
DoubleEvaluator engine = new DoubleEvaluator();
BooleanVariable vb = new BooleanVariable(true);
engine.defineVariable("$1", vb);
BooleanVariable vb2 = new BooleanVariable(true);
engine.defineVariable("$2", vb2);
double d = engine.evaluate("If[$1 && $2, 1, 0]");
Assert.assertEquals(d, 1d, DoubleEvaluator.EPSILON);
vb.setValue(false);
d = engine.evaluate();
Assert.assertEquals(d, 0d, DoubleEvaluator.EPSILON);
} catch (Exception e) {
e.printStackTrace();
Assert.assertEquals("", e.getMessage());
}
}
Aggregations