sigprocmask: Fix configuration failure on Solaris 10 (regr. 2020-07-25).
[gnulib.git] / tests / unistr / test-u16-check.c
blob5b88e0fd6e734ca26a755f4eb361bc44d7a36dfa
1 /* Test of u16_check() function.
2 Copyright (C) 2010-2020 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2010. */
19 #include <config.h>
21 #include "unistr.h"
23 #include "macros.h"
25 int
26 main ()
28 /* Test empty string. */
30 static const uint16_t input[] = { 0 };
31 ASSERT (u16_check (input, 0) == NULL);
34 /* Test valid non-empty string. */
36 static const uint16_t input[] = /* "Данило Шеган" */
37 { 0x0414, 0x0430, 0x043D, 0x0438, 0x043B, 0x043E, 0x0020, 0x0428, 0x0435, 0x0433, 0x0430, 0x043D };
38 ASSERT (u16_check (input, SIZEOF (input)) == NULL);
41 /* Test out-of-range character with 2 units: U+110000. */
43 static const uint16_t input[] = { 0x0414, 0x0430, 0xDBFF, 0xE000 };
44 ASSERT (u16_check (input, SIZEOF (input)) == input + 2);
47 /* Test surrogate codepoints. */
49 static const uint16_t input[] = { 0x0414, 0x0430, 0xDBFF, 0xDFFF };
50 ASSERT (u16_check (input, SIZEOF (input)) == NULL);
53 static const uint16_t input[] = { 0x0414, 0x0430, 0xDBFF };
54 ASSERT (u16_check (input, SIZEOF (input)) == input + 2);
57 static const uint16_t input[] = { 0x0414, 0x0430, 0xDFFF };
58 ASSERT (u16_check (input, SIZEOF (input)) == input + 2);
61 static const uint16_t input[] = { 0x0414, 0x0430, 0xDFFF, 0xDBFF };
62 ASSERT (u16_check (input, SIZEOF (input)) == input + 2);
65 return 0;