brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · c83e53f Raw
75 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: no-localization10 11// <random>12 13// template <class UIntType, size_t w, size_t n, size_t m, size_t r,14//           UIntType a, size_t u, UIntType d, size_t s,15//           UIntType b, size_t t, UIntType c, size_t l, UIntType f>16// class mersenne_twister_engine;17 18// template <class charT, class traits,19//           class UIntType, size_t w, size_t n, size_t m, size_t r,20//           UIntType a, size_t u, UIntType d, size_t s,21//           UIntType b, size_t t, UIntType c, size_t l, UIntType f>22// basic_ostream<charT, traits>&23// operator<<(basic_ostream<charT, traits>& os,24//            const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& x);25//26// template <class charT, class traits,27//           class UIntType, size_t w, size_t n, size_t m, size_t r,28//           UIntType a, size_t u, UIntType d, size_t s,29//           UIntType b, size_t t, UIntType c, size_t l, UIntType f>30// basic_ostream<charT, traits>&31// operator>>(basic_istream<charT, traits>& is,32//            mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& x);33 34#include <random>35#include <sstream>36#include <cassert>37 38#include "test_macros.h"39 40void41test1()42{43    typedef std::mt19937 E;44    E e1;45    e1.discard(100);46    std::ostringstream os;47    os << e1;48    std::istringstream is(os.str());49    E e2;50    is >> e2;51    assert(e1 == e2);52}53 54void55test2()56{57    typedef std::mt19937_64 E;58    E e1;59    e1.discard(100);60    std::ostringstream os;61    os << e1;62    std::istringstream is(os.str());63    E e2;64    is >> e2;65    assert(e1 == e2);66}67 68int main(int, char**)69{70    test1();71    test2();72 73  return 0;74}75