use of org.matheclipse.parser.client.eval.DoubleEvaluator in project symja_android_library by axkr.
the class EvalDoubleTestCase method check.
public void check(String in, String compareWith) {
try {
DoubleEvaluator engine = new DoubleEvaluator();
double d = engine.evaluate(in);
assertEquals(Double.valueOf(d).toString(), compareWith);
} catch (Exception e) {
e.printStackTrace();
assertEquals("", e.getMessage());
}
}
use of org.matheclipse.parser.client.eval.DoubleEvaluator in project symja_android_library by axkr.
the class EvalDoubleCallbackTestCase method testMissingFunction009.
public void testMissingFunction009() {
try {
DoubleEvaluator engine = new DoubleEvaluator();
double d = engine.evaluate("aTest[1.0]");
assertEquals(Double.toString(d), "");
} catch (MathException e) {
assertEquals("EvalDouble#evaluateFunction(FunctionNode) not possible for: aTest(1.0)", e.getMessage());
}
}
use of org.matheclipse.parser.client.eval.DoubleEvaluator in project symja_android_library by axkr.
the class EvalDoubleCallbackTestCase method check.
public void check(String in, String compareWith) {
try {
DoubleEvaluator engine = new DoubleEvaluator();
double d = engine.evaluate(in);
assertEquals(Double.valueOf(d).toString(), compareWith);
} catch (Exception e) {
e.printStackTrace();
assertEquals(e.getMessage(), compareWith);
}
}
use of org.matheclipse.parser.client.eval.DoubleEvaluator in project symja_android_library by axkr.
the class EvalDoubleCallbackTestCase method testEval005.
public void testEval005() {
try {
IDoubleValue vd = new DoubleVariable(3.0);
DoubleEvaluator engine = new DoubleEvaluator();
engine.defineVariable("x", vd);
double d = engine.evaluate("x^2*x^2-1");
assertEquals(Double.valueOf(d).toString(), "80.0");
vd.setValue(4);
d = engine.evaluate();
assertEquals(Double.valueOf(d).toString(), "255.0");
} catch (Exception e) {
e.printStackTrace();
assertEquals("", e.getMessage());
}
}
use of org.matheclipse.parser.client.eval.DoubleEvaluator in project symja_android_library by axkr.
the class EvalDoubleCallbackTestCase 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());
}
}
Aggregations