Skip to content

Commit

Permalink
Add removed tests for is_simple and is_valid with geometries whose co…
Browse files Browse the repository at this point in the history
…ordinates are close to the maximum double
  • Loading branch information
vissarion committed Feb 28, 2024
1 parent 68c0861 commit bc03fb2
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/algorithms/is_simple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,25 @@ BOOST_AUTO_TEST_CASE( test_geometry_with_NaN_coordinates )
test_simple(mls, true, false);
}

BOOST_AUTO_TEST_CASE( test_geometry_with_NaN_coordinates_2 )
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << std::endl << std::endl;
std::cout << "************************************" << std::endl;
std::cout << " is_valid: geometry with NaN coordinates" << std::endl;
std::cout << "************************************" << std::endl;
#endif

linestring_type ls1, ls2;
bg::read_wkt("LINESTRING(1 1,1.115235e+308 1.738137e+308)", ls1);
bg::read_wkt("LINESTRING(-1 1,1.115235e+308 1.738137e+308)", ls2);

multi_linestring_type mls;
bg::intersection(ls1, ls2, mls);

test_simple(mls, false, false);
}

BOOST_AUTO_TEST_CASE( test_is_simple_variant )
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
Expand Down
30 changes: 30 additions & 0 deletions test/algorithms/is_valid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,36 @@ BOOST_AUTO_TEST_CASE( test_with_NaN_coordinates )
>::apply("mls-NaN", mls, false);
}

BOOST_AUTO_TEST_CASE( test_with_NaN_coordinates_2 )
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << std::endl << std::endl;
std::cout << "************************************" << std::endl;
std::cout << " is_valid: geometry with NaN coordinates" << std::endl;
std::cout << "************************************" << std::endl;
#endif

linestring_type ls1, ls2;
bg::read_wkt("LINESTRING(1 1,1.115235e+308 1.738137e+308)", ls1);
bg::read_wkt("LINESTRING(-1 1,1.115235e+308 1.738137e+308)", ls2);

multi_linestring_type mls;
bg::intersection(ls1, ls2, mls);

typedef validity_tester_linear<true> tester_allow_spikes;
typedef validity_tester_linear<false> tester_disallow_spikes;

test_valid
<
tester_allow_spikes, multi_linestring_type
>::apply("mls-NaN", mls, false);

test_valid
<
tester_disallow_spikes, multi_linestring_type
>::apply("mls-NaN", mls, false);
}

BOOST_AUTO_TEST_CASE( test_is_valid_variant )
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
Expand Down

0 comments on commit bc03fb2

Please sign in to comment.