Examples of DecimalEvaluator


Examples of com.googlecode.gql4j.GqlQuery.DecimalEvaluator

    assertEquals(
        new FunctionEvaluator("key",
            ImmutableList.<Evaluator>of(new StringEvaluator("'abc'"))),
        parser("key('abc')").value().r);
   
    assertEquals(new DecimalEvaluator("1"), parser("1").value().r);
  }
View Full Code Here

Examples of com.googlecode.gql4j.GqlQuery.DecimalEvaluator

    assertEquals(new DecimalEvaluator("1"), parser("1").value().r);
  }
 
  @Test
  public void testCondition_1() throws RecognitionException {
    Condition expected = new Condition("a", FilterOperator.EQUAL, new DecimalEvaluator("1"));   
    Condition actual = parser("a=1").condition().r;
   
    assertEquals(expected, actual);
  }
View Full Code Here

Examples of com.googlecode.gql4j.GqlQuery.DecimalEvaluator

 
  @Test
  public void testParseWhere_1() {
    ParseResult actual = GqlQuery.parse("SELECT * from a where a = 1");
    ParseResult expected = new ParseResult().setSelect(new Select(false)).setFrom(new From("a")).setWhere(
        new Where().withCondition(new Condition("a", FilterOperator.EQUAL, new DecimalEvaluator("1"))));
    assertEquals(expected, actual);
  }
View Full Code Here

Examples of com.googlecode.gql4j.GqlQuery.DecimalEvaluator

 
  @Test
  public void testParseWhere_2() {
    ParseResult actual = GqlQuery.parse("SELECT * from a where a = 1 and b <= '3'");
    ParseResult expected = new ParseResult().setSelect(new Select(false)).setFrom(new From("a")).setWhere(
        new Where().withCondition(new Condition("a", FilterOperator.EQUAL, new DecimalEvaluator("1")))
        .withCondition(new Condition("b", FilterOperator.LESS_THAN_OR_EQUAL, new StringEvaluator("'3'")))
        );
    assertEquals(expected, actual);
  }
View Full Code Here

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

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

   
    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

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

   
    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

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

*/
public class EvaluatorBasicTest {

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

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

    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

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

    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
TOP
Copyright © 2018 www.massapi.com. 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.