Add SYCL testing for cbrt

This commit is contained in:
Matt Borland 2024-07-23 16:50:16 -04:00
parent 6eeca996b4
commit 405e13847b
No known key found for this signature in database
GPG Key ID: 0D3F929B7E6E4DAB
5 changed files with 12 additions and 3 deletions

View File

@ -1,4 +1,5 @@
// (C) Copyright John Maddock 2006.
// (C) Copyright Matt Borland 2024.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -253,6 +254,7 @@ test_result<Real> test_hetero(const A& a, F1 test_func, F2 expect_func)
return result;
}
#ifndef BOOST_MATH_NO_EXCEPTIONS
template <class Val, class Exception>
void test_check_throw(Val, Exception)
{
@ -293,6 +295,7 @@ void test_check_throw(Val v, boost::math::rounding_error const*)
BOOST_CHECK((v == boost::math::tools::max_value<Val>()) || (v == -boost::math::tools::max_value<Val>()));
}
}
#endif
} // namespace tools
} // namespace math
@ -303,7 +306,7 @@ void test_check_throw(Val v, boost::math::rounding_error const*)
// exception-free testing support, ideally we'd only define this in our tests,
// but to keep things simple we really need it somewhere that's always included:
//
#ifdef BOOST_NO_EXCEPTIONS
#ifdef BOOST_MATH_NO_EXCEPTIONS
# define BOOST_MATH_CHECK_THROW(x, ExceptionType) boost::math::tools::test_check_throw(x, static_cast<ExceptionType const*>(nullptr));
#else
# define BOOST_MATH_CHECK_THROW(x, y) BOOST_CHECK_THROW(x, y)

View File

@ -6,8 +6,8 @@
#ifndef BOOST_MATH_HANDLE_TEST_RESULT
#define BOOST_MATH_HANDLE_TEST_RESULT
#include "../include_private/boost/math/tools/test.hpp"
#include <boost/math/tools/stats.hpp>
#include <boost/math/tools/test.hpp>
#include <boost/math/tools/precision.hpp>
#include <boost/regex.hpp>
#include <boost/test/test_tools.hpp>

View File

@ -15,3 +15,4 @@ run test_cauchy.cpp ;
# Special Functions
run test_beta_simple.cpp ;
run test_cbrt.cpp ;

View File

@ -9,7 +9,10 @@
# pragma warning (disable : 4224)
#endif
#ifndef SYCL_LANGUAGE_VERSION
#include <pch_light.hpp> // include /libs/math/src/
#endif
#include "test_cbrt.hpp"
#include <boost/math/special_functions/cbrt.hpp> // Added to avoid link failure missing cbrt variants.

View File

@ -1,5 +1,6 @@
// Copyright John Maddock 2006.
// Copyright Paul A. Bristow 2007, 2009
// Copyright Matt Borland 2024
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -9,7 +10,6 @@
#include <boost/test/unit_test.hpp>
#include <boost/test/tools/floating_point_comparison.hpp>
#include <boost/math/tools/stats.hpp>
#include <boost/math/tools/test.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/array.hpp>
#include <boost/math/special_functions/math_fwd.hpp>
@ -93,7 +93,9 @@ void test_cbrt(T, const char* name)
}
BOOST_IF_CONSTEXPR(std::numeric_limits<T>::has_quiet_NaN)
{
#ifndef BOOST_MATH_NO_EXCEPTIONS
BOOST_CHECK_THROW(boost::math::cbrt(std::numeric_limits<T>::quiet_NaN()), std::domain_error);
#endif
}
}