brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 06503cb Raw
71 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// <codecvt>10 11// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT12 13// template <class Elem, unsigned long Maxcode = 0x10ffff,14//           codecvt_mode Mode = (codecvt_mode)0>15// class codecvt_utf8_utf1616//     : public codecvt<Elem, char, mbstate_t>17// {18//     // unspecified19// };20 21// int max_length() const throw();22 23#include <codecvt>24#include <cassert>25 26#include "test_macros.h"27 28int main(int, char**)29{30#ifndef TEST_HAS_NO_WIDE_CHARACTERS31    {32        typedef std::codecvt_utf8_utf16<wchar_t> C;33        C c;34        int r = c.max_length();35        assert(r == 4);36    }37    {38        typedef std::codecvt_utf8_utf16<wchar_t, 0xFFFFFFFF, std::consume_header> C;39        C c;40        int r = c.max_length();41        assert(r == 7);42    }43#endif // TEST_HAS_NO_WIDE_CHARACTERS44    {45        typedef std::codecvt_utf8_utf16<char16_t> C;46        C c;47        int r = c.max_length();48        assert(r == 4);49    }50    {51        typedef std::codecvt_utf8_utf16<char16_t, 0xFFFFFFFF, std::consume_header> C;52        C c;53        int r = c.max_length();54        assert(r == 7);55    }56    {57        typedef std::codecvt_utf8_utf16<char32_t> C;58        C c;59        int r = c.max_length();60        assert(r == 4);61    }62    {63        typedef std::codecvt_utf8_utf16<char32_t, 0xFFFFFFFF, std::consume_header> C;64        C c;65        int r = c.max_length();66        assert(r == 7);67    }68 69  return 0;70}71