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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <codecvt>
10 
11 // template <class Elem, unsigned long Maxcode = 0x10ffff,
12 //           codecvt_mode Mode = (codecvt_mode)0>
13 // class codecvt_utf16
14 //     : public codecvt<Elem, char, mbstate_t>
15 // {
16 //     // unspecified
17 // };
18 
19 // int max_length() const throw();
20 
21 #include <codecvt>
22 #include <cassert>
23 
24 #include "test_macros.h"
25 
26 int main(int, char**)
27 {
28     {
29         typedef std::codecvt_utf16<wchar_t> C;
30         C c;
31         int r = c.max_length();
32         assert(r == 4);
33     }
34     {
35         typedef std::codecvt_utf16<wchar_t, 0xFFFFFFFF, std::consume_header> C;
36         C c;
37         int r = c.max_length();
38         assert(r == 6);
39     }
40     {
41         typedef std::codecvt_utf16<char16_t> C;
42         C c;
43         int r = c.max_length();
44         assert(r == 2);
45     }
46     {
47         typedef std::codecvt_utf16<char16_t, 0xFFFFFFFF, std::consume_header> C;
48         C c;
49         int r = c.max_length();
50         assert(r == 4);
51     }
52     {
53         typedef std::codecvt_utf16<char32_t> C;
54         C c;
55         int r = c.max_length();
56         assert(r == 4);
57     }
58     {
59         typedef std::codecvt_utf16<char32_t, 0xFFFFFFFF, std::consume_header> C;
60         C c;
61         int r = c.max_length();
62         assert(r == 6);
63     }
64 
65   return 0;
66 }
67