blob: d8ca8aebc62b84547e68efb477a3bff203fce89f [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00007//
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
Marshall Clow83e2c4d2013-01-05 03:21:01 +000020#include "platform_support.h" // locale name macros
Howard Hinnantc0d0cba2011-10-03 15:23:59 +000021
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000022template <class CharT>
23struct 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
37int 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 }
Howard Hinnantc0d0cba2011-10-03 15:23:59 +000047 std::locale::global(std::locale(LOCALE_en_US_UTF_8));
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000048 {
49 test<char> t;
Howard Hinnantc0d0cba2011-10-03 15:23:59 +000050 assert(t.getloc().name() == LOCALE_en_US_UTF_8);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000051 }
52 {
53 test<wchar_t> t;
Howard Hinnantc0d0cba2011-10-03 15:23:59 +000054 assert(t.getloc().name() == LOCALE_en_US_UTF_8);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000055 }
56}