From patchwork Mon Jan 31 05:34:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos O'Donell X-Patchwork-Id: 50582 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2DF49385841A for ; Mon, 31 Jan 2022 05:35:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2DF49385841A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1643607355; bh=pInOY6FYaKc7EU6qS+/ah0MbW+N22fIsj0OPYPt2TJc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Xu/uOc6W8HbS4A/2btcfV7oXCdHTnHoBZvhSIKcImWj3NFV8QL/EJm4SbAJYABbsw Z7vhP2wbMd5hc98AyrDh07GNtNuH28WEM06L8xYMeEok+UvDfDAafI5tFxFnleExF7 2rZgt51wrEIAs6A9mONsh/DgMl6trTj337RhhKu4= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 14E5B3858D28 for ; Mon, 31 Jan 2022 05:34:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 14E5B3858D28 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-434-7kqG73x9NDamPQ7WBQ9-jw-1; Mon, 31 Jan 2022 00:34:52 -0500 X-MC-Unique: 7kqG73x9NDamPQ7WBQ9-jw-1 Received: by mail-qk1-f197.google.com with SMTP id j66-20020a375545000000b004e0e071f37eso6316945qkb.23 for ; Sun, 30 Jan 2022 21:34:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pInOY6FYaKc7EU6qS+/ah0MbW+N22fIsj0OPYPt2TJc=; b=qeo/FevmYwdauqcb54DXsL+Nk3PqvDPHsXFRZkwpOP/XnzeuJNt6GYYnUSug8Or41x ro76yLQmQYiOTOD5Xii4JahnMfc2ugncKChffv28jNt8PwlbMt1VsPEdDKUSlfi/tav6 KmzlRBLbTHNLynADyOBNXYB162dVqVufXuxjzJuvuVIHvBLS+ID7wOF9TKDvQDn7GLuM 5zmmKT2B+v/D4rrusp3yFxdKdMMdU2q5+/Yk63BcFFZcizUGWmgBSNK51glTAyFHiZUm +9fmSMGpE69rhFlFWMkGr+leE8yID0iRcpNZAqgHBR346lfZeAlQJB2JJuvfhE9bRpBJ o+pA== X-Gm-Message-State: AOAM533KGkrwQVmShz0SA5aLQUV+8gHWkm6ltsJRYV9L2NV30ZfvJYK+ HfIdB2MvY+f0XxNpGmHOWoH1CUKGoXqzqlHpqZtuoHmulPa2jmfEsA/q6bE6M58dqXUrX9rOWw+ 7WowUf0rim3TqWJSCBaqMuqlwFSP0Eb8w8edHk6bpU1fbRz2fKcM5Ckv3usSRFkTGhOx0pg== X-Received: by 2002:a05:6214:21e8:: with SMTP id p8mr16407211qvj.116.1643607291953; Sun, 30 Jan 2022 21:34:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJwII0dPfrVz3GHqwMla+OG9IEG9+J2m0YI0+EwzvUT3IwKEXHWqqay1IYI9/MzcFnyERUNbcA== X-Received: by 2002:a05:6214:21e8:: with SMTP id p8mr16407198qvj.116.1643607291679; Sun, 30 Jan 2022 21:34:51 -0800 (PST) Received: from athas.redhat.com (135-23-175-80.cpe.pppoe.ca. [135.23.175.80]) by smtp.gmail.com with ESMTPSA id 18sm7261884qka.126.2022.01.30.21.34.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 21:34:51 -0800 (PST) To: libc-alpha@sourceware.org, fweimer@redhat.com, michael.hudson@canonical.com Subject: [PATCH 1/2] localedef: Fix handling of empty mon_decimal_point Date: Mon, 31 Jan 2022 00:34:41 -0500 Message-Id: <20220131053442.3995804-2-carlos@redhat.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220131053442.3995804-1-carlos@redhat.com> References: <20220131053442.3995804-1-carlos@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Carlos O'Donell via Libc-alpha From: Carlos O'Donell Reply-To: Carlos O'Donell Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The handling of mon_decimal_point is incorrect when it comes to handling the empty "" value. The existing parser in monetary_read() will correctly handle setting the non-wide-character value and the wide-character value e.g. STR_ELEM_WC(mon_decimal_point) if they are set in the locale definition. However, in monetary_finish() we have conflicting TEST_ELEM() which sets a default value (if the locale definition doesn't include one), and subsequent code which looks for mon_decimal_point to be NULL to issue a specific error message and set the defaults. The latter is unused because TEST_ELEM() always sets a default. The simplest solution is to remove the TEST_ELEM() check, and allow the existing check to look to see if mon_decimal_point is NULL and set an appropriate default. The final fix is to move the setting of mon_decimal_point_wc so it occurs only when mon_decimal_point is being set to a default, keeping both values consistent. There is no way to tell the difference between mon_decimal_point_wc having been set to the empty string and not having been defined at all, for that distinction we must use mon_decimal_point being NULL or "", and so we must logically set the default together with mon_decimal_point. Lastly, there are more fixes similar to this that could be made to ld-monetary.c, but we avoid that in order to fix just the code required for mon_decimal_point, which impacts the ability for C.UTF-8 to set mon_decimal_point to "", since without this fix we end up with an inconsistent setting of mon_decimal_point set to "", but mon_decimal_point_wc set to "." which is incorrect. Tested on x86_64 and i686 without regression. Reviewed-by: Florian Weimer --- locale/programs/ld-monetary.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/locale/programs/ld-monetary.c b/locale/programs/ld-monetary.c index 277b9ff042..3b0412b405 100644 --- a/locale/programs/ld-monetary.c +++ b/locale/programs/ld-monetary.c @@ -207,7 +207,6 @@ No definition for %s category found"), "LC_MONETARY"); TEST_ELEM (int_curr_symbol, ""); TEST_ELEM (currency_symbol, ""); - TEST_ELEM (mon_decimal_point, "."); TEST_ELEM (mon_thousands_sep, ""); TEST_ELEM (positive_sign, ""); TEST_ELEM (negative_sign, ""); @@ -257,6 +256,7 @@ not correspond to a valid name in ISO 4217 [--no-warnings=intcurrsym]"), record_error (0, 0, _("%s: field `%s' not defined"), "LC_MONETARY", "mon_decimal_point"); monetary->mon_decimal_point = "."; + monetary->mon_decimal_point_wc = L'.'; } else if (monetary->mon_decimal_point[0] == '\0' && ! be_quiet && ! nothing) { @@ -264,8 +264,6 @@ not correspond to a valid name in ISO 4217 [--no-warnings=intcurrsym]"), %s: value for field `%s' must not be an empty string"), "LC_MONETARY", "mon_decimal_point"); } - if (monetary->mon_decimal_point_wc == L'\0') - monetary->mon_decimal_point_wc = L'.'; if (monetary->mon_grouping_len == 0) { From patchwork Mon Jan 31 05:34:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos O'Donell X-Patchwork-Id: 50583 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CCDD0385800F for ; Mon, 31 Jan 2022 05:36:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CCDD0385800F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1643607397; bh=VVQ8CqO4Nc1MlE5JL4OJLOvBH5WwOWA3PKY7grN4zR0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=cHo5zSli66L4K4hp+LPZsSRgFqEKor+HWhrEb9Gx4K1PD73g4fCz7JsVs0+Jy5bsT whjG9c2vWRFuBsymq8LpCGx+PuauoP6CzIvdnJp6xxiRBILX/OAt0jkG3934n/WljM M+sRNypKUufPMLSDlt8KjtEBohLjHxq1FiZk3jd4= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id B02233858427 for ; Mon, 31 Jan 2022 05:34:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B02233858427 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-117-b6mhZ_tgO4mOj0x8ghJEGA-1; Mon, 31 Jan 2022 00:34:55 -0500 X-MC-Unique: b6mhZ_tgO4mOj0x8ghJEGA-1 Received: by mail-qk1-f199.google.com with SMTP id b204-20020a3767d5000000b004b2a0d2e930so7885673qkc.15 for ; Sun, 30 Jan 2022 21:34:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VVQ8CqO4Nc1MlE5JL4OJLOvBH5WwOWA3PKY7grN4zR0=; b=QvIhOvsFAvb4jc9Ss+C7E0f94XBVz1DwjxJxwalCte8jNmvtSUR2YM4PjcQmcv+6DY M23GMAeE5NvD0ZQ1KCWGCn2du0BchuOFKWzdqTBqgEVvpArs2g/Niehue4YVphZJSP7F AaS55U1nhuqlyh6RB3Q1WLgrIohYDhxDJ7QbgmoH03Tq55lQPQYySsdspf5cyJx0TQeN Zq6A0u0RcG1LX+QgPiAi979Hl02wsQyq3bZsD20bbYbT0gjb4uK1hApgPxz1MdWNscAg YOOQZhY8MBXW2snAwU4BmGwSJ3Uxl4obcM4pw70pJ02eoXf5Xl4oaunfa3b8w4dX4T7z jYJQ== X-Gm-Message-State: AOAM53195v9Ep7eCu6hv265cJbeRNdf1+9UdkXDgPgpc0746egNZBYtt E4vW1ry1n4o3Y2gsysapy4ax2ZF1CrjhK3QJRAIHHq3tiu3+skpwi3duns2OiCftpwAyQZSXO9/ IaMp/HfiXj/13muQUdSf/EDv819kb11ZNWNldZZnt/+gQveOLTwS88CVucVhbGNhh739raw== X-Received: by 2002:a05:6214:21ac:: with SMTP id t12mr16394985qvc.123.1643607294118; Sun, 30 Jan 2022 21:34:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJw7fE/SWR2BVZ51AiB4o8XM+pGxSR23aSZwV/LsX3/9qQ6/UrplBZqTeaOUWL/oKHIE5YnebA== X-Received: by 2002:a05:6214:21ac:: with SMTP id t12mr16394963qvc.123.1643607293587; Sun, 30 Jan 2022 21:34:53 -0800 (PST) Received: from athas.redhat.com (135-23-175-80.cpe.pppoe.ca. [135.23.175.80]) by smtp.gmail.com with ESMTPSA id 18sm7261884qka.126.2022.01.30.21.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 21:34:52 -0800 (PST) To: libc-alpha@sourceware.org, fweimer@redhat.com, michael.hudson@canonical.com Subject: [PATCH 2/2] localedata: Adjust C.UTF-8 to align with C/POSIX. Date: Mon, 31 Jan 2022 00:34:42 -0500 Message-Id: <20220131053442.3995804-3-carlos@redhat.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220131053442.3995804-1-carlos@redhat.com> References: <20220131053442.3995804-1-carlos@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_FILL_THIS_FORM_SHORT, T_SCC_BODY_TEXT_LINE, UPPERCASE_50_75 autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Carlos O'Donell via Libc-alpha From: Carlos O'Donell Reply-To: Carlos O'Donell Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" We have had one downstream report from Canonical [1] that an rrdtool test was broken by the differences in LC_TIME that we had in the non-builtin C locale (C.UTF-8). If one application has an issue there are going to be others, and so with this commit we review and fix all the issues that cause the builtin C locale to be different from C.UTF-8, which includes: * mon_decimal_point should be empty e.g. "" - Depends on mon_decimal_point_wc fix. * negative_sign should be empty e.g. "" * week should be aligned with ISO 30112 default e.g. 7;19971130;4 * d_fmt corrected with escaped slashes e.g. "%m//%d//%y" * yesstr and nostr should be empty e.g. "" * country_ab2 and country_ab3 should be empty e.g. "" We bump LC_IDENTIFICATION version and adjust the date to indicate the change in the locale. A new tst-c-utf8-consistency test is added to ensure consistency between C/POSIX and C.UTF-8. Tested on x86_64 and i686 without regression. [1] https://sourceware.org/pipermail/libc-alpha/2022-January/135703.html Co-authored-by: Florian Weimer Reviewed-by: Florian Weimer --- localedata/Makefile | 30 +- localedata/locales/C | 22 +- localedata/tst-c-utf8-consistency.c | 539 ++++++++++++++++++++++++++++ 3 files changed, 578 insertions(+), 13 deletions(-) create mode 100644 localedata/tst-c-utf8-consistency.c diff --git a/localedata/Makefile b/localedata/Makefile index 79db713925..9ae2e5c161 100644 --- a/localedata/Makefile +++ b/localedata/Makefile @@ -155,11 +155,31 @@ locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \ tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \ tst_wctype tst_wcwidth -tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \ - tst-leaks tst-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \ - tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \ - tst-strfmon1 tst-sscanf bug-setlocale1 tst-setlocale2 tst-setlocale3 \ - tst-wctype tst-iconv-math-trans +tests = \ + $(locale_test_suite) \ + bug-iconv-trans \ + bug-setlocale1 \ + bug-usesetlocale \ + tst-c-utf8-consistency \ + tst-digits \ + tst-iconv-math-trans \ + tst-leaks \ + tst-mbswcs1 \ + tst-mbswcs2 \ + tst-mbswcs3 \ + tst-mbswcs4 \ + tst-mbswcs5 \ + tst-mbswcs6 \ + tst-setlocale \ + tst-setlocale2 \ + tst-setlocale3 \ + tst-sscanf \ + tst-strfmon1 \ + tst-wctype \ + tst-xlocale1 \ + tst-xlocale2 \ + # tests + tests-static = bug-setlocale1-static tests += $(tests-static) ifeq (yes,$(build-shared)) diff --git a/localedata/locales/C b/localedata/locales/C index ca801c79cf..fb647ccc4b 100644 --- a/localedata/locales/C +++ b/localedata/locales/C @@ -12,8 +12,8 @@ tel "" fax "" language "" territory "" -revision "2.0" -date "2020-06-28" +revision "2.1" +date "2022-01-30" category "i18n:2012";LC_IDENTIFICATION category "i18n:2012";LC_CTYPE category "i18n:2012";LC_COLLATE @@ -68,11 +68,11 @@ LC_MONETARY % glibc/locale/C-monetary.c.). int_curr_symbol "" currency_symbol "" -mon_decimal_point "." +mon_decimal_point "" mon_thousands_sep "" mon_grouping -1 positive_sign "" -negative_sign "-" +negative_sign "" int_frac_digits -1 frac_digits -1 p_cs_precedes -1 @@ -121,7 +121,9 @@ mon "January";"February";"March";"April";"May";"June";"July";/ % % ISO 8601 conforming applications should use the values 7, 19971201 (a % Monday), and 4 (Thursday), respectively. -week 7;19971201;4 +% +% This field is consciously aligned with ISO 30112 and the C/POSIX locale. +week 7;19971130;4 first_weekday 1 first_workday 2 @@ -129,7 +131,7 @@ first_workday 2 d_t_fmt "%a %b %e %H:%M:%S %Y" % Appropriate date representation (%x) -d_fmt "%m/%d/%y" +d_fmt "%m//%d//%y" % Appropriate time representation (%X) t_fmt "%H:%M:%S" @@ -150,8 +152,8 @@ LC_MESSAGES % yesexpr "^[yY]" noexpr "^[nN]" -yesstr "Yes" -nostr "No" +yesstr "" +nostr "" END LC_MESSAGES LC_PAPER @@ -175,6 +177,10 @@ LC_ADDRESS % the LC_ADDRESS category. % (also used in the built in C/POSIX locale in glibc/locale/C-address.c) postal_fmt "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N" +% The abbreviated 2 char and 3 char should be set to empty strings to +% match the C/POSIX locale. +country_ab2 "" +country_ab3 "" END LC_ADDRESS LC_TELEPHONE diff --git a/localedata/tst-c-utf8-consistency.c b/localedata/tst-c-utf8-consistency.c new file mode 100644 index 0000000000..50feed3090 --- /dev/null +++ b/localedata/tst-c-utf8-consistency.c @@ -0,0 +1,539 @@ +/* Test that C/POSIX and C.UTF-8 are consistent. + Copyright (C) 2022 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include + +/* Initialized by do_test using newlocale. */ +static locale_t c_utf8; + +/* Set to true for second pass. */ +static bool use_nl_langinfo_l; + +static void +switch_to_c (void) +{ + if (setlocale (LC_ALL, "C") == NULL) + FAIL_EXIT1 ("setlocale (LC_ALL, \"C\")"); +} + +static void +switch_to_c_utf8 (void) +{ + if (setlocale (LC_ALL, "C.UTF-8") == NULL) + FAIL_EXIT1 ("setlocale (LC_ALL, \"C.UTF-8\")"); +} + +static char * +str (nl_item item) +{ + if (!use_nl_langinfo_l) + switch_to_c (); + return nl_langinfo (item); +} + +static char * +str_utf8 (nl_item item) +{ + if (use_nl_langinfo_l) + return nl_langinfo_l (item, c_utf8); + else + { + switch_to_c_utf8 (); + return nl_langinfo (item); + } +} + +static wchar_t * +wstr (nl_item item) +{ + return (wchar_t *) str (item); +} + +static wchar_t * +wstr_utf8 (nl_item item) +{ + return (wchar_t *) str_utf8 (item); +} + +static int +byte (nl_item item) +{ + return (signed char) *str (item); +} + +static int +byte_utf8 (nl_item item) +{ + return (signed char) *str_utf8 (item); +} + +static int +word (nl_item item) +{ + union + { + char *ptr; + int word; + } u; + u.ptr = str (item); + return u.word; +} + +static int +word_utf8 (nl_item item) +{ + union + { + char *ptr; + int word; + } u; + u.ptr = str_utf8 (item); + return u.word; +} + +static void +one_pass (void) +{ + /* LC_TIME. */ + TEST_COMPARE_STRING (str (ABDAY_1), str_utf8 (ABDAY_1)); + TEST_COMPARE_STRING (str (ABDAY_2), str_utf8 (ABDAY_2)); + TEST_COMPARE_STRING (str (ABDAY_3), str_utf8 (ABDAY_3)); + TEST_COMPARE_STRING (str (ABDAY_4), str_utf8 (ABDAY_4)); + TEST_COMPARE_STRING (str (ABDAY_5), str_utf8 (ABDAY_5)); + TEST_COMPARE_STRING (str (ABDAY_6), str_utf8 (ABDAY_6)); + TEST_COMPARE_STRING (str (ABDAY_7), str_utf8 (ABDAY_7)); + + TEST_COMPARE_STRING (str (DAY_1), str_utf8 (DAY_1)); + TEST_COMPARE_STRING (str (DAY_2), str_utf8 (DAY_2)); + TEST_COMPARE_STRING (str (DAY_3), str_utf8 (DAY_3)); + TEST_COMPARE_STRING (str (DAY_4), str_utf8 (DAY_4)); + TEST_COMPARE_STRING (str (DAY_5), str_utf8 (DAY_5)); + TEST_COMPARE_STRING (str (DAY_6), str_utf8 (DAY_6)); + TEST_COMPARE_STRING (str (DAY_7), str_utf8 (DAY_7)); + + TEST_COMPARE_STRING (str (ABMON_1), str_utf8 (ABMON_1)); + TEST_COMPARE_STRING (str (ABMON_2), str_utf8 (ABMON_2)); + TEST_COMPARE_STRING (str (ABMON_3), str_utf8 (ABMON_3)); + TEST_COMPARE_STRING (str (ABMON_4), str_utf8 (ABMON_4)); + TEST_COMPARE_STRING (str (ABMON_5), str_utf8 (ABMON_5)); + TEST_COMPARE_STRING (str (ABMON_6), str_utf8 (ABMON_6)); + TEST_COMPARE_STRING (str (ABMON_7), str_utf8 (ABMON_7)); + TEST_COMPARE_STRING (str (ABMON_8), str_utf8 (ABMON_8)); + TEST_COMPARE_STRING (str (ABMON_9), str_utf8 (ABMON_9)); + TEST_COMPARE_STRING (str (ABMON_10), str_utf8 (ABMON_10)); + TEST_COMPARE_STRING (str (ABMON_11), str_utf8 (ABMON_11)); + TEST_COMPARE_STRING (str (ABMON_12), str_utf8 (ABMON_12)); + + TEST_COMPARE_STRING (str (MON_1), str_utf8 (MON_1)); + TEST_COMPARE_STRING (str (MON_2), str_utf8 (MON_2)); + TEST_COMPARE_STRING (str (MON_3), str_utf8 (MON_3)); + TEST_COMPARE_STRING (str (MON_4), str_utf8 (MON_4)); + TEST_COMPARE_STRING (str (MON_5), str_utf8 (MON_5)); + TEST_COMPARE_STRING (str (MON_6), str_utf8 (MON_6)); + TEST_COMPARE_STRING (str (MON_7), str_utf8 (MON_7)); + TEST_COMPARE_STRING (str (MON_8), str_utf8 (MON_8)); + TEST_COMPARE_STRING (str (MON_9), str_utf8 (MON_9)); + TEST_COMPARE_STRING (str (MON_10), str_utf8 (MON_10)); + TEST_COMPARE_STRING (str (MON_11), str_utf8 (MON_11)); + TEST_COMPARE_STRING (str (MON_12), str_utf8 (MON_12)); + + TEST_COMPARE_STRING (str (AM_STR), str_utf8 (AM_STR)); + TEST_COMPARE_STRING (str (PM_STR), str_utf8 (PM_STR)); + + TEST_COMPARE_STRING (str (D_T_FMT), str_utf8 (D_T_FMT)); + TEST_COMPARE_STRING (str (D_FMT), str_utf8 (D_FMT)); + TEST_COMPARE_STRING (str (T_FMT), str_utf8 (T_FMT)); + TEST_COMPARE_STRING (str (T_FMT_AMPM), + str_utf8 (T_FMT_AMPM)); + + TEST_COMPARE_STRING (str (ERA), str_utf8 (ERA)); + TEST_COMPARE_STRING (str (ERA_YEAR), str_utf8 (ERA_YEAR)); + TEST_COMPARE_STRING (str (ERA_D_FMT), str_utf8 (ERA_D_FMT)); + TEST_COMPARE_STRING (str (ALT_DIGITS), str_utf8 (ALT_DIGITS)); + TEST_COMPARE_STRING (str (ERA_D_T_FMT), str_utf8 (ERA_D_T_FMT)); + TEST_COMPARE_STRING (str (ERA_T_FMT), str_utf8 (ERA_T_FMT)); + TEST_COMPARE (word (_NL_TIME_ERA_NUM_ENTRIES), + word_utf8 (_NL_TIME_ERA_NUM_ENTRIES)); + /* No array elements, so nothing to compare for _NL_TIME_ERA_ENTRIES. */ + TEST_COMPARE (word (_NL_TIME_ERA_NUM_ENTRIES), 0); + + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABDAY_1), wstr_utf8 (_NL_WABDAY_1)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABDAY_2), wstr_utf8 (_NL_WABDAY_2)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABDAY_3), wstr_utf8 (_NL_WABDAY_3)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABDAY_4), wstr_utf8 (_NL_WABDAY_4)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABDAY_5), wstr_utf8 (_NL_WABDAY_5)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABDAY_6), wstr_utf8 (_NL_WABDAY_6)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABDAY_7), wstr_utf8 (_NL_WABDAY_7)); + + TEST_COMPARE_STRING_WIDE (wstr (_NL_WDAY_1), wstr_utf8 (_NL_WDAY_1)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WDAY_2), wstr_utf8 (_NL_WDAY_2)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WDAY_3), wstr_utf8 (_NL_WDAY_3)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WDAY_4), wstr_utf8 (_NL_WDAY_4)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WDAY_5), wstr_utf8 (_NL_WDAY_5)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WDAY_6), wstr_utf8 (_NL_WDAY_6)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WDAY_7), wstr_utf8 (_NL_WDAY_7)); + + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABMON_1), wstr_utf8 (_NL_WABMON_1)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABMON_2), wstr_utf8 (_NL_WABMON_2)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABMON_3), wstr_utf8 (_NL_WABMON_3)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABMON_4), wstr_utf8 (_NL_WABMON_4)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABMON_5), wstr_utf8 (_NL_WABMON_5)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABMON_6), wstr_utf8 (_NL_WABMON_6)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABMON_7), wstr_utf8 (_NL_WABMON_7)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABMON_8), wstr_utf8 (_NL_WABMON_8)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABMON_9), wstr_utf8 (_NL_WABMON_9)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABMON_10), wstr_utf8 (_NL_WABMON_10)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABMON_11), wstr_utf8 (_NL_WABMON_11)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABMON_12), wstr_utf8 (_NL_WABMON_12)); + + TEST_COMPARE_STRING_WIDE (wstr (_NL_WMON_1), wstr_utf8 (_NL_WMON_1)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WMON_2), wstr_utf8 (_NL_WMON_2)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WMON_3), wstr_utf8 (_NL_WMON_3)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WMON_4), wstr_utf8 (_NL_WMON_4)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WMON_5), wstr_utf8 (_NL_WMON_5)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WMON_6), wstr_utf8 (_NL_WMON_6)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WMON_7), wstr_utf8 (_NL_WMON_7)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WMON_8), wstr_utf8 (_NL_WMON_8)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WMON_9), wstr_utf8 (_NL_WMON_9)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WMON_10), wstr_utf8 (_NL_WMON_10)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WMON_11), wstr_utf8 (_NL_WMON_11)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WMON_12), wstr_utf8 (_NL_WMON_12)); + + TEST_COMPARE_STRING_WIDE (wstr (_NL_WAM_STR), wstr_utf8 (_NL_WAM_STR)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WPM_STR), wstr_utf8 (_NL_WPM_STR)); + + TEST_COMPARE_STRING_WIDE (wstr (_NL_WD_T_FMT), wstr_utf8 (_NL_WD_T_FMT)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WD_FMT), wstr_utf8 (_NL_WD_FMT)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WT_FMT), wstr_utf8 (_NL_WT_FMT)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WT_FMT_AMPM), + wstr_utf8 (_NL_WT_FMT_AMPM)); + + TEST_COMPARE_STRING_WIDE (wstr (_NL_WERA_YEAR), wstr_utf8 (_NL_WERA_YEAR)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WERA_D_FMT), wstr_utf8 (_NL_WERA_D_FMT)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WALT_DIGITS), + wstr_utf8 (_NL_WALT_DIGITS)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WERA_D_T_FMT), + wstr_utf8 (_NL_WERA_D_T_FMT)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WERA_T_FMT), wstr_utf8 (_NL_WERA_T_FMT)); + + /* This is somewhat inconsistent, but see locale/categories.def. */ + TEST_COMPARE (byte (_NL_TIME_WEEK_NDAYS), byte_utf8 (_NL_TIME_WEEK_NDAYS)); + TEST_COMPARE (word (_NL_TIME_WEEK_1STDAY), + word_utf8 (_NL_TIME_WEEK_1STDAY)); + TEST_COMPARE (byte (_NL_TIME_WEEK_1STWEEK), + byte_utf8 (_NL_TIME_WEEK_1STWEEK)); + TEST_COMPARE (byte (_NL_TIME_FIRST_WEEKDAY), + byte_utf8 (_NL_TIME_FIRST_WEEKDAY)); + TEST_COMPARE (byte (_NL_TIME_FIRST_WORKDAY), + byte_utf8 (_NL_TIME_FIRST_WORKDAY)); + TEST_COMPARE (byte (_NL_TIME_CAL_DIRECTION), + byte_utf8 (_NL_TIME_CAL_DIRECTION)); + TEST_COMPARE_STRING (str (_NL_TIME_TIMEZONE), str_utf8 (_NL_TIME_TIMEZONE)); + + TEST_COMPARE_STRING (str (_DATE_FMT), str_utf8 (_DATE_FMT)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_W_DATE_FMT), wstr_utf8 (_NL_W_DATE_FMT)); + + /* Expected difference. */ + TEST_COMPARE_STRING (str (_NL_TIME_CODESET), "ANSI_X3.4-1968"); + TEST_COMPARE_STRING (str_utf8 (_NL_TIME_CODESET), "UTF-8"); + + TEST_COMPARE_STRING (str (ALTMON_1), str_utf8 (ALTMON_1)); + TEST_COMPARE_STRING (str (ALTMON_2), str_utf8 (ALTMON_2)); + TEST_COMPARE_STRING (str (ALTMON_3), str_utf8 (ALTMON_3)); + TEST_COMPARE_STRING (str (ALTMON_4), str_utf8 (ALTMON_4)); + TEST_COMPARE_STRING (str (ALTMON_5), str_utf8 (ALTMON_5)); + TEST_COMPARE_STRING (str (ALTMON_6), str_utf8 (ALTMON_6)); + TEST_COMPARE_STRING (str (ALTMON_7), str_utf8 (ALTMON_7)); + TEST_COMPARE_STRING (str (ALTMON_8), str_utf8 (ALTMON_8)); + TEST_COMPARE_STRING (str (ALTMON_9), str_utf8 (ALTMON_9)); + TEST_COMPARE_STRING (str (ALTMON_10), str_utf8 (ALTMON_10)); + TEST_COMPARE_STRING (str (ALTMON_11), str_utf8 (ALTMON_11)); + TEST_COMPARE_STRING (str (ALTMON_12), str_utf8 (ALTMON_12)); + + TEST_COMPARE_STRING_WIDE (wstr (_NL_WALTMON_1), wstr_utf8 (_NL_WALTMON_1)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WALTMON_2), wstr_utf8 (_NL_WALTMON_2)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WALTMON_3), wstr_utf8 (_NL_WALTMON_3)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WALTMON_4), wstr_utf8 (_NL_WALTMON_4)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WALTMON_5), wstr_utf8 (_NL_WALTMON_5)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WALTMON_6), wstr_utf8 (_NL_WALTMON_6)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WALTMON_7), wstr_utf8 (_NL_WALTMON_7)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WALTMON_8), wstr_utf8 (_NL_WALTMON_8)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WALTMON_9), wstr_utf8 (_NL_WALTMON_9)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WALTMON_10), wstr_utf8 (_NL_WALTMON_10)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WALTMON_11), wstr_utf8 (_NL_WALTMON_11)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WALTMON_12), wstr_utf8 (_NL_WALTMON_12)); + + TEST_COMPARE_STRING (str (_NL_ABALTMON_1), str_utf8 (_NL_ABALTMON_1)); + TEST_COMPARE_STRING (str (_NL_ABALTMON_2), str_utf8 (_NL_ABALTMON_2)); + TEST_COMPARE_STRING (str (_NL_ABALTMON_3), str_utf8 (_NL_ABALTMON_3)); + TEST_COMPARE_STRING (str (_NL_ABALTMON_4), str_utf8 (_NL_ABALTMON_4)); + TEST_COMPARE_STRING (str (_NL_ABALTMON_5), str_utf8 (_NL_ABALTMON_5)); + TEST_COMPARE_STRING (str (_NL_ABALTMON_6), str_utf8 (_NL_ABALTMON_6)); + TEST_COMPARE_STRING (str (_NL_ABALTMON_7), str_utf8 (_NL_ABALTMON_7)); + TEST_COMPARE_STRING (str (_NL_ABALTMON_8), str_utf8 (_NL_ABALTMON_8)); + TEST_COMPARE_STRING (str (_NL_ABALTMON_9), str_utf8 (_NL_ABALTMON_9)); + TEST_COMPARE_STRING (str (_NL_ABALTMON_10), str_utf8 (_NL_ABALTMON_10)); + TEST_COMPARE_STRING (str (_NL_ABALTMON_11), str_utf8 (_NL_ABALTMON_11)); + TEST_COMPARE_STRING (str (_NL_ABALTMON_12), str_utf8 (_NL_ABALTMON_12)); + + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABALTMON_1), + wstr_utf8 (_NL_WABALTMON_1)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABALTMON_2), + wstr_utf8 (_NL_WABALTMON_2)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABALTMON_3), + wstr_utf8 (_NL_WABALTMON_3)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABALTMON_4), + wstr_utf8 (_NL_WABALTMON_4)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABALTMON_5), + wstr_utf8 (_NL_WABALTMON_5)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABALTMON_6), + wstr_utf8 (_NL_WABALTMON_6)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABALTMON_7), + wstr_utf8 (_NL_WABALTMON_7)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABALTMON_8), + wstr_utf8 (_NL_WABALTMON_8)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABALTMON_9), + wstr_utf8 (_NL_WABALTMON_9)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABALTMON_10), + wstr_utf8 (_NL_WABALTMON_10)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABALTMON_11), + wstr_utf8 (_NL_WABALTMON_11)); + TEST_COMPARE_STRING_WIDE (wstr (_NL_WABALTMON_12), + wstr_utf8 (_NL_WABALTMON_12)); + + /* LC_COLLATE. Mostly untested, only expected differences. */ + TEST_COMPARE_STRING (str (_NL_COLLATE_CODESET), "ANSI_X3.4-1968"); + TEST_COMPARE_STRING (str_utf8 (_NL_COLLATE_CODESET), "UTF-8"); + + /* LC_CTYPE. Mostly untested, only expected differences. */ + TEST_COMPARE_STRING (str (CODESET), "ANSI_X3.4-1968"); + TEST_COMPARE_STRING (str_utf8 (CODESET), "UTF-8"); + + /* LC_MONETARY. */ + TEST_COMPARE_STRING (str (INT_CURR_SYMBOL), str_utf8 (INT_CURR_SYMBOL)); + TEST_COMPARE_STRING (str (CURRENCY_SYMBOL), str_utf8 (CURRENCY_SYMBOL)); + TEST_COMPARE_STRING (str (MON_DECIMAL_POINT), str_utf8 (MON_DECIMAL_POINT)); + TEST_COMPARE_STRING (str (MON_THOUSANDS_SEP), str_utf8 (MON_THOUSANDS_SEP)); + TEST_COMPARE_STRING (str (MON_GROUPING), str_utf8 (MON_GROUPING)); + TEST_COMPARE_STRING (str (POSITIVE_SIGN), str_utf8 (POSITIVE_SIGN)); + TEST_COMPARE_STRING (str (NEGATIVE_SIGN), str_utf8 (NEGATIVE_SIGN)); + TEST_COMPARE (byte (INT_FRAC_DIGITS), byte_utf8 (INT_FRAC_DIGITS)); + TEST_COMPARE (byte (FRAC_DIGITS), byte_utf8 (FRAC_DIGITS)); + TEST_COMPARE (byte (P_CS_PRECEDES), byte_utf8 (P_CS_PRECEDES)); + TEST_COMPARE (byte (P_SEP_BY_SPACE), byte_utf8 (P_SEP_BY_SPACE)); + TEST_COMPARE (byte (N_CS_PRECEDES), byte_utf8 (N_CS_PRECEDES)); + TEST_COMPARE (byte (N_SEP_BY_SPACE), byte_utf8 (N_SEP_BY_SPACE)); + TEST_COMPARE (byte (P_SIGN_POSN), byte_utf8 (P_SIGN_POSN)); + TEST_COMPARE (byte (N_SIGN_POSN), byte_utf8 (N_SIGN_POSN)); + TEST_COMPARE_STRING (str (CRNCYSTR), str_utf8 (CRNCYSTR)); + TEST_COMPARE (byte (INT_P_CS_PRECEDES), byte_utf8 (INT_P_CS_PRECEDES)); + TEST_COMPARE (byte (INT_P_SEP_BY_SPACE), byte_utf8 (INT_P_SEP_BY_SPACE)); + TEST_COMPARE (byte (INT_N_CS_PRECEDES), byte_utf8 (INT_N_CS_PRECEDES)); + TEST_COMPARE (byte (INT_N_SEP_BY_SPACE), byte_utf8 (INT_N_SEP_BY_SPACE)); + TEST_COMPARE (byte (INT_P_SIGN_POSN), byte_utf8 (INT_P_SIGN_POSN)); + TEST_COMPARE (byte (INT_N_SIGN_POSN), byte_utf8 (INT_N_SIGN_POSN)); + TEST_COMPARE_STRING (str (_NL_MONETARY_DUO_INT_CURR_SYMBOL), + str_utf8 (_NL_MONETARY_DUO_INT_CURR_SYMBOL)); + TEST_COMPARE_STRING (str (_NL_MONETARY_DUO_CURRENCY_SYMBOL), + str_utf8 (_NL_MONETARY_DUO_CURRENCY_SYMBOL)); + TEST_COMPARE (byte (_NL_MONETARY_DUO_INT_FRAC_DIGITS), + byte_utf8 (_NL_MONETARY_DUO_INT_FRAC_DIGITS)); + TEST_COMPARE (byte (_NL_MONETARY_DUO_FRAC_DIGITS), + byte_utf8 (_NL_MONETARY_DUO_FRAC_DIGITS)); + TEST_COMPARE (byte (_NL_MONETARY_DUO_P_CS_PRECEDES), + byte_utf8 (_NL_MONETARY_DUO_P_CS_PRECEDES)); + TEST_COMPARE (byte (_NL_MONETARY_DUO_P_SEP_BY_SPACE), + byte_utf8 (_NL_MONETARY_DUO_P_SEP_BY_SPACE)); + TEST_COMPARE (byte (_NL_MONETARY_DUO_N_CS_PRECEDES), + byte_utf8 (_NL_MONETARY_DUO_N_CS_PRECEDES)); + TEST_COMPARE (byte (_NL_MONETARY_DUO_N_SEP_BY_SPACE), + byte_utf8 (_NL_MONETARY_DUO_N_SEP_BY_SPACE)); + TEST_COMPARE (byte (_NL_MONETARY_DUO_INT_P_CS_PRECEDES), + byte_utf8 (_NL_MONETARY_DUO_INT_P_CS_PRECEDES)); + TEST_COMPARE (byte (_NL_MONETARY_DUO_INT_P_SEP_BY_SPACE), + byte_utf8 (_NL_MONETARY_DUO_INT_P_SEP_BY_SPACE)); + TEST_COMPARE (byte (_NL_MONETARY_DUO_INT_N_CS_PRECEDES), + byte_utf8 (_NL_MONETARY_DUO_INT_N_CS_PRECEDES)); + TEST_COMPARE (byte (_NL_MONETARY_DUO_INT_N_SEP_BY_SPACE), + byte_utf8 (_NL_MONETARY_DUO_INT_N_SEP_BY_SPACE)); + TEST_COMPARE (byte (_NL_MONETARY_DUO_INT_P_SIGN_POSN), + byte_utf8 (_NL_MONETARY_DUO_INT_P_SIGN_POSN)); + TEST_COMPARE (byte (_NL_MONETARY_DUO_INT_N_SIGN_POSN), + byte_utf8 (_NL_MONETARY_DUO_INT_N_SIGN_POSN)); + TEST_COMPARE (byte (_NL_MONETARY_DUO_P_SIGN_POSN), + byte_utf8 (_NL_MONETARY_DUO_P_SIGN_POSN)); + TEST_COMPARE (byte (_NL_MONETARY_DUO_N_SIGN_POSN), + byte_utf8 (_NL_MONETARY_DUO_N_SIGN_POSN)); + TEST_COMPARE (byte (_NL_MONETARY_DUO_INT_P_SIGN_POSN), + byte_utf8 (_NL_MONETARY_DUO_INT_P_SIGN_POSN)); + TEST_COMPARE (byte (_NL_MONETARY_DUO_INT_N_SIGN_POSN), + byte_utf8 (_NL_MONETARY_DUO_INT_N_SIGN_POSN)); + TEST_COMPARE (word (_NL_MONETARY_UNO_VALID_FROM), + word_utf8 (_NL_MONETARY_UNO_VALID_FROM)); + TEST_COMPARE (word (_NL_MONETARY_UNO_VALID_TO), + word_utf8 (_NL_MONETARY_UNO_VALID_TO)); + TEST_COMPARE (word (_NL_MONETARY_DUO_VALID_FROM), + word_utf8 (_NL_MONETARY_DUO_VALID_FROM)); + TEST_COMPARE (word (_NL_MONETARY_DUO_VALID_TO), + word_utf8 (_NL_MONETARY_DUO_VALID_TO)); + /* _NL_MONETARY_CONVERSION_RATE cannot be tested (word array). */ + TEST_COMPARE (word (_NL_MONETARY_DECIMAL_POINT_WC), + word_utf8 (_NL_MONETARY_DECIMAL_POINT_WC)); + TEST_COMPARE (word (_NL_MONETARY_THOUSANDS_SEP_WC), + word_utf8 (_NL_MONETARY_THOUSANDS_SEP_WC)); + /* Expected difference. */ + TEST_COMPARE_STRING (str (_NL_MONETARY_CODESET), "ANSI_X3.4-1968"); + TEST_COMPARE_STRING (str_utf8 (_NL_MONETARY_CODESET), "UTF-8"); + + /* LC_NUMERIC. */ + + TEST_COMPARE_STRING (str (DECIMAL_POINT), str_utf8 (DECIMAL_POINT)); + TEST_COMPARE_STRING (str (RADIXCHAR), str_utf8 (RADIXCHAR)); + TEST_COMPARE_STRING (str (THOUSANDS_SEP), str_utf8 (THOUSANDS_SEP)); + TEST_COMPARE_STRING (str (THOUSEP), str_utf8 (THOUSEP)); + TEST_COMPARE_STRING (str (GROUPING), str_utf8 (GROUPING)); + TEST_COMPARE (word (_NL_NUMERIC_DECIMAL_POINT_WC), + word_utf8 (_NL_NUMERIC_DECIMAL_POINT_WC)); + TEST_COMPARE (word (_NL_NUMERIC_THOUSANDS_SEP_WC), + word_utf8 (_NL_NUMERIC_THOUSANDS_SEP_WC)); + /* Expected difference. */ + TEST_COMPARE_STRING (str (_NL_NUMERIC_CODESET), "ANSI_X3.4-1968"); + TEST_COMPARE_STRING (str_utf8 (_NL_NUMERIC_CODESET), "UTF-8"); + + /* LC_MESSAGES. */ + + TEST_COMPARE_STRING (str (YESEXPR), str_utf8 (YESEXPR)); + TEST_COMPARE_STRING (str (NOEXPR), str_utf8 (NOEXPR)); + TEST_COMPARE_STRING (str (YESSTR), str_utf8 (YESSTR)); + TEST_COMPARE_STRING (str (NOSTR), str_utf8 (NOSTR)); + /* Expected difference. */ + TEST_COMPARE_STRING (str (_NL_MESSAGES_CODESET), "ANSI_X3.4-1968"); + TEST_COMPARE_STRING (str_utf8 (_NL_MESSAGES_CODESET), "UTF-8"); + + /* LC_PAPER. */ + + TEST_COMPARE (word (_NL_PAPER_HEIGHT), word_utf8 (_NL_PAPER_HEIGHT)); + TEST_COMPARE (word (_NL_PAPER_WIDTH), word_utf8 (_NL_PAPER_WIDTH)); + /* Expected difference. */ + TEST_COMPARE_STRING (str (_NL_PAPER_CODESET), "ANSI_X3.4-1968"); + TEST_COMPARE_STRING (str_utf8 (_NL_PAPER_CODESET), "UTF-8"); + + /* LC_NAME. */ + + TEST_COMPARE_STRING (str (_NL_NAME_NAME_FMT), + str_utf8 (_NL_NAME_NAME_FMT)); + TEST_COMPARE_STRING (str (_NL_NAME_NAME_GEN), + str_utf8 (_NL_NAME_NAME_GEN)); + TEST_COMPARE_STRING (str (_NL_NAME_NAME_MR), + str_utf8 (_NL_NAME_NAME_MR)); + TEST_COMPARE_STRING (str (_NL_NAME_NAME_MRS), + str_utf8 (_NL_NAME_NAME_MRS)); + TEST_COMPARE_STRING (str (_NL_NAME_NAME_MISS), + str_utf8 (_NL_NAME_NAME_MISS)); + TEST_COMPARE_STRING (str (_NL_NAME_NAME_MS), + str_utf8 (_NL_NAME_NAME_MS)); + /* Expected difference. */ + TEST_COMPARE_STRING (str (_NL_NAME_CODESET), "ANSI_X3.4-1968"); + TEST_COMPARE_STRING (str_utf8 (_NL_NAME_CODESET), "UTF-8"); + + /* LC_ADDRESS. */ + + TEST_COMPARE_STRING (str (_NL_ADDRESS_POSTAL_FMT), + str_utf8 (_NL_ADDRESS_POSTAL_FMT)); + TEST_COMPARE_STRING (str (_NL_ADDRESS_COUNTRY_NAME), + str_utf8 (_NL_ADDRESS_COUNTRY_NAME)); + TEST_COMPARE_STRING (str (_NL_ADDRESS_COUNTRY_POST), + str_utf8 (_NL_ADDRESS_COUNTRY_POST)); + TEST_COMPARE_STRING (str (_NL_ADDRESS_COUNTRY_AB2), + str_utf8 (_NL_ADDRESS_COUNTRY_AB2)); + TEST_COMPARE_STRING (str (_NL_ADDRESS_COUNTRY_AB3), + str_utf8 (_NL_ADDRESS_COUNTRY_AB3)); + TEST_COMPARE_STRING (str (_NL_ADDRESS_COUNTRY_CAR), + str_utf8 (_NL_ADDRESS_COUNTRY_CAR)); + TEST_COMPARE (word (_NL_ADDRESS_COUNTRY_NUM), + word_utf8 (_NL_ADDRESS_COUNTRY_NUM)); + TEST_COMPARE_STRING (str (_NL_ADDRESS_COUNTRY_ISBN), + str_utf8 (_NL_ADDRESS_COUNTRY_ISBN)); + TEST_COMPARE_STRING (str (_NL_ADDRESS_LANG_NAME), + str_utf8 (_NL_ADDRESS_LANG_NAME)); + TEST_COMPARE_STRING (str (_NL_ADDRESS_LANG_AB), + str_utf8 (_NL_ADDRESS_LANG_AB)); + TEST_COMPARE_STRING (str (_NL_ADDRESS_LANG_TERM), + str_utf8 (_NL_ADDRESS_LANG_TERM)); + TEST_COMPARE_STRING (str (_NL_ADDRESS_LANG_LIB), + str_utf8 (_NL_ADDRESS_LANG_LIB)); + /* Expected difference. */ + TEST_COMPARE_STRING (str (_NL_ADDRESS_CODESET), "ANSI_X3.4-1968"); + TEST_COMPARE_STRING (str_utf8 (_NL_ADDRESS_CODESET), "UTF-8"); + + /* LC_TELEPHONE. */ + + TEST_COMPARE_STRING (str (_NL_TELEPHONE_TEL_INT_FMT), + str_utf8 (_NL_TELEPHONE_TEL_INT_FMT)); + TEST_COMPARE_STRING (str (_NL_TELEPHONE_TEL_DOM_FMT), + str_utf8 (_NL_TELEPHONE_TEL_DOM_FMT)); + TEST_COMPARE_STRING (str (_NL_TELEPHONE_INT_SELECT), + str_utf8 (_NL_TELEPHONE_INT_SELECT)); + TEST_COMPARE_STRING (str (_NL_TELEPHONE_INT_PREFIX), + str_utf8 (_NL_TELEPHONE_INT_PREFIX)); + /* Expected difference. */ + TEST_COMPARE_STRING (str (_NL_TELEPHONE_CODESET), "ANSI_X3.4-1968"); + TEST_COMPARE_STRING (str_utf8 (_NL_TELEPHONE_CODESET), "UTF-8"); + + /* LC_MEASUREMENT. */ + + TEST_COMPARE (byte (_NL_MEASUREMENT_MEASUREMENT), + byte_utf8 (_NL_MEASUREMENT_MEASUREMENT)); + /* Expected difference. */ + TEST_COMPARE_STRING (str (_NL_MEASUREMENT_CODESET), "ANSI_X3.4-1968"); + TEST_COMPARE_STRING (str_utf8 (_NL_MEASUREMENT_CODESET), "UTF-8"); + + /* LC_IDENTIFICATION is skipped since C.UTF-8 is distinct from C. */ + + /* _NL_IDENTIFICATION_CATEGORY cannot be tested because it is a + string array. */ + /* Expected difference. */ + TEST_COMPARE_STRING (str (_NL_IDENTIFICATION_CODESET), "ANSI_X3.4-1968"); + TEST_COMPARE_STRING (str_utf8 (_NL_IDENTIFICATION_CODESET), "UTF-8"); +} + +static int +do_test (void) +{ + puts ("info: using setlocale and nl_langinfo"); + one_pass (); + + puts ("info: using nl_langinfo_l"); + + c_utf8 = newlocale (LC_ALL_MASK, "C.UTF-8", (locale_t) 0); + TEST_VERIFY_EXIT (c_utf8 != (locale_t) 0); + + switch_to_c (); + use_nl_langinfo_l = true; + one_pass (); + + freelocale (c_utf8); + + return 0; +} + +#include