Skip to content

Commit 1c2a425

Browse files
committed
Refactor tests triggering a moved-from-warning
Clang-tidy doesn't understand that only one SECTION is run per test so it thinks data is used after move. This removes some of the SECTIONs which don't really do things relevant to the tests here. And one test is split into two so we don't need the SECTION any more.
1 parent 1f04c53 commit 1c2a425

File tree

1 file changed

+15
-26
lines changed

1 file changed

+15
-26
lines changed

tests/test-expire-from-geometry.cpp

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -390,13 +390,6 @@ TEST_CASE("expire multilinestring geometry", "[NoDB]")
390390
et.from_geometry(geom, expire_config);
391391
}
392392

393-
SECTION("geom with check")
394-
{
395-
geom::geometry_t geom{std::move(ml)};
396-
geom.set_srid(3857);
397-
et.from_geometry_if_3857(geom, expire_config);
398-
}
399-
400393
auto const tiles = et.get_tiles();
401394
REQUIRE(tiles.size() == 3);
402395
CHECK(tile_t::from_quadkey(tiles[0], zoom) == tile_t{zoom, 2049, 2046});
@@ -440,13 +433,6 @@ TEST_CASE("expire multipolygon geometry", "[NoDB]")
440433
et.from_geometry(geom, expire_config);
441434
}
442435

443-
SECTION("geom with check")
444-
{
445-
geom::geometry_t geom{std::move(mp)};
446-
geom.set_srid(3857);
447-
et.from_geometry_if_3857(geom, expire_config);
448-
}
449-
450436
auto const tiles = et.get_tiles();
451437
REQUIRE(tiles.size() == 17);
452438

@@ -476,18 +462,8 @@ TEST_CASE("expire geometry collection", "[NoDB]")
476462
collection.add_geometry(geom::geometry_t{
477463
geom::linestring_t{{15000.0, 15000.0}, {25000.0, 15000.0}}});
478464

479-
SECTION("geom")
480-
{
481-
geom::geometry_t const geom{std::move(collection)};
482-
et.from_geometry(geom, expire_config);
483-
}
484-
485-
SECTION("geom with check")
486-
{
487-
geom::geometry_t geom{std::move(collection)};
488-
geom.set_srid(3857);
489-
et.from_geometry_if_3857(geom, expire_config);
490-
}
465+
geom::geometry_t const geom{std::move(collection)};
466+
et.from_geometry(geom, expire_config);
491467

492468
auto const tiles = et.get_tiles();
493469
REQUIRE(tiles.size() == 6);
@@ -499,6 +475,19 @@ TEST_CASE("expire geometry collection", "[NoDB]")
499475
CHECK(tile_t::from_quadkey(tiles[5], zoom) == tile_t{zoom, 2048, 2048});
500476
}
501477

478+
TEST_CASE("expire works if in 3857", "[NoDB]")
479+
{
480+
expire_config_t const expire_config;
481+
expire_tiles et{zoom, defproj};
482+
483+
geom::geometry_t geom{geom::point_t{0.0, 0.0}};
484+
geom.set_srid(3857);
485+
et.from_geometry_if_3857(geom, expire_config);
486+
487+
auto const tiles = et.get_tiles();
488+
REQUIRE(tiles.size() == 4);
489+
}
490+
502491
TEST_CASE("expire doesn't do anything if not in 3857", "[NoDB]")
503492
{
504493
expire_config_t const expire_config;

0 commit comments

Comments
 (0)