]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Test std::seed_seq construction from input iterators
authorJonathan Wakely <jwakely@redhat.com>
Tue, 17 Aug 2021 13:18:58 +0000 (14:18 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 17 Aug 2021 13:31:21 +0000 (14:31 +0100)
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* testsuite/26_numerics/random/seed_seq/cons/range.cc: Check
construction from input iterators.

libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/range.cc

index 8ea87342002aed65da4886a8349728fa6cfdf1d1..63233c893c08ae705a95422c41d62c793f1681fa 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <random>
 #include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
 
 void
 test01()
@@ -38,9 +39,22 @@ test01()
   //VERIFY();
 }
 
+void
+test02()
+{
+  unsigned arr[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+  __gnu_test::input_container<unsigned int> in(arr);
+  std::seed_seq seq(in.begin(), in.end());
+
+  std::vector<unsigned> foo(10000);
+  seq.generate(foo.begin(), foo.end());
+
+  VERIFY( seq.size() == 10 );
+}
+
 int
 main()
 {
   test01();
-  return 0;
+  test02();
 }