xref: /llvm-project/libcxx/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/io.pass.cpp (revision 57b08b0944046a6a57ee9b7b479181f548a5b9b4)
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 void
31 test1()
32 {
33     typedef std::knuth_b E;
34     E e1;
35     e1.discard(100);
36     std::ostringstream os;
37     os << e1;
38     std::istringstream is(os.str());
39     E e2;
40     is >> e2;
41     assert(e1 == e2);
42 }
43 
44 int main()
45 {
46     test1();
47 }
48