mirror of
https://github.com/status-im/realm-js.git
synced 2025-03-03 15:40:40 +00:00
bool tests
This commit is contained in:
parent
fdf1fbd12b
commit
aeb1e7ecb3
@ -220,6 +220,9 @@ struct ValueGetter<bool, TableGetter> {
|
|||||||
if (value.type == parser::Expression::Type::Argument) {
|
if (value.type == parser::Expression::Type::Argument) {
|
||||||
return args.bool_for_argument(std::stoi(value.s));
|
return args.bool_for_argument(std::stoi(value.s));
|
||||||
}
|
}
|
||||||
|
if (value.type != parser::Expression::Type::True && value.type != parser::Expression::Type::False) {
|
||||||
|
throw std::runtime_error("Attempting to compare bool property to a non-bool value");
|
||||||
|
}
|
||||||
return value.type == parser::Expression::Type::True;
|
return value.type == parser::Expression::Type::True;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -74,6 +74,7 @@ static std::vector<std::string> valid_queries = {
|
|||||||
"a==a OR a==a",
|
"a==a OR a==a",
|
||||||
"and=='AND'&&'or'=='||'",
|
"and=='AND'&&'or'=='||'",
|
||||||
"and == or && ORE > GRAND",
|
"and == or && ORE > GRAND",
|
||||||
|
"a=1AND NOTb=2",
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::vector<std::string> invalid_queries = {
|
static std::vector<std::string> invalid_queries = {
|
||||||
@ -124,6 +125,7 @@ static std::vector<std::string> invalid_queries = {
|
|||||||
"a==a &| a==a",
|
"a==a &| a==a",
|
||||||
"a==a && OR a==a",
|
"a==a && OR a==a",
|
||||||
"a==aORa==a",
|
"a==aORa==a",
|
||||||
|
"a=1ANDNOT b=2",
|
||||||
|
|
||||||
"truepredicate &&",
|
"truepredicate &&",
|
||||||
"truepredicate & truepredicate",
|
"truepredicate & truepredicate",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user