[NFC][Py Reformat] Reformat python files in libcxx/libcxxabi
[llvm-project.git] / libcxx / test / std / localization / locale.stdcvt / codecvt_utf16_unshift.pass.cpp
blob55cbf5a7d0717edd5d6601aafdece333c68bc7e3
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 // result
22 // unshift(stateT& state,
23 // externT* to, externT* to_end, externT*& to_next) const;
25 #include <codecvt>
26 #include <cassert>
28 #include "test_macros.h"
30 int main(int, char**)
32 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
34 typedef std::codecvt_utf16<wchar_t> C;
35 C c;
36 char n[4] = {0};
37 std::mbstate_t m;
38 char* np = nullptr;
39 std::codecvt_base::result r = c.unshift(m, n, n+4, np);
40 assert(r == std::codecvt_base::noconv);
42 #endif
44 typedef std::codecvt_utf16<char16_t> C;
45 C c;
46 char n[4] = {0};
47 std::mbstate_t m;
48 char* np = nullptr;
49 std::codecvt_base::result r = c.unshift(m, n, n+4, np);
50 assert(r == std::codecvt_base::noconv);
53 typedef std::codecvt_utf16<char32_t> C;
54 C c;
55 char n[4] = {0};
56 std::mbstate_t m;
57 char* np = nullptr;
58 std::codecvt_base::result r = c.unshift(m, n, n+4, np);
59 assert(r == std::codecvt_base::noconv);
62 return 0;