libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

setfill.pass.cpp (863B)


      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <iomanip>
     11 
     12 // template<charT> T4 setfill(charT c);
     13 
     14 #include <iomanip>
     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::ostream os(&sb);
     30         os << std::setfill('*');
     31         assert(os.fill() == '*');
     32     }
     33     {
     34         testbuf<wchar_t> sb;
     35         std::wostream os(&sb);
     36         os << std::setfill(L'*');
     37         assert(os.fill() == L'*');
     38     }
     39 }