compound tests

This commit is contained in:
Ari Lazier 2015-11-12 15:40:54 -08:00
parent 5dda5f4b6b
commit 3828417f32
2 changed files with 18 additions and 2 deletions

View File

@ -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 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 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 and_op : pad< sor< two< '&' >, pegtl_istring_t("and") >, blank > {};
struct or_op : sor< pad< two< '|' >, blank> , pad_plus< pegtl_istring_t("or"), blank > > {}; struct or_op : pad< sor< two< '|' >, pegtl_istring_t("or") >, blank > {};
struct or_ext : if_must< or_op, pred > {}; struct or_ext : if_must< or_op, pred > {};
struct and_ext : if_must< and_op, pred > {}; struct and_ext : if_must< and_op, pred > {};

View File

@ -65,6 +65,15 @@ static std::vector<std::string> valid_queries = {
"NOT(0=0)", "NOT(0=0)",
"not (0=0)", "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<std::string> invalid_queries = { static std::vector<std::string> invalid_queries = {
@ -109,6 +118,13 @@ static std::vector<std::string> invalid_queries = {
"(!!0=0)", "(!!0=0)",
"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 & truepredicate", "truepredicate & truepredicate",
}; };