Home | History | Annotate | Download | only in streambuf.cons
      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 // REQUIRES: locale.en_US.UTF-8
     11 
     12 // <streambuf>
     13 
     14 // template <class charT, class traits = char_traits<charT> >
     15 // class basic_streambuf;
     16 
     17 // basic_streambuf();
     18 
     19 #include <streambuf>
     20 #include <cassert>
     21 
     22 #include "platform_support.h" // locale name macros
     23 
     24 template <class CharT>
     25 struct test
     26     : public std::basic_streambuf<CharT>
     27 {
     28     test()
     29     {
     30         assert(this->eback() == 0);
     31         assert(this->gptr() == 0);
     32         assert(this->egptr() == 0);
     33         assert(this->pbase() == 0);
     34         assert(this->pptr() == 0);
     35         assert(this->epptr() == 0);
     36     }
     37 };
     38 
     39 int main()
     40 {
     41     {
     42         test<char> t;
     43         assert(t.getloc().name() == "C");
     44     }
     45     {
     46         test<wchar_t> t;
     47         assert(t.getloc().name() == "C");
     48     }
     49     std::locale::global(std::locale(LOCALE_en_US_UTF_8));
     50     {
     51         test<char> t;
     52         assert(t.getloc().name() == LOCALE_en_US_UTF_8);
     53     }
     54     {
     55         test<wchar_t> t;
     56         assert(t.getloc().name() == LOCALE_en_US_UTF_8);
     57     }
     58 }
     59