From 051b60503c0e63901c601f7901047938b4931915 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 29 Jul 2023 21:39:02 +0200 Subject: [PATCH] btowc tests: Renumber tests. * tests/test-btowc*.sh: Renamed 1 -> 2 -> 3 -> 1. * tests/test-btowc.c: Update. * modules/btowc-tests: Update. --- ChangeLog | 7 +++++ modules/btowc-tests | 8 ++--- tests/{test-btowc3.sh => test-btowc-1.sh} | 4 +-- tests/{test-btowc1.sh => test-btowc-2.sh} | 2 +- tests/{test-btowc2.sh => test-btowc-3.sh} | 2 +- tests/test-btowc.c | 36 +++++++++++------------ 6 files changed, 33 insertions(+), 26 deletions(-) rename tests/{test-btowc3.sh => test-btowc-1.sh} (52%) rename tests/{test-btowc1.sh => test-btowc-2.sh} (90%) rename tests/{test-btowc2.sh => test-btowc-3.sh} (90%) diff --git a/ChangeLog b/ChangeLog index 96c217a02e..a46ceef2b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-07-29 Bruno Haible + + btowc tests: Renumber tests. + * tests/test-btowc*.sh: Renamed 1 -> 2 -> 3 -> 1. + * tests/test-btowc.c: Update. + * modules/btowc-tests: Update. + 2023-07-29 Bruno Haible time-h: Simplify after 2017-05-01 change. diff --git a/modules/btowc-tests b/modules/btowc-tests index 59d33eb00b..efb86ce8a1 100644 --- a/modules/btowc-tests +++ b/modules/btowc-tests @@ -1,7 +1,7 @@ Files: -tests/test-btowc1.sh -tests/test-btowc2.sh -tests/test-btowc3.sh +tests/test-btowc-1.sh +tests/test-btowc-2.sh +tests/test-btowc-3.sh tests/test-btowc.c tests/signature.h tests/macros.h @@ -16,7 +16,7 @@ gt_LOCALE_FR gt_LOCALE_FR_UTF8 Makefile.am: -TESTS += test-btowc1.sh test-btowc2.sh test-btowc3.sh +TESTS += test-btowc-1.sh test-btowc-2.sh test-btowc-3.sh TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-btowc test_btowc_LDADD = $(LDADD) $(SETLOCALE_LIB) diff --git a/tests/test-btowc3.sh b/tests/test-btowc-1.sh similarity index 52% rename from tests/test-btowc3.sh rename to tests/test-btowc-1.sh index ee9e143c1c..d6776565d6 100755 --- a/tests/test-btowc3.sh +++ b/tests/test-btowc-1.sh @@ -2,8 +2,8 @@ # Test whether the POSIX locale has encoding errors. LC_ALL=C \ -${CHECKER} ./test-btowc${EXEEXT} 3 || exit 1 +${CHECKER} ./test-btowc${EXEEXT} 1 || exit 1 LC_ALL=POSIX \ -${CHECKER} ./test-btowc${EXEEXT} 3 || exit 1 +${CHECKER} ./test-btowc${EXEEXT} 1 || exit 1 exit 0 diff --git a/tests/test-btowc1.sh b/tests/test-btowc-2.sh similarity index 90% rename from tests/test-btowc1.sh rename to tests/test-btowc-2.sh index e51e1c5c5e..9f939d6cbb 100755 --- a/tests/test-btowc1.sh +++ b/tests/test-btowc-2.sh @@ -12,4 +12,4 @@ if test $LOCALE_FR = none; then fi LC_ALL=$LOCALE_FR \ -${CHECKER} ./test-btowc${EXEEXT} 1 +${CHECKER} ./test-btowc${EXEEXT} 2 diff --git a/tests/test-btowc2.sh b/tests/test-btowc-3.sh similarity index 90% rename from tests/test-btowc2.sh rename to tests/test-btowc-3.sh index 9f38f4e8ae..4124476564 100755 --- a/tests/test-btowc2.sh +++ b/tests/test-btowc-3.sh @@ -12,4 +12,4 @@ if test $LOCALE_FR_UTF8 = none; then fi LC_ALL=$LOCALE_FR_UTF8 \ -${CHECKER} ./test-btowc${EXEEXT} 2 +${CHECKER} ./test-btowc${EXEEXT} 3 diff --git a/tests/test-btowc.c b/tests/test-btowc.c index 8a803e5335..908ec6af9e 100644 --- a/tests/test-btowc.c +++ b/tests/test-btowc.c @@ -44,30 +44,14 @@ main (int argc, char *argv[]) "C" locale. Furthermore, when you attempt to set the "C" or "POSIX" locale via setlocale(), what you get is a "C" locale with UTF-8 encoding, that is, effectively the "C.UTF-8" locale. */ - if (argc > 1 && strcmp (argv[1], "3") == 0 && MB_CUR_MAX > 1) - argv[1] = "2"; + if (argc > 1 && strcmp (argv[1], "1") == 0 && MB_CUR_MAX > 1) + argv[1] = "3"; #endif if (argc > 1) switch (argv[1][0]) { case '1': - /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ - for (c = 0; c < 0x80; c++) - ASSERT (btowc (c) == c); - for (c = 0xA0; c < 0x100; c++) - ASSERT (btowc (c) != WEOF); - return 0; - - case '2': - /* Locale encoding is UTF-8. */ - for (c = 0; c < 0x80; c++) - ASSERT (btowc (c) == c); - for (c = 0x80; c < 0x100; c++) - ASSERT (btowc (c) == WEOF); - return 0; - - case '3': /* C or POSIX locale. */ for (c = 0; c < 0x100; c++) if (c != 0) @@ -85,6 +69,22 @@ main (int argc, char *argv[]) ASSERT (wc == c || wc == 0xDF00 + c); } return 0; + + case '2': + /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ + for (c = 0; c < 0x80; c++) + ASSERT (btowc (c) == c); + for (c = 0xA0; c < 0x100; c++) + ASSERT (btowc (c) != WEOF); + return 0; + + case '3': + /* Locale encoding is UTF-8. */ + for (c = 0; c < 0x80; c++) + ASSERT (btowc (c) == c); + for (c = 0x80; c < 0x100; c++) + ASSERT (btowc (c) == WEOF); + return 0; } return 1; -- 2.39.5