use of com.cinchapi.ccl.grammar.PostfixNotationSymbol in project concourse by cinchapi.
the class ConcourseCompilerTest method testParseCclTimestampNumericPhrase.
@Test
public void testParseCclTimestampNumericPhrase() {
String ccl = "name = jeff at \"" + Time.now() + "\"";
Queue<PostfixNotationSymbol> symbols = ConcourseCompiler.get().arrange((ConditionTree) ConcourseCompiler.get().parse(ccl));
ExpressionSymbol expr = (ExpressionSymbol) symbols.poll();
// this means a
Assert.assertNotEquals(0, expr.raw().timestamp());
// timestamp was
// parsed
}
use of com.cinchapi.ccl.grammar.PostfixNotationSymbol in project concourse by cinchapi.
the class ConcourseCompilerTest method testParseCclValueWithoutQuotes.
@Test
public void testParseCclValueWithoutQuotes() {
String ccl = "name = jeff nelson";
Queue<PostfixNotationSymbol> symbols = ConcourseCompiler.get().arrange((ConditionTree) ConcourseCompiler.get().parse(ccl));
ExpressionSymbol expr = (ExpressionSymbol) symbols.poll();
Assert.assertEquals("jeff nelson", expr.values().get(0).value());
}
use of com.cinchapi.ccl.grammar.PostfixNotationSymbol in project concourse by cinchapi.
the class ConcourseCompilerTest method testToPostfixNotationSimpleBetween.
@Test
public void testToPostfixNotationSimpleBetween() {
Criteria criteria = Criteria.where().key("foo").operator(Operator.BETWEEN).value("bar").value("baz").build();
Queue<PostfixNotationSymbol> pfn = Parsing.toPostfixNotation(criteria.symbols());
Assert.assertEquals(pfn.size(), 1);
Assert.assertEquals(((ExpressionSymbol) Iterables.getOnlyElement(pfn)).key(), new KeySymbol("foo"));
Assert.assertEquals(((ExpressionSymbol) Iterables.getOnlyElement(pfn)).values().get(0), new ValueSymbol("bar"));
Assert.assertEquals(((ExpressionSymbol) Iterables.getOnlyElement(pfn)).values().get(1), new ValueSymbol("baz"));
Assert.assertEquals(((ExpressionSymbol) Iterables.getOnlyElement(pfn)).operator(), new OperatorSymbol(Operator.BETWEEN));
}
use of com.cinchapi.ccl.grammar.PostfixNotationSymbol in project concourse by cinchapi.
the class ConcourseCompilerTest method testParseCCLConjuctionsWithAnd.
@Test
public void testParseCCLConjuctionsWithAnd() {
String ccl = "name = chandresh pancholi on last christmas day && favovite_player != C. Ronaldo during last year";
Queue<PostfixNotationSymbol> symbols = ConcourseCompiler.get().arrange((ConditionTree) ConcourseCompiler.get().parse(ccl));
Assert.assertEquals(3, symbols.size());
for (int i = 0; i < 2; i++) {
ExpressionSymbol expr = (ExpressionSymbol) symbols.poll();
Assert.assertTrue(expr.values().get(0).value().toString().contains(" "));
Assert.assertNotEquals(0, expr.raw().timestamp());
}
}
use of com.cinchapi.ccl.grammar.PostfixNotationSymbol in project concourse by cinchapi.
the class ConcourseCompilerTest method testParseCclTimestampPhraseWithoutQuotes.
@Test
public void testParseCclTimestampPhraseWithoutQuotes() {
String ccl = "name = jeff at 3 seconds ago";
Queue<PostfixNotationSymbol> symbols = ConcourseCompiler.get().arrange((ConditionTree) ConcourseCompiler.get().parse(ccl));
ExpressionSymbol expr = (ExpressionSymbol) symbols.poll();
// this means a
Assert.assertNotEquals(0, expr.raw().timestamp());
// timestamp was
// parsed
}
Aggregations