Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74148 - in trunk/libs/geometry/test: . algorithms
From: barend.gehrels_at_[hidden]
Date: 2011-08-30 06:49:36


Author: barendgehrels
Date: 2011-08-30 06:49:35 EDT (Tue, 30 Aug 2011)
New Revision: 74148
URL: http://svn.boost.org/trac/boost/changeset/74148

Log:
Added (simplex) test for intersection using Boost.Rational and reapplied test_pointer
Text files modified:
   trunk/libs/geometry/test/algorithms/intersection.cpp | 19 ++++++++++++++++---
   trunk/libs/geometry/test/geometry_test_common.hpp | 5 +++++
   2 files changed, 21 insertions(+), 3 deletions(-)

Modified: trunk/libs/geometry/test/algorithms/intersection.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/intersection.cpp (original)
+++ trunk/libs/geometry/test/algorithms/intersection.cpp 2011-08-30 06:49:35 EDT (Tue, 30 Aug 2011)
@@ -27,6 +27,8 @@
 #include <boost/geometry/geometries/point_xy.hpp>
 #include <boost/geometry/geometries/register/linestring.hpp>
 
+#include <boost/geometry/util/rational.hpp>
+
 #include <test_common/test_point.hpp>
 #include <test_common/with_pointer.hpp>
 #include <test_geometries/custom_segment.hpp>
@@ -399,10 +401,18 @@
     BOOST_CHECK_MESSAGE(false, "No exception thrown");
 }
 
-int test_main(int, char* [])
+template <typename Point>
+void test_rational()
 {
- test_exception<bg::model::d2::point_xy<double> >();
+ typedef bg::model::polygon<Point> polygon;
+ test_one<polygon, polygon, polygon>("simplex_normal",
+ simplex_normal[0], simplex_normal[1],
+ 1, 7, 5.47363293);
+}
 
+
+int test_main(int, char* [])
+{
     test_all<bg::model::d2::point_xy<double> >();
 
 #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
@@ -412,9 +422,12 @@
     test_all<bg::model::d2::point_xy<ttmath_big> >();
 #endif
 
- //test_pointer_version();
 #endif
 
+ test_exception<bg::model::d2::point_xy<double> >();
+ test_pointer_version();
+ test_rational<bg::model::d2::point_xy<boost::rational<int> > >();
+
     return 0;
 }
 

Modified: trunk/libs/geometry/test/geometry_test_common.hpp
==============================================================================
--- trunk/libs/geometry/test/geometry_test_common.hpp (original)
+++ trunk/libs/geometry/test/geometry_test_common.hpp 2011-08-30 06:49:35 EDT (Tue, 30 Aug 2011)
@@ -82,6 +82,11 @@
     { static std::string name() { return "t"; } };
 #endif
 
+#if defined(BOOST_RATIONAL_HPP)
+template <typename T> struct string_from_type<boost::rational<T> >
+{ static std::string name() { return "r"; } };
+#endif
+
 
 #if defined(HAVE_GMP)
     template <> struct string_from_type<boost::numeric_adaptor::gmp_value_type>


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