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_istream;
14 // basic_istream(basic_istream&& rhs);
20 #include "test_macros.h"
22 template <class CharT
>
24 : public std::basic_streambuf
<CharT
>
29 template <class CharT
>
31 : public std::basic_istream
<CharT
>
33 typedef std::basic_istream
<CharT
> base
;
34 test_istream(testbuf
<CharT
>* sb
) : base(sb
) {}
36 test_istream(test_istream
&& s
)
37 : base(std::move(s
)) {}
44 test_istream
<char> is1(&sb
);
45 test_istream
<char> is(std::move(is1
));
46 assert(is1
.rdbuf() == &sb
);
47 assert(is1
.gcount() == 0);
48 assert(is
.gcount() == 0);
49 assert(is
.rdbuf() == 0);
50 assert(is
.tie() == 0);
51 assert(is
.fill() == ' ');
52 assert(is
.rdstate() == is
.goodbit
);
53 assert(is
.exceptions() == is
.goodbit
);
54 assert(is
.flags() == (is
.skipws
| is
.dec
));
55 assert(is
.precision() == 6);
56 assert(is
.getloc().name() == "C");
58 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
61 test_istream
<wchar_t> is1(&sb
);
62 test_istream
<wchar_t> is(std::move(is1
));
63 assert(is1
.gcount() == 0);
64 assert(is
.gcount() == 0);
65 assert(is1
.rdbuf() == &sb
);
66 assert(is
.rdbuf() == 0);
67 assert(is
.tie() == 0);
68 assert(is
.fill() == L
' ');
69 assert(is
.rdstate() == is
.goodbit
);
70 assert(is
.exceptions() == is
.goodbit
);
71 assert(is
.flags() == (is
.skipws
| is
.dec
));
72 assert(is
.precision() == 6);
73 assert(is
.getloc().name() == "C");