[test] [perimeter] Minor changes in perimeter tests to reflect comments.

This commit is contained in:
Vissarion Fysikopoulos 2016-05-26 10:42:23 +03:00
parent 218c554091
commit 78961eaf08
3 changed files with 14 additions and 25 deletions

View File

@ -33,15 +33,15 @@ struct geo_strategies
template <typename P>
void test_default() //this should use andoyer strategy
{
for (std::size_t i = 0; i < Poly_data_geo.size(); ++i)
for (std::size_t i = 0; i <= 2; ++i)
{
test_geometry<bg::model::polygon<P> >(Poly_data_geo[i],
test_geometry<bg::model::polygon<P> >(poly_data_geo[i],
1116814.237 + 1116152.605);
}
// Multipolygon
test_geometry<bg::model::multi_polygon<bg::model::polygon<P> > >
(Multipoly_data[0], 60078934.0425);
(multipoly_data[0], 60078934.0425);
// Geometries with length zero
test_geometry<P>("POINT(0 0)", 0);
@ -52,9 +52,9 @@ void test_default() //this should use andoyer strategy
template <typename P, typename N, typename Strategy>
void test_with_strategy(N exp_length, Strategy strategy)
{
for (std::size_t i = 0; i < Poly_data_geo.size(); ++i)
for (std::size_t i = 0; i <= 2; ++i)
{
test_geometry<bg::model::polygon<P> >(Poly_data_geo[i],
test_geometry<bg::model::polygon<P> >(poly_data_geo[i],
exp_length,
strategy);
}

View File

@ -13,18 +13,14 @@
#include <string>
static std::string Poly_data_geo_1[] = {
static std::string poly_data_geo[] = {
"POLYGON((0 90,1 80,1 70))",
"POLYGON((0 90,1 80,1 80,1 80,1 70,1 70))",
"POLYGON((0 90,1 80,1 79,1 78,1 77,1 76,1 75,1 74,\
1 73,1 72,1 71,1 70))"
};
std::vector<std::string> Poly_data_geo(Poly_data_geo_1, Poly_data_geo_1 +
sizeof(Poly_data_geo_1) / sizeof(std::string));
static std::string Poly_data_sph_1[] = {
static std::string poly_data_sph[] = {
"POLYGON((0 0,180 0,0 0))",
"POLYGON((0 0,180 0,180 0,180 0,180 180,0 0))",
"POLYGON((0 0,180 0,180 10,180 20,180 30,180 40,180 50,180 60,\
@ -32,15 +28,8 @@ static std::string Poly_data_sph_1[] = {
180 140,180 150,180 160,180 170,180 180,0 0))"
};
std::vector<std::string> Poly_data_sph(Poly_data_sph_1, Poly_data_sph_1 +
sizeof(Poly_data_sph_1) / sizeof(std::string));
static std::string Multipoly_data_1[] = {
static std::string multipoly_data[] = {
"MULTIPOLYGON(((0 0,180 0,0 0)), ((0 0, 0 90, 90 90, 0 0)))"
};
std::vector<std::string> Multipoly_data(Multipoly_data_1, Multipoly_data_1 +
sizeof(Multipoly_data_1) / sizeof(std::string));
#endif // PERIMETER_POLYGON_CASES_HPP

View File

@ -19,14 +19,14 @@ void test_all_default() //test the default strategy
{
double const pi = boost::math::constants::pi<double>();
for (std::size_t i = 0; i < Poly_data_sph.size(); ++i)
for (std::size_t i = 0; i <= 2; ++i)
{
test_geometry<bg::model::polygon<P> >(Poly_data_sph[i], 2 * pi);
test_geometry<bg::model::polygon<P> >(poly_data_sph[i], 2 * pi);
}
// Multipolygon
test_geometry<bg::model::multi_polygon<bg::model::polygon<P> > >
(Multipoly_data[0], 3 * pi);
(multipoly_data[0], 3 * pi);
// Geometries with length zero
test_geometry<P>("POINT(0 0)", 0);
@ -40,16 +40,16 @@ void test_all_haversine(double const mean_radius)
double const pi = boost::math::constants::pi<double>();
bg::strategy::distance::haversine<double> haversine_strategy(mean_radius);
for (std::size_t i = 0; i < Poly_data_sph.size(); ++i)
for (std::size_t i = 0; i <= 2; ++i)
{
test_geometry<bg::model::polygon<P> >(Poly_data_sph[i],
test_geometry<bg::model::polygon<P> >(poly_data_sph[i],
2 * pi * mean_radius,
haversine_strategy);
}
// Multipolygon
test_geometry<bg::model::multi_polygon<bg::model::polygon<P> > >
(Multipoly_data[0],
(multipoly_data[0],
3 * pi * mean_radius,
haversine_strategy);