From 7a26352317486d73a0eb88418655ecf36f50d152 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Sun, 6 Sep 2026 21:41:33 +0200 Subject: [PATCH 1/5] Add missing test dependencies --- test/Jamfile.v2 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 From 20fa9ad4729261148de0f8b18cb21576a33b59ee Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Sun, 6 Sep 2026 21:42:38 +0200 Subject: [PATCH 2/5] Include most tests in CMake test file --- test/CMakeLists.txt | 62 ++++++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 443dc320f..52203b027 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,30 +1,52 @@ # 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() + boost_test(TYPE run 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) From fc4b488f20dcf6534e99c3da59eb99a41d46dab5 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Tue, 8 Sep 2026 21:57:17 +0200 Subject: [PATCH 3/5] Avoid sign compare warning in test --- test/test_comp_xoshiro128pp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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]; From 65b7e443b6d908b104e95f539f23c9f50ddecf41 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Tue, 8 Sep 2026 22:01:58 +0200 Subject: [PATCH 4/5] Fix use of deprecated header --- test/test_qrng_functions.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 2a8c4dee0d7199b88d509731dbd26293c3f3c309 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Sat, 12 Sep 2026 13:25:22 +0200 Subject: [PATCH 5/5] Only compile test_lagged_fibonacci44497 etc They overflow the stack due to 2 generator instances using 348kB each, allocated on the stack, and another 348kB on-stack buffer being used in `seed_array_real`. --- test/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 52203b027..015f456fa 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -37,7 +37,13 @@ if(HAVE_BOOST_TEST) boost_message(SEND_ERROR "Unknown dependency '${part}'") endif() endforeach() - boost_test(TYPE run SOURCES ${sources} LINK_LIBRARIES Boost::random ${extra_libs}) + 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()