Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 4 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 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 | |
Marshall Clow | 83e2c4d | 2013-01-05 03:21:01 +0000 | [diff] [blame] | 20 | #include "platform_support.h" // locale name macros |
Howard Hinnant | c0d0cba | 2011-10-03 15:23:59 +0000 | [diff] [blame] | 21 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 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 | } |
Howard Hinnant | c0d0cba | 2011-10-03 15:23:59 +0000 | [diff] [blame] | 47 | std::locale::global(std::locale(LOCALE_en_US_UTF_8)); |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 48 | { |
| 49 | test<char> t; |
Howard Hinnant | c0d0cba | 2011-10-03 15:23:59 +0000 | [diff] [blame] | 50 | assert(t.getloc().name() == LOCALE_en_US_UTF_8); |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 51 | } |
| 52 | { |
| 53 | test<wchar_t> t; |
Howard Hinnant | c0d0cba | 2011-10-03 15:23:59 +0000 | [diff] [blame] | 54 | assert(t.getloc().name() == LOCALE_en_US_UTF_8); |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 55 | } |
| 56 | } |