|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r56874 - in sandbox/ggl/formal_review_request/libs/ggl/test: . core
From: barend.gehrels_at_[hidden]
Date: 2009-10-15 13:01:31
Author: barendgehrels
Date: 2009-10-15 13:01:29 EDT (Thu, 15 Oct 2009)
New Revision: 56874
URL: http://svn.boost.org/trac/boost/changeset/56874
Log:
Added testsuite for core
Added:
sandbox/ggl/formal_review_request/libs/ggl/test/
sandbox/ggl/formal_review_request/libs/ggl/test/Jamroot (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/core/
sandbox/ggl/formal_review_request/libs/ggl/test/core/Jamfile (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/core/access.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_dimension.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_system.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_type.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/core/geometry_id.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/core/point_type.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/core/radian_access.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/core/reverse_dispatch.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/core/ring.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/core/tag.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/core/topological_dimension.cpp (contents, props changed)
Added: sandbox/ggl/formal_review_request/libs/ggl/test/Jamroot
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/Jamroot 2009-10-15 13:01:29 EDT (Thu, 15 Oct 2009)
@@ -0,0 +1,17 @@
+# Generic Geometry Library unit tests
+#
+# Copyright Bruno Lalande 2008
+# Copyright Barend Gehrels, Geodan Holding B.V. Amsterdam, the Netherlands.
+# 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)
+
+project
+ : requirements
+ <include>../../../boost
+ <include>.
+ <toolset>gcc:<cxxflags>-pedantic
+ ;
+
+import testing ;
+
Added: sandbox/ggl/formal_review_request/libs/ggl/test/core/Jamfile
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/Jamfile 2009-10-15 13:01:29 EDT (Thu, 15 Oct 2009)
@@ -0,0 +1,21 @@
+# Generic Geometry Library unit tests
+#
+# Copyright Bruno Lalande 2008
+# Copyright Barend Gehrels, Geodan Holding B.V. Amsterdam, the Netherlands.
+# 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)
+
+run access.cpp ;
+run coordinate_dimension.cpp ;
+run coordinate_system.cpp ;
+run coordinate_type.cpp ;
+run geometry_id.cpp ;
+run point_type.cpp ;
+run radian_access.cpp ;
+run reverse_dispatch.cpp ;
+run ring.cpp ;
+run tag.cpp ;
+run topological_dimension.cpp ;
+
+
Added: sandbox/ggl/formal_review_request/libs/ggl/test/core/access.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/access.cpp 2009-10-15 13:01:29 EDT (Thu, 15 Oct 2009)
@@ -0,0 +1,126 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// 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)
+
+#include <boost/test/floating_point_comparison.hpp>
+#include <boost/test/included/test_exec_monitor.hpp>
+
+#include <ggl/core/access.hpp>
+
+
+#include <ggl/core/coordinate_type.hpp>
+#include <ggl/algorithms/make.hpp>
+
+#include <ggl/geometries/adapted/c_array_cartesian.hpp>
+#include <ggl/geometries/adapted/tuple_cartesian.hpp>
+
+
+#include <ggl/core/cs.hpp>
+#include <ggl/geometries/point.hpp>
+#include <ggl/geometries/nsphere.hpp>
+#include <ggl/geometries/segment.hpp>
+#include <ggl/geometries/box.hpp>
+
+
+
+template <typename G>
+void test_get_set()
+{
+ typedef typename ggl::coordinate_type<G>::type coordinate_type;
+
+ G g;
+ ggl::set<0>(g, coordinate_type(1));
+ ggl::set<1>(g, coordinate_type(2));
+
+ coordinate_type x = ggl::get<0>(g);
+ coordinate_type y = ggl::get<1>(g);
+
+ BOOST_CHECK_CLOSE(double(x), 1.0, 0.0001);
+ BOOST_CHECK_CLOSE(double(y), 2.0, 0.0001);
+}
+
+template <typename G>
+void test_indexed_get_set(G& g)
+{
+ ggl::set<0, 0>(g, 1);
+ ggl::set<0, 1>(g, 2);
+ ggl::set<1, 0>(g, 3);
+ ggl::set<1, 1>(g, 4);
+
+ typedef typename ggl::coordinate_type<G>::type coordinate_type;
+ coordinate_type x1 = ggl::get<0, 0>(g);
+ coordinate_type y1 = ggl::get<0, 1>(g);
+ coordinate_type x2 = ggl::get<1, 0>(g);
+ coordinate_type y2 = ggl::get<1, 1>(g);
+
+ BOOST_CHECK_CLOSE(double(x1), 1.0, 0.0001);
+ BOOST_CHECK_CLOSE(double(y1), 2.0, 0.0001);
+ BOOST_CHECK_CLOSE(double(x2), 3.0, 0.0001);
+ BOOST_CHECK_CLOSE(double(y2), 4.0, 0.0001);
+}
+
+template <typename G, typename T>
+void test_indexed_get(G const& g, T a, T b, T c, T d)
+{
+ T x1 = ggl::get<0, 0>(g);
+ T y1 = ggl::get<0, 1>(g);
+ T x2 = ggl::get<1, 0>(g);
+ T y2 = ggl::get<1, 1>(g);
+
+ BOOST_CHECK_CLOSE(double(x1), double(a), 0.0001);
+ BOOST_CHECK_CLOSE(double(y1), double(b), 0.0001);
+ BOOST_CHECK_CLOSE(double(x2), double(c), 0.0001);
+ BOOST_CHECK_CLOSE(double(y2), double(d), 0.0001);
+}
+
+template <typename P>
+void test_all()
+{
+ typedef typename ggl::coordinate_type<P>::type coordinate_type;
+
+ // POINT, setting coordinate
+ test_get_set<P>();
+
+ // N-SPHERE, setting sphere center
+ test_get_set<ggl::nsphere<P, double> >();
+
+ // BOX, setting left/right/top/bottom
+ ggl::box<P> b;
+ test_indexed_get_set(b);
+
+ // SEGMENT (in GGL not having default constructor; however that is not a requirement)
+ P p1 = ggl::make_zero<P>();
+ P p2 = ggl::make_zero<P>();
+ ggl::segment<P> s(p1, p2);
+ test_indexed_get_set(s);
+
+ // CONST SEGMENT
+ ggl::set<0>(p1, 1); // we don't use assign because dim in {2,3}
+ ggl::set<1>(p1, 2);
+ ggl::set<0>(p2, 3);
+ ggl::set<1>(p2, 4);
+ ggl::segment<const P> cs(p1, p2);
+ test_indexed_get(cs,
+ coordinate_type(1), coordinate_type(2),
+ coordinate_type(3), coordinate_type(4));
+}
+
+
+int test_main(int, char* [])
+{
+ test_get_set<int[2]>();
+ test_get_set<float[2]>();
+ test_get_set<double[2]>();
+
+ test_get_set<double[3]>();
+
+ test_all<ggl::point<int, 2, ggl::cs::cartesian> >();
+ test_all<ggl::point<float, 2, ggl::cs::cartesian> >();
+ test_all<ggl::point<double, 2, ggl::cs::cartesian> >();
+
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_dimension.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_dimension.cpp 2009-10-15 13:01:29 EDT (Thu, 15 Oct 2009)
@@ -0,0 +1,69 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// 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)
+
+#include <boost/concept/assert.hpp>
+#include <boost/test/included/test_exec_monitor.hpp>
+
+#include <ggl/core/coordinate_dimension.hpp>
+
+
+#include <ggl/geometries/geometries.hpp>
+
+#include <ggl/geometries/adapted/c_array_cartesian.hpp>
+#include <ggl/geometries/adapted/tuple_cartesian.hpp>
+
+#include <ggl/geometries/adapted/boost_array_as_linestring.hpp>
+#include <ggl/geometries/adapted/std_as_linestring.hpp>
+
+#include <vector>
+#include <deque>
+
+
+template <typename G, std::size_t Expected>
+void test_geometry()
+{
+ BOOST_CHECK_EQUAL(ggl::dimension<G>::type::value, Expected);
+}
+
+template <typename P, size_t D>
+void test_all()
+{
+ test_geometry<P, D>();
+ test_geometry<const P, D>();
+ test_geometry<ggl::linestring<P> , D>();
+ test_geometry<ggl::linear_ring<P> , D>();
+ test_geometry<ggl::polygon<P> , D>();
+ test_geometry<ggl::box<P> , D>();
+ test_geometry<ggl::segment<P> , D>();
+ test_geometry<ggl::segment<const P> , D>();
+ test_geometry<ggl::nsphere<P, double> , D>();
+
+ test_geometry<std::vector<P>, D>();
+ test_geometry<std::deque<P>, D>();
+
+ test_geometry<boost::array<P, 5>, D>();
+}
+
+int test_main(int, char* [])
+{
+ test_geometry<int[2], 2>();
+ test_geometry<float[2], 2>();
+ test_geometry<double[2], 2>();
+
+ test_geometry<int[3], 3>();
+ test_geometry<float[3], 3>();
+ test_geometry<double[3], 3>();
+
+ test_geometry<boost::tuple<double, double>, 2>();
+ test_geometry<boost::tuple<double, double, double>, 3>();
+
+ test_all<ggl::point<int, 2, ggl::cs::cartesian>, 2 >();
+ test_all<ggl::point<float, 2, ggl::cs::cartesian>, 2 >();
+ test_all<ggl::point<double, 2, ggl::cs::cartesian>, 2 >();
+
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_system.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_system.cpp 2009-10-15 13:01:29 EDT (Thu, 15 Oct 2009)
@@ -0,0 +1,96 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// 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)
+
+#include <boost/concept/assert.hpp>
+#include <boost/test/included/test_exec_monitor.hpp>
+
+#include <ggl/core/coordinate_system.hpp>
+
+
+#include <ggl/geometries/geometries.hpp>
+
+#include <ggl/geometries/adapted/c_array_cartesian.hpp>
+#include <ggl/geometries/adapted/tuple_cartesian.hpp>
+
+#include <ggl/geometries/adapted/boost_array_as_linestring.hpp>
+#include <ggl/geometries/adapted/std_as_linestring.hpp>
+
+#include <vector>
+#include <deque>
+
+
+template <typename G, typename Expected>
+void test_geometry()
+{
+ BOOST_CHECK_EQUAL(typeid(typename ggl::coordinate_system<G>::type).name(),
+ typeid(Expected).name());
+}
+
+template <typename P, typename Expected>
+void test_all()
+{
+ test_geometry<P, Expected>();
+ test_geometry<const P, Expected>();
+ test_geometry<ggl::linestring<P> , Expected>();
+ test_geometry<ggl::linear_ring<P> , Expected>();
+ test_geometry<ggl::polygon<P> , Expected>();
+ test_geometry<ggl::box<P> , Expected>();
+ test_geometry<ggl::segment<P> , Expected>();
+ test_geometry<ggl::segment<const P> , Expected>();
+ test_geometry<ggl::nsphere<P, double> , Expected>();
+
+ test_geometry<std::vector<P>, Expected>();
+ test_geometry<std::deque<P>, Expected>();
+
+ test_geometry<boost::array<P, 5>, Expected>();
+}
+
+int test_main(int, char* [])
+{
+ // Because of the included headerfiles, there are always cartesian
+ test_geometry<int[2], ggl::cs::cartesian>();
+ test_geometry<float[2], ggl::cs::cartesian>();
+ test_geometry<double[2], ggl::cs::cartesian>();
+
+ test_geometry<int[3], ggl::cs::cartesian>();
+ test_geometry<float[3], ggl::cs::cartesian>();
+ test_geometry<double[3], ggl::cs::cartesian>();
+
+ // Because of the included headerfiles, there are always cartesian
+ test_geometry<boost::tuple<double, double>, ggl::cs::cartesian>();
+ test_geometry<boost::tuple<double, double, double>, ggl::cs::cartesian>();
+
+
+ // Test cartesian
+ test_all<ggl::point<int, 2, ggl::cs::cartesian>, ggl::cs::cartesian>();
+ test_all<ggl::point<float, 2, ggl::cs::cartesian>, ggl::cs::cartesian>();
+ test_all<ggl::point<double, 2, ggl::cs::cartesian>, ggl::cs::cartesian>();
+
+ // Test spherical
+ test_all<ggl::point<int, 2, ggl::cs::spherical<ggl::degree> >,
+ ggl::cs::spherical<ggl::degree> >();
+ test_all<ggl::point<float, 2, ggl::cs::spherical<ggl::degree> >,
+ ggl::cs::spherical<ggl::degree> >();
+ test_all<ggl::point<double, 2, ggl::cs::spherical<ggl::degree> >,
+ ggl::cs::spherical<ggl::degree> >();
+
+ test_all<ggl::point<int, 2, ggl::cs::spherical<ggl::radian> >,
+ ggl::cs::spherical<ggl::radian> >();
+ test_all<ggl::point<float, 2, ggl::cs::spherical<ggl::radian> >,
+ ggl::cs::spherical<ggl::radian> >();
+ test_all<ggl::point<double, 2, ggl::cs::spherical<ggl::radian> >,
+ ggl::cs::spherical<ggl::radian> >();
+
+ // Test other
+ test_all<ggl::point<double, 2, ggl::cs::polar<ggl::degree> >,
+ ggl::cs::polar<ggl::degree> >();
+
+ test_all<ggl::point<double, 2, ggl::cs::geographic<ggl::degree> >,
+ ggl::cs::geographic<ggl::degree> >();
+
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_type.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_type.cpp 2009-10-15 13:01:29 EDT (Thu, 15 Oct 2009)
@@ -0,0 +1,73 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// 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)
+
+#include <boost/concept/assert.hpp>
+#include <boost/test/included/test_exec_monitor.hpp>
+
+#include <ggl/core/coordinate_type.hpp>
+
+
+#include <ggl/geometries/geometries.hpp>
+
+#include <ggl/geometries/adapted/c_array_cartesian.hpp>
+#include <ggl/geometries/adapted/tuple_cartesian.hpp>
+
+#include <ggl/geometries/adapted/boost_array_as_linestring.hpp>
+#include <ggl/geometries/adapted/std_as_linestring.hpp>
+
+#include <vector>
+#include <deque>
+
+
+template <typename G, typename Expected>
+void test_geometry()
+{
+ BOOST_CHECK_EQUAL(typeid(typename ggl::coordinate_type<G>::type).name(),
+ typeid(Expected).name());
+}
+
+template <typename P, typename Expected>
+void test_all()
+{
+ test_geometry<P, Expected>();
+ test_geometry<const P, Expected>();
+ test_geometry<ggl::linestring<P> , Expected>();
+ test_geometry<ggl::linear_ring<P> , Expected>();
+ test_geometry<ggl::polygon<P> , Expected>();
+ test_geometry<ggl::box<P> , Expected>();
+ test_geometry<ggl::segment<P> , Expected>();
+ test_geometry<ggl::segment<const P> , Expected>();
+ test_geometry<ggl::nsphere<P, double> , Expected>();
+
+ test_geometry<std::vector<P>, Expected>();
+ test_geometry<std::deque<P>, Expected>();
+
+ test_geometry<boost::array<P, 5>, Expected>();
+}
+
+int test_main(int, char* [])
+{
+ test_geometry<int[2], int>();
+ test_geometry<float[2], float>();
+ test_geometry<double[2], double>();
+
+ test_geometry<int[3], int>();
+ test_geometry<float[3], float>();
+ test_geometry<double[3], double>();
+
+ test_geometry<boost::tuple<float, float>, float>();
+ test_geometry<boost::tuple<double, double>, double>();
+ test_geometry<boost::tuple<long double, long double>, long double>();
+ test_geometry<boost::tuple<double, double, double>, double>();
+
+ test_all<ggl::point<int, 2, ggl::cs::cartesian>, int>();
+ test_all<ggl::point<float, 2, ggl::cs::cartesian>, float>();
+ test_all<ggl::point<double, 2, ggl::cs::cartesian>, double>();
+ test_all<ggl::point<long double, 2, ggl::cs::cartesian>, long double>();
+
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/core/geometry_id.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/geometry_id.cpp 2009-10-15 13:01:29 EDT (Thu, 15 Oct 2009)
@@ -0,0 +1,68 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// 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)
+
+#include <boost/concept/assert.hpp>
+#include <boost/test/included/test_exec_monitor.hpp>
+
+#include <ggl/core/geometry_id.hpp>
+
+#include <ggl/geometries/geometries.hpp>
+
+#include <ggl/geometries/adapted/c_array_cartesian.hpp>
+#include <ggl/geometries/adapted/tuple_cartesian.hpp>
+
+#include <ggl/geometries/adapted/boost_array_as_linestring.hpp>
+#include <ggl/geometries/adapted/std_as_linestring.hpp>
+
+#include <vector>
+#include <deque>
+
+
+template <typename G, std::size_t Expected>
+void test_geometry()
+{
+ BOOST_CHECK_EQUAL(ggl::geometry_id<G>::type::value, Expected);
+}
+
+template <typename P>
+void test_all()
+{
+ test_geometry<P, 1>();
+ test_geometry<const P, 1>();
+ test_geometry<ggl::linestring<P> , 2>();
+ test_geometry<ggl::linear_ring<P> , 93>();
+ test_geometry<ggl::polygon<P> , 3>();
+ test_geometry<ggl::box<P> , 94>();
+ test_geometry<ggl::segment<P> , 92>();
+ test_geometry<ggl::segment<const P> , 92>();
+ test_geometry<ggl::nsphere<P, double> , 91>();
+
+ test_geometry<std::vector<P>, 2>();
+ test_geometry<std::deque<P>, 2>();
+
+ test_geometry<boost::array<P, 5>, 2>();
+}
+
+int test_main(int, char* [])
+{
+ test_geometry<int[2], 1>();
+ test_geometry<float[2], 1>();
+ test_geometry<double[2], 1>();
+
+ test_geometry<int[3], 1>();
+ test_geometry<float[3], 1>();
+ test_geometry<double[3], 1>();
+
+ test_geometry<boost::tuple<double, double>, 1>();
+ test_geometry<boost::tuple<double, double, double>, 1>();
+
+ test_all<ggl::point<int, 2, ggl::cs::cartesian> >();
+ test_all<ggl::point<float, 2, ggl::cs::cartesian> >();
+ test_all<ggl::point<double, 2, ggl::cs::cartesian> >();
+
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/core/point_type.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/point_type.cpp 2009-10-15 13:01:29 EDT (Thu, 15 Oct 2009)
@@ -0,0 +1,72 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// 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)
+
+#include <boost/concept/assert.hpp>
+#include <boost/test/included/test_exec_monitor.hpp>
+
+
+#include <ggl/core/tag.hpp>
+
+#include <ggl/geometries/geometries.hpp>
+
+#include <ggl/geometries/adapted/c_array_cartesian.hpp>
+#include <ggl/geometries/adapted/tuple_cartesian.hpp>
+
+#include <ggl/geometries/adapted/boost_array_as_linestring.hpp>
+#include <ggl/geometries/adapted/std_as_linestring.hpp>
+
+#include <vector>
+#include <deque>
+
+
+template <typename G, typename Expected>
+void test_geometry()
+{
+ BOOST_CHECK_EQUAL(typeid(typename ggl::point_type<G>::type).name(),
+ typeid(Expected).name());
+}
+
+template <typename P>
+void test_all()
+{
+ test_geometry<P, P>();
+ test_geometry<const P, P>();
+ test_geometry<ggl::linestring<P> , P>();
+ test_geometry<ggl::linear_ring<P> , P>();
+ test_geometry<ggl::polygon<P> , P>();
+ test_geometry<ggl::box<P> , P>();
+ test_geometry<ggl::segment<P> , P>();
+ test_geometry<ggl::segment<const P> , P>();
+ test_geometry<ggl::nsphere<P, double> , P>();
+
+ test_geometry<std::vector<P>, P>();
+ test_geometry<std::deque<P>, P>();
+
+ test_geometry<boost::array<P, 5>, P>();
+}
+
+int test_main(int, char* [])
+{
+ test_geometry<int[2], int[2]>();
+ test_geometry<float[2], float[2]>();
+ test_geometry<double[2], double[2]>();
+
+ test_geometry<int[3], int[3]>();
+ test_geometry<float[3], float[3]>();
+ test_geometry<double[3], double[3]>();
+
+ test_geometry<boost::tuple<double, double>,
+ boost::tuple<double, double> >();
+ test_geometry<boost::tuple<double, double, double>,
+ boost::tuple<double, double, double> >();
+
+ test_all<ggl::point<int, 2, ggl::cs::cartesian> >();
+ test_all<ggl::point<float, 2, ggl::cs::cartesian> >();
+ test_all<ggl::point<double, 2, ggl::cs::cartesian> >();
+
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/core/radian_access.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/radian_access.cpp 2009-10-15 13:01:29 EDT (Thu, 15 Oct 2009)
@@ -0,0 +1,81 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// 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)
+
+#include <boost/test/floating_point_comparison.hpp>
+#include <boost/test/included/test_exec_monitor.hpp>
+
+
+#include <ggl/core/coordinate_type.hpp>
+#include <ggl/core/radian_access.hpp>
+
+#include <ggl/core/cs.hpp>
+#include <ggl/geometries/point.hpp>
+
+
+template <typename P, typename T>
+void test_get(T const& c1, T const& c2,
+ T const& e1, T const& e2)
+{
+ typedef typename ggl::coordinate_type<P>::type coordinate_type;
+
+ P p;
+ ggl::set<0>(p, coordinate_type(c1));
+ ggl::set<1>(p, coordinate_type(c2));
+
+ coordinate_type g1 = ggl::get_as_radian<0>(p);
+ coordinate_type g2 = ggl::get_as_radian<1>(p);
+
+ BOOST_CHECK_CLOSE(double(g1), double(e1), 0.0001);
+ BOOST_CHECK_CLOSE(double(g2), double(e2), 0.0001);
+}
+
+
+template <typename P, typename T>
+void test_set(T const& c1, T const& c2,
+ T const& e1, T const& e2)
+{
+ typedef typename ggl::coordinate_type<P>::type coordinate_type;
+
+ P p;
+ ggl::set_from_radian<0>(p, coordinate_type(c1));
+ ggl::set_from_radian<1>(p, coordinate_type(c2));
+
+ coordinate_type g1 = ggl::get<0>(p);
+ coordinate_type g2 = ggl::get<1>(p);
+
+ BOOST_CHECK_CLOSE(double(g1), double(e1), 0.0001);
+ BOOST_CHECK_CLOSE(double(g2), double(e2), 0.0001);
+}
+
+
+template <typename T>
+void test()
+{
+ double d2r = 3.1415926535897932384626433832795 / 180.0;
+
+ test_get<ggl::point<T, 2, ggl::cs::spherical<ggl::degree> > >
+ (1.0, 2.0, 1.0 * d2r, 2.0 * d2r);
+
+ test_get<ggl::point<T, 2, ggl::cs::spherical<ggl::radian> > >
+ (1.0, 2.0, 1.0, 2.0);
+
+ test_set<ggl::point<T, 2, ggl::cs::spherical<ggl::radian> > >
+ (1.0, 2.0, 1.0, 2.0);
+ test_set<ggl::point<T, 2, ggl::cs::spherical<ggl::degree> > >
+ (1.0 * d2r, 2.0 * d2r, 1.0, 2.0);
+
+}
+
+
+int test_main(int, char* [])
+{
+ //test<float>();
+ test<double>();
+
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/core/reverse_dispatch.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/reverse_dispatch.cpp 2009-10-15 13:01:29 EDT (Thu, 15 Oct 2009)
@@ -0,0 +1,60 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// 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)
+
+#include <iostream>
+
+#include <boost/test/included/test_exec_monitor.hpp>
+
+#include <ggl/core/reverse_dispatch.hpp>
+
+#include <ggl/geometries/geometries.hpp>
+
+
+
+template <typename Geometry1, typename Geometry2, bool Expected>
+void test_reversed()
+{
+ BOOST_CHECK_EQUAL((ggl::reverse_dispatch<Geometry1, Geometry2>::type::value),
+ Expected);
+}
+
+
+template <typename P>
+void test_all()
+{
+
+ test_reversed<P, P, false>();
+ test_reversed<P, ggl::linestring<P>, false>();
+ test_reversed<ggl::linestring<P>, P, true>();
+ test_reversed<ggl::linear_ring<P>, P, true>();
+ test_reversed<ggl::linestring<P>, ggl::linear_ring<P>, false>();
+ test_reversed<ggl::linear_ring<P>, ggl::linestring<P>, true>();
+}
+
+template <typename P1, typename P2>
+void test_mixed()
+{
+ test_reversed<P1, P2, false>();
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<ggl::point<int, 2, ggl::cs::cartesian> >();
+ test_mixed
+ <
+ ggl::point<int, 2, ggl::cs::cartesian>,
+ ggl::point<int, 2, ggl::cs::spherical<ggl::degree> >
+ >();
+ test_mixed
+ <
+ ggl::point<int, 2, ggl::cs::spherical<ggl::degree> >,
+ ggl::point<int, 2, ggl::cs::spherical<ggl::radian> >
+ >();
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/core/ring.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/ring.cpp 2009-10-15 13:01:29 EDT (Thu, 15 Oct 2009)
@@ -0,0 +1,68 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// 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)
+
+#include <iostream>
+
+#include <boost/test/included/test_exec_monitor.hpp>
+
+// To be tested:
+#include <ggl/core/ring_type.hpp>
+#include <ggl/core/exterior_ring.hpp>
+#include <ggl/core/interior_rings.hpp>
+
+// For geometries:
+#include <ggl/core/cs.hpp>
+#include <ggl/geometries/point.hpp>
+#include <ggl/geometries/polygon.hpp>
+
+
+#include <ggl/extensions/gis/io/wkt/read_wkt.hpp>
+
+
+
+
+template <typename P>
+void test_ring(std::string const& wkt,
+ int expected_main_count,
+ int expected_interior_ring_count,
+ int expected_first_interior_count)
+{
+ typedef ggl::polygon<P> the_polygon;
+ typedef typename ggl::ring_type<the_polygon>::type the_ring;
+ typedef typename ggl::interior_type<the_polygon>::type the_interior;
+
+ the_polygon poly;
+ read_wkt(wkt, poly);
+
+ the_ring ext = ggl::exterior_ring(poly);
+ the_interior rings = ggl::interior_rings(poly);
+
+ BOOST_CHECK_EQUAL(ggl::num_interior_rings(poly), expected_interior_ring_count);
+ BOOST_CHECK_EQUAL(boost::size(rings), expected_interior_ring_count);
+ BOOST_CHECK_EQUAL(boost::size(ext), expected_main_count);
+ if (boost::size(rings) > 0)
+ {
+ BOOST_CHECK_EQUAL(boost::size(rings.front()), expected_first_interior_count);
+ }
+}
+
+
+template <typename P>
+void test_all()
+{
+ test_ring<P>("POLYGON((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))", 5, 1, 5);
+ test_ring<P>("POLYGON((0 0,0 3,3 3,3 0,0 0),(1 1,2 2,2 1,1 1),(1 1,1 2,2 2,1 1))", 5, 2, 4);
+ test_ring<P>("POLYGON((0 0,0 3,3 3,3 0,0 0))", 5, 0, 0);
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<ggl::point<double, 2, ggl::cs::cartesian> >();
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/core/tag.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/tag.cpp 2009-10-15 13:01:29 EDT (Thu, 15 Oct 2009)
@@ -0,0 +1,69 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// 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)
+
+#include <boost/concept/assert.hpp>
+#include <boost/test/included/test_exec_monitor.hpp>
+
+#include <ggl/core/tag.hpp>
+
+#include <ggl/geometries/geometries.hpp>
+
+#include <ggl/geometries/adapted/c_array_cartesian.hpp>
+#include <ggl/geometries/adapted/tuple_cartesian.hpp>
+
+#include <ggl/geometries/adapted/boost_array_as_linestring.hpp>
+#include <ggl/geometries/adapted/std_as_linestring.hpp>
+
+#include <vector>
+#include <deque>
+
+
+template <typename G, typename Expected>
+void test_geometry()
+{
+ BOOST_CHECK_EQUAL(typeid(typename ggl::tag<G>::type).name(),
+ typeid(Expected).name());
+}
+
+template <typename P, size_t D>
+void test_all()
+{
+ test_geometry<P, ggl::point_tag>();
+ test_geometry<const P, ggl::point_tag>();
+ test_geometry<ggl::linestring<P> , ggl::linestring_tag>();
+ test_geometry<ggl::linear_ring<P> , ggl::ring_tag>();
+ test_geometry<ggl::polygon<P> , ggl::polygon_tag>();
+ test_geometry<ggl::box<P> , ggl::box_tag>();
+ test_geometry<ggl::segment<P> , ggl::segment_tag>();
+ test_geometry<ggl::segment<const P> , ggl::segment_tag>();
+ test_geometry<ggl::nsphere<P, double> , ggl::nsphere_tag>();
+
+ test_geometry<std::vector<P>, ggl::linestring_tag>();
+ test_geometry<std::deque<P>, ggl::linestring_tag>();
+
+ test_geometry<boost::array<P, 5>, ggl::linestring_tag>();
+}
+
+int test_main(int, char* [])
+{
+ test_geometry<int[2], ggl::point_tag>();
+ test_geometry<float[2], ggl::point_tag>();
+ test_geometry<double[2], ggl::point_tag>();
+
+ test_geometry<int[3], ggl::point_tag>();
+ test_geometry<float[3], ggl::point_tag>();
+ test_geometry<double[3], ggl::point_tag>();
+
+ test_geometry<boost::tuple<double, double>, ggl::point_tag>();
+ test_geometry<boost::tuple<double, double, double>, ggl::point_tag>();
+
+ test_all<ggl::point<int, 2, ggl::cs::cartesian>, 2 >();
+ test_all<ggl::point<float, 2, ggl::cs::cartesian>, 2 >();
+ test_all<ggl::point<double, 2, ggl::cs::cartesian>, 2 >();
+
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/core/topological_dimension.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/topological_dimension.cpp 2009-10-15 13:01:29 EDT (Thu, 15 Oct 2009)
@@ -0,0 +1,68 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// 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)
+
+#include <boost/concept/assert.hpp>
+#include <boost/test/included/test_exec_monitor.hpp>
+
+#include <ggl/core/topological_dimension.hpp>
+
+#include <ggl/geometries/geometries.hpp>
+
+#include <ggl/geometries/adapted/c_array_cartesian.hpp>
+#include <ggl/geometries/adapted/tuple_cartesian.hpp>
+
+#include <ggl/geometries/adapted/boost_array_as_linestring.hpp>
+#include <ggl/geometries/adapted/std_as_linestring.hpp>
+
+#include <vector>
+#include <deque>
+
+
+template <typename G, std::size_t Expected>
+void test_geometry()
+{
+ BOOST_CHECK_EQUAL(ggl::topological_dimension<G>::type::value, Expected);
+}
+
+template <typename P>
+void test_all()
+{
+ test_geometry<P, 0>();
+ test_geometry<const P, 0>();
+ test_geometry<ggl::linestring<P> , 1>();
+ test_geometry<ggl::linear_ring<P> , 2>(); // being discussed
+ test_geometry<ggl::polygon<P> , 2>();
+ test_geometry<ggl::box<P> , 2>();
+ test_geometry<ggl::segment<P> , 1>();
+ test_geometry<ggl::segment<const P> , 1>();
+ test_geometry<ggl::nsphere<P, double> , 2>(); // being discussed
+
+ test_geometry<std::vector<P>, 1>();
+ test_geometry<std::deque<P>, 1>();
+
+ test_geometry<boost::array<P, 5>, 1>();
+}
+
+int test_main(int, char* [])
+{
+ test_geometry<int[2], 0>();
+ test_geometry<float[2], 0>();
+ test_geometry<double[2], 0>();
+
+ test_geometry<int[3], 0>();
+ test_geometry<float[3], 0>();
+ test_geometry<double[3], 0>();
+
+ test_geometry<boost::tuple<double, double>, 0>();
+ test_geometry<boost::tuple<double, double, double>, 0>();
+
+ test_all<ggl::point<int, 2, ggl::cs::cartesian> >();
+ test_all<ggl::point<float, 2, ggl::cs::cartesian> >();
+ test_all<ggl::point<double, 2, ggl::cs::cartesian> >();
+
+ return 0;
+}
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