summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Wojciechowski <lucas@mapbox.com>2018-02-28 12:40:55 -0800
committerLucas Wojciechowski <lucas@mapbox.com>2018-02-28 12:42:47 -0800
commitbf13252bc877f719b2b2bb5490e8ca2d13118ac6 (patch)
treec94d7a37a0b7e8f046a960a82f8df286c99cb9bd
parentac3fc7873f2bd2b63ca79d822dabd50849cb5e19 (diff)
downloadqtlocation-mapboxgl-bf13252bc877f719b2b2bb5490e8ca2d13118ac6.tar.gz
Add expression filter tests
-rw-r--r--test/style/filter.test.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/style/filter.test.cpp b/test/style/filter.test.cpp
index ac91182934..6f261c43ec 100644
--- a/test/style/filter.test.cpp
+++ b/test/style/filter.test.cpp
@@ -99,3 +99,13 @@ TEST(Filter, ID) {
ASSERT_FALSE(filter("[\"==\", \"$id\", 1234]", {{ "id", uint64_t(1234) }}));
}
+
+TEST(Filter, Expression) {
+ ASSERT_TRUE(filter("[\"==\", [\"+\", 1, 1], 2]"));
+ ASSERT_FALSE(filter("[\"==\", [\"+\", 1, 1], 4]"));
+}
+
+TEST(Filter, PropertyExpression) {
+ ASSERT_TRUE(filter("[\"==\", [\"get\", \"two\"], 2]", {{"two", int64_t(2)}}));
+ ASSERT_FALSE(filter("[\"==\", [\"get\", \"two\"], 4]", {{"two", int64_t(2)}}));
+}