1// RUN: %clang -O0 %s -o %t && %run %t
2// UNSUPPORTED: darwin
3
4#include <assert.h>
5#include <locale.h>
6#include <wchar.h>
7
8int main(int argc, char **argv) {
9 wchar_t q[10];
10 size_t n = wcsxfrm(s1: q, s2: L"abcdef", n: sizeof(q) / sizeof(wchar_t));
11 assert(n < sizeof(q));
12
13 wchar_t q2[10];
14 locale_t loc = newlocale(LC_ALL_MASK, locale: "", base: (locale_t)0);
15 n = wcsxfrm_l(s1: q2, s2: L"qwerty", n: sizeof(q) / sizeof(wchar_t), loc: loc);
16 assert(n < sizeof(q2));
17
18 freelocale(dataset: loc);
19 return 0;
20}
21

source code of compiler-rt/test/sanitizer_common/TestCases/Posix/wcsxfrm.c