diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-12-05 09:51:08 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-12-05 09:51:08 +0000 |
commit | dd17514ce7a10d785b977586224d31563888cb9d (patch) | |
tree | f57c103834b1701ecae9c96ac5bdb78b5a6b9c25 /localedata | |
parent | 6c805a2b9def1eb11a5db00b8184fb57a1e4d561 (diff) | |
download | glibc-dd17514ce7a10d785b977586224d31563888cb9d.zip glibc-dd17514ce7a10d785b977586224d31563888cb9d.tar.gz glibc-dd17514ce7a10d785b977586224d31563888cb9d.tar.bz2 |
Update.
2003-11-30 Petter Reinholdtsen <pere@hungry.com>
* stdlib/strfmon.c: Correct formatting of international currency
values. The international currency formatting should prefer the
int_* values if they are set for a locale, and use the domestic
values if the int_* values are unset.
Diffstat (limited to 'localedata')
21 files changed, 245 insertions, 6 deletions
diff --git a/localedata/ChangeLog b/localedata/ChangeLog index 1b4802c..62c79ff 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,35 @@ +2003-11-30 Petter Reinholdtsen <pere@hungry.com> + + * tst-fmon.sh: Allow quotes around the result string, to make it + easier to see important whitespace. + * tst-fmon.data: Likewise. + + * tst-fmon.sh: Clean up output, unify capitalization and output order. + * tst-fmon.c: Likewise. + + * tst-fmon.data: Add test for international currency formatting. + * tst-fmon-locales/tstfmon_n01y12: Add definitions for int_* fields. + * tst-fmon-locales/tstfmon_n02n40: Likewise. + * tst-fmon-locales/tstfmon_n10y31: Likewise. + * tst-fmon-locales/tstfmon_n11y41: Likewise. + * tst-fmon-locales/tstfmon_n12y11: Likewise. + * tst-fmon-locales/tstfmon_n20n32: Likewise. + * tst-fmon-locales/tstfmon_n30y20: Likewise. + * tst-fmon-locales/tstfmon_n41n00: Likewise. + * tst-fmon-locales/tstfmon_y01y10: Likewise. + * tst-fmon-locales/tstfmon_y02n22: Likewise. + * tst-fmon-locales/tstfmon_y22n42: Likewise. + * tst-fmon-locales/tstfmon_y30y21: Likewise. + * tst-fmon-locales/tstfmon_y32n31: Likewise. + * tst-fmon-locales/tstfmon_y40y00: Likewise. + * tst-fmon-locales/tstfmon_y42n21: Likewise. + + * locales/en_US: Correct spacing for international + currency formatting, now that strfmon() works better. + + * locales/ja_JP: Correct currency position and + spacing now that strfmon() work better. + 2003-12-03 Ulrich Drepper <drepper@redhat.com> * locales/af_ZA: Add ISO 3166 information. diff --git a/localedata/locales/en_US b/localedata/locales/en_US index 13a19db..1da3158 100644 --- a/localedata/locales/en_US +++ b/localedata/locales/en_US @@ -52,8 +52,10 @@ negative_sign "<U002D>" int_frac_digits 2 frac_digits 2 p_cs_precedes 1 +int_p_sep_by_space 1 p_sep_by_space 0 n_cs_precedes 1 +int_n_sep_by_space 1 n_sep_by_space 0 p_sign_posn 1 n_sign_posn 1 diff --git a/localedata/locales/ja_JP b/localedata/locales/ja_JP index 1e4b1c1..6a3229f 100644 --- a/localedata/locales/ja_JP +++ b/localedata/locales/ja_JP @@ -14894,8 +14894,10 @@ p_cs_precedes 1 p_sep_by_space 0 n_cs_precedes 1 n_sep_by_space 0 -p_sign_posn 1 +p_sign_posn 4 n_sign_posn 4 +int_p_sep_by_space 2 +int_n_sep_by_space 2 END LC_MONETARY diff --git a/localedata/tst-fmon-locales/tstfmon_n01y12 b/localedata/tst-fmon-locales/tstfmon_n01y12 index 975c5ec..499a1ea 100644 --- a/localedata/tst-fmon-locales/tstfmon_n01y12 +++ b/localedata/tst-fmon-locales/tstfmon_n01y12 @@ -23,4 +23,10 @@ p_sep_by_space 1 n_cs_precedes 1 n_sign_posn 1 n_sep_by_space 2 +int_p_cs_precedes 0 +int_p_sign_posn 0 +int_p_sep_by_space 1 +int_n_cs_precedes 1 +int_n_sign_posn 1 +int_n_sep_by_space 2 END LC_MONETARY diff --git a/localedata/tst-fmon-locales/tstfmon_n02n40 b/localedata/tst-fmon-locales/tstfmon_n02n40 index 7c41612..ad6ee6b 100644 --- a/localedata/tst-fmon-locales/tstfmon_n02n40 +++ b/localedata/tst-fmon-locales/tstfmon_n02n40 @@ -23,4 +23,10 @@ p_sep_by_space 2 n_cs_precedes 0 n_sign_posn 4 n_sep_by_space 0 +int_p_cs_precedes 0 +int_p_sign_posn 0 +int_p_sep_by_space 2 +int_n_cs_precedes 0 +int_n_sign_posn 4 +int_n_sep_by_space 0 END LC_MONETARY diff --git a/localedata/tst-fmon-locales/tstfmon_n10y31 b/localedata/tst-fmon-locales/tstfmon_n10y31 index 5e14d7d..e325832 100644 --- a/localedata/tst-fmon-locales/tstfmon_n10y31 +++ b/localedata/tst-fmon-locales/tstfmon_n10y31 @@ -23,4 +23,10 @@ p_sep_by_space 0 n_cs_precedes 1 n_sign_posn 3 n_sep_by_space 1 +int_p_cs_precedes 0 +int_p_sign_posn 1 +int_p_sep_by_space 0 +int_n_cs_precedes 1 +int_n_sign_posn 3 +int_n_sep_by_space 1 END LC_MONETARY diff --git a/localedata/tst-fmon-locales/tstfmon_n11y41 b/localedata/tst-fmon-locales/tstfmon_n11y41 index 22685cb..497f750 100644 --- a/localedata/tst-fmon-locales/tstfmon_n11y41 +++ b/localedata/tst-fmon-locales/tstfmon_n11y41 @@ -23,4 +23,10 @@ p_sep_by_space 1 n_cs_precedes 1 n_sign_posn 4 n_sep_by_space 1 +int_p_cs_precedes 0 +int_p_sign_posn 1 +int_p_sep_by_space 1 +int_n_cs_precedes 1 +int_n_sign_posn 4 +int_n_sep_by_space 1 END LC_MONETARY diff --git a/localedata/tst-fmon-locales/tstfmon_n12y11 b/localedata/tst-fmon-locales/tstfmon_n12y11 index 0788bab..d964101 100644 --- a/localedata/tst-fmon-locales/tstfmon_n12y11 +++ b/localedata/tst-fmon-locales/tstfmon_n12y11 @@ -23,4 +23,10 @@ p_sep_by_space 2 n_cs_precedes 1 n_sign_posn 1 n_sep_by_space 1 +int_p_cs_precedes 0 +int_p_sign_posn 1 +int_p_sep_by_space 2 +int_n_cs_precedes 1 +int_n_sign_posn 1 +int_n_sep_by_space 1 END LC_MONETARY diff --git a/localedata/tst-fmon-locales/tstfmon_n20n32 b/localedata/tst-fmon-locales/tstfmon_n20n32 index 2c219e9..9441280 100644 --- a/localedata/tst-fmon-locales/tstfmon_n20n32 +++ b/localedata/tst-fmon-locales/tstfmon_n20n32 @@ -23,4 +23,10 @@ p_sep_by_space 0 n_cs_precedes 0 n_sign_posn 3 n_sep_by_space 2 +int_p_cs_precedes 0 +int_p_sign_posn 2 +int_p_sep_by_space 0 +int_n_cs_precedes 0 +int_n_sign_posn 3 +int_n_sep_by_space 2 END LC_MONETARY diff --git a/localedata/tst-fmon-locales/tstfmon_n30y20 b/localedata/tst-fmon-locales/tstfmon_n30y20 index c3216b4..2c8a9ea 100644 --- a/localedata/tst-fmon-locales/tstfmon_n30y20 +++ b/localedata/tst-fmon-locales/tstfmon_n30y20 @@ -23,4 +23,10 @@ p_sep_by_space 0 n_cs_precedes 1 n_sign_posn 2 n_sep_by_space 0 +int_p_cs_precedes 0 +int_p_sign_posn 3 +int_p_sep_by_space 0 +int_n_cs_precedes 1 +int_n_sign_posn 2 +int_n_sep_by_space 0 END LC_MONETARY diff --git a/localedata/tst-fmon-locales/tstfmon_n41n00 b/localedata/tst-fmon-locales/tstfmon_n41n00 index 199cd54..56879ec 100644 --- a/localedata/tst-fmon-locales/tstfmon_n41n00 +++ b/localedata/tst-fmon-locales/tstfmon_n41n00 @@ -23,4 +23,10 @@ p_sep_by_space 1 n_cs_precedes 0 n_sign_posn 0 n_sep_by_space 0 +int_p_cs_precedes 0 +int_p_sign_posn 4 +int_p_sep_by_space 1 +int_n_cs_precedes 0 +int_n_sign_posn 0 +int_n_sep_by_space 0 END LC_MONETARY diff --git a/localedata/tst-fmon-locales/tstfmon_y01y10 b/localedata/tst-fmon-locales/tstfmon_y01y10 index 1e26360..7c0b22a 100644 --- a/localedata/tst-fmon-locales/tstfmon_y01y10 +++ b/localedata/tst-fmon-locales/tstfmon_y01y10 @@ -23,4 +23,10 @@ p_sep_by_space 1 n_cs_precedes 1 n_sign_posn 1 n_sep_by_space 0 +int_p_cs_precedes 1 +int_p_sign_posn 0 +int_p_sep_by_space 1 +int_n_cs_precedes 1 +int_n_sign_posn 1 +int_n_sep_by_space 0 END LC_MONETARY diff --git a/localedata/tst-fmon-locales/tstfmon_y02n22 b/localedata/tst-fmon-locales/tstfmon_y02n22 index 26c8158..7d9ac30 100644 --- a/localedata/tst-fmon-locales/tstfmon_y02n22 +++ b/localedata/tst-fmon-locales/tstfmon_y02n22 @@ -23,4 +23,10 @@ p_sep_by_space 2 n_cs_precedes 0 n_sign_posn 2 n_sep_by_space 2 +int_p_cs_precedes 1 +int_p_sign_posn 0 +int_p_sep_by_space 2 +int_n_cs_precedes 0 +int_n_sign_posn 2 +int_n_sep_by_space 2 END LC_MONETARY diff --git a/localedata/tst-fmon-locales/tstfmon_y22n42 b/localedata/tst-fmon-locales/tstfmon_y22n42 index 37a2d49..fda413b 100644 --- a/localedata/tst-fmon-locales/tstfmon_y22n42 +++ b/localedata/tst-fmon-locales/tstfmon_y22n42 @@ -23,4 +23,10 @@ p_sep_by_space 2 n_cs_precedes 0 n_sign_posn 4 n_sep_by_space 2 +int_p_cs_precedes 1 +int_p_sign_posn 2 +int_p_sep_by_space 2 +int_n_cs_precedes 0 +int_n_sign_posn 4 +int_n_sep_by_space 2 END LC_MONETARY diff --git a/localedata/tst-fmon-locales/tstfmon_y30y21 b/localedata/tst-fmon-locales/tstfmon_y30y21 index 4b38c42..9dee2cc 100644 --- a/localedata/tst-fmon-locales/tstfmon_y30y21 +++ b/localedata/tst-fmon-locales/tstfmon_y30y21 @@ -23,4 +23,10 @@ p_sep_by_space 0 n_cs_precedes 1 n_sign_posn 2 n_sep_by_space 1 +int_p_cs_precedes 1 +int_p_sign_posn 3 +int_p_sep_by_space 0 +int_n_cs_precedes 1 +int_n_sign_posn 2 +int_n_sep_by_space 1 END LC_MONETARY diff --git a/localedata/tst-fmon-locales/tstfmon_y32n31 b/localedata/tst-fmon-locales/tstfmon_y32n31 index 7c54154..34967c7 100644 --- a/localedata/tst-fmon-locales/tstfmon_y32n31 +++ b/localedata/tst-fmon-locales/tstfmon_y32n31 @@ -23,4 +23,10 @@ p_sep_by_space 2 n_cs_precedes 0 n_sign_posn 3 n_sep_by_space 1 +int_p_cs_precedes 1 +int_p_sign_posn 3 +int_p_sep_by_space 2 +int_n_cs_precedes 0 +int_n_sign_posn 3 +int_n_sep_by_space 1 END LC_MONETARY diff --git a/localedata/tst-fmon-locales/tstfmon_y40y00 b/localedata/tst-fmon-locales/tstfmon_y40y00 index 664b20d..348b07b 100644 --- a/localedata/tst-fmon-locales/tstfmon_y40y00 +++ b/localedata/tst-fmon-locales/tstfmon_y40y00 @@ -23,4 +23,10 @@ p_sep_by_space 0 n_cs_precedes 1 n_sign_posn 0 n_sep_by_space 0 +int_p_cs_precedes 1 +int_p_sign_posn 4 +int_p_sep_by_space 0 +int_n_cs_precedes 1 +int_n_sign_posn 0 +int_n_sep_by_space 0 END LC_MONETARY diff --git a/localedata/tst-fmon-locales/tstfmon_y42n21 b/localedata/tst-fmon-locales/tstfmon_y42n21 index 2a879e4..d2f7e9e 100644 --- a/localedata/tst-fmon-locales/tstfmon_y42n21 +++ b/localedata/tst-fmon-locales/tstfmon_y42n21 @@ -23,4 +23,10 @@ p_sep_by_space 2 n_cs_precedes 0 n_sign_posn 2 n_sep_by_space 1 +int_p_cs_precedes 1 +int_p_sign_posn 4 +int_p_sep_by_space 2 +int_n_cs_precedes 0 +int_n_sign_posn 2 +int_n_sep_by_space 1 END LC_MONETARY diff --git a/localedata/tst-fmon.c b/localedata/tst-fmon.c index 091a057..a45c8ba 100644 --- a/localedata/tst-fmon.c +++ b/localedata/tst-fmon.c @@ -58,8 +58,8 @@ main (int argc, char *argv[]) if (strcmp (s, argv[4]) != 0) { printf ("\ -locale: \"%s\", format: \"%s\", expected: \"%s\", got: \"%s\" => %s\n", - argv[1], argv[2], argv[4], s, +Locale: \"%s\" Format: \"%s\" Value: \"%s\" Recieved: \"%s\" Expected: \"%s\" => %s\n", + argv[1], argv[2], argv[3], s, argv[4], strcmp (s, argv[4]) != 0 ? "false" : "correct"); exit (EXIT_FAILURE); } diff --git a/localedata/tst-fmon.data b/localedata/tst-fmon.data index d67a38f..d7bcb17 100644 --- a/localedata/tst-fmon.data +++ b/localedata/tst-fmon.data @@ -1,5 +1,5 @@ # Test data for test-strfmon, which checks it's implementation in glibc -# Copyright (C) 1996, 1997, 2000, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 2000, 2002, 2003 Free Software Foundation, Inc. # This file is part of the GNU C Library. # Contributed by Jochen Hein <jochen.hein@delphi.central.de>, 1997. # @@ -28,6 +28,8 @@ # #2 format string which is fed into strfmon # #3 double value that is used for formatting # #4 the expected result (may contain trailing spaces!) +# This field might be enclosed with "" to make it easier to see +# the white space # # First the implementation without any locale-dependent data # - no currency symbol is printed, formatting is somewhat standard @@ -236,3 +238,113 @@ tstfmon_y42n21 %11n 123.45 $ +123.45 tstfmon_y42n21 %11n -123.45 123.45 $- tstfmon_y42n21 %^=*#5n 123.45 $ +**123.45 tstfmon_y42n21 %^=*#5n -123.45 **123.45 $- +# +# check all int_cs_precedes/int_sign_posn/int_sep_by_space +# combinations using special test locales. The six characters after +# the "_" indicate these three values for positive and then negative +# quantities. +# +tstfmon_n01y12 %i 123.45 "123.45 USC" +tstfmon_n01y12 %i -123.45 "- USC123.45" +tstfmon_n01y12 %13i 123.45 " 123.45 USC" +tstfmon_n01y12 %13i -123.45 " - USC123.45" +tstfmon_n01y12 %^=*#5i 123.45 " **123.45 USC" +tstfmon_n01y12 %^=*#5i -123.45 "- USC**123.45" +# +tstfmon_n02n40 %i 123.45 "123.45USC" +tstfmon_n02n40 %i -123.45 "123.45USC-" +tstfmon_n02n40 %13i 123.45 " 123.45USC" +tstfmon_n02n40 %13i -123.45 " 123.45USC-" +tstfmon_n02n40 %^=*#5i 123.45 "**123.45USC" +tstfmon_n02n40 %^=*#5i -123.45 "**123.45USC-" +# +tstfmon_n10y31 %i 123.45 "+123.45USC" +tstfmon_n10y31 %i -123.45 "-USC 123.45" +tstfmon_n10y31 %13i 123.45 " +123.45USC" +tstfmon_n10y31 %13i -123.45 " -USC 123.45" +tstfmon_n10y31 %^=*#5i 123.45 " +**123.45USC" +tstfmon_n10y31 %^=*#5i -123.45 "-USC **123.45" +# +tstfmon_n11y41 %i 123.45 "+123.45 USC" +tstfmon_n11y41 %i -123.45 "USC- 123.45" +tstfmon_n11y41 %13i 123.45 " +123.45 USC" +tstfmon_n11y41 %13i -123.45 " USC- 123.45" +tstfmon_n11y41 %^=*#5i 123.45 " +**123.45 USC" +tstfmon_n11y41 %^=*#5i -123.45 "USC- **123.45" +# +tstfmon_n12y11 %i 123.45 "+123.45USC" +tstfmon_n12y11 %i -123.45 "-USC 123.45" +tstfmon_n12y11 %13i 123.45 " +123.45USC" +tstfmon_n12y11 %13i -123.45 " -USC 123.45" +tstfmon_n12y11 %^=*#5i 123.45 " +**123.45USC" +tstfmon_n12y11 %^=*#5i -123.45 "-USC **123.45" +# +tstfmon_n20n32 %i 123.45 "123.45USC+" +tstfmon_n20n32 %i -123.45 "123.45- USC" +tstfmon_n20n32 %13i 123.45 " 123.45USC+" +tstfmon_n20n32 %13i -123.45 " 123.45- USC" +tstfmon_n20n32 %^=*#5i 123.45 "**123.45USC+" +tstfmon_n20n32 %^=*#5i -123.45 "**123.45- USC" +# +tstfmon_n30y20 %i 123.45 "123.45+USC" +tstfmon_n30y20 %i -123.45 "USC123.45-" +tstfmon_n30y20 %13i 123.45 " 123.45+USC" +tstfmon_n30y20 %13i -123.45 " USC123.45-" +tstfmon_n30y20 %^=*#5i 123.45 " **123.45+USC" +tstfmon_n30y20 %^=*#5i -123.45 "USC**123.45-" +# +tstfmon_n41n00 %i 123.45 "123.45 USC+" +tstfmon_n41n00 %i -123.45 "(123.45USC)" +tstfmon_n41n00 %13i 123.45 " 123.45 USC+" +tstfmon_n41n00 %13i -123.45 " (123.45USC)" +tstfmon_n41n00 %^=*#5i 123.45 " **123.45 USC+" +tstfmon_n41n00 %^=*#5i -123.45 "(**123.45USC)" +# +tstfmon_y01y10 %i 123.45 "USC 123.45" +tstfmon_y01y10 %i -123.45 "-USC123.45" +tstfmon_y01y10 %13i 123.45 " USC 123.45" +tstfmon_y01y10 %13i -123.45 " -USC123.45" +tstfmon_y01y10 %^=*#5i 123.45 "USC **123.45" +tstfmon_y01y10 %^=*#5i -123.45 "-USC**123.45" +# +tstfmon_y02n22 %i 123.45 "USC123.45" +tstfmon_y02n22 %i -123.45 "123.45USC O/D" +tstfmon_y02n22 %12i 123.45 " USC123.45" +tstfmon_y02n22 %12i -123.45 "123.45USC O/D" +tstfmon_y02n22 %^=*#5i 123.45 "USC**123.45" +tstfmon_y02n22 %^=*#5i -123.45 " **123.45USC O/D" +# +tstfmon_y22n42 %i 123.45 "USC123.45+" +tstfmon_y22n42 %i -123.45 "123.45USC -" +tstfmon_y22n42 %13i 123.45 " USC123.45+" +tstfmon_y22n42 %13i -123.45 " 123.45USC -" +tstfmon_y22n42 %^=*#5i 123.45 "USC**123.45+" +tstfmon_y22n42 %^=*#5i -123.45 " **123.45USC -" +# +tstfmon_y30y21 %i 123.45 "+USC123.45" +tstfmon_y30y21 %i -123.45 "USC 123.45-" +tstfmon_y30y21 %13i 123.45 " +USC123.45" +tstfmon_y30y21 %13i -123.45 " USC 123.45-" +tstfmon_y30y21 %^=*#5i 123.45 "+USC**123.45" +tstfmon_y30y21 %^=*#5i -123.45 "USC **123.45-" +# +tstfmon_y32n31 %i 123.45 "+ USC123.45" +tstfmon_y32n31 %i -123.45 "123.45 -USC" +tstfmon_y32n31 %13i 123.45 " + USC123.45" +tstfmon_y32n31 %13i -123.45 " 123.45 -USC" +tstfmon_y32n31 %^=*#5i 123.45 "+ USC**123.45" +tstfmon_y32n31 %^=*#5i -123.45 " **123.45 -USC" +# +tstfmon_y40y00 %i 123.45 "USC+123.45" +tstfmon_y40y00 %i -123.45 "(USC123.45)" +tstfmon_y40y00 %13i 123.45 " USC+123.45" +tstfmon_y40y00 %13i -123.45 " (USC123.45)" +tstfmon_y40y00 %^=*#5i 123.45 "USC+**123.45" +tstfmon_y40y00 %^=*#5i -123.45 "(USC**123.45)" +# +tstfmon_y42n21 %i 123.45 "USC +123.45" +tstfmon_y42n21 %i -123.45 "123.45 USC-" +tstfmon_y42n21 %13i 123.45 " USC +123.45" +tstfmon_y42n21 %13i -123.45 " 123.45 USC-" +tstfmon_y42n21 %^=*#5i 123.45 "USC +**123.45" +tstfmon_y42n21 %^=*#5i -123.45 " **123.45 USC-" diff --git a/localedata/tst-fmon.sh b/localedata/tst-fmon.sh index c8b6d69..95dab36 100755 --- a/localedata/tst-fmon.sh +++ b/localedata/tst-fmon.sh @@ -44,16 +44,17 @@ errcode=0 while IFS=" " read locale format value expect; do case "$locale" in '#'*) continue ;; esac if [ -n "$format" ]; then + expect=`echo "$expect" | sed 's/^\"\(.*\)\"$/\1/'` if LOCPATH=${common_objpfx}localedata \ GCONV_PATH=${common_objpfx}/iconvdata \ ${run_program_prefix} ${common_objpfx}localedata/tst-fmon \ "$locale" "$format" "$value" "$expect" ; then echo "Locale: \"${locale}\" Format: \"${format}\"" \ - "Value: \"${value}\" Expect: \"${expect}\" passed" + "Value: \"${value}\" Expected: \"${expect}\" passed" else errcode=$? echo "Locale: \"${locale}\" Format: \"${format}\"" \ - "Value: \"${value}\" Expect: \"${expect}\" failed" + "Value: \"${value}\" Expected: \"${expect}\" failed" fi fi done < $datafile |