brintos

brintos / llvm-project-archived public Read only

0
0
Text · 984 B · d72ac92 Raw
40 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <string>10 11// template<> struct char_traits<char16_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  char16_t s2[3] = {0};22  assert(std::char_traits<char16_t>::assign(s2, 3, char16_t(5)) == s2);23  assert(s2[0] == char16_t(5));24  assert(s2[1] == char16_t(5));25  assert(s2[2] == char16_t(5));26  assert(std::char_traits<char16_t>::assign(NULL, 0, char16_t(5)) == NULL);27 28  return true;29}30 31int main(int, char**) {32  test();33 34#if TEST_STD_VER > 1735  static_assert(test());36#endif37 38  return 0;39}40