]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode_wchar_t.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 22_locale / codecvt / codecvt_unicode_wchar_t.cc
CommitLineData
a945c346 1// Copyright (C) 2020-2024 Free Software Foundation, Inc.
02dab998
DM
2//
3// This file is part of the GNU ISO C++ Library. This library is free
4// software; you can redistribute it and/or modify it under the
5// terms of the GNU General Public License as published by the
6// Free Software Foundation; either version 3, or (at your option)
7// any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License along
15// with this library; see the file COPYING3. If not see
16// <http://www.gnu.org/licenses/>.
17
18// { dg-do run { target c++11 } }
19
20#include "codecvt_unicode.h"
21
22#include <codecvt>
23
24using namespace std;
25
26void
27test_utf8_utf32_codecvts ()
28{
29#if __SIZEOF_WCHAR_T__ == 4
7d0cdbbc 30 codecvt_utf8<wchar_t> cvt;
a8b9c32d 31 test_utf8_utf32_cvt (cvt);
02dab998
DM
32#endif
33}
34
35void
36test_utf8_utf16_codecvts ()
37{
38#if __SIZEOF_WCHAR_T__ >= 2
7d0cdbbc 39 codecvt_utf8_utf16<wchar_t> cvt;
a8b9c32d 40 test_utf8_utf16_cvt (cvt);
02dab998
DM
41#endif
42}
43
44void
45test_utf8_ucs2_codecvts ()
46{
47#if __SIZEOF_WCHAR_T__ == 2
7d0cdbbc 48 codecvt_utf8<wchar_t> cvt;
a8b9c32d
DM
49 test_utf8_ucs2_cvt (cvt);
50#endif
51}
52
53void
54test_utf16_utf32_codecvts ()
55{
56#if __SIZEOF_WCHAR_T__ == 4
57 codecvt_utf16<wchar_t> cvt3;
58 test_utf16_utf32_cvt (cvt3, utf16_big_endian);
59
60 codecvt_utf16<wchar_t, 0x10FFFF, codecvt_mode::little_endian> cvt4;
61 test_utf16_utf32_cvt (cvt4, utf16_little_endian);
62#endif
63}
64
65void
66test_utf16_ucs2_codecvts ()
67{
68#if __SIZEOF_WCHAR_T__ == 2
69 codecvt_utf16<wchar_t> cvt3;
70 test_utf16_ucs2_cvt (cvt3, utf16_big_endian);
71
72 codecvt_utf16<wchar_t, 0x10FFFF, codecvt_mode::little_endian> cvt4;
73 test_utf16_ucs2_cvt (cvt4, utf16_little_endian);
02dab998
DM
74#endif
75}
76
77int
78main ()
79{
80 test_utf8_utf32_codecvts ();
81 test_utf8_utf16_codecvts ();
82 test_utf8_ucs2_codecvts ();
a8b9c32d
DM
83 test_utf16_utf32_codecvts ();
84 test_utf16_ucs2_codecvts ();
02dab998 85}