xref: /llvm-project/libcxx/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/discard.pass.cpp (revision 7fc6a55688c816f5fc1a5481ae7af25be7500356)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <random>
10 
11 // template<class Engine, size_t k>
12 // class shuffle_order_engine
13 
14 // void discard(unsigned long long z);
15 
16 #include <random>
17 #include <cassert>
18 
19 #include "test_macros.h"
20 
21 void
test1()22 test1()
23 {
24     std::knuth_b e1;
25     std::knuth_b e2 = e1;
26     assert(e1 == e2);
27     e1.discard(3);
28     assert(e1 != e2);
29     (void)e2();
30     (void)e2();
31     (void)e2();
32     assert(e1 == e2);
33 }
34 
main(int,char **)35 int main(int, char**)
36 {
37     test1();
38 
39   return 0;
40 }
41