mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-09 15:14:02 +00:00
[test] Fix static asserts by passing types.
This commit is contained in:
parent
789281a5d1
commit
efff23114a
@ -184,19 +184,18 @@ struct test_variant_different_default_strategy
|
||||
|
||||
variant_type v1, v2;
|
||||
|
||||
using variant_cdistance_t = typename bg::comparable_distance_result
|
||||
<
|
||||
variant_type, variant_type, bg::default_strategy
|
||||
>::type;
|
||||
using cdistance_t = typename bg::comparable_distance_result
|
||||
<
|
||||
point_type, point_type, bg::default_strategy
|
||||
>::type;
|
||||
BOOST_GEOMETRY_STATIC_ASSERT(
|
||||
(std::is_same
|
||||
<
|
||||
typename bg::comparable_distance_result
|
||||
<
|
||||
variant_type, variant_type, bg::default_strategy
|
||||
>::type,
|
||||
typename bg::comparable_distance_result
|
||||
<
|
||||
point_type, point_type, bg::default_strategy
|
||||
>::type
|
||||
>::value),
|
||||
"Unexpected result type");
|
||||
(std::is_same<variant_cdistance_t, cdistance_t>::value),
|
||||
"Unexpected result type",
|
||||
variant_cdistance_t, cdistance_t);
|
||||
|
||||
// Default strategy
|
||||
v1 = point;
|
||||
@ -257,27 +256,23 @@ struct test_variant_same_default_strategy
|
||||
|
||||
variant_type v1, v2;
|
||||
|
||||
using variant_cdistance_t = typename bg::comparable_distance_result
|
||||
<
|
||||
variant_type, variant_type, bg::default_strategy
|
||||
>::type;
|
||||
BOOST_GEOMETRY_STATIC_ASSERT(
|
||||
(std::is_same
|
||||
<
|
||||
typename bg::comparable_distance_result
|
||||
<
|
||||
variant_type, variant_type, bg::default_strategy
|
||||
>::type,
|
||||
ExpectedResultType
|
||||
>::value),
|
||||
"Unexpected result type");
|
||||
(std::is_same<variant_cdistance_t, ExpectedResultType>::value),
|
||||
"Unexpected result type",
|
||||
variant_cdistance_t, ExpectedResultType);
|
||||
|
||||
using cdistance_t = typename bg::comparable_distance_result
|
||||
<
|
||||
point_type, point_type, bg::default_strategy
|
||||
>::type;
|
||||
BOOST_GEOMETRY_STATIC_ASSERT(
|
||||
(std::is_same
|
||||
<
|
||||
typename bg::comparable_distance_result
|
||||
<
|
||||
point_type, point_type, bg::default_strategy
|
||||
>::type,
|
||||
ExpectedResultType
|
||||
>::value),
|
||||
"Unexpected result type");
|
||||
(std::is_same<cdistance_t, ExpectedResultType>::value),
|
||||
"Unexpected result type",
|
||||
cdistance_t, ExpectedResultType);
|
||||
|
||||
// Default strategy
|
||||
v1 = point;
|
||||
@ -348,27 +343,23 @@ struct test_variant_with_strategy
|
||||
|
||||
strategy_type strategy;
|
||||
|
||||
using variant_cdistance_t = typename bg::comparable_distance_result
|
||||
<
|
||||
variant_type, variant_type, strategy_type
|
||||
>::type;
|
||||
BOOST_GEOMETRY_STATIC_ASSERT(
|
||||
(std::is_same
|
||||
<
|
||||
typename bg::comparable_distance_result
|
||||
<
|
||||
variant_type, variant_type, strategy_type
|
||||
>::type,
|
||||
ExpectedResultType
|
||||
>::value),
|
||||
"Unexpected result type");
|
||||
(std::is_same<variant_cdistance_t, ExpectedResultType>::value),
|
||||
"Unexpected result type",
|
||||
variant_cdistance_t, ExpectedResultType);
|
||||
|
||||
using cdistance_t = typename bg::comparable_distance_result
|
||||
<
|
||||
segment_type, linestring_type, strategy_type
|
||||
>::type;
|
||||
BOOST_GEOMETRY_STATIC_ASSERT(
|
||||
(std::is_same
|
||||
<
|
||||
typename bg::comparable_distance_result
|
||||
<
|
||||
segment_type, linestring_type, strategy_type
|
||||
>::type,
|
||||
ExpectedResultType
|
||||
>::value),
|
||||
"Unexpected result type");
|
||||
(std::is_same<cdistance_t, ExpectedResultType>::value),
|
||||
"Unexpected result type",
|
||||
cdistance_t, ExpectedResultType);
|
||||
|
||||
// Passed strategy
|
||||
v1 = seg;
|
||||
@ -462,17 +453,14 @@ struct test_variant_boxes
|
||||
typename bg::util::detail::default_integral::type
|
||||
>::type expected_result_type;
|
||||
|
||||
using variant_cdistance_t = typename bg::comparable_distance_result
|
||||
<
|
||||
variant_type, variant_type, bg::default_strategy
|
||||
>::type;
|
||||
BOOST_GEOMETRY_STATIC_ASSERT(
|
||||
(std::is_same
|
||||
<
|
||||
typename bg::comparable_distance_result
|
||||
<
|
||||
variant_type, variant_type, bg::default_strategy
|
||||
>::type,
|
||||
expected_result_type
|
||||
>::value),
|
||||
"Unexpected result type"
|
||||
);
|
||||
(std::is_same<variant_cdistance_t, expected_result_type>::value),
|
||||
"Unexpected result type",
|
||||
variant_cdistance_t, expected_result_type);
|
||||
|
||||
// Default strategy
|
||||
check_result<T>::apply(bg::comparable_distance(v1, v2),
|
||||
|
@ -84,7 +84,8 @@ void test_distance_point()
|
||||
typedef typename services::return_type<taxicab_distance, P, P>::type cab_return_type;
|
||||
BOOST_GEOMETRY_STATIC_ASSERT(
|
||||
(std::is_same<cab_return_type, typename bg::coordinate_type<P>::type>::value),
|
||||
"Unexpected result type");
|
||||
"Unexpected result type",
|
||||
cab_return_type, typename bg::coordinate_type<P>::type);
|
||||
|
||||
taxicab_distance tcd;
|
||||
cab_return_type d = bg::distance(p1, p2, tcd);
|
||||
@ -460,16 +461,14 @@ void test_variant()
|
||||
|
||||
variant_type v1, v2;
|
||||
|
||||
using distance_t = typename bg::distance_result
|
||||
<
|
||||
variant_type, variant_type, bg::default_strategy
|
||||
>::type;
|
||||
BOOST_GEOMETRY_STATIC_ASSERT(
|
||||
(std::is_same
|
||||
<
|
||||
typename bg::distance_result
|
||||
<
|
||||
variant_type, variant_type, bg::default_strategy
|
||||
>::type,
|
||||
double
|
||||
>::value),
|
||||
"Unexpected result type");
|
||||
(std::is_same<distance_t, double>::value),
|
||||
"Unexpected result type",
|
||||
distance_t, double);
|
||||
|
||||
// Default strategy
|
||||
v1 = point;
|
||||
|
@ -59,9 +59,11 @@ struct distance_from_bg
|
||||
Strategy const& strategy)
|
||||
{
|
||||
BOOST_GEOMETRY_STATIC_ASSERT((use_distance_from_bg<Geometry1>::value),
|
||||
"Unexpected kind of Geometry1");
|
||||
"Unexpected kind of Geometry1",
|
||||
Geometry1);
|
||||
BOOST_GEOMETRY_STATIC_ASSERT((use_distance_from_bg<Geometry2>::value),
|
||||
"Unexpected kind of Geometry1");
|
||||
"Unexpected kind of Geometry2",
|
||||
Geometry2);
|
||||
|
||||
return geometry::distance(geometry1, geometry2, strategy);
|
||||
}
|
||||
|
@ -64,7 +64,9 @@ template <typename Argument, typename Result>
|
||||
inline void check_sqrt(Argument const& arg, Result const& result)
|
||||
{
|
||||
using return_type = typename bg::math::detail::square_root<Argument>::return_type;
|
||||
BOOST_GEOMETRY_STATIC_ASSERT((std::is_same<return_type, Result>::value), "Wrong return type");
|
||||
BOOST_GEOMETRY_STATIC_ASSERT((std::is_same<return_type, Result>::value),
|
||||
"Wrong return type",
|
||||
return_type, Result);
|
||||
|
||||
#ifdef BOOST_GEOMETRY_TEST_DEBUG
|
||||
std::cout << "testing: " << typeid(Result).name()
|
||||
|
Loading…
x
Reference in New Issue
Block a user