Skip to content

Commit

Permalink
test fix for multiprecision 562 (#1015)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanelandt committed Aug 23, 2023
1 parent fac5c41 commit 3d8e1d5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 42 deletions.
2 changes: 1 addition & 1 deletion test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ test-suite misc :
[ run centered_continued_fraction_test.cpp : : : [ requires cxx17_if_constexpr cxx17_std_apply ] [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : <linkflags>-lquadmath ] ]
[ run luroth_expansion_test.cpp : : : [ requires cxx17_if_constexpr cxx17_std_apply ] [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : <linkflags>-lquadmath ] ]
[ run engel_expansion_test.cpp : : : [ requires cxx17_if_constexpr cxx17_std_apply ] [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : <linkflags>-lquadmath ] ]
[ run test_classify.cpp pch ../../test/build//boost_unit_test_framework ]
[ run test_classify.cpp pch ../../test/build//boost_unit_test_framework : : : <toolset>msvc:<cxxflags>/bigobj ]
[ run test_error_handling.cpp ../../test/build//boost_unit_test_framework ]
[ run legendre_stieltjes_test.cpp ../../test/build//boost_unit_test_framework : : : [ requires cxx11_auto_declarations cxx11_range_based_for ] [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : <linkflags>-lquadmath ] ]
[ run test_minima.cpp pch ../../test/build//boost_unit_test_framework ]
Expand Down
41 changes: 0 additions & 41 deletions test/test_autodiff_7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,45 +23,4 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(expm1_hpp, T, all_float_types) {
}
}

BOOST_AUTO_TEST_CASE_TEMPLATE(fpclassify_hpp, T, all_float_types) {
using boost::math::fpclassify;
using boost::math::isfinite;
using boost::math::isinf;
using boost::math::isnan;
using boost::math::isnormal;
using boost::multiprecision::fpclassify;
using boost::multiprecision::isfinite;
using boost::multiprecision::isinf;
using boost::multiprecision::isnan;
using boost::multiprecision::isnormal;

using test_constants = test_constants_t<T>;
static constexpr auto m = test_constants::order;
test_detail::RandomSample<T> x_sampler{-1000, 1000};
for (auto i : boost::irange(test_constants::n_samples)) {
std::ignore = i;

BOOST_CHECK_EQUAL(fpclassify(make_fvar<T, m>(0)), FP_ZERO);
BOOST_CHECK_EQUAL(fpclassify(make_fvar<T, m>(10)), FP_NORMAL);
BOOST_CHECK_EQUAL(
fpclassify(make_fvar<T, m>(std::numeric_limits<T>::infinity())),
FP_INFINITE);
BOOST_CHECK_EQUAL(
fpclassify(make_fvar<T, m>(std::numeric_limits<T>::quiet_NaN())),
FP_NAN);
if (std::numeric_limits<T>::has_denorm != std::denorm_absent) {
BOOST_CHECK_EQUAL(
fpclassify(make_fvar<T, m>(std::numeric_limits<T>::denorm_min())),
FP_SUBNORMAL);
}

BOOST_CHECK(isfinite(make_fvar<T, m>(0)));
BOOST_CHECK(isnormal(make_fvar<T, m>((std::numeric_limits<T>::min)())));
BOOST_CHECK(
!isnormal(make_fvar<T, m>(std::numeric_limits<T>::denorm_min())));
BOOST_CHECK(isinf(make_fvar<T, m>(std::numeric_limits<T>::infinity())));
BOOST_CHECK(isnan(make_fvar<T, m>(std::numeric_limits<T>::quiet_NaN())));
}
}

BOOST_AUTO_TEST_SUITE_END()
15 changes: 15 additions & 0 deletions test/test_classify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <iostream>
#include <iomanip>

#include "test_autodiff.hpp"

#ifdef _MSC_VER
#pragma warning(disable: 4127 4146) // conditional expression is constant
#endif
Expand Down Expand Up @@ -256,6 +258,9 @@ void test_classify(T t, const char* type)
#endif
}


BOOST_AUTO_TEST_SUITE(test_fpclassify)

BOOST_AUTO_TEST_CASE( test_main )
{
BOOST_MATH_CONTROL_FP;
Expand Down Expand Up @@ -288,6 +293,16 @@ BOOST_AUTO_TEST_CASE( test_main )
test_classify(unsigned(0), "unsigned");
}

BOOST_AUTO_TEST_CASE_TEMPLATE(fpclassify_autodiff, T, all_float_types) {
test_classify(boost::math::differentiation::make_fvar<T, 1>(0), "autodiff float");
test_classify(boost::math::differentiation::make_fvar<T, 2>(0), "autodiff float");
test_classify(boost::math::differentiation::make_fvar<T, 3>(0), "autodiff float");
test_classify(boost::math::differentiation::make_fvar<T, 7>(0), "autodiff float");
test_classify(boost::math::differentiation::make_fvar<T, 12>(0), "autodiff float");
}

BOOST_AUTO_TEST_SUITE_END()

/*
Autorun "i:\Boost-sandbox\math_toolkit\libs\math\test\MSVC80\debug\test_classify.exe"
Running 1 test case...
Expand Down

0 comments on commit 3d8e1d5

Please sign in to comment.