From 3828417f321386ff8ad5615a9747aeb8b875103b Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Thu, 12 Nov 2015 15:40:54 -0800 Subject: [PATCH] compound tests --- src/object-store/parser/parser.cpp | 4 ++-- src/object-store/parser/test.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/object-store/parser/parser.cpp b/src/object-store/parser/parser.cpp index bc4d6520..19b6b226 100644 --- a/src/object-store/parser/parser.cpp +++ b/src/object-store/parser/parser.cpp @@ -94,8 +94,8 @@ struct false_pred : pegtl_istring_t("falsepredicate") {}; struct not_pre : seq< sor< one< '!' >, seq< pegtl_istring_t("not") >, star< blank > > > {}; struct atom_pred : seq< opt< not_pre >, pad< sor< group_pred, true_pred, false_pred, comparison_pred >, blank > > {}; -struct and_op : sor< pad< two< '&' >, blank >, pad_plus< pegtl_istring_t("and"), blank > > {}; -struct or_op : sor< pad< two< '|' >, blank> , pad_plus< pegtl_istring_t("or"), blank > > {}; +struct and_op : pad< sor< two< '&' >, pegtl_istring_t("and") >, blank > {}; +struct or_op : pad< sor< two< '|' >, pegtl_istring_t("or") >, blank > {}; struct or_ext : if_must< or_op, pred > {}; struct and_ext : if_must< and_op, pred > {}; diff --git a/src/object-store/parser/test.cpp b/src/object-store/parser/test.cpp index 636ea316..e47dcee7 100644 --- a/src/object-store/parser/test.cpp +++ b/src/object-store/parser/test.cpp @@ -65,6 +65,15 @@ static std::vector valid_queries = { "NOT(0=0)", "not (0=0)", "NOT (!0=0)", + + // compound + "a==a && a==a", + "a==a || a==a", + "a==a&&a==a||a=a", + "a==a and a==a", + "a==a OR a==a", + "and=='AND'&&'or'=='||'", + "and == or && ORE > GRAND", }; static std::vector invalid_queries = { @@ -109,6 +118,13 @@ static std::vector invalid_queries = { "(!!0=0)", "0=0 !", + // compound + "a==a & a==a", + "a==a | a==a", + "a==a &| a==a", + "a==a && OR a==a", + "a==aORa==a", + "truepredicate &&", "truepredicate & truepredicate", };