Bitcoin Core  27.99.0
P2P Digital Currency
xoroshiro128plusplus_tests.cpp
Go to the documentation of this file.
1 // Copyright (c) 2022 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
7 
8 #include <boost/test/unit_test.hpp>
9 
10 BOOST_FIXTURE_TEST_SUITE(xoroshiro128plusplus_tests, BasicTestingSetup)
11 
12 BOOST_AUTO_TEST_CASE(reference_values)
13 {
14  // numbers generated from reference implementation
15  XoRoShiRo128PlusPlus rng(0);
16  BOOST_TEST(0x6f68e1e7e2646ee1 == rng());
17  BOOST_TEST(0xbf971b7f454094ad == rng());
18  BOOST_TEST(0x48f2de556f30de38 == rng());
19  BOOST_TEST(0x6ea7c59f89bbfc75 == rng());
20 
21  // seed with a random number
22  rng = XoRoShiRo128PlusPlus(0x1a26f3fa8546b47a);
23  BOOST_TEST(0xc8dc5e08d844ac7d == rng());
24  BOOST_TEST(0x5b5f1f6d499dad1b == rng());
25  BOOST_TEST(0xbeb0031f93313d6f == rng());
26  BOOST_TEST(0xbfbcf4f43a264497 == rng());
27 }
28 
xoroshiro128++ PRNG.
BOOST_AUTO_TEST_SUITE_END()
Basic testing setup.
Definition: setup_common.h:52
BOOST_AUTO_TEST_CASE(reference_values)