summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/miscellaneous/clip_ids.cpp127
-rw-r--r--test/miscellaneous/tile.cpp82
2 files changed, 105 insertions, 104 deletions
diff --git a/test/miscellaneous/clip_ids.cpp b/test/miscellaneous/clip_ids.cpp
index 845b094520..cf7ebb398b 100644
--- a/test/miscellaneous/clip_ids.cpp
+++ b/test/miscellaneous/clip_ids.cpp
@@ -4,6 +4,7 @@
#include <algorithm>
#include <mbgl/util/clip_ids.hpp>
+#include <mbgl/map/tile.hpp>
#include <mbgl/util/std.hpp>
using namespace mbgl;
@@ -29,11 +30,11 @@ template <typename T> void print(const T &sources) {
TEST(ClipIDs, ParentAndFourChildren) {
const std::vector<std::vector<std::shared_ptr<Tile>>> sources = {
{
- std::make_shared<Tile>(Tile::ID { 1, 0, 0 }),
- std::make_shared<Tile>(Tile::ID { 1, 0, 1 }),
- std::make_shared<Tile>(Tile::ID { 1, 1, 0 }),
- std::make_shared<Tile>(Tile::ID { 1, 1, 1 }),
- std::make_shared<Tile>(Tile::ID { 0, 0, 0 }),
+ std::make_shared<Tile>(TileID { 1, 0, 0 }),
+ std::make_shared<Tile>(TileID { 1, 0, 1 }),
+ std::make_shared<Tile>(TileID { 1, 1, 0 }),
+ std::make_shared<Tile>(TileID { 1, 1, 1 }),
+ std::make_shared<Tile>(TileID { 0, 0, 0 }),
},
};
@@ -50,11 +51,11 @@ TEST(ClipIDs, ParentAndFourChildren) {
TEST(ClipIDs, ParentAndFourChildrenNegative) {
const std::vector<std::vector<std::shared_ptr<Tile>>> sources = {
{
- std::make_shared<Tile>(Tile::ID { 1, -2, 0 }),
- std::make_shared<Tile>(Tile::ID { 1, -2, 1 }),
- std::make_shared<Tile>(Tile::ID { 1, -1, 0 }),
- std::make_shared<Tile>(Tile::ID { 1, -1, 1 }),
- std::make_shared<Tile>(Tile::ID { 0, -1, 0 }),
+ std::make_shared<Tile>(TileID { 1, -2, 0 }),
+ std::make_shared<Tile>(TileID { 1, -2, 1 }),
+ std::make_shared<Tile>(TileID { 1, -1, 0 }),
+ std::make_shared<Tile>(TileID { 1, -1, 1 }),
+ std::make_shared<Tile>(TileID { 0, -1, 0 }),
},
};
@@ -71,11 +72,11 @@ TEST(ClipIDs, ParentAndFourChildrenNegative) {
TEST(ClipIDs, NegativeParentAndMissingLevel) {
const std::vector<std::vector<std::shared_ptr<Tile>>> sources = {
{
- std::make_shared<Tile>(Tile::ID { 1, -1, 0 }),
- std::make_shared<Tile>(Tile::ID { 2, -1, 0 }),
- std::make_shared<Tile>(Tile::ID { 2, -2, 1 }),
- std::make_shared<Tile>(Tile::ID { 2, -1, 1 }),
- std::make_shared<Tile>(Tile::ID { 2, -2, 0 }),
+ std::make_shared<Tile>(TileID { 1, -1, 0 }),
+ std::make_shared<Tile>(TileID { 2, -1, 0 }),
+ std::make_shared<Tile>(TileID { 2, -2, 1 }),
+ std::make_shared<Tile>(TileID { 2, -1, 1 }),
+ std::make_shared<Tile>(TileID { 2, -2, 0 }),
},
};
@@ -93,13 +94,13 @@ TEST(ClipIDs, NegativeParentAndMissingLevel) {
TEST(ClipIDs, SevenOnSameLevel) {
const std::vector<std::vector<std::shared_ptr<Tile>>> sources = {
{
- std::make_shared<Tile>(Tile::ID { 2, 0, 0 }),
- std::make_shared<Tile>(Tile::ID { 2, 0, 1 }),
- std::make_shared<Tile>(Tile::ID { 2, 0, 2 }),
- std::make_shared<Tile>(Tile::ID { 2, 1, 0 }),
- std::make_shared<Tile>(Tile::ID { 2, 1, 1 }),
- std::make_shared<Tile>(Tile::ID { 2, 1, 2 }),
- std::make_shared<Tile>(Tile::ID { 2, 2, 0 }),
+ std::make_shared<Tile>(TileID { 2, 0, 0 }),
+ std::make_shared<Tile>(TileID { 2, 0, 1 }),
+ std::make_shared<Tile>(TileID { 2, 0, 2 }),
+ std::make_shared<Tile>(TileID { 2, 1, 0 }),
+ std::make_shared<Tile>(TileID { 2, 1, 1 }),
+ std::make_shared<Tile>(TileID { 2, 1, 2 }),
+ std::make_shared<Tile>(TileID { 2, 2, 0 }),
},
};
@@ -118,18 +119,18 @@ TEST(ClipIDs, SevenOnSameLevel) {
TEST(ClipIDs, MultipleLevels) {
const std::vector<std::vector<std::shared_ptr<Tile>>> sources = {
{
- std::make_shared<Tile>(Tile::ID { 2, 0, 0 }),
- std::make_shared<Tile>(Tile::ID { 3, 0, 0 }),
- std::make_shared<Tile>(Tile::ID { 3, 0, 1 }),
- std::make_shared<Tile>(Tile::ID { 4, 0, 2 }),
- std::make_shared<Tile>(Tile::ID { 4, 1, 2 }),
- std::make_shared<Tile>(Tile::ID { 4, 0, 3 }),
- std::make_shared<Tile>(Tile::ID { 4, 1, 3 }),
- std::make_shared<Tile>(Tile::ID { 3, 1, 0 }),
- std::make_shared<Tile>(Tile::ID { 3, 1, 1 }),
- std::make_shared<Tile>(Tile::ID { 2, 1, 0 }),
- std::make_shared<Tile>(Tile::ID { 3, 2, 0 }),
- std::make_shared<Tile>(Tile::ID { 3, 2, 1 }),
+ std::make_shared<Tile>(TileID { 2, 0, 0 }),
+ std::make_shared<Tile>(TileID { 3, 0, 0 }),
+ std::make_shared<Tile>(TileID { 3, 0, 1 }),
+ std::make_shared<Tile>(TileID { 4, 0, 2 }),
+ std::make_shared<Tile>(TileID { 4, 1, 2 }),
+ std::make_shared<Tile>(TileID { 4, 0, 3 }),
+ std::make_shared<Tile>(TileID { 4, 1, 3 }),
+ std::make_shared<Tile>(TileID { 3, 1, 0 }),
+ std::make_shared<Tile>(TileID { 3, 1, 1 }),
+ std::make_shared<Tile>(TileID { 2, 1, 0 }),
+ std::make_shared<Tile>(TileID { 3, 2, 0 }),
+ std::make_shared<Tile>(TileID { 3, 2, 1 }),
},
};
@@ -154,17 +155,17 @@ TEST(ClipIDs, MultipleLevels) {
TEST(ClipIDs, Bug206) {
const std::vector<std::vector<std::shared_ptr<Tile>>> sources = {
{
- std::make_shared<Tile>(Tile::ID { 10, 162, 395 }),
- std::make_shared<Tile>(Tile::ID { 10, 162, 396 }),
- std::make_shared<Tile>(Tile::ID { 10, 163, 395 }),
- std::make_shared<Tile>(Tile::ID { 11, 326, 791 }),
- std::make_shared<Tile>(Tile::ID { 12, 654, 1582 }),
- std::make_shared<Tile>(Tile::ID { 12, 654, 1583 }),
- std::make_shared<Tile>(Tile::ID { 12, 655, 1582 }),
- std::make_shared<Tile>(Tile::ID { 12, 655, 1583 }),
- std::make_shared<Tile>(Tile::ID { 10, 163, 396 }),
- std::make_shared<Tile>(Tile::ID { 10, 164, 395 }),
- std::make_shared<Tile>(Tile::ID { 10, 164, 396 }),
+ std::make_shared<Tile>(TileID { 10, 162, 395 }),
+ std::make_shared<Tile>(TileID { 10, 162, 396 }),
+ std::make_shared<Tile>(TileID { 10, 163, 395 }),
+ std::make_shared<Tile>(TileID { 11, 326, 791 }),
+ std::make_shared<Tile>(TileID { 12, 654, 1582 }),
+ std::make_shared<Tile>(TileID { 12, 654, 1583 }),
+ std::make_shared<Tile>(TileID { 12, 655, 1582 }),
+ std::make_shared<Tile>(TileID { 12, 655, 1583 }),
+ std::make_shared<Tile>(TileID { 10, 163, 396 }),
+ std::make_shared<Tile>(TileID { 10, 164, 395 }),
+ std::make_shared<Tile>(TileID { 10, 164, 396 }),
},
};
@@ -188,23 +189,23 @@ TEST(ClipIDs, Bug206) {
TEST(ClipIDs, MultipleSources) {
const std::vector<std::vector<std::shared_ptr<Tile>>> sources = {
{
- std::make_shared<Tile>(Tile::ID { 0, 0, 0 }),
- std::make_shared<Tile>(Tile::ID { 1, 1, 1 }),
- std::make_shared<Tile>(Tile::ID { 2, 2, 1 }),
- std::make_shared<Tile>(Tile::ID { 2, 2, 2 }),
+ std::make_shared<Tile>(TileID { 0, 0, 0 }),
+ std::make_shared<Tile>(TileID { 1, 1, 1 }),
+ std::make_shared<Tile>(TileID { 2, 2, 1 }),
+ std::make_shared<Tile>(TileID { 2, 2, 2 }),
},
{
- std::make_shared<Tile>(Tile::ID { 0, 0, 0 }),
- std::make_shared<Tile>(Tile::ID { 1, 1, 1 }),
- std::make_shared<Tile>(Tile::ID { 2, 1, 1 }),
- std::make_shared<Tile>(Tile::ID { 2, 2, 2 }),
+ std::make_shared<Tile>(TileID { 0, 0, 0 }),
+ std::make_shared<Tile>(TileID { 1, 1, 1 }),
+ std::make_shared<Tile>(TileID { 2, 1, 1 }),
+ std::make_shared<Tile>(TileID { 2, 2, 2 }),
},
{
- std::make_shared<Tile>(Tile::ID { 1, 0, 0 }),
- std::make_shared<Tile>(Tile::ID { 1, 0, 1 }),
- std::make_shared<Tile>(Tile::ID { 1, 1, 0 }),
- std::make_shared<Tile>(Tile::ID { 1, 1, 1 }),
- std::make_shared<Tile>(Tile::ID { 2, 1, 1 }),
+ std::make_shared<Tile>(TileID { 1, 0, 0 }),
+ std::make_shared<Tile>(TileID { 1, 0, 1 }),
+ std::make_shared<Tile>(TileID { 1, 1, 0 }),
+ std::make_shared<Tile>(TileID { 1, 1, 1 }),
+ std::make_shared<Tile>(TileID { 2, 1, 1 }),
},
};
@@ -230,13 +231,13 @@ TEST(ClipIDs, MultipleSources) {
TEST(ClipIDs, DuplicateIDs) {
const std::vector<std::vector<std::shared_ptr<Tile>>> sources = {
{
- std::make_shared<Tile>(Tile::ID { 2, 0, 0 }),
- std::make_shared<Tile>(Tile::ID { 2, 0, 1 }),
+ std::make_shared<Tile>(TileID { 2, 0, 0 }),
+ std::make_shared<Tile>(TileID { 2, 0, 1 }),
},
{
- std::make_shared<Tile>(Tile::ID { 2, 0, 0 }),
- std::make_shared<Tile>(Tile::ID { 2, 0, 1 }),
- std::make_shared<Tile>(Tile::ID { 2, 0, 1 }),
+ std::make_shared<Tile>(TileID { 2, 0, 0 }),
+ std::make_shared<Tile>(TileID { 2, 0, 1 }),
+ std::make_shared<Tile>(TileID { 2, 0, 1 }),
}
};
diff --git a/test/miscellaneous/tile.cpp b/test/miscellaneous/tile.cpp
index 01da68f10d..6c5c89ac43 100644
--- a/test/miscellaneous/tile.cpp
+++ b/test/miscellaneous/tile.cpp
@@ -1,50 +1,50 @@
#include <iostream>
#include "../fixtures/util.hpp"
-#include <mbgl/map/tile.hpp>
+#include <mbgl/map/tile_id.hpp>
using namespace mbgl;
TEST(Variant, isChild) {
- ASSERT_TRUE(Tile::ID(1, 0, 0).isChildOf(Tile::ID(0, 0, 0)));
- ASSERT_TRUE(Tile::ID(1, 1, 0).isChildOf(Tile::ID(0, 0, 0)));
- ASSERT_TRUE(Tile::ID(1, 2, 0).isChildOf(Tile::ID(0, 1, 0)));
- ASSERT_TRUE(Tile::ID(1, 3, 0).isChildOf(Tile::ID(0, 1, 0)));
- ASSERT_TRUE(Tile::ID(1, 4, 0).isChildOf(Tile::ID(0, 2, 0)));
- ASSERT_TRUE(Tile::ID(1, 5, 0).isChildOf(Tile::ID(0, 2, 0)));
- ASSERT_TRUE(Tile::ID(2, 0, 0).isChildOf(Tile::ID(0, 0, 0)));
-
- ASSERT_TRUE(Tile::ID(2, 8, 0).isChildOf(Tile::ID(0, 2, 0)));
- ASSERT_TRUE(Tile::ID(2, 9, 0).isChildOf(Tile::ID(0, 2, 0)));
- ASSERT_TRUE(Tile::ID(2, 10, 0).isChildOf(Tile::ID(0, 2, 0)));
- ASSERT_TRUE(Tile::ID(2, 11, 0).isChildOf(Tile::ID(0, 2, 0)));
- ASSERT_TRUE(Tile::ID(2, 12, 0).isChildOf(Tile::ID(0, 3, 0)));
- ASSERT_TRUE(Tile::ID(2, 13, 0).isChildOf(Tile::ID(0, 3, 0)));
-
- ASSERT_TRUE(Tile::ID(1, -1, 0).isChildOf(Tile::ID(0, -1, 0)));
- ASSERT_TRUE(Tile::ID(1, -2, 0).isChildOf(Tile::ID(0, -1, 0)));
- ASSERT_TRUE(Tile::ID(1, -3, 0).isChildOf(Tile::ID(0, -2, 0)));
- ASSERT_TRUE(Tile::ID(1, -4, 0).isChildOf(Tile::ID(0, -2, 0)));
- ASSERT_TRUE(Tile::ID(2, -1, 0).isChildOf(Tile::ID(0, -1, 0)));
- ASSERT_TRUE(Tile::ID(2, -2, 0).isChildOf(Tile::ID(0, -1, 0)));
- ASSERT_TRUE(Tile::ID(2, -3, 0).isChildOf(Tile::ID(0, -1, 0)));
- ASSERT_TRUE(Tile::ID(2, -4, 0).isChildOf(Tile::ID(0, -1, 0)));
- ASSERT_TRUE(Tile::ID(2, -5, 0).isChildOf(Tile::ID(0, -2, 0)));
- ASSERT_TRUE(Tile::ID(2, -6, 0).isChildOf(Tile::ID(0, -2, 0)));
- ASSERT_TRUE(Tile::ID(2, -7, 0).isChildOf(Tile::ID(0, -2, 0)));
- ASSERT_TRUE(Tile::ID(2, -8, 0).isChildOf(Tile::ID(0, -2, 0)));
-
- ASSERT_FALSE(Tile::ID(4, -16, 0).isChildOf(Tile::ID(0, -2, 0)));
- ASSERT_TRUE(Tile::ID(4, -17, 0).isChildOf(Tile::ID(0, -2, 0)));
-
- ASSERT_TRUE(Tile::ID(2, -1, 0).isChildOf(Tile::ID(1, -1, 0)));
- ASSERT_TRUE(Tile::ID(2, -2, 0).isChildOf(Tile::ID(1, -1, 0)));
- ASSERT_TRUE(Tile::ID(2, -3, 0).isChildOf(Tile::ID(1, -2, 0)));
- ASSERT_TRUE(Tile::ID(2, -4, 0).isChildOf(Tile::ID(1, -2, 0)));
- ASSERT_TRUE(Tile::ID(3, -1, 0).isChildOf(Tile::ID(1, -1, 0)));
- ASSERT_TRUE(Tile::ID(3, -2, 0).isChildOf(Tile::ID(1, -1, 0)));
- ASSERT_TRUE(Tile::ID(3, -3, 0).isChildOf(Tile::ID(1, -1, 0)));
- ASSERT_TRUE(Tile::ID(3, -4, 0).isChildOf(Tile::ID(1, -1, 0)));
- ASSERT_TRUE(Tile::ID(3, -5, 0).isChildOf(Tile::ID(1, -2, 0)));
+ ASSERT_TRUE(TileID(1, 0, 0).isChildOf(TileID(0, 0, 0)));
+ ASSERT_TRUE(TileID(1, 1, 0).isChildOf(TileID(0, 0, 0)));
+ ASSERT_TRUE(TileID(1, 2, 0).isChildOf(TileID(0, 1, 0)));
+ ASSERT_TRUE(TileID(1, 3, 0).isChildOf(TileID(0, 1, 0)));
+ ASSERT_TRUE(TileID(1, 4, 0).isChildOf(TileID(0, 2, 0)));
+ ASSERT_TRUE(TileID(1, 5, 0).isChildOf(TileID(0, 2, 0)));
+ ASSERT_TRUE(TileID(2, 0, 0).isChildOf(TileID(0, 0, 0)));
+
+ ASSERT_TRUE(TileID(2, 8, 0).isChildOf(TileID(0, 2, 0)));
+ ASSERT_TRUE(TileID(2, 9, 0).isChildOf(TileID(0, 2, 0)));
+ ASSERT_TRUE(TileID(2, 10, 0).isChildOf(TileID(0, 2, 0)));
+ ASSERT_TRUE(TileID(2, 11, 0).isChildOf(TileID(0, 2, 0)));
+ ASSERT_TRUE(TileID(2, 12, 0).isChildOf(TileID(0, 3, 0)));
+ ASSERT_TRUE(TileID(2, 13, 0).isChildOf(TileID(0, 3, 0)));
+
+ ASSERT_TRUE(TileID(1, -1, 0).isChildOf(TileID(0, -1, 0)));
+ ASSERT_TRUE(TileID(1, -2, 0).isChildOf(TileID(0, -1, 0)));
+ ASSERT_TRUE(TileID(1, -3, 0).isChildOf(TileID(0, -2, 0)));
+ ASSERT_TRUE(TileID(1, -4, 0).isChildOf(TileID(0, -2, 0)));
+ ASSERT_TRUE(TileID(2, -1, 0).isChildOf(TileID(0, -1, 0)));
+ ASSERT_TRUE(TileID(2, -2, 0).isChildOf(TileID(0, -1, 0)));
+ ASSERT_TRUE(TileID(2, -3, 0).isChildOf(TileID(0, -1, 0)));
+ ASSERT_TRUE(TileID(2, -4, 0).isChildOf(TileID(0, -1, 0)));
+ ASSERT_TRUE(TileID(2, -5, 0).isChildOf(TileID(0, -2, 0)));
+ ASSERT_TRUE(TileID(2, -6, 0).isChildOf(TileID(0, -2, 0)));
+ ASSERT_TRUE(TileID(2, -7, 0).isChildOf(TileID(0, -2, 0)));
+ ASSERT_TRUE(TileID(2, -8, 0).isChildOf(TileID(0, -2, 0)));
+
+ ASSERT_FALSE(TileID(4, -16, 0).isChildOf(TileID(0, -2, 0)));
+ ASSERT_TRUE(TileID(4, -17, 0).isChildOf(TileID(0, -2, 0)));
+
+ ASSERT_TRUE(TileID(2, -1, 0).isChildOf(TileID(1, -1, 0)));
+ ASSERT_TRUE(TileID(2, -2, 0).isChildOf(TileID(1, -1, 0)));
+ ASSERT_TRUE(TileID(2, -3, 0).isChildOf(TileID(1, -2, 0)));
+ ASSERT_TRUE(TileID(2, -4, 0).isChildOf(TileID(1, -2, 0)));
+ ASSERT_TRUE(TileID(3, -1, 0).isChildOf(TileID(1, -1, 0)));
+ ASSERT_TRUE(TileID(3, -2, 0).isChildOf(TileID(1, -1, 0)));
+ ASSERT_TRUE(TileID(3, -3, 0).isChildOf(TileID(1, -1, 0)));
+ ASSERT_TRUE(TileID(3, -4, 0).isChildOf(TileID(1, -1, 0)));
+ ASSERT_TRUE(TileID(3, -5, 0).isChildOf(TileID(1, -2, 0)));
}