Skip to content

Commit

Permalink
Remove use of Boost.Random in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Apr 14, 2024
1 parent dae3f02 commit 6d50d48
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
if(HAVE_BOOST_TEST)

boost_test_jamfile(FILE Jamfile.v2
LINK_LIBRARIES Boost::crc Boost::core Boost::timer Boost::random)
LINK_LIBRARIES Boost::crc Boost::core Boost::timer Boost::integer Boost::predef)

endif()
8 changes: 4 additions & 4 deletions test/crc_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <boost/config.hpp> // for BOOST_MSVC, etc.
#include <boost/cstdint.hpp> // for boost::uint16_t, etc.
#include <boost/integer.hpp> // for boost::uint_t
#include <boost/random/linear_congruential.hpp> // for boost::minstd_rand
#include <boost/core/detail/minstd_rand.hpp> // for boost::detail::minstd_rand
#include <boost/core/lightweight_test.hpp>
#include <boost/timer/timer.hpp> // for boost::timer

Expand Down Expand Up @@ -195,7 +195,7 @@ PRIVATE_TESTER_NAME::error_test
uint32_t ran_data[ 256 ];
std::size_t const ran_length = sizeof(ran_data) / sizeof(ran_data[0]);

std::generate_n( ran_data, ran_length, boost::minstd_rand() );
std::generate_n( ran_data, ran_length, boost::detail::minstd_rand() );

// Create computers and compute the checksum of the data
optimal_crc_type fast_tester;
Expand Down Expand Up @@ -434,7 +434,7 @@ timing_test
boost::int32_t ran_data[ 256 ];
std::size_t const ran_length = sizeof(ran_data) / sizeof(ran_data[0]);

std::generate_n( ran_data, ran_length, boost::minstd_rand() );
std::generate_n( ran_data, ran_length, boost::detail::minstd_rand() );

// Use the first runs as a check. This gives a chance for first-
// time static initialization to not interfere in the timings.
Expand Down Expand Up @@ -521,7 +521,7 @@ augmented_tests
size_t const ran_length = sizeof(ran_data) / sizeof(ran_data[0]);
size_t const data_length = ran_length - 1;

std::generate_n( ran_data, data_length, boost::minstd_rand() );
std::generate_n( ran_data, data_length, boost::detail::minstd_rand() );

// When creating a CRC for an augmented message, use
// zeros in the appended CRC spot for the first run.
Expand Down
10 changes: 5 additions & 5 deletions test/crc_test2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

// See <http://www.boost.org/libs/crc/> for the library's home page.

#include <boost/core/lightweight_test.hpp>
#include <boost/crc.hpp> // for boost::crc_basic,crc_optimal,augmented_crc,crc

#include <boost/core/lightweight_test.hpp>
#include <boost/cstdint.hpp> // for boost::uint16_t, uint32_t, uintmax_t
#include <boost/predef/other/endian.h>
#include <boost/integer.hpp> // for boost::uint_t
#include <boost/typeof/typeof.hpp> // for BOOST_AUTO
#include <boost/random/linear_congruential.hpp> // for boost::minstd_rand
#include <boost/core/detail/minstd_rand.hpp> // for boost::detail::minstd_rand
#include <boost/type_traits/integral_constant.hpp>

#include <algorithm> // for std::generate_n, for_each
#include <climits> // for CHAR_BIT
Expand Down Expand Up @@ -325,7 +325,7 @@ void operator()(CRCPolicy)
boost::uint32_t ran_data[ 256 ];
std::size_t const ran_length = sizeof(ran_data) / sizeof(ran_data[0]);

std::generate_n( ran_data, ran_length, boost::minstd_rand() );
std::generate_n( ran_data, ran_length, boost::detail::minstd_rand() );

// Create computers and compute the checksum of the data
BOOST_AUTO( optimal_tester, CRCPolicy::make_crc_optimal() );
Expand Down Expand Up @@ -386,7 +386,7 @@ void augmented_crc_test()
uint32_t & run_crc = run_data[ data_length ];
size_t const data_size = sizeof( run_data ) - sizeof( run_crc );

std::generate_n( run_data, data_length, boost::minstd_rand() );
std::generate_n( run_data, data_length, boost::detail::minstd_rand() );
run_crc = 0u;

// The augmented-CRC routine needs to push an appropriate number of zero
Expand Down

0 comments on commit 6d50d48

Please sign in to comment.