1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2026-10-24 00:48:56 +03:00
Files
gnulib/tests/test-towctrans.c
Bruno Haible 8ee4c7ca41 Fix many test failures on Windows and 32-bit AIX (regr. 2026-05-08).
* tests/test-iswdigit.c (for_character): Restore cast of constants to
wchar_t, but in the form of a compound initializer.
* tests/test-iswpunct.c (for_character): Likewise.
* tests/test-iswxdigit.c (for_character): Likewise.
* tests/test-mbrtowc.c (main): Likewise.
* tests/test-mbrtowc-w32.c (test_one_locale): Likewise.
* tests/test-mbrtowc-w32utf8.c (main): Likewise.
* tests/test-mbsnrtowcs.c (main): Likewise.
* tests/test-mbsrtowcs.c (main): Likewise.
* tests/test-mbstowcs.c (main): Likewise.
* tests/test-snprintf-posix.h (test_function): Likewise.
* tests/test-sprintf-posix.h (test_function): Likewise.
* tests/test-towctrans.c (main): Likewise.
* tests/test-vasnprintf-posix.c (test_function): Likewise.
* tests/test-vasnwprintf-posix.c (test_function): Likewise.
* tests/test-vasprintf-posix.c (test_function): Likewise.
* tests/test-wcrtomb.c (check_character): Likewise.
* tests/test-wcscmp.c (main): Likewise.
* tests/test-wcsncmp.c (main): Likewise.
* tests/test-wmemcmp.c (main): Likewise.
* m4/c32rtomb.m4 (gl_C32RTOMB_SANITYCHECK): Likewise.
* m4/iswdigit.m4 (gl_FUNC_ISWDIGIT): Likewise.
* m4/iswxdigit.m4 (gl_FUNC_ISWXDIGIT): Likewise.
* m4/mbrtoc32.m4 (gl_MBRTOC32_SANITYCHECK): Likewise.
* m4/mbrtowc.m4 (gl_MBRTOWC_NULL_ARG1, gl_MBRTOWC_STORES_INCOMPLETE):
Likewise.
* m4/mbsnrtowcs.m4 (gl_MBSNRTOWCS_WORKS_IN_TRADITIONAL_LOCALE):
Likewise.
* m4/wcrtomb.m4 (gl_FUNC_WCRTOMB): Likewise.
2026-05-10 23:13:57 +02:00

61 lines
1.9 KiB
C

/* Test of wide character mappings.
Copyright (C) 2023-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>, 2023. */
#include <config.h>
#include <wctype.h>
#include "signature.h"
SIGNATURE_CHECK (towctrans, wint_t, (wint_t, wctrans_t));
#include "macros.h"
int
main (int argc, char *argv[])
{
wctrans_t desc;
desc = wctrans ("any");
ASSERT (desc == (wctrans_t) 0);
desc = wctrans ("tolower");
ASSERT (desc != (wctrans_t) 0);
ASSERT (towctrans (L'a', desc) == 'a');
ASSERT (towctrans (L'z', desc) == 'z');
ASSERT (towctrans (L'A', desc) == 'a');
ASSERT (towctrans (L'Z', desc) == 'z');
ASSERT (towctrans (L'1', desc) == '1');
ASSERT (towctrans (L'_', desc) == '_');
ASSERT (towctrans (L'_', desc) == '_');
ASSERT (towctrans ((wchar_t) {0}, desc) == 0);
ASSERT (towctrans (WEOF, desc) == WEOF);
desc = wctrans ("toupper");
ASSERT (desc != (wctrans_t) 0);
ASSERT (towctrans (L'A', desc) == 'A');
ASSERT (towctrans (L'Z', desc) == 'Z');
ASSERT (towctrans (L'a', desc) == 'A');
ASSERT (towctrans (L'z', desc) == 'Z');
ASSERT (towctrans (L'1', desc) == '1');
ASSERT (towctrans (L'_', desc) == '_');
ASSERT (towctrans ((wchar_t) {0}, desc) == 0);
ASSERT (towctrans (WEOF, desc) == WEOF);
return test_exit_status;
}