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