Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76894 - in trunk/libs/geometry/test/algorithms: . detail/sections
From: barend.gehrels_at_[hidden]
Date: 2012-02-05 06:09:41


Author: barendgehrels
Date: 2012-02-05 06:09:40 EST (Sun, 05 Feb 2012)
New Revision: 76894
URL: http://svn.boost.org/trac/boost/changeset/76894

Log:
Pending commits in unit tests
Text files modified:
   trunk/libs/geometry/test/algorithms/detail/sections/sectionalize.cpp | 35 +++++++++++++++++++++++++++++++++++
   trunk/libs/geometry/test/algorithms/intersects.cpp | 5 +++++
   trunk/libs/geometry/test/algorithms/within.cpp | 1 +
   3 files changed, 41 insertions(+), 0 deletions(-)

Modified: trunk/libs/geometry/test/algorithms/detail/sections/sectionalize.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/detail/sections/sectionalize.cpp (original)
+++ trunk/libs/geometry/test/algorithms/detail/sections/sectionalize.cpp 2012-02-05 06:09:40 EST (Sun, 05 Feb 2012)
@@ -297,8 +297,43 @@
         4, "0..4|4..5|5..8|8..11", "+|-|+|-");
 }
 
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ std::string const polygon_li = "POLYGON((1872000 528000,1872000 192000,1536119 192000,1536000 528000,1200000 528000,1200000 863880,1536000 863880,1872000 863880,1872000 528000))";
+ bg::model::polygon<int_point_type> int_poly;
+ bg::model::polygon<double_point_type> double_poly;
+ bg::read_wkt(polygon_li, int_poly);
+ bg::read_wkt(polygon_li, double_poly);
+
+ bg::sections<bg::model::box<int_point_type>, 1> int_sections;
+ bg::sections<bg::model::box<double_point_type>, 1> double_sections;
+
+ bg::sectionalize<false>(int_poly, int_sections);
+ bg::sectionalize<false>(double_poly, double_sections);
+
+ bool equally_sized = int_sections.size() == double_sections.size();
+ BOOST_CHECK(equally_sized);
+ if (! equally_sized)
+ {
+ return;
+ }
+
+ for (unsigned int i = 0; i < int_sections.size(); i++)
+ {
+ BOOST_CHECK(int_sections[i].begin_index == double_sections[i].begin_index);
+ BOOST_CHECK(int_sections[i].count == double_sections[i].count);
+ }
+
+}
+
+
 int test_main(int, char* [])
 {
+ test_large_integers();
+
     //test_all<bg::model::d2::point_xy<float> >();
     test_all<bg::model::d2::point_xy<double> >();
 

Modified: trunk/libs/geometry/test/algorithms/intersects.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/intersects.cpp (original)
+++ trunk/libs/geometry/test/algorithms/intersects.cpp 2012-02-05 06:09:40 EST (Sun, 05 Feb 2012)
@@ -11,6 +11,8 @@
 #include <boost/geometry/geometries/geometries.hpp>
 #include <boost/geometry/geometries/point_xy.hpp>
 
+#include <boost/geometry/util/rational.hpp>
+
 
 template <typename P>
 void test_all()
@@ -118,6 +120,9 @@
 {
     test_all<bg::model::d2::point_xy<double> >();
 
+ test_all<bg::model::d2::point_xy<boost::rational<int> > >();
+
+
 #if defined(HAVE_TTMATH)
     test_all<bg::model::d2::point_xy<ttmath_big> >();
 #endif

Modified: trunk/libs/geometry/test/algorithms/within.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/within.cpp (original)
+++ trunk/libs/geometry/test/algorithms/within.cpp 2012-02-05 06:09:40 EST (Sun, 05 Feb 2012)
@@ -238,6 +238,7 @@
     bool wi = bg::within(int_point, int_poly);
     bool wd = bg::within(double_point, double_poly);
 
+ BOOST_CHECK_MESSAGE(wi == wd, "within<a double> different from within<an int>");
 }
 
 int test_main( int , char* [] )


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk