[NFC][Py Reformat] Reformat python files in libcxx/libcxxabi
[llvm-project.git] / libcxx / test / std / localization / locale.stdcvt / codecvt_utf16_encoding.pass.cpp
blob12bfa096924b6fc10081cff3279e25217914515f
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 //===----------------------------------------------------------------------===//
9 // <codecvt>
11 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
13 // template <class Elem, unsigned long Maxcode = 0x10ffff,
14 // codecvt_mode Mode = (codecvt_mode)0>
15 // class codecvt_utf16
16 // : public codecvt<Elem, char, mbstate_t>
17 // {
18 // // unspecified
19 // };
21 // int encoding() const throw();
23 #include <codecvt>
24 #include <cassert>
26 #include "test_macros.h"
28 int main(int, char**)
30 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
32 typedef std::codecvt_utf16<wchar_t> C;
33 C c;
34 int r = c.encoding();
35 assert(r == 0);
37 #endif
39 typedef std::codecvt_utf16<char16_t> C;
40 C c;
41 int r = c.encoding();
42 assert(r == 0);
45 typedef std::codecvt_utf16<char32_t> C;
46 C c;
47 int r = c.encoding();
48 assert(r == 0);
51 return 0;