Package org.yaac.server.egql.evaluator

Examples of org.yaac.server.egql.evaluator.AddEvaluator


        parser("---1/+-+2").mult().e);
  }
 
  @Test
  public void testExpression() throws Exception {
    Assert.assertEquals(new AddEvaluator(new DecimalEvaluator("1"), new DecimalEvaluator("2")),
        parser("1+2").expression().e);
   
    Assert.assertEquals(new SubtractEvaluator(new DecimalEvaluator("1"), new DecimalEvaluator("2")),
        parser("1-2").expression().e);
   
    Assert.assertEquals(new SubtractEvaluator(
        new MultiplyEvaluator(new DecimalEvaluator("1"), new DecimalEvaluator("2")),
        new DecimalEvaluator("2")),
        parser("1*2-2").expression().e);
   
    Assert.assertEquals(new AddEvaluator(
        new MultiplyEvaluator(new DecimalEvaluator("1"), new DecimalEvaluator("2")),
        new MultiplyEvaluator(new DecimalEvaluator("3"), new DecimalEvaluator("4"))),
        parser("1*2 + 3 * 4").expression().e);
  }
 
View Full Code Here


  }
 
  @Test
  public void testNestedExpression() throws Exception {
    Assert.assertEquals(new MultiplyEvaluator(
        new AddEvaluator(new DecimalEvaluator("2"), new DecimalEvaluator("3")),
        new DecimalEvaluator("4")),
        parser("(2 + 3) * 4").expression().e);
  }
 
View Full Code Here

TOP

Related Classes of org.yaac.server.egql.evaluator.AddEvaluator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.