| 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 p, size_t r> |
| 12 | // class discard_block_engine |
| 13 | |
| 14 | // void discard(unsigned long long z); |
| 15 | |
| 16 | #include <random> |
| 17 | #include <cassert> |
| 18 | |
| 19 | #include "test_macros.h" |
| 20 | |
| 21 | void |
| 22 | test1() |
| 23 | { |
| 24 | std::ranlux24 e1; |
| 25 | std::ranlux24 e2 = e1; |
| 26 | assert(e1 == e2); |
| 27 | e1.discard(z: 3); |
| 28 | assert(e1 != e2); |
| 29 | (void)e2(); |
| 30 | (void)e2(); |
| 31 | (void)e2(); |
| 32 | assert(e1 == e2); |
| 33 | } |
| 34 | |
| 35 | void |
| 36 | test2() |
| 37 | { |
| 38 | std::ranlux48 e1; |
| 39 | std::ranlux48 e2 = e1; |
| 40 | assert(e1 == e2); |
| 41 | e1.discard(z: 3); |
| 42 | assert(e1 != e2); |
| 43 | (void)e2(); |
| 44 | (void)e2(); |
| 45 | (void)e2(); |
| 46 | assert(e1 == e2); |
| 47 | } |
| 48 | |
| 49 | int main(int, char**) |
| 50 | { |
| 51 | test1(); |
| 52 | test2(); |
| 53 | |
| 54 | return 0; |
| 55 | } |
| 56 | |