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-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <iomanip> 10 11 // T6 setw(int n); 12 13 #include <iomanip> 14 #include <istream> 15 #include <ostream> 16 #include <cassert> 17 18 template <class CharT> 19 struct testbuf 20 : public std::basic_streambuf<CharT> 21 { 22 testbuf() {} 23 }; 24 25 int main() 26 { 27 { 28 testbuf<char> sb; 29 std::istream is(&sb); 30 is >> std::setw(10); 31 assert(is.width() == 10); 32 } 33 { 34 testbuf<char> sb; 35 std::ostream os(&sb); 36 os << std::setw(10); 37 assert(os.width() == 10); 38 } 39 { 40 testbuf<wchar_t> sb; 41 std::wistream is(&sb); 42 is >> std::setw(10); 43 assert(is.width() == 10); 44 } 45 { 46 testbuf<wchar_t> sb; 47 std::wostream os(&sb); 48 os << std::setw(10); 49 assert(os.width() == 10); 50 } 51 } 52