diff --git a/test/io/wkt/wkt.cpp b/test/io/wkt/wkt.cpp index 5884b96be..9da9fc8df 100644 --- a/test/io/wkt/wkt.cpp +++ b/test/io/wkt/wkt.cpp @@ -12,7 +12,6 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -//#include #include #include @@ -58,40 +57,27 @@ void test_wkt(std::string const& wkt, std::size_t n, double len = 0, BOOST_CHECK_CLOSE(double(bg::perimeter(geometry)), peri, 0.0001); } - // String comparison: only for int/double/float etc - // GMP/CLN add +e01, L0, etc - if (boost::is_fundamental - < - typename bg::coordinate_type::type - >::type::value) - { - std::ostringstream out; - out << bg::wkt(geometry); - BOOST_CHECK_EQUAL(boost::to_upper_copy(out.str()), - boost::to_upper_copy(wkt)); - } + std::ostringstream out; + out << bg::wkt(geometry); + BOOST_CHECK_EQUAL(boost::to_upper_copy(out.str()), + boost::to_upper_copy(wkt)); } template void test_relaxed_wkt(std::string const& wkt, std::string const& expected) { - if (boost::is_fundamental - < - typename bg::coordinate_type::type - >::type::value) - { - std::string e; - G geometry; - bg::read_wkt(wkt, geometry); - std::ostringstream out; - out << bg::wkt(geometry); + std::string e; + G geometry; + bg::read_wkt(wkt, geometry); + std::ostringstream out; + out << bg::wkt(geometry); - BOOST_CHECK_EQUAL(boost::to_upper_copy(out.str()), boost::to_upper_copy(expected)); - } + BOOST_CHECK_EQUAL(boost::to_upper_copy(out.str()), boost::to_upper_copy(expected)); } + template void test_wrong_wkt(std::string const& wkt, std::string const& start) { @@ -106,8 +92,29 @@ void test_wrong_wkt(std::string const& wkt, std::string const& start) e = ex.what(); boost::to_lower(e); } - BOOST_CHECK_MESSAGE(boost::starts_with(e, start), " Expected:" - << start << " Got:" << e << " with WKT: " << wkt); + catch(...) + { + e = "other exception"; + } + + bool check = true; + +#if defined(HAVE_TTMATH) + // For ttmath we skip bad lexical casts + typedef typename bg::coordinate_type::type ct; + + if (boost::is_same::type::value + && boost::starts_with(start, "bad lexical cast")) + { + check = false; + } +#endif + + if (check) + { + BOOST_CHECK_MESSAGE(boost::starts_with(e, start), " Expected:" + << start << " Got:" << e << " with WKT: " << wkt); + } } template @@ -126,7 +133,7 @@ void test_all() using namespace boost::geometry; typedef bg::model::point P; - test_wkt

("POINT(1 2)", 1); + test_wkt

("POINT(1 2)", 1); test_wkt >("LINESTRING(1 1,2 2,3 3)", 3, 2 * sqrt(2.0)); test_wkt >("POLYGON((0 0,0 4,4 4,4 0,0 0)" ",(1 1,1 2,2 2,2 1,1 1),(1 1,1 2,2 2,2 1,1 1))", 15, 0, 18, 24); diff --git a/test/io/wkt/wkt.vcproj b/test/io/wkt/wkt.vcproj index aa65f3648..988ee6af7 100644 --- a/test/io/wkt/wkt.vcproj +++ b/test/io/wkt/wkt.vcproj @@ -20,7 +20,7 @@ OutputDirectory="$(SolutionDir)$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)\wkt" ConfigurationType="1" - InheritedPropertySheets="..\..\boost.vsprops" + InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops" CharacterSet="1" >