diff --git a/test/algorithms/relational_operations/overlaps/overlaps_box.cpp b/test/algorithms/relational_operations/overlaps/overlaps_box.cpp index c80ff6de4..26dd04c20 100644 --- a/test/algorithms/relational_operations/overlaps/overlaps_box.cpp +++ b/test/algorithms/relational_operations/overlaps/overlaps_box.cpp @@ -43,6 +43,20 @@ void test_3d() test_geometry, bg::model::box

>("BOX(1 1 1, 3 3 3)", "BOX(4 4 4,6 6 6)", false); } +template +void test_eps() +{ + typedef typename bg::coordinate_type

::type coord_type; + coord_type const eps = std::numeric_limits::epsilon(); + + bg::model::box

b1(P(0, 0), P(1, 1)); + bg::model::box

b2(P(-1, -1), P(eps/2, eps/2)); + + test_geometry(b1, b2, + "box(P(0, 0), P(1, 1))", "box(P(-1, -1), P(eps/2, eps/2))", + false); +} + template void test_2d() { @@ -53,9 +67,11 @@ int test_main( int , char* [] ) { test_2d >(); test_2d >(); + test_eps >(); #if defined(HAVE_TTMATH) test_2d >(); + test_eps >(); #endif //test_3d >(); diff --git a/test/algorithms/relational_operations/overlaps/test_overlaps.hpp b/test/algorithms/relational_operations/overlaps/test_overlaps.hpp index 862fe7389..8caf7dc03 100644 --- a/test/algorithms/relational_operations/overlaps/test_overlaps.hpp +++ b/test/algorithms/relational_operations/overlaps/test_overlaps.hpp @@ -2,6 +2,12 @@ // Unit Test // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. + +// This file was modified by Oracle on 2015. +// Modifications copyright (c) 2015 Oracle and/or its affiliates. + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -22,15 +28,12 @@ template -void test_geometry(std::string const& wkt1, - std::string const& wkt2, bool expected) +void test_geometry(Geometry1 const& geometry1, + Geometry2 const& geometry2, + std::string const& wkt1, + std::string const& wkt2, + bool expected) { - Geometry1 geometry1; - Geometry2 geometry2; - - bg::read_wkt(wkt1, geometry1); - bg::read_wkt(wkt2, geometry2); - bool detected = bg::overlaps(geometry1, geometry2); BOOST_CHECK_MESSAGE(detected == expected, @@ -42,11 +45,25 @@ void test_geometry(std::string const& wkt1, detected = bg::overlaps(geometry2, geometry1); BOOST_CHECK_MESSAGE(detected == expected, - "overlaps: " << wkt1 - << " with " << wkt2 + "overlaps: " << wkt2 + << " with " << wkt1 << " -> Expected: " << expected << " detected: " << detected); } +template +void test_geometry(std::string const& wkt1, + std::string const& wkt2, + bool expected) +{ + Geometry1 geometry1; + Geometry2 geometry2; + + bg::read_wkt(wkt1, geometry1); + bg::read_wkt(wkt2, geometry2); + + test_geometry(geometry1, geometry2, wkt1, wkt2, expected); +} + #endif