xref: /llvm-project/libcxx/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/io.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 // template <class charT, class traits,
15 //           class Engine, size_t k>
16 // basic_ostream<charT, traits>&
17 // operator<<(basic_ostream<charT, traits>& os,
18 //            const shuffle_order_engine<Engine, k>& x);
19 //
20 // template <class charT, class traits,
21 //           class Engine, size_t k>
22 // basic_istream<charT, traits>&
23 // operator>>(basic_istream<charT, traits>& is,
24 //            shuffle_order_engine<Engine, k>& x);
25 
26 #include <random>
27 #include <sstream>
28 #include <cassert>
29 
30 #include "test_macros.h"
31 
32 void
33 test1()
34 {
35     typedef std::knuth_b E;
36     E e1;
37     e1.discard(100);
38     std::ostringstream os;
39     os << e1;
40     std::istringstream is(os.str());
41     E e2;
42     is >> e2;
43     assert(e1 == e2);
44 }
45 
46 int main(int, char**)
47 {
48     test1();
49 
50   return 0;
51 }
52