Package org.yaac.server.egql.evaluator

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


                new BooleanEvaluator("TRUE"),
                new NotEvaluator(
                    new RelationEvaluator(
                        new FieldEvaluator("a"),
                        RelationEvaluator.Type.GREATER_THAN,
                        new DecimalEvaluator("10"))))));
   
    expected.setGroupByClause(new GroupByClause().add("a").add("b"));
   
    Assert.assertEquals(expected, actual);
 
View Full Code Here


   
    InsertStatement actual = TestUtil.parser(inputStr).insert_statement().stmt;
   
    InsertStatement expected = new InsertStatement().withKind("kind_a").withItem(
        new InsertItem("prop_1", new StringEvaluator("'a'"), true)
        ).withItem(new InsertItem("prop_2", new DecimalEvaluator("10"), true));
   
    Assert.assertEquals(expected, actual);
  }
View Full Code Here

   
    InsertStatement actual = TestUtil.parser(inputStr).insert_statement().stmt;
   
    InsertStatement expected = new InsertStatement().withKind("kind_a").withItem(
        new InsertItem("prop_1", new StringEvaluator("'a'"), true)
        ).withItem(new InsertItem("prop_2", new DecimalEvaluator("10"), false));
   
    Assert.assertEquals(expected, actual);
  }
View Full Code Here

*/
public class EvaluatorBasicTest {

  @Test
  public void testTerm() throws Exception {   
    Assert.assertEquals(new DecimalEvaluator("1"), parser("1").term().e);
  }
View Full Code Here

    Assert.assertEquals(new DecimalEvaluator("1"), parser("1").term().e);
  }
 
  @Test
  public void testUnary() throws Exception {
    Assert.assertEquals(new NegationEvaluator(new DecimalEvaluator("1")),
        parser("-1").unary().e);
   
    Assert.assertEquals(new NegationEvaluator(new DecimalEvaluator("1")),
        parser("---1").unary().e);
   
    Assert.assertEquals(new DecimalEvaluator("1"), parser("--1").unary().e);
   
    Assert.assertEquals(new DecimalEvaluator("1"), parser("--+1").unary().e);
   
    Assert.assertEquals(new DecimalEvaluator("1"), parser("+++++++1").unary().e);
  }
View Full Code Here

    Assert.assertEquals(new DecimalEvaluator("1"), parser("+++++++1").unary().e);
  }
 
  @Test
  public void testMult() throws Exception {
    Assert.assertEquals(new MultiplyEvaluator(new DecimalEvaluator("1"), new DecimalEvaluator("2")),
        parser("1*2").mult().e);
   
    Assert.assertEquals(new DivideEvaluator(new DecimalEvaluator("1"), new DecimalEvaluator("2")),
        parser("1/2").mult().e);
   
    Assert.assertEquals(new DivideEvaluator(new NegationEvaluator(new DecimalEvaluator("1")), new DecimalEvaluator("2")),
        parser("-1 / 2").mult().e);
   
    Assert.assertEquals(new MultiplyEvaluator(new MultiplyEvaluator(
        new DecimalEvaluator("1"), new DecimalEvaluator("2")), new DecimalEvaluator("3")),
        parser("1*2*3").mult().e);
   
    Assert.assertEquals(new DivideEvaluator(
        new NegationEvaluator(new DecimalEvaluator("1")),
        new NegationEvaluator(new DecimalEvaluator("2"))),
        parser("---1/+-+2").mult().e);
  }
View Full Code Here

        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.DecimalEvaluator

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.