Changeset View
Changeset View
Standalone View
Standalone View
src/test/lcg_tests.cpp
- This file was added.
// Copyright (c) 2019 The Bitcoin developers | |||||
// Distributed under the MIT software license, see the accompanying | |||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | |||||
#include "test/lcg.h" | |||||
#include <boost/test/unit_test.hpp> | |||||
BOOST_AUTO_TEST_CASE(lcg_tests) { | |||||
deadalnix: remove | |||||
LCG64 lcg; | |||||
deadalnixUnsubmitted Done Inline ActionsYou may want to start several starting values. deadalnix: You may want to start several starting values. | |||||
// We want that the first iteration is 0 which is a helpful special | |||||
// case. | |||||
BOOST_REQUIRE_EQUAL(lcg.next(), 0); | |||||
for (int i = 0; i < 99; i++) { | |||||
lcg.next(); | |||||
} | |||||
// Make sure the LCG is producing expected value after many iterations. | |||||
// This ensures mul and add overflows are acting as expected on this | |||||
// architecture. | |||||
BOOST_REQUIRE_EQUAL(lcg.next(), 0xf306b780aa88c194); | |||||
} |
remove