diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 443dc320f..015f456fa 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,30 +1,58 @@ # Copyright 2018, 2019 Peter Dimov # Copyright 2023 Matt Borland +# Copyright 2026 Alexander Grund # Distributed under 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(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) +include(BoostTest OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) if(HAVE_BOOST_TEST) - boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES - Boost::random - Boost::array - Boost::assert - Boost::config - Boost::core - Boost::dynamic_bitset - Boost::exception - Boost::integer - Boost::io - Boost::lexical_cast - Boost::math - Boost::multiprecision - Boost::numeric_conversion - Boost::range - Boost::system - Boost::throw_exception - Boost::type_traits - Boost::utility) + file(STRINGS "Jamfile.v2" data) + foreach(line IN LISTS data) + if(line MATCHES "^[ \t]*run[ \t]+(.+)") + set(args "${CMAKE_MATCH_1}") + if(args MATCHES "multiprecision_.+_test") + continue() + elseif(NOT args MATCHES "^([^:;]+)[ \t]*;[ \t]*$") + boost_message(AUTHOR_WARNING "boost_test_jamfile: Unknown Jamfile line: ${line}\n'${args}'") + continue() + endif() + string(REPLACE " " ";" parts "${CMAKE_MATCH_1}") + set(sources ) + set(extra_libs ) + foreach(part IN ITEMS ${parts}) + if(part MATCHES "^[./a-zA-Z0-9_]+\.cpp+$") + list(APPEND sources ${part}) + elseif(part STREQUAL "/boost/assign//boost_assign") + list(APPEND extra_libs Boost::assign) + elseif(part STREQUAL "/boost/iterator//boost_iterator") + list(APPEND extra_libs Boost::iterator) + elseif(part STREQUAL "/boost/test//boost_unit_test_framework") + list(APPEND extra_libs Boost::unit_test_framework) + elseif(part STREQUAL "math_test") + list(APPEND extra_libs Boost::assign Boost::bind Boost::exception Boost::lexical_cast Boost::math Boost::numeric_conversion) + else() + boost_message(SEND_ERROR "Unknown dependency '${part}'") + endif() + endforeach() + if(sources MATCHES "^test_lagged_fibonacci[0-9]+") + # Larger ones overflow the stack, see comment in Jamfile + set(type compile) + else() + set(type run) + endif() + boost_test(TYPE ${type} SOURCES ${sources} LINK_LIBRARIES Boost::random ${extra_libs}) + endif() + endforeach() endif() + +boost_test(TYPE run SOURCES multiprecision_int_test.cpp + LINK_LIBRARIES Boost::random Boost::unit_test_framework Boost::multiprecision + COMPILE_FEATURES cxx_std_14) +boost_test(TYPE compile SOURCES multiprecision_float_test.cpp + LINK_LIBRARIES Boost::random Boost::unit_test_framework Boost::multiprecision + COMPILE_FEATURES cxx_std_14) +boost_test(TYPE compile SOURCES statistic_tests.cpp + LINK_LIBRARIES Boost::random Boost::bind Boost::math) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 6c5a0b918..b4db865db 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -1,7 +1,8 @@ # Copyright 2003 Jens Maurer # Copyright 2009-2011 Steven Watanabe -# Distributed under the Boost Software License, Version 1.0. (See accompany- -# ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +# Copyright 2026 Alexander Grund +# Distributed under 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) # Boost Random Library test Jamfile @@ -24,7 +25,7 @@ project /boost/random/test : requirements run test_const_mod.cpp /boost/test//boost_unit_test_framework ; run test_generate_canonical.cpp /boost/test//boost_unit_test_framework ; run test_random_number_generator.cpp /boost/test//boost_unit_test_framework ; -run ../example/random_demo.cpp ; +run ../example/random_demo.cpp /boost/iterator//boost_iterator ; run test_random_device.cpp /boost/test//boost_unit_test_framework ; run test_minstd_rand0.cpp /boost/test//boost_unit_test_framework ; @@ -103,6 +104,7 @@ explicit test_lagged_fibonacci1279 test_lagged_fibonacci2281 alias math_test : /boost/assign//boost_assign + /boost/bind//boost_bind /boost/exception//boost_exception /boost/lexical_cast//boost_lexical_cast /boost/math//boost_math_tr1 diff --git a/test/test_comp_xoshiro128pp.cpp b/test/test_comp_xoshiro128pp.cpp index ac05b6da8..a40b509ed 100644 --- a/test/test_comp_xoshiro128pp.cpp +++ b/test/test_comp_xoshiro128pp.cpp @@ -108,9 +108,9 @@ void long_jump(void) { uint32_t s1 = 0; uint32_t s2 = 0; uint32_t s3 = 0; - for(int i = 0; i < sizeof LONG_JUMP / sizeof *LONG_JUMP; i++) + for(const uint32_t jump: LONG_JUMP) for(int b = 0; b < 32; b++) { - if (LONG_JUMP[i] & UINT32_C(1) << b) { + if (jump & UINT32_C(1) << b) { s0 ^= s[0]; s1 ^= s[1]; s2 ^= s[2]; diff --git a/test/test_qrng_functions.hpp b/test/test_qrng_functions.hpp index effc96007..d22f94e02 100644 --- a/test/test_qrng_functions.hpp +++ b/test/test_qrng_functions.hpp @@ -7,7 +7,7 @@ #define TEST_QRNG_FUNCTIONS_HPP_INCLUDED #include -#include +#include #include