summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Wojciechowski <lucas@mapbox.com>2018-02-28 12:40:55 -0800
committerLucas Wojciechowski <lucas@mapbox.com>2018-03-07 11:46:17 -0800
commitbd9e8b615013af903884249da4054f969c8cfadc (patch)
tree3fc3f30aa27f89429ebf0d13896a82efb8f3b03f
parent777dd63a08f17832cc340e30f8629a3a7a000af8 (diff)
downloadqtlocation-mapboxgl-bd9e8b615013af903884249da4054f969c8cfadc.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)}}));
+}