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) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 17157527d..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,9 +25,8 @@ 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 test_random_device.cpp /boost/random//boost_random /boost/test//included : : : static : test_random_device ; -run test_random_device.cpp /boost/random//boost_random /boost/test//included : : : shared : test_random_device_dll ; +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 ; run test_minstd_rand.cpp /boost/test//boost_unit_test_framework ; @@ -104,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/statistic_tests.hpp b/test/statistic_tests.hpp index c1feb5559..ce25bb0f9 100644 --- a/test/statistic_tests.hpp +++ b/test/statistic_tests.hpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include @@ -491,6 +491,7 @@ inline double cdf(const kolmogorov_smirnov_probability& dist, double val) inline double quantile(const kolmogorov_smirnov_probability& dist, double val) { + using namespace boost::placeholders; return invert_monotone_inc(boost::bind(&cdf, dist, _1), val, 0.0, 1000.0); } diff --git a/test/test_random_device.cpp b/test/test_random_device.cpp index 1ae01dd06..c7a84b2bc 100644 --- a/test/test_random_device.cpp +++ b/test/test_random_device.cpp @@ -1,6 +1,7 @@ /* boost random_test.cpp various tests * * Copyright (c) 2010 Steven Watanabe + * Copyright (c) 2016 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/LICENCE_1_0.txt) @@ -10,8 +11,8 @@ #include -#include -#include +#define BOOST_TEST_MAIN +#include #ifndef BOOST_NO_CXX11_CONSTEXPR constexpr boost::random_device::result_type const_min = (boost::random_device::min)();