brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · df9df90 Raw
66 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// REQUIRES: locale.en_US.UTF-810 11// <streambuf>12 13// template <class charT, class traits = char_traits<charT> >14// class basic_streambuf;15 16// basic_streambuf();17 18#include <streambuf>19#include <cassert>20 21#include "test_macros.h"22#include "platform_support.h" // locale name macros23 24template <class CharT>25struct test26    : 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 39int main(int, char**)40{41    {42        test<char> t;43        assert(t.getloc().name() == "C");44    }45#ifndef TEST_HAS_NO_WIDE_CHARACTERS46    {47        test<wchar_t> t;48        assert(t.getloc().name() == "C");49    }50#endif51 52    std::locale::global(std::locale(LOCALE_en_US_UTF_8));53    {54        test<char> t;55        assert(t.getloc().name() == LOCALE_en_US_UTF_8);56    }57#ifndef TEST_HAS_NO_WIDE_CHARACTERS58    {59        test<wchar_t> t;60        assert(t.getloc().name() == LOCALE_en_US_UTF_8);61    }62#endif63 64  return 0;65}66