| 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 | // UNSUPPORTED: no-localization |
| 10 | |
| 11 | // <random> |
| 12 | |
| 13 | // template<class UIntType, size_t w, size_t s, size_t r> |
| 14 | // class subtract_with_carry_engine; |
| 15 | |
| 16 | // template <class charT, class traits, |
| 17 | // class UIntType, size_t w, size_t s, size_t r> |
| 18 | // basic_ostream<charT, traits>& |
| 19 | // operator<<(basic_ostream<charT, traits>& os, |
| 20 | // const subtract_with_carry_engine<UIntType, w, s, r>& x); |
| 21 | // |
| 22 | // template <class charT, class traits, |
| 23 | // class UIntType, size_t w, size_t s, size_t r> |
| 24 | // basic_istream<charT, traits>& |
| 25 | // operator>>(basic_istream<charT, traits>& is, |
| 26 | // subtract_with_carry_engine<UIntType, w, s, r>& x); |
| 27 | |
| 28 | #include <random> |
| 29 | #include <sstream> |
| 30 | #include <cassert> |
| 31 | |
| 32 | #include "test_macros.h" |
| 33 | |
| 34 | void |
| 35 | test1() |
| 36 | { |
| 37 | typedef std::ranlux24_base E; |
| 38 | E e1; |
| 39 | e1.discard(z: 100); |
| 40 | std::ostringstream os; |
| 41 | os << e1; |
| 42 | std::istringstream is(os.str()); |
| 43 | E e2; |
| 44 | is >> e2; |
| 45 | assert(e1 == e2); |
| 46 | } |
| 47 | |
| 48 | void |
| 49 | test2() |
| 50 | { |
| 51 | typedef std::ranlux48_base E; |
| 52 | E e1; |
| 53 | e1.discard(z: 100); |
| 54 | std::ostringstream os; |
| 55 | os << e1; |
| 56 | std::istringstream is(os.str()); |
| 57 | E e2; |
| 58 | is >> e2; |
| 59 | assert(e1 == e2); |
| 60 | } |
| 61 | |
| 62 | int main(int, char**) |
| 63 | { |
| 64 | test1(); |
| 65 | test2(); |
| 66 | |
| 67 | return 0; |
| 68 | } |
| 69 | |