From 408c608fc7bf1557ee987dd7fbe662fabed21a53 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 07:39:03 +0200 Subject: Adding upstream version 1.1.1. Signed-off-by: Daniel Baumann --- tests/test_rand.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/test_rand.cpp (limited to 'tests/test_rand.cpp') 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 +#include +#include +#include + +#include "bench.hpp" +#include "catch.hpp" + +TEST_CASE("linear_congruential_engine", "[random]") { + + frozen::linear_congruential_engine dist0; + std::linear_congruential_engine 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 odist0; + std::linear_congruential_engine 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 dist3; + (void)dist3; + +} + -- cgit v1.2.3