Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / numerics / rand / rand.eng / rand.eng.lcong / copy.pass.cpp
blob5dac0772cb0e947706a8afca84e44ea49cbb4134
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 // <random>
11 // template <class UIntType, UIntType a, UIntType c, UIntType m>
12 // class linear_congruential_engine;
14 // linear_congruential_engine(const linear_congruential_engine&);
16 #include <random>
17 #include <cassert>
19 #include "test_macros.h"
21 template <class T, T a, T c, T m>
22 void
23 test1()
25 typedef std::linear_congruential_engine<T, a, c, m> E;
26 E e1;
27 E e2 = e1;
28 assert(e1 == e2);
29 (void)e1();
30 (void)e2();
31 assert(e1 == e2);
34 template <class T>
35 void
36 test()
38 test1<T, 0, 0, 0>();
39 test1<T, 0, 1, 2>();
40 test1<T, 1, 1, 2>();
41 const T M(static_cast<T>(-1));
42 test1<T, 0, 0, M>();
43 test1<T, 0, M-2, M>();
44 test1<T, 0, M-1, M>();
45 test1<T, M-2, 0, M>();
46 test1<T, M-2, M-2, M>();
47 test1<T, M-2, M-1, M>();
48 test1<T, M-1, 0, M>();
49 test1<T, M-1, M-2, M>();
50 test1<T, M-1, M-1, M>();
53 int main(int, char**)
55 test<unsigned short>();
56 test<unsigned int>();
57 test<unsigned long>();
58 test<unsigned long long>();
60 return 0;