remove C++ version flex-area test

HEAD^2
Sarah Hoffmann 2022-05-06 16:24:23 +02:00
parent 743d9ee543
commit 4ed4d4855b
14 changed files with 0 additions and 260 deletions

View File

@ -73,7 +73,6 @@ set_test(test-wkb LABELS NoDB)
# these tests require LUA support
if (WITH_LUA)
set_test(test-output-flex)
set_test(test-output-flex-area)
set_test(test-output-flex-attr)
set_test(test-output-flex-bbox)
set_test(test-output-flex-cluster)

View File

@ -1,33 +0,0 @@
local polygons = osm2pgsql.define_table{
name = 'osm2pgsql_test_polygon',
ids = { type = 'area', id_column = 'osm_id' },
columns = {
{ column = 'name', type = 'text' },
{ column = 'geom', type = 'geometry', projection = test.geom_proj },
{ column = 'area', type = 'area', projection = test.area_proj },
}
}
function is_empty(some_table)
return next(some_table) == nil
end
function osm2pgsql.process_way(object)
if is_empty(object.tags) then
return
end
polygons:add_row({
name = object.tags.name,
geom = { create = 'area' }
})
end
function osm2pgsql.process_relation(object)
polygons:add_row({
name = object.tags.name,
geom = { create = 'area', split_at = 'multi' }
})
end

View File

@ -1,55 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
Nodes:
7 8
3 4 11 12
9 10
1 2 5 6
-->
<osm version="0.6">
<node id="1" version="1" lat="50.0" lon="9.0"/>
<node id="2" version="1" lat="50.0" lon="9.1"/>
<node id="3" version="1" lat="50.1" lon="9.0"/>
<node id="4" version="1" lat="50.1" lon="9.1"/>
<node id="5" version="1" lat="50.0" lon="9.2"/>
<node id="6" version="1" lat="50.0" lon="9.5"/>
<node id="7" version="1" lat="50.3" lon="9.2"/>
<node id="8" version="1" lat="50.3" lon="9.5"/>
<node id="9" version="1" lat="50.1" lon="9.3"/>
<node id="10" version="1" lat="50.1" lon="9.4"/>
<node id="11" version="1" lat="50.2" lon="9.3"/>
<node id="12" version="1" lat="50.2" lon="9.4"/>
<way id="1" version="1">
<nd ref="1"/>
<nd ref="2"/>
<nd ref="4"/>
<nd ref="3"/>
<nd ref="1"/>
<tag k="natural" v="water"/>
<tag k="name" v="poly"/>
</way>
<way id="2" version="1">
<nd ref="5"/>
<nd ref="6"/>
<nd ref="8"/>
<nd ref="7"/>
<nd ref="5"/>
</way>
<way id="3" version="1">
<nd ref="9"/>
<nd ref="10"/>
<nd ref="12"/>
<nd ref="11"/>
<nd ref="9"/>
</way>
<relation id='1' version='1'>
<member type="way" ref="2" role=""/>
<member type="way" ref="3" role=""/>
<tag k="type" v="multipolygon"/>
<tag k="natural" v="water"/>
<tag k="name" v="multi"/>
</relation>
</osm>

View File

@ -1,5 +0,0 @@
test = { geom_proj = 25832, area_proj = 25832 }
dofile(osm2pgsql.config_dir .. '/test_output_flex_area.lua')

View File

@ -1,5 +0,0 @@
test = { geom_proj = 25832, area_proj = 3857 }
dofile(osm2pgsql.config_dir .. '/test_output_flex_area.lua')

View File

@ -1,5 +0,0 @@
test = { geom_proj = 25832, area_proj = 4326 }
dofile(osm2pgsql.config_dir .. '/test_output_flex_area.lua')

View File

@ -1,5 +0,0 @@
test = { geom_proj = 3857, area_proj = 25832 }
dofile(osm2pgsql.config_dir .. '/test_output_flex_area.lua')

View File

@ -1,5 +0,0 @@
test = { geom_proj = 3857, area_proj = 3857 }
dofile(osm2pgsql.config_dir .. '/test_output_flex_area.lua')

View File

@ -1,5 +0,0 @@
test = { geom_proj = 3857, area_proj = 4326 }
dofile(osm2pgsql.config_dir .. '/test_output_flex_area.lua')

View File

@ -1,5 +0,0 @@
test = { geom_proj = 4326, area_proj = 25832 }
dofile(osm2pgsql.config_dir .. '/test_output_flex_area.lua')

View File

@ -1,5 +0,0 @@
test = { geom_proj = 4326, area_proj = 3857 }
dofile(osm2pgsql.config_dir .. '/test_output_flex_area.lua')

View File

@ -1,5 +0,0 @@
test = { geom_proj = 4326, area_proj = 4326 }
dofile(osm2pgsql.config_dir .. '/test_output_flex_area.lua')

View File

@ -1,5 +0,0 @@
test = { geom_proj = 'latlong', area_proj = 'merc' }
dofile(osm2pgsql.config_dir .. '/test_output_flex_area.lua')

View File

@ -1,121 +0,0 @@
/**
* SPDX-License-Identifier: GPL-2.0-or-later
*
* This file is part of osm2pgsql (https://osm2pgsql.org/).
*
* Copyright (C) 2006-2022 by the osm2pgsql developer community.
* For a full list of authors see the git log.
*/
#include <catch.hpp>
#include "common-import.hpp"
#include "common-options.hpp"
#include "format.hpp"
#include <array>
static testing::db::import_t db;
static char const *const data_file = "test_output_flex_area.osm";
// Area values for 4326, 3857, 25832 (ETRS89 / UTM zone 32N).
// First is for polygon, second for multipolygon.
static const double area[3][2] = {{0.01, 0.08},
{192987010.0, 1547130000.0},
{79600737.5375453234, 635499542.9545904398}};
static std::array<char const *, 3> const names = {"4326", "3857", "25832"};
// Indexes into area arrays above
enum projs
{
p4326 = 0,
p3857 = 1,
p25832 = 2
};
void check(int p1, int p2)
{
std::string conf_file{
"test_output_flex_area_{}_{}.lua"_format(names[p1], names[p2])};
options_t const options = testing::opt_t().flex(conf_file.c_str());
REQUIRE_NOTHROW(db.run_file(options, data_file));
auto conn = db.db().connect();
REQUIRE(2 == conn.get_count("osm2pgsql_test_polygon"));
// polygon
conn.assert_double(
area[p1][0],
"SELECT ST_Area(geom) FROM osm2pgsql_test_polygon WHERE name='poly'");
conn.assert_double(
area[p2][0],
"SELECT area FROM osm2pgsql_test_polygon WHERE name='poly'");
conn.assert_double(area[p4326][0],
"SELECT ST_Area(ST_Transform(geom, 4326)) "
"FROM osm2pgsql_test_polygon WHERE name='poly'");
// multipolygon
conn.assert_double(
area[p1][1],
"SELECT ST_Area(geom) FROM osm2pgsql_test_polygon WHERE name='multi'");
conn.assert_double(
area[p2][1],
"SELECT area FROM osm2pgsql_test_polygon WHERE name='multi'");
conn.assert_double(area[p4326][1],
"SELECT ST_Area(ST_Transform(geom, 4326)) "
"FROM osm2pgsql_test_polygon WHERE name='multi'");
}
TEST_CASE("area and area calculation in latlon (4326) projection")
{
check(p4326, p4326);
}
TEST_CASE("area in mercator with area calculation in latlon")
{
check(p4326, p3857);
}
#ifdef HAVE_GENERIC_PROJ
TEST_CASE("area in latlon with area calculation in 25832 projection")
{
check(p4326, p25832);
}
#endif
TEST_CASE("area in latlon with area calculation in mercator projection")
{
check(p3857, p4326);
}
TEST_CASE("area and area calculation in default (3857) projection")
{
check(p3857, p3857);
}
#ifdef HAVE_GENERIC_PROJ
TEST_CASE("area in mercator with area calculation in 25832 projection")
{
check(p3857, p25832);
}
TEST_CASE("area in 25832 with area calculation in latlon projection")
{
check(p25832, p4326);
}
TEST_CASE("area in 25832 with area calculation in mercator projection")
{
check(p25832, p3857);
}
TEST_CASE("area and area calculation in 25832 projection")
{
check(p25832, p25832);
}
#endif