]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/basic_istringstream/cons/wchar_t/1.cc
1 // Copyright (C) 2020 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // C++20 29.8.2.2 basic_stringbuf constructors [stringbuf.cons
20 // { dg-options "-std=gnu++2a" }
21 // { dg-do run { target c++2a } }
22 // { dg-require-effective-target cxx11-abi }
26 #include <testsuite_allocator.h>
27 #include <testsuite_hooks.h>
32 std::wistringstream::allocator_type a
;
33 std::wistringstream
stm(std::ios_base::in
, a
);
36 auto const cstr
= L
"This is a test";
41 std::wstring
s1(cstr
);
42 std::wistringstream
stm(std::move(s1
));
45 std::wstring
s2(cstr
);
46 VERIFY( stm
.str() == s2
);
52 using alloc_type
= __gnu_test::tracker_allocator
<wchar_t>;
53 using str_type
= std::basic_string
<wchar_t, std::char_traits
<wchar_t>, alloc_type
>;
55 auto const mode
= std::ios_base::in
;
59 std::wistringstream::allocator_type a
;
60 std::wistringstream
sbuf(s1
, mode
, a
);
61 std::wstring
s2(cstr
);
62 VERIFY( sbuf
.str() == s2
);
66 std::wistringstream
sbuf(s1
, mode
);
67 std::wstring
s2(cstr
);
68 VERIFY( sbuf
.str() == s2
);
72 std::wistringstream
sbuf(s1
);
73 std::wstring
s2(cstr
);
74 VERIFY( sbuf
.str() == s2
);