diff --git a/test/algorithms/difference.cpp b/test/algorithms/difference.cpp
index 7787dea3d..a606e2c3d 100644
--- a/test/algorithms/difference.cpp
+++ b/test/algorithms/difference.cpp
@@ -46,8 +46,7 @@ void test_all()
typedef bg::model::polygon
polygon;
typedef bg::model::ring
ring;
- bool const is_float =
- boost::is_same::type, float>::value;
+ typedef typename bg::coordinate_type::type ct;
test_one("simplex_normal",
simplex_normal[0], simplex_normal[1],
@@ -93,7 +92,7 @@ void test_all()
test_one("distance_zero",
distance_zero[0], distance_zero[1],
2, 0, 8.7048386,
- is_float ? 1 : 2, // The too small one is discarded for floating point
+ if_typed(1, 2), // The too small one is discarded for floating point
0, 0.0098387);
@@ -200,17 +199,42 @@ void test_all()
***/
#ifdef _MSC_VER
- {
- // Isovist (submitted by Brandon during Formal Review)
- std::string tn = string_from_type::type>::name();
- test_one("isovist",
- isovist1[0], isovist1[1],
- 4, 0, 0.279121891701124,
- 4, 0, 224.889211358929,
- 0.01);
- }
-#endif
+ // Isovist (submitted by Brandon during Formal Review)
+ test_one("isovist",
+ isovist1[0], isovist1[1],
+ 4, 0, 0.279121891701124,
+ 4, 0, 224.889211358929,
+ 0.01);
+ test_one("ggl_list_20110306_javier",
+ ggl_list_20110306_javier[0], ggl_list_20110306_javier[1],
+ 1, 0, 71495.3331,
+ 2, 0, 8960.49049);
+#endif
+
+ test_one("ggl_list_20110307_javier",
+ ggl_list_20110307_javier[0], ggl_list_20110307_javier[1],
+ 1, 0, 16815.6,
+ 1, 0, 3200.4,
+ 0.01);
+
+ // 2011-07-02
+ // Interesting FP-precision case.
+ // sql server gives: 6.62295817619452E-05
+ // PostGIS gives: 0.0 (no output)
+ // Boost.Geometry gives results depending on FP-type, and compiler, and operating system.
+ test_one("ggl_list_20110627_phillip",
+ ggl_list_20110627_phillip[0], ggl_list_20110627_phillip[1],
+ if_typed(0, 1), 0,
+ if_typed(0.0, if_typed(0.000383878,
+ 0.0000000000001105367)),
+ 1, 0, 3577.40960816756
+#ifdef _MSC_VER
+ , 0.01
+#else
+ , if_typed(50.0, 0.01)
+#endif
+ );
// Other combi's
{
diff --git a/test/algorithms/intersection.cpp b/test/algorithms/intersection.cpp
index c4d9ec5c3..56526bc57 100644
--- a/test/algorithms/intersection.cpp
+++ b/test/algorithms/intersection.cpp
@@ -23,6 +23,7 @@
#include
#include
+#include
#include
#include
@@ -155,19 +156,34 @@ void test_areal()
crossed[0], crossed[1],
3, 0, 1.5);
+ typedef typename bg::coordinate_type::type ct;
+
#ifdef _MSC_VER
- {
- // Isovist (submitted by Brandon during Formal Review)
- std::string tn = string_from_type::type>::name();
- test_one("isovist",
- isovist1[0], isovist1[1],
- 1,
- tn == std::string("f") ? 19 : tn == std::string("d") ? 22 : 20,
- 88.19203,
- tn == std::string("f") ? 0.5 : tn == std::string("d") ? 0.1 : 0.01);
- }
+ // Isovist (submitted by Brandon during Formal Review)
+ test_one("isovist",
+ isovist1[0], isovist1[1],
+ 1,
+ if_typed(19, if_typed(22, 20)),
+ 88.19203,
+ if_typed(0.5, if_typed(0.1, 0.01)));
#endif
+ //std::cout << typeid(ct).name() << std::endl;
+
+ test_one("ggl_list_20110306_javier",
+ ggl_list_20110306_javier[0], ggl_list_20110306_javier[1],
+ 1, if_typed_tt(5, 4),
+ 0.6649875,
+ if_typed(1.0, 0.01));
+
+ test_one("ggl_list_20110307_javier",
+ ggl_list_20110307_javier[0], ggl_list_20110307_javier[1],
+ 1, 4, 0.4, 0.01);
+
+ test_one("ggl_list_20110627_phillip",
+ ggl_list_20110627_phillip[0], ggl_list_20110627_phillip[1],
+ 1, if_typed_tt(6, 5), 11151.6618);
+
return;
diff --git a/test/algorithms/overlay/overlay_cases.hpp b/test/algorithms/overlay/overlay_cases.hpp
index 650a49123..71d4b66e3 100644
--- a/test/algorithms/overlay/overlay_cases.hpp
+++ b/test/algorithms/overlay/overlay_cases.hpp
@@ -490,6 +490,21 @@ static std::string ggl_list_20110306_javier[2] =
"POLYGON((-2 2,2002 2,2002 -2002,-2 -2002,-2 2),(0 -147.00000000000003,0 -2000,2000 -2000,2000 0,104 0,440 -240,400 -280,0 -147.00000000000003))",
"POLYGON((359.99000000000001 -280,0 -182,0 -147,400.00999999999999 -280,359.99000000000001 -280))"
};
+
+static std::string ggl_list_20110307_javier[2] =
+ {
+ "POLYGON((-2 2, 1842 2, 1842 -2362, -2 -2362, -2 2), (0 0, 0 -2360, 1840 -2360, 1840 0, 0 0))",
+ // "POLYGON((-0.01 -1960, 0 -1960, 0 -1880, 0.01 -1960, -0.01 -1960))"
+ "POLYGON ((-0.01 -1960, 80.01 -1960, 0 -1880, -0.01 -1960))"
+ };
+
+
+static std::string ggl_list_20110627_phillip[2] =
+ {
+ "POLYGON((537.99678544791459 124.30517362077681,437.36539413622404 142.02728895075373,456.33031803043468 249.50296671450121,556.96217263181723 231.78347688272990,537.99678544791459 124.30517362077681))",
+ "POLYGON((437.35 142.03,461.94 281.32,564.5 263.26,539.9 123.97,437.35 142.03))"
+ };
+
// GEOS "TestOverlay" test.
diff --git a/test/algorithms/union.cpp b/test/algorithms/union.cpp
index 95d079f1b..f24cc34b3 100644
--- a/test/algorithms/union.cpp
+++ b/test/algorithms/union.cpp
@@ -25,26 +25,12 @@
#include
#include
-static std::string javier4[2] =
- {
- "POLYGON((-2 2, 1842 2, 1842 -2362, -2 -2362, -2 2), (0 0, 0 -2360, 1840 -2360, 1840 0, 0 0))",
- // "POLYGON((-0.01 -1960, 0 -1960, 0 -1880, 0.01 -1960, -0.01 -1960))"
- "POLYGON ((-0.01 -1960, 80.01 -1960, 0 -1880, -0.01 -1960))"
- };
-
-
-
-
-
-
template
void test_areal()
{
- test_one("javier4",
- javier4[0], javier4[1],
- 1, 1, 13, 20016.4);
+ typedef typename bg::coordinate_type::type ct;
test_one("simplex_normal",
simplex_normal[0], simplex_normal[1],
@@ -63,12 +49,7 @@ void test_areal()
// This sample was selected because of the border case, and ttmath generates one point more.
test_one("star_poly", example_star, example_polygon,
1, 1,
-#if defined(HAVE_TTMATH)
- boost::is_same::type, ttmath_big>::value ? 28 : 27,
-#else
- 27,
-#endif
- 5.647949);
+ if_typed_tt(28, 27), 5.647949);
// Pseudo-box as Polygon
// (note, internally, the intersection points is different, so yes,
@@ -237,6 +218,17 @@ void test_areal()
test_one("ggl_list_20110306_javier",
ggl_list_20110306_javier[0], ggl_list_20110306_javier[1],
1, 1, 16, 80456.4904910401);
+
+ test_one("ggl_list_20110307_javier",
+ ggl_list_20110307_javier[0], ggl_list_20110307_javier[1],
+ 1, 1, 13, 20016.4);
+
+ test_one("ggl_list_20110627_phillip",
+ ggl_list_20110627_phillip[0], ggl_list_20110627_phillip[1],
+ 1, 0,
+ if_typed(5, if_typed_tt(8, 7)),
+ 14729.07145);
+
#ifdef _MSC_VER
{
diff --git a/test/geometry_test_common.hpp b/test/geometry_test_common.hpp
index 0af0a8340..d7f43c066 100644
--- a/test/geometry_test_common.hpp
+++ b/test/geometry_test_common.hpp
@@ -94,6 +94,24 @@ template <> struct string_from_type
#endif
+template
+inline T if_typed_tt(T value_tt, T value)
+{
+#if defined(HAVE_TTMATH)
+ return boost::is_same::value ? value_tt : value;
+#else
+ return value;
+#endif
+}
+
+template
+inline T if_typed(T value_typed, T value)
+{
+ return boost::is_same::value ? value_typed : value;
+}
+
+
+
struct geographic_policy
{