Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / numerics / rand / rand.eng / rand.eng.lcong / io.pass.cpp
blob7f7b75e09c1104a21ea1ab1cd1b2d810410ab850
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-localization
11 // <random>
13 // template <class UIntType, UIntType a, UIntType c, UIntType m>
14 // class linear_congruential_engine;
16 // template <class charT, class traits,
17 // class UIntType, UIntType a, UIntType c, UIntType m>
18 // basic_ostream<charT, traits>&
19 // operator<<(basic_ostream<charT, traits>& os,
20 // const linear_congruential_engine<UIntType, a, c, m>& x);
22 // template <class charT, class traits,
23 // class UIntType, UIntType a, UIntType c, UIntType m>
24 // basic_istream<charT, traits>&
25 // operator>>(basic_istream<charT, traits>& is,
26 // linear_congruential_engine<UIntType, a, c, m>& x);
28 #include <random>
29 #include <sstream>
30 #include <cassert>
32 #include "test_macros.h"
34 int main(int, char**)
37 typedef std::linear_congruential_engine<unsigned, 48271, 0, 2147483647> E;
38 E e1;
39 e1.discard(100);
40 std::ostringstream os;
41 os << e1;
42 std::istringstream is(os.str());
43 E e2;
44 is >> e2;
45 assert(e1 == e2);
48 return 0;