From 0eb7d247a4c7e93ba3deb92dc0d1cdf4622472fc Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Sun, 18 Jul 2021 15:12:50 +0300 Subject: [PATCH] Add include tests --- include/boost/math/ccmath/ccmath.hpp | 2 ++ include/boost/math/ccmath/sqrt.hpp | 6 +++--- test/compile_test/ccmath_isinf_incl_test.cpp | 16 ++++++++++++++++ test/compile_test/ccmath_isnan_incl_test.cpp | 16 ++++++++++++++++ test/compile_test/ccmath_sqrt_incl_test.cpp | 16 ++++++++++++++++ 5 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 test/compile_test/ccmath_isinf_incl_test.cpp create mode 100644 test/compile_test/ccmath_isnan_incl_test.cpp create mode 100644 test/compile_test/ccmath_sqrt_incl_test.cpp diff --git a/include/boost/math/ccmath/ccmath.hpp b/include/boost/math/ccmath/ccmath.hpp index 370158a52..d754ae2cf 100644 --- a/include/boost/math/ccmath/ccmath.hpp +++ b/include/boost/math/ccmath/ccmath.hpp @@ -8,5 +8,7 @@ #define BOOST_MATH_CCMATH #include +#include +#include #endif // BOOST_MATH_CCMATH diff --git a/include/boost/math/ccmath/sqrt.hpp b/include/boost/math/ccmath/sqrt.hpp index 826c02dbc..f7938a502 100644 --- a/include/boost/math/ccmath/sqrt.hpp +++ b/include/boost/math/ccmath/sqrt.hpp @@ -5,8 +5,8 @@ // // Constexpr implementation of sqrt function -#ifndef BOOST_MATH_SPECIAL_FUNCTIONS_SQRT -#define BOOST_MATH_SPECIAL_FUNCTIONS_SQRT +#ifndef BOOST_MATH_CCMATH_SQRT +#define BOOST_MATH_CCMATH_SQRT #include #include @@ -53,4 +53,4 @@ inline constexpr double sqrt(Z x) }}} // Namespaces -#endif // BOOST_MATH_SPECIAL_FUNCTIONS_SQRT +#endif // BOOST_MATH_CCMATH_SQRT diff --git a/test/compile_test/ccmath_isinf_incl_test.cpp b/test/compile_test/ccmath_isinf_incl_test.cpp new file mode 100644 index 000000000..0f93c236a --- /dev/null +++ b/test/compile_test/ccmath_isinf_incl_test.cpp @@ -0,0 +1,16 @@ +// (C) Copyright Matt Borland 2021. +// 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) + +#include +#include "test_compile_result.hpp" + +void compile_and_link_test() +{ + check_result(boost::math::ccmath::isinf(1.0f)); + check_result(boost::math::ccmath::isinf(1.0)); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + check_result(boost::math::ccmath::isinf(1.0l)); +#endif +} diff --git a/test/compile_test/ccmath_isnan_incl_test.cpp b/test/compile_test/ccmath_isnan_incl_test.cpp new file mode 100644 index 000000000..134cc6a09 --- /dev/null +++ b/test/compile_test/ccmath_isnan_incl_test.cpp @@ -0,0 +1,16 @@ +// (C) Copyright Matt Borland 2021. +// 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) + +#include +#include "test_compile_result.hpp" + +void compile_and_link_test() +{ + check_result(boost::math::ccmath::isnan(1.0f)); + check_result(boost::math::ccmath::isnan(1.0)); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + check_result(boost::math::ccmath::isnan(1.0l)); +#endif +} diff --git a/test/compile_test/ccmath_sqrt_incl_test.cpp b/test/compile_test/ccmath_sqrt_incl_test.cpp new file mode 100644 index 000000000..fac0d116b --- /dev/null +++ b/test/compile_test/ccmath_sqrt_incl_test.cpp @@ -0,0 +1,16 @@ +// (C) Copyright Matt Borland 2021. +// 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) + +#include +#include "test_compile_result.hpp" + +void compile_and_link_test() +{ + check_result(boost::math::ccmath::sqrt(1.0f)); + check_result(boost::math::ccmath::sqrt(1.0)); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + check_result(boost::math::ccmath::sqrt(1.0l)); +#endif +}