[test] Drop TypeOf dependency.

This commit is contained in:
Adam Wulkiewicz 2015-01-05 00:09:42 +01:00
parent 4b34a79de0
commit d24712d733
4 changed files with 38 additions and 26 deletions

View File

@ -14,14 +14,14 @@
#include <boost/geometry/algorithms/length.hpp> #include <boost/geometry/algorithms/length.hpp>
#include <boost/geometry/io/wkt/read.hpp> #include <boost/geometry/io/wkt/read.hpp>
#include <boost/geometry/strategies/strategies.hpp> #include <boost/geometry/strategies/strategies.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/variant/variant.hpp> #include <boost/variant/variant.hpp>
template <typename Geometry> template <typename Geometry>
void test_length(Geometry const& geometry, long double expected_length) void test_length(Geometry const& geometry, long double expected_length)
{ {
BOOST_AUTO(length, bg::length(geometry)); typename bg::default_length_result<Geometry>::type
length = bg::length(geometry);
#ifdef BOOST_GEOMETRY_TEST_DEBUG #ifdef BOOST_GEOMETRY_TEST_DEBUG
std::ostringstream out; std::ostringstream out;

View File

@ -10,7 +10,6 @@
#define BOOST_GEOMETRY_TEST_PERIMETER_HPP #define BOOST_GEOMETRY_TEST_PERIMETER_HPP
#include <boost/typeof/typeof.hpp>
#include <boost/variant/variant.hpp> #include <boost/variant/variant.hpp>
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
@ -23,7 +22,8 @@
template <typename Geometry> template <typename Geometry>
void test_perimeter(Geometry const& geometry, long double expected_perimeter) void test_perimeter(Geometry const& geometry, long double expected_perimeter)
{ {
BOOST_AUTO(perimeter, bg::perimeter(geometry)); typename bg::default_length_result<Geometry>::type
perimeter = bg::perimeter(geometry);
#ifdef BOOST_GEOMETRY_TEST_DEBUG #ifdef BOOST_GEOMETRY_TEST_DEBUG
std::ostringstream out; std::ostringstream out;

View File

@ -20,7 +20,6 @@
#endif #endif
#include <boost/timer.hpp> #include <boost/timer.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/concept/requires.hpp> #include <boost/concept/requires.hpp>
#include <boost/concept_check.hpp> #include <boost/concept_check.hpp>
@ -239,20 +238,27 @@ void test_integer(bool check_types)
bg::assign_values(p2, 98765432, 87654321); bg::assign_values(p2, 98765432, 87654321);
typedef bg::strategy::distance::pythagoras<> pythagoras_type; typedef bg::strategy::distance::pythagoras<> pythagoras_type;
pythagoras_type pythagoras;
BOOST_AUTO(distance, pythagoras.apply(p1, p2));
BOOST_CHECK_CLOSE(distance, 107655455.02347542, 0.001);
typedef typename bg::strategy::distance::services::comparable_type typedef typename bg::strategy::distance::services::comparable_type
< <
pythagoras_type pythagoras_type
>::type comparable_type; >::type comparable_type;
comparable_type comparable;
BOOST_AUTO(cdistance, comparable.apply(p1, p2));
BOOST_CHECK_EQUAL(cdistance, 11589696996311540);
typedef BOOST_TYPEOF(cdistance) cdistance_type; typedef typename bg::strategy::distance::services::return_type
typedef BOOST_TYPEOF(distance) distance_type; <
pythagoras_type, point_type, point_type
>::type distance_type;
typedef typename bg::strategy::distance::services::return_type
<
comparable_type, point_type, point_type
>::type cdistance_type;
pythagoras_type pythagoras;
distance_type distance = pythagoras.apply(p1, p2);
BOOST_CHECK_CLOSE(distance, 107655455.02347542, 0.001);
comparable_type comparable;
cdistance_type cdistance = comparable.apply(p1, p2);
BOOST_CHECK_EQUAL(cdistance, 11589696996311540);
distance_type distance2 = sqrt(distance_type(cdistance)); distance_type distance2 = sqrt(distance_type(cdistance));
BOOST_CHECK_CLOSE(distance, distance2, 0.001); BOOST_CHECK_CLOSE(distance, distance2, 0.001);

View File

@ -29,7 +29,6 @@
#include <boost/core/ignore_unused.hpp> #include <boost/core/ignore_unused.hpp>
#include <boost/timer.hpp> #include <boost/timer.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/concept/requires.hpp> #include <boost/concept/requires.hpp>
#include <boost/concept_check.hpp> #include <boost/concept_check.hpp>
@ -336,21 +335,28 @@ inline void test_integer(bool check_types)
bg::assign_values(b, 0, 0, 12345678, 23456789); bg::assign_values(b, 0, 0, 12345678, 23456789);
bg::assign_values(p, 98765432, 87654321); bg::assign_values(p, 98765432, 87654321);
typedef bg::strategy::distance::pythagoras_point_box<> pythagoras_pb_type; typedef bg::strategy::distance::pythagoras_point_box<> pythagoras_type;
pythagoras_pb_type pythagoras_pb;
BOOST_AUTO(distance, pythagoras_pb.apply(p, b));
BOOST_CHECK_CLOSE(distance, 107655455.02347542, 0.001);
typedef typename bg::strategy::distance::services::comparable_type typedef typename bg::strategy::distance::services::comparable_type
< <
pythagoras_pb_type pythagoras_type
>::type comparable_type; >::type comparable_type;
comparable_type comparable;
BOOST_AUTO(cdistance, comparable.apply(p, b));
BOOST_CHECK_EQUAL(cdistance, 11589696996311540);
typedef BOOST_TYPEOF(cdistance) cdistance_type; typedef typename bg::strategy::distance::services::return_type
typedef BOOST_TYPEOF(distance) distance_type; <
pythagoras_type, point_type, box_type
>::type distance_type;
typedef typename bg::strategy::distance::services::return_type
<
comparable_type, point_type, box_type
>::type cdistance_type;
pythagoras_type pythagoras;
distance_type distance = pythagoras.apply(p, b);
BOOST_CHECK_CLOSE(distance, 107655455.02347542, 0.001);
comparable_type comparable;
cdistance_type cdistance = comparable.apply(p, b);
BOOST_CHECK_EQUAL(cdistance, 11589696996311540);
distance_type distance2 = sqrt(distance_type(cdistance)); distance_type distance2 = sqrt(distance_type(cdistance));
BOOST_CHECK_CLOSE(distance, distance2, 0.001); BOOST_CHECK_CLOSE(distance, distance2, 0.001);