1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2026-10-24 00:48:56 +03:00

btoc32 tests: Enhance tests.

* tests/test-btoc32.c (main): Verify that btoc32 is consistent with
mbrtoc32.
* modules/btoc32-tests (Depends-on): Add mbszero, mbrtoc32.
This commit is contained in:
Bruno Haible
2026-09-18 17:43:26 +02:00
parent 1ed3525161
commit 8396458e22
3 changed files with 24 additions and 0 deletions

View File

@@ -1,3 +1,10 @@
2026-09-18 Bruno Haible <bruno@clisp.org>
btoc32 tests: Enhance tests.
* tests/test-btoc32.c (main): Verify that btoc32 is consistent with
mbrtoc32.
* modules/btoc32-tests (Depends-on): Add mbszero, mbrtoc32.
2026-09-18 Bruno Haible <bruno@clisp.org>
c32rtomb + uchar-h-c23: Make consistent with mbrtoc32 in the C locale.

View File

@@ -11,6 +11,8 @@ m4/codeset.m4
Depends-on:
setlocale
mbszero
mbrtoc32
streq
configure.ac:

View File

@@ -38,6 +38,21 @@ main (int argc, char *argv[])
ASSERT (btoc32 (EOF) == WEOF);
/* Verify that btoc32 is consistent with mbrtoc32. */
for (int c = 0; c < 0x100; c++)
if (c != 0)
{
mbstate_t state;
mbszero (&state);
char s[1];
s[0] = (unsigned char) c;
char32_t wc;
if (mbrtoc32 (&wc, s, 1, &state) <= 1)
ASSERT (btoc32 (c) == wc);
else
ASSERT (btoc32 (c) == WEOF);
}
#ifdef __ANDROID__
/* On Android ≥ 5.0, the default locale is the "C.UTF-8" locale, not the
"C" locale. Furthermore, when you attempt to set the "C" or "POSIX"