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 w, class UIntType> |
12 | // class independent_bits_engine |
13 | |
14 | // independent_bits_engine& operator=(const independent_bits_engine&); |
15 | |
16 | #include <random> |
17 | #include <cassert> |
18 | |
19 | #include "test_macros.h" |
20 | |
21 | void |
22 | test1() |
23 | { |
24 | typedef std::independent_bits_engine<std::ranlux24, 32, unsigned> E; |
25 | E e1(2); |
26 | (void)e1(); |
27 | E e2(5); |
28 | e2 = e1; |
29 | assert(e1 == e2); |
30 | assert(e1() == e2()); |
31 | E::result_type k = e1(); |
32 | assert(e1 != e2); |
33 | assert(e2() == k); |
34 | assert(e1 == e2); |
35 | } |
36 | |
37 | void |
38 | test2() |
39 | { |
40 | typedef std::independent_bits_engine<std::ranlux48, 64, unsigned long long> E; |
41 | E e1(3); |
42 | (void)e1(); |
43 | E e2(5); |
44 | e2 = e1; |
45 | assert(e1 == e2); |
46 | assert(e1() == e2()); |
47 | E::result_type k = e1(); |
48 | assert(e1 != e2); |
49 | assert(e2() == k); |
50 | assert(e1 == e2); |
51 | } |
52 | |
53 | int main(int, char**) |
54 | { |
55 | test1(); |
56 | test2(); |
57 | |
58 | return 0; |
59 | } |
60 | |