Unit test for NonRandomCounter
random engine.
More...
#include <boost/test/unit_test.hpp>
#include "icarusalg/Utilities/NonRandomCounter.h"
Go to the source code of this file.
Unit test for NonRandomCounter
random engine.
- Date
- February 14, 2020
- Author
- Gianluca Petrillo (petri.nosp@m.llo@.nosp@m.slac..nosp@m.stan.nosp@m.ford..nosp@m.edu)
- See Also
icarusalg/Utilities/NonRandomCounter.h
Definition in file NonRandomCounter_test.cc.
#define BOOST_TEST_MODULE NonRandomCounterTest |
BOOST_AUTO_TEST_CASE |
( |
TestCase |
| ) |
|
Definition at line 18 of file NonRandomCounter_test.cc.
20 constexpr std::size_t
N = 1024U;
21 constexpr
long seed = 3U;
25 std::cout <<
"engine { " << seed <<
" }: ";
28 BOOST_CHECK_EQUAL(engine.name(),
"NonRandomCounter");
31 std::array<double, N> numbers;
32 engine.flatArray(numbers.size(), numbers.data());
33 std::cout <<
"\nengine.flatArray(" << numbers.size() <<
", "
34 << ((
void*) numbers.data()) <<
") => ";
37 for (std::size_t i = 1U; i <
N; ++i)
38 BOOST_CHECK_LT(numbers[i - 1U], numbers[i]);
41 engine.setSeed(seed, 0);
42 std::cout <<
"\nengine.setSeed(" << seed <<
") => ";
45 for (
double const expected: numbers)
46 BOOST_CHECK_EQUAL(engine.flat(), expected);
47 std::cout <<
"\nengine.flat() x " << numbers.size() <<
" => ";
51 engine.setSeeds(&seed, 1);
52 std::cout <<
"\nengine.setSeeds(" << ((
void*) &seed) <<
", 1) => ";
55 for (
double const expected: numbers)
56 BOOST_CHECK_EQUAL(engine.flat(), expected);
57 std::cout <<
"\nengine.flat() x " << numbers.size() <<
" => ";
Fast random engine which returns sequential numbers.
process_name largeant stream1 can override from command line with o or output physics producers generator N
BEGIN_PROLOG could also be cout