Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 48 additions & 20 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 5 additions & 3 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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 ;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/test_comp_xoshiro128pp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion test/test_qrng_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define TEST_QRNG_FUNCTIONS_HPP_INCLUDED

#include <boost/random/uniform_real.hpp>
#include <boost/test/floating_point_comparison.hpp>
#include <boost/test/tools/floating_point_comparison.hpp>

#include <sstream>

Expand Down
Loading