Skip to content
Open
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
62 changes: 42 additions & 20 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
11 changes: 6 additions & 5 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,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 : : : <link>static : test_random_device ;
run test_random_device.cpp /boost/random//boost_random /boost/test//included : : : <link>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 ;
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion test/statistic_tests.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <cmath>

#include <boost/config.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <boost/random/uniform_01.hpp>
#include <boost/random/variate_generator.hpp>

Expand Down Expand Up @@ -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);
}

Expand Down
5 changes: 3 additions & 2 deletions test/test_random_device.cpp
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -10,8 +11,8 @@

#include <boost/random/random_device.hpp>

#include <boost/test/test_tools.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>

#ifndef BOOST_NO_CXX11_CONSTEXPR
constexpr boost::random_device::result_type const_min = (boost::random_device::min)();
Expand Down
Loading