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