Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/flex-table-column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct column_type_lookup
char const *name() const noexcept { return m_name; }
};

std::vector<column_type_lookup> const column_types = {
std::vector<column_type_lookup> const COLUMN_TYPES = {
{{"text", table_column_type::text},
{"boolean", table_column_type::boolean},
{"bool", table_column_type::boolean},
Expand Down Expand Up @@ -60,7 +60,7 @@ std::vector<column_type_lookup> const column_types = {

table_column_type get_column_type_from_string(std::string const &type)
{
auto const *column_type = util::find_by_name(column_types, type);
auto const *column_type = util::find_by_name(COLUMN_TYPES, type);
if (!column_type) {
throw fmt_error("Unknown column type '{}'.", type);
}
Expand Down
4 changes: 2 additions & 2 deletions src/geom-area-assembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

namespace geom {

osmium::area::AssemblerConfig const area_config;
osmium::area::AssemblerConfig const AREA_CONFIG;

area_assembler_t::area_assembler_t(osmium::memory::Buffer *buffer)
: osmium::area::detail::BasicAssembler(area_config), m_buffer(buffer)
: osmium::area::detail::BasicAssembler(AREA_CONFIG), m_buffer(buffer)
{
}

Expand Down
114 changes: 57 additions & 57 deletions tests/test-expire-from-geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ std::shared_ptr<reprojection> defproj{

// We are using zoom level 12 here, because at that level a tile is about
// 10,000 units wide/high which gives us easy numbers to work with.
constexpr uint32_t zoom = 12;
constexpr uint32_t ZOOM = 12;

} // anonymous namespace

TEST_CASE("expire null geometry does nothing", "[NoDB]")
{
expire_config_t const expire_config;
expire_tiles et{zoom, defproj};
expire_tiles et{ZOOM, defproj};

SECTION("geom")
{
Expand All @@ -53,7 +53,7 @@ TEST_CASE("expire null geometry does nothing", "[NoDB]")
TEST_CASE("expire point at tile boundary", "[NoDB]")
{
expire_config_t const expire_config;
expire_tiles et{zoom, defproj};
expire_tiles et{ZOOM, defproj};

geom::point_t const pt{0.0, 0.0};

Expand All @@ -74,16 +74,16 @@ TEST_CASE("expire point at tile boundary", "[NoDB]")

auto const tiles = et.get_tiles();
REQUIRE(tiles.size() == 4);
CHECK(tile_t::from_quadkey(tiles[0], zoom) == tile_t{zoom, 2047, 2047});
CHECK(tile_t::from_quadkey(tiles[1], zoom) == tile_t{zoom, 2048, 2047});
CHECK(tile_t::from_quadkey(tiles[2], zoom) == tile_t{zoom, 2047, 2048});
CHECK(tile_t::from_quadkey(tiles[3], zoom) == tile_t{zoom, 2048, 2048});
CHECK(tile_t::from_quadkey(tiles[0], ZOOM) == tile_t{ZOOM, 2047, 2047});
CHECK(tile_t::from_quadkey(tiles[1], ZOOM) == tile_t{ZOOM, 2048, 2047});
CHECK(tile_t::from_quadkey(tiles[2], ZOOM) == tile_t{ZOOM, 2047, 2048});
CHECK(tile_t::from_quadkey(tiles[3], ZOOM) == tile_t{ZOOM, 2048, 2048});
}

TEST_CASE("expire point away from tile boundary", "[NoDB]")
{
expire_config_t const expire_config;
expire_tiles et{zoom, defproj};
expire_tiles et{ZOOM, defproj};

geom::point_t const pt{5000.0, 5000.0};

Expand All @@ -104,13 +104,13 @@ TEST_CASE("expire point away from tile boundary", "[NoDB]")

auto const tiles = et.get_tiles();
REQUIRE(tiles.size() == 1);
CHECK(tile_t::from_quadkey(tiles[0], zoom) == tile_t{zoom, 2048, 2047});
CHECK(tile_t::from_quadkey(tiles[0], ZOOM) == tile_t{ZOOM, 2048, 2047});
}

TEST_CASE("expire linestring away from tile boundary", "[NoDB]")
{
expire_config_t const expire_config;
expire_tiles et{zoom, defproj};
expire_tiles et{ZOOM, defproj};

SECTION("line")
{
Expand All @@ -135,13 +135,13 @@ TEST_CASE("expire linestring away from tile boundary", "[NoDB]")

auto const tiles = et.get_tiles();
REQUIRE(tiles.size() == 1);
CHECK(tile_t::from_quadkey(tiles[0], zoom) == tile_t{zoom, 2048, 2047});
CHECK(tile_t::from_quadkey(tiles[0], ZOOM) == tile_t{ZOOM, 2048, 2047});
}

TEST_CASE("expire linestring crossing tile boundary", "[NoDB]")
{
expire_config_t const expire_config;
expire_tiles et{zoom, defproj};
expire_tiles et{ZOOM, defproj};

SECTION("line")
{
Expand All @@ -166,14 +166,14 @@ TEST_CASE("expire linestring crossing tile boundary", "[NoDB]")

auto const tiles = et.get_tiles();
REQUIRE(tiles.size() == 2);
CHECK(tile_t::from_quadkey(tiles[0], zoom) == tile_t{zoom, 2048, 2046});
CHECK(tile_t::from_quadkey(tiles[1], zoom) == tile_t{zoom, 2048, 2047});
CHECK(tile_t::from_quadkey(tiles[0], ZOOM) == tile_t{ZOOM, 2048, 2046});
CHECK(tile_t::from_quadkey(tiles[1], ZOOM) == tile_t{ZOOM, 2048, 2047});
}

TEST_CASE("expire small polygon", "[NoDB]")
{
expire_config_t const expire_config;
expire_tiles et{zoom, defproj};
expire_tiles et{ZOOM, defproj};

SECTION("polygon")
{
Expand Down Expand Up @@ -210,15 +210,15 @@ TEST_CASE("expire small polygon", "[NoDB]")

auto const tiles = et.get_tiles();
REQUIRE(tiles.size() == 1);
CHECK(tile_t::from_quadkey(tiles[0], zoom) == tile_t{zoom, 2048, 2047});
CHECK(tile_t::from_quadkey(tiles[0], ZOOM) == tile_t{ZOOM, 2048, 2047});
}

TEST_CASE("expire large polygon as bbox", "[NoDB]")
{
expire_config_t expire_config;
expire_config.mode = expire_mode::hybrid;
expire_config.full_area_limit = 40000;
expire_tiles et{zoom, defproj};
expire_tiles et{ZOOM, defproj};

SECTION("polygon")
{
Expand Down Expand Up @@ -255,25 +255,25 @@ TEST_CASE("expire large polygon as bbox", "[NoDB]")

auto const tiles = et.get_tiles();
REQUIRE(tiles.size() == 9);
CHECK(tile_t::from_quadkey(tiles[0], zoom) == tile_t{zoom, 2048, 2045});
CHECK(tile_t::from_quadkey(tiles[1], zoom) == tile_t{zoom, 2049, 2045});
CHECK(tile_t::from_quadkey(tiles[2], zoom) == tile_t{zoom, 2050, 2045});
CHECK(tile_t::from_quadkey(tiles[0], ZOOM) == tile_t{ZOOM, 2048, 2045});
CHECK(tile_t::from_quadkey(tiles[1], ZOOM) == tile_t{ZOOM, 2049, 2045});
CHECK(tile_t::from_quadkey(tiles[2], ZOOM) == tile_t{ZOOM, 2050, 2045});

CHECK(tile_t::from_quadkey(tiles[3], zoom) == tile_t{zoom, 2048, 2046});
CHECK(tile_t::from_quadkey(tiles[4], zoom) == tile_t{zoom, 2049, 2046});
CHECK(tile_t::from_quadkey(tiles[7], zoom) == tile_t{zoom, 2050, 2046});
CHECK(tile_t::from_quadkey(tiles[3], ZOOM) == tile_t{ZOOM, 2048, 2046});
CHECK(tile_t::from_quadkey(tiles[4], ZOOM) == tile_t{ZOOM, 2049, 2046});
CHECK(tile_t::from_quadkey(tiles[7], ZOOM) == tile_t{ZOOM, 2050, 2046});

CHECK(tile_t::from_quadkey(tiles[5], zoom) == tile_t{zoom, 2048, 2047});
CHECK(tile_t::from_quadkey(tiles[6], zoom) == tile_t{zoom, 2049, 2047});
CHECK(tile_t::from_quadkey(tiles[8], zoom) == tile_t{zoom, 2050, 2047});
CHECK(tile_t::from_quadkey(tiles[5], ZOOM) == tile_t{ZOOM, 2048, 2047});
CHECK(tile_t::from_quadkey(tiles[6], ZOOM) == tile_t{ZOOM, 2049, 2047});
CHECK(tile_t::from_quadkey(tiles[8], ZOOM) == tile_t{ZOOM, 2050, 2047});
}

TEST_CASE("expire large polygon as boundary", "[NoDB]")
{
expire_config_t expire_config;
expire_config.mode = expire_mode::hybrid;
expire_config.full_area_limit = 10000;
expire_tiles et{zoom, defproj};
expire_tiles et{ZOOM, defproj};

SECTION("polygon")
{
Expand Down Expand Up @@ -320,22 +320,22 @@ TEST_CASE("expire large polygon as boundary", "[NoDB]")

auto const tiles = et.get_tiles();
REQUIRE(tiles.size() == 8);
CHECK(tile_t::from_quadkey(tiles[0], zoom) == tile_t{zoom, 2048, 2045});
CHECK(tile_t::from_quadkey(tiles[1], zoom) == tile_t{zoom, 2049, 2045});
CHECK(tile_t::from_quadkey(tiles[2], zoom) == tile_t{zoom, 2050, 2045});
CHECK(tile_t::from_quadkey(tiles[0], ZOOM) == tile_t{ZOOM, 2048, 2045});
CHECK(tile_t::from_quadkey(tiles[1], ZOOM) == tile_t{ZOOM, 2049, 2045});
CHECK(tile_t::from_quadkey(tiles[2], ZOOM) == tile_t{ZOOM, 2050, 2045});

CHECK(tile_t::from_quadkey(tiles[3], zoom) == tile_t{zoom, 2048, 2046});
CHECK(tile_t::from_quadkey(tiles[6], zoom) == tile_t{zoom, 2050, 2046});
CHECK(tile_t::from_quadkey(tiles[3], ZOOM) == tile_t{ZOOM, 2048, 2046});
CHECK(tile_t::from_quadkey(tiles[6], ZOOM) == tile_t{ZOOM, 2050, 2046});

CHECK(tile_t::from_quadkey(tiles[4], zoom) == tile_t{zoom, 2048, 2047});
CHECK(tile_t::from_quadkey(tiles[5], zoom) == tile_t{zoom, 2049, 2047});
CHECK(tile_t::from_quadkey(tiles[7], zoom) == tile_t{zoom, 2050, 2047});
CHECK(tile_t::from_quadkey(tiles[4], ZOOM) == tile_t{ZOOM, 2048, 2047});
CHECK(tile_t::from_quadkey(tiles[5], ZOOM) == tile_t{ZOOM, 2049, 2047});
CHECK(tile_t::from_quadkey(tiles[7], ZOOM) == tile_t{ZOOM, 2050, 2047});
}

TEST_CASE("expire multipoint geometry", "[NoDB]")
{
expire_config_t const expire_config;
expire_tiles et{zoom, defproj};
expire_tiles et{ZOOM, defproj};

geom::point_t const p1{0.0, 0.0};
geom::point_t const p2{15000.0, 15000.0};
Expand Down Expand Up @@ -369,17 +369,17 @@ TEST_CASE("expire multipoint geometry", "[NoDB]")

auto const tiles = et.get_tiles();
REQUIRE(tiles.size() == 5);
CHECK(tile_t::from_quadkey(tiles[0], zoom) == tile_t{zoom, 2047, 2047});
CHECK(tile_t::from_quadkey(tiles[1], zoom) == tile_t{zoom, 2049, 2046});
CHECK(tile_t::from_quadkey(tiles[2], zoom) == tile_t{zoom, 2048, 2047});
CHECK(tile_t::from_quadkey(tiles[3], zoom) == tile_t{zoom, 2047, 2048});
CHECK(tile_t::from_quadkey(tiles[4], zoom) == tile_t{zoom, 2048, 2048});
CHECK(tile_t::from_quadkey(tiles[0], ZOOM) == tile_t{ZOOM, 2047, 2047});
CHECK(tile_t::from_quadkey(tiles[1], ZOOM) == tile_t{ZOOM, 2049, 2046});
CHECK(tile_t::from_quadkey(tiles[2], ZOOM) == tile_t{ZOOM, 2048, 2047});
CHECK(tile_t::from_quadkey(tiles[3], ZOOM) == tile_t{ZOOM, 2047, 2048});
CHECK(tile_t::from_quadkey(tiles[4], ZOOM) == tile_t{ZOOM, 2048, 2048});
}

TEST_CASE("expire multilinestring geometry", "[NoDB]")
{
expire_config_t const expire_config;
expire_tiles et{zoom, defproj};
expire_tiles et{ZOOM, defproj};

geom::linestring_t l1{{2000.0, 2000.0}, {3000.0, 3000.0}};
geom::linestring_t l2{{15000.0, 15000.0}, {25000.0, 15000.0}};
Expand All @@ -397,17 +397,17 @@ TEST_CASE("expire multilinestring geometry", "[NoDB]")

auto const tiles = et.get_tiles();
REQUIRE(tiles.size() == 3);
CHECK(tile_t::from_quadkey(tiles[0], zoom) == tile_t{zoom, 2049, 2046});
CHECK(tile_t::from_quadkey(tiles[1], zoom) == tile_t{zoom, 2048, 2047});
CHECK(tile_t::from_quadkey(tiles[2], zoom) == tile_t{zoom, 2050, 2046});
CHECK(tile_t::from_quadkey(tiles[0], ZOOM) == tile_t{ZOOM, 2049, 2046});
CHECK(tile_t::from_quadkey(tiles[1], ZOOM) == tile_t{ZOOM, 2048, 2047});
CHECK(tile_t::from_quadkey(tiles[2], ZOOM) == tile_t{ZOOM, 2050, 2046});
}

TEST_CASE("expire multipolygon geometry", "[NoDB]")
{
expire_config_t expire_config;
expire_config.mode = expire_mode::hybrid;
expire_config.full_area_limit = 10000;
expire_tiles et{zoom, defproj};
expire_tiles et{ZOOM, defproj};

geom::polygon_t p1{{{2000.0, 2000.0},
{2000.0, 3000.0},
Expand Down Expand Up @@ -447,11 +447,11 @@ TEST_CASE("expire multipolygon geometry", "[NoDB]")
}

std::set<quadkey_t> expected;
expected.insert(tile_t{zoom, 2048, 2047}.quadkey()); // p1
expected.insert(tile_t{ZOOM, 2048, 2047}.quadkey()); // p1

for (uint32_t x = 2049; x <= 2052; ++x) {
for (uint32_t y = 2043; y <= 2046; ++y) {
expected.insert(tile_t{zoom, x, y}.quadkey()); // p2
expected.insert(tile_t{ZOOM, x, y}.quadkey()); // p2
}
}
REQUIRE(expected == result);
Expand All @@ -460,7 +460,7 @@ TEST_CASE("expire multipolygon geometry", "[NoDB]")
TEST_CASE("expire geometry collection", "[NoDB]")
{
expire_config_t const expire_config;
expire_tiles et{zoom, defproj};
expire_tiles et{ZOOM, defproj};

geom::collection_t collection;
collection.add_geometry(geom::geometry_t{geom::point_t{0.0, 0.0}});
Expand All @@ -472,18 +472,18 @@ TEST_CASE("expire geometry collection", "[NoDB]")

auto const tiles = et.get_tiles();
REQUIRE(tiles.size() == 6);
CHECK(tile_t::from_quadkey(tiles[0], zoom) == tile_t{zoom, 2047, 2047});
CHECK(tile_t::from_quadkey(tiles[1], zoom) == tile_t{zoom, 2049, 2046});
CHECK(tile_t::from_quadkey(tiles[2], zoom) == tile_t{zoom, 2048, 2047});
CHECK(tile_t::from_quadkey(tiles[3], zoom) == tile_t{zoom, 2050, 2046});
CHECK(tile_t::from_quadkey(tiles[4], zoom) == tile_t{zoom, 2047, 2048});
CHECK(tile_t::from_quadkey(tiles[5], zoom) == tile_t{zoom, 2048, 2048});
CHECK(tile_t::from_quadkey(tiles[0], ZOOM) == tile_t{ZOOM, 2047, 2047});
CHECK(tile_t::from_quadkey(tiles[1], ZOOM) == tile_t{ZOOM, 2049, 2046});
CHECK(tile_t::from_quadkey(tiles[2], ZOOM) == tile_t{ZOOM, 2048, 2047});
CHECK(tile_t::from_quadkey(tiles[3], ZOOM) == tile_t{ZOOM, 2050, 2046});
CHECK(tile_t::from_quadkey(tiles[4], ZOOM) == tile_t{ZOOM, 2047, 2048});
CHECK(tile_t::from_quadkey(tiles[5], ZOOM) == tile_t{ZOOM, 2048, 2048});
}

TEST_CASE("expire works if in 3857", "[NoDB]")
{
expire_config_t const expire_config;
expire_tiles et{zoom, defproj};
expire_tiles et{ZOOM, defproj};

geom::geometry_t geom{geom::point_t{0.0, 0.0}};
geom.set_srid(PROJ_SPHERE_MERC);
Expand All @@ -496,7 +496,7 @@ TEST_CASE("expire works if in 3857", "[NoDB]")
TEST_CASE("expire doesn't do anything if not in 3857", "[NoDB]")
{
expire_config_t const expire_config;
expire_tiles et{zoom, defproj};
expire_tiles et{ZOOM, defproj};

geom::geometry_t geom{geom::point_t{0.0, 0.0}};
geom.set_srid(1234);
Expand Down
4 changes: 2 additions & 2 deletions tests/test-output-flex-example-configs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace {

testing::db::import_t db;

char const *const data_file = "liechtenstein-2013-08-03.osm.pbf";
char const *const DATA_FILE = "liechtenstein-2013-08-03.osm.pbf";

std::vector<std::string> get_files() {
// NOLINTNEXTLINE(concurrency-mt-unsafe)
Expand All @@ -43,7 +43,7 @@ TEST_CASE("minimal test for flex example configs")
auto const conf_file = "../../flex-config/" + file + ".lua";
options_t const options = testing::opt_t().flex(conf_file.c_str());

REQUIRE_NOTHROW(db.run_file(options, data_file));
REQUIRE_NOTHROW(db.run_file(options, DATA_FILE));

auto conn = db.db().connect();
}
Expand Down
Loading