1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <codecvt>
11
12 // template <class Elem, unsigned long Maxcode = 0x10ffff,
13 // codecvt_mode Mode = (codecvt_mode)0>
14 // class codecvt_utf16
15 // : public codecvt<Elem, char, mbstate_t>
16 // {
17 // // unspecified
18 // };
19
20 // int max_length() const throw();
21
22 #include <codecvt>
23 #include <cassert>
24
main()25 int main()
26 {
27 {
28 typedef std::codecvt_utf16<wchar_t> C;
29 C c;
30 int r = c.max_length();
31 assert(r == 4);
32 }
33 {
34 typedef std::codecvt_utf16<wchar_t, 0xFFFFFFFF, std::consume_header> C;
35 C c;
36 int r = c.max_length();
37 assert(r == 6);
38 }
39 {
40 typedef std::codecvt_utf16<char16_t> C;
41 C c;
42 int r = c.max_length();
43 assert(r == 2);
44 }
45 {
46 typedef std::codecvt_utf16<char16_t, 0xFFFFFFFF, std::consume_header> C;
47 C c;
48 int r = c.max_length();
49 assert(r == 4);
50 }
51 {
52 typedef std::codecvt_utf16<char32_t> C;
53 C c;
54 int r = c.max_length();
55 assert(r == 4);
56 }
57 {
58 typedef std::codecvt_utf16<char32_t, 0xFFFFFFFF, std::consume_header> C;
59 C c;
60 int r = c.max_length();
61 assert(r == 6);
62 }
63 }
64