diff options
Diffstat (limited to 'tests/test_rand.cpp')
-rw-r--r-- | tests/test_rand.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/test_rand.cpp b/tests/test_rand.cpp new file mode 100644 index 0000000..eac94ec --- /dev/null +++ b/tests/test_rand.cpp @@ -0,0 +1,40 @@ +#include <algorithm> +#include <frozen/random.h> +#include <iostream> +#include <random> + +#include "bench.hpp" +#include "catch.hpp" + +TEST_CASE("linear_congruential_engine", "[random]") { + + frozen::linear_congruential_engine<std::uint32_t, 48271u, 0, 0x7fffffff> dist0; + std::linear_congruential_engine<std::uint32_t, 48271u, 0, 0x7fffffff> rdist0; + REQUIRE(dist0.min() == rdist0.min()); + REQUIRE(dist0.max() == rdist0.max()); + REQUIRE(dist0() == rdist0()); + REQUIRE(dist0() == rdist0()); + REQUIRE(dist0() == rdist0()); + + auto next0 = dist0(); + (void) next0; + dist0.discard(3); + rdist0.discard(4); + REQUIRE(dist0() == rdist0()); + + frozen::linear_congruential_engine<std::uint32_t, 48271u, 0, 0x7fffffff> odist0; + std::linear_congruential_engine<std::uint32_t, 48271u, 0, 0x7fffffff> ordist0; + REQUIRE(rdist0() != ordist0()); + REQUIRE(dist0() != odist0()); + REQUIRE(!(dist0() == odist0())); + + + frozen::minstd_rand dist1; + (void)dist1; + frozen::minstd_rand dist2; + (void)dist2; + frozen::linear_congruential_engine<std::size_t, 3, 3, 0> dist3; + (void)dist3; + +} + |