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// <string>
10
11// template<> struct char_traits<char32_t>
12
13// static char_type* assign(char_type* s, size_t n, char_type a);
14
15#include <string>
16#include <cassert>
17
18#include "test_macros.h"
19
20TEST_CONSTEXPR_CXX20 bool test() {
21 char32_t s2[3] = {0};
22 assert(std::char_traits<char32_t>::assign(s2, 3, char32_t(5)) == s2);
23 assert(s2[0] == char32_t(5));
24 assert(s2[1] == char32_t(5));
25 assert(s2[2] == char32_t(5));
26 assert(std::char_traits<char32_t>::assign(NULL, 0, char32_t(5)) == NULL);
27
28 return true;
29}
30
31int main(int, char**) {
32 test();
33
34#if TEST_STD_VER > 17
35 static_assert(test());
36#endif
37
38 return 0;
39}
40

source code of libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign3.pass.cpp