summaryrefslogtreecommitdiff
path: root/test/util
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-01-17 10:20:10 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-01-18 13:38:05 -0600
commitd076ba05673a6ced9d3e641e2c7a2b5f3c70a80f (patch)
treede58d4c34b6c63d182e0f19630a16f66cff7865e /test/util
parent14fe15e3fc2b4c3013806047d202b3ca6beed259 (diff)
downloadqtlocation-mapboxgl-d076ba05673a6ced9d3e641e2c7a2b5f3c70a80f.tar.gz
[core] Clean up merge_lines.cpp and add bounds checking
Diffstat (limited to 'test/util')
-rw-r--r--test/util/merge_lines.test.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/util/merge_lines.test.cpp b/test/util/merge_lines.test.cpp
index 4856a734fe..9a8f01ef35 100644
--- a/test/util/merge_lines.test.cpp
+++ b/test/util/merge_lines.test.cpp
@@ -76,3 +76,27 @@ TEST(MergeLines, CircularLines) {
EXPECT_TRUE(input3[i].geometry == expected3[i].geometry);
}
}
+
+TEST(MergeLines, EmptyOuterGeometry) {
+ std::vector<mbgl::SymbolFeature> input = {
+ { FeatureType::LineString, {}, aaa, {}, 0 },
+ };
+
+ const std::vector<mbgl::SymbolFeature> expected = input;
+
+ mbgl::util::mergeLines(input);
+
+ EXPECT_EQ(expected[0].geometry, input[0].geometry);
+}
+
+TEST(MergeLines, EmptyInnerGeometry) {
+ std::vector<mbgl::SymbolFeature> input = {
+ { FeatureType::LineString, {{}}, aaa, {}, 0 },
+ };
+
+ const std::vector<mbgl::SymbolFeature> expected = input;
+
+ mbgl::util::mergeLines(input);
+
+ EXPECT_EQ(expected[0].geometry, input[0].geometry);
+}