Boost-Geometry-Utils
view release on metacpan or search on metacpan
src/boost/test/floating_point_comparison.hpp view on Meta::CPAN
//____________________________________________________________________________//
} // namespace tt_detail
// ************************************************************************** //
// ************** tolerance presentation types ************** //
// ************************************************************************** //
template<typename FPT>
struct percent_tolerance_t {
explicit percent_tolerance_t( FPT v ) : m_value( v ) {}
FPT m_value;
};
//____________________________________________________________________________//
template<typename Out,typename FPT>
Out& operator<<( Out& out, percent_tolerance_t<FPT> t )
{
return out << t.m_value;
}
//____________________________________________________________________________//
template<typename FPT>
inline percent_tolerance_t<FPT>
percent_tolerance( FPT v )
{
return percent_tolerance_t<FPT>( v );
}
//____________________________________________________________________________//
template<typename FPT>
struct fraction_tolerance_t {
explicit fraction_tolerance_t( FPT v ) : m_value( v ) {}
FPT m_value;
};
src/boost/test/floating_point_comparison.hpp view on Meta::CPAN
// ************************************************************************** //
template<typename FPT>
class close_at_tolerance {
public:
// Public typedefs
typedef bool result_type;
// Constructor
template<typename ToleranceBaseType>
explicit close_at_tolerance( percent_tolerance_t<ToleranceBaseType> tolerance,
floating_point_comparison_type fpc_type = FPC_STRONG )
: p_fraction_tolerance( tt_detail::fpt_abs( static_cast<FPT>(0.01)*tolerance.m_value ) )
, p_strong_or_weak( fpc_type == FPC_STRONG )
, m_report_modifier( 100. )
{}
template<typename ToleranceBaseType>
explicit close_at_tolerance( fraction_tolerance_t<ToleranceBaseType> tolerance,
floating_point_comparison_type fpc_type = FPC_STRONG )
: p_fraction_tolerance( tt_detail::fpt_abs( tolerance.m_value ) )
, p_strong_or_weak( fpc_type == FPC_STRONG )
src/boost/test/floating_point_comparison.hpp view on Meta::CPAN
// ************************************************************************** //
// ************** check_is_close ************** //
// ************************************************************************** //
struct BOOST_TEST_DECL check_is_close_t {
// Public typedefs
typedef bool result_type;
template<typename FPT1, typename FPT2, typename ToleranceBaseType>
predicate_result
operator()( FPT1 left, FPT2 right, percent_tolerance_t<ToleranceBaseType> tolerance,
floating_point_comparison_type fpc_type = FPC_STRONG ) const
{
// deduce "better" type from types of arguments being compared
// if one type is floating and the second integral we use floating type and
// value of integral type is promoted to the floating. The same for float and double
// But we don't want to compare two values of integral types using this tool.
typedef typename numeric::conversion_traits<FPT1,FPT2>::supertype FPT;
BOOST_STATIC_ASSERT( !is_integral<FPT>::value );
close_at_tolerance<FPT> pred( tolerance, fpc_type );
src/boost/test/test_tools.hpp view on Meta::CPAN
BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::ge_impl(), "", WARN, CHECK_GE, (L)(R) )
#define BOOST_CHECK_GE( L, R ) \
BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::ge_impl(), "", CHECK, CHECK_GE, (L)(R) )
#define BOOST_REQUIRE_GE( L, R ) \
BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::ge_impl(), "", REQUIRE, CHECK_GE, (L)(R) )
//____________________________________________________________________________//
#define BOOST_WARN_CLOSE( L, R, T ) \
BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::check_is_close, "", WARN, CHECK_CLOSE, \
(L)(R)(::boost::test_tools::percent_tolerance(T)) )
#define BOOST_CHECK_CLOSE( L, R, T ) \
BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::check_is_close, "", CHECK, CHECK_CLOSE, \
(L)(R)(::boost::test_tools::percent_tolerance(T)) )
#define BOOST_REQUIRE_CLOSE( L, R, T ) \
BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::check_is_close, "", REQUIRE, CHECK_CLOSE, \
(L)(R)(::boost::test_tools::percent_tolerance(T)) )
//____________________________________________________________________________//
#define BOOST_WARN_CLOSE_FRACTION( L, R, T ) \
BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::check_is_close, "", WARN, CHECK_CLOSE_FRACTION, \
(L)(R)(::boost::test_tools::fraction_tolerance(T)) )
#define BOOST_CHECK_CLOSE_FRACTION( L, R, T ) \
BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::check_is_close, "", CHECK, CHECK_CLOSE_FRACTION, \
(L)(R)(::boost::test_tools::fraction_tolerance(T)) )
#define BOOST_REQUIRE_CLOSE_FRACTION( L, R, T ) \
( run in 0.334 second using v1.01-cache-2.11-cpan-709fd43a63f )