summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-05-05 14:30:37 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-05-05 14:30:37 -0700
commit59a7fbf8e423790237287f1ea3c1a54d7eec64af (patch)
tree83086dc1d6eaace6dd95fa9391766cf2578a7f37 /test
parenta66901ed07e05eaaf91fd1feb59176389d81faa8 (diff)
downloadqtlocation-mapboxgl-59a7fbf8e423790237287f1ea3c1a54d7eec64af.tar.gz
[core] Implement has/!has filters (#4952)
Diffstat (limited to 'test')
-rw-r--r--test/style/filter.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/style/filter.cpp b/test/style/filter.cpp
index da0e5ff4a3..f258c31492 100644
--- a/test/style/filter.cpp
+++ b/test/style/filter.cpp
@@ -114,3 +114,25 @@ TEST(Filter, None) {
ASSERT_FALSE(evaluate(parse("[\"none\", [\"==\", \"foo\", 0], [\"==\", \"foo\", 1]]"),
{{ std::string("foo"), int64_t(1) }}));
}
+
+TEST(Filter, Has) {
+ ASSERT_TRUE(evaluate(parse("[\"has\", \"foo\"]"),
+ {{ std::string("foo"), int64_t(1) }}));
+ ASSERT_TRUE(evaluate(parse("[\"has\", \"foo\"]"),
+ {{ std::string("foo"), int64_t(0) }}));
+ ASSERT_TRUE(evaluate(parse("[\"has\", \"foo\"]"),
+ {{ std::string("foo"), false }}));
+ ASSERT_FALSE(evaluate(parse("[\"has\", \"foo\"]"),
+ {{}}));
+}
+
+TEST(Filter, NotHas) {
+ ASSERT_FALSE(evaluate(parse("[\"!has\", \"foo\"]"),
+ {{ std::string("foo"), int64_t(1) }}));
+ ASSERT_FALSE(evaluate(parse("[\"!has\", \"foo\"]"),
+ {{ std::string("foo"), int64_t(0) }}));
+ ASSERT_FALSE(evaluate(parse("[\"!has\", \"foo\"]"),
+ {{ std::string("foo"), false }}));
+ ASSERT_TRUE(evaluate(parse("[\"!has\", \"foo\"]"),
+ {{}}));
+}