46 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// class bernoulli_distribution14 15// template <class charT, class traits>16// basic_ostream<charT, traits>&17// operator<<(basic_ostream<charT, traits>& os,18// const bernoulli_distribution& x);19//20// template <class charT, class traits>21// basic_istream<charT, traits>&22// operator>>(basic_istream<charT, traits>& is,23// bernoulli_distribution& x);24 25#include <random>26#include <sstream>27#include <cassert>28 29#include "test_macros.h"30 31int main(int, char**)32{33 {34 typedef std::bernoulli_distribution D;35 D d1(.25);36 std::ostringstream os;37 os << d1;38 std::istringstream is(os.str());39 D d2;40 is >> d2;41 assert(d1 == d2);42 }43 44 return 0;45}46