libstdc++-v3/ChangeLog:
* testsuite/26_numerics/random/uniform_real_distribution/operators/64351.cc
[_GLIBCXX_USE_OLD_GENERATE_CANONICAL]: Restore test01. Do not discard an
extra value in test02.
* testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc:
Skip if _GLIBCXX_USE_OLD_GENERATE_CANONICAL is defined in options.
#include <random>
#include <testsuite_hooks.h>
+// libstdc++/64351
+void
+test01()
+{
+#ifdef _GLIBCXX_USE_OLD_GENERATE_CANONICAL
+ std::mt19937 rng(8890);
+ std::uniform_real_distribution<float> dist;
+
+ rng.discard(30e6);
+ for (long i = 0; i < 10e6; ++i)
+ {
+ auto n = dist(rng);
+ VERIFY( n != 1.f );
+ }
+#else
+ // New generate_canonical is tested in ./gencanon.cc
+#endif
+}
+
// libstdc++/63176
void
test02()
rng2.discard(1);
}
+
// PR libstdc++/80137
+#ifdef _GLIBCXX_USE_OLD_GENERATE_CANONICAL
+ // Each std::generate_canonical call should consume exactly one value.
+#else
rng2.discard(1); // account for a 1.0 generated and discarded.
+#endif
VERIFY( rng == rng2 );
}
int
main()
{
+ test01();
test02();
}
// { dg-do run { target { c++11 && { ! simulator } } } }
+// { dg-skip-if "requires new impl" { *-*-* } { -D_GLIBCXX_USE_OLD_GENERATE_CANONICAL -D_GLIBCXX_USE_OLD_GENERATE_CANONICAL=1 } }
#include <random>
#include <limits>
local_rng(std::mt19937 const& arg) : std::mt19937(arg) {}
};
-// Verify P0952R9 implementation requiring a second round-trip
+// Verify P0952R2 implementation requiring a second round-trip
// if first yields exactly 1. In this test, the RNG delivering
// 32 bits per call is seeded such that this occurs once on the
// sixth iteration for float, and not at all for double.