use of org.apache.ratis.examples.arithmetic.expression.Variable in project incubator-ratis by apache.
the class TestAssignCli method createExpression.
@Test
public void createExpression() throws Exception {
Assert.assertEquals(new DoubleValue(2.0), new Assign().createExpression("2.0"));
Assert.assertEquals(MULT.apply(2.0, new Variable("a")), new Assign().createExpression("2*a"));
Assert.assertEquals(ADD.apply(2.0, 1.0), new Assign().createExpression("2+1"));
Assert.assertEquals(ADD.apply(new Variable("a"), new Variable("b")), new Assign().createExpression("a+b"));
Assert.assertEquals(SQRT.apply(new Variable("a")), new Assign().createExpression("√a"));
Assert.assertEquals(SQRT.apply(2.0), new Assign().createExpression("√2"));
}
Aggregations