Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test fix for multiprecision 562 #1015

Merged
merged 3 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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