1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 // template <class charT, class traits = char_traits<charT> >
12 // class basic_ostream;
14 // basic_ostream(basic_ostream&& rhs);
19 #include "test_macros.h"
22 template <class CharT
>
24 : public std::basic_streambuf
<CharT
>
29 template <class CharT
>
31 : public std::basic_ostream
<CharT
>
33 typedef std::basic_ostream
<CharT
> base
;
34 test_ostream(testbuf
<CharT
>* sb
) : base(sb
) {}
36 test_ostream(test_ostream
&& s
)
37 : base(std::move(s
)) {}
45 test_ostream
<char> os1(&sb
);
46 test_ostream
<char> os(std::move(os1
));
47 assert(os1
.rdbuf() == &sb
);
48 assert(os
.rdbuf() == 0);
49 assert(os
.tie() == 0);
50 assert(os
.fill() == ' ');
51 assert(os
.rdstate() == os
.goodbit
);
52 assert(os
.exceptions() == os
.goodbit
);
53 assert(os
.flags() == (os
.skipws
| os
.dec
));
54 assert(os
.precision() == 6);
55 assert(os
.getloc().name() == "C");
57 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
60 test_ostream
<wchar_t> os1(&sb
);
61 test_ostream
<wchar_t> os(std::move(os1
));
62 assert(os1
.rdbuf() == &sb
);
63 assert(os
.rdbuf() == 0);
64 assert(os
.tie() == 0);
65 assert(os
.fill() == L
' ');
66 assert(os
.rdstate() == os
.goodbit
);
67 assert(os
.exceptions() == os
.goodbit
);
68 assert(os
.flags() == (os
.skipws
| os
.dec
));
69 assert(os
.precision() == 6);
70 assert(os
.getloc().name() == "C");