Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ulrich Drepper committed Dec 5, 2003
1 parent 6c805a2 commit dd17514
Show file tree
Hide file tree
Showing 23 changed files with 291 additions and 39 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
@@ -1,3 +1,10 @@
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.

2003-12-03 Jakub Jelinek <jakub@redhat.com>

* posix/Makefile (distribute): Add BOOST.tests.
Expand Down
32 changes: 32 additions & 0 deletions 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.
Expand Down
2 changes: 2 additions & 0 deletions localedata/locales/en_US
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion localedata/locales/ja_JP
Expand Up @@ -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


Expand Down
6 changes: 6 additions & 0 deletions localedata/tst-fmon-locales/tstfmon_n01y12
Expand Up @@ -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
6 changes: 6 additions & 0 deletions localedata/tst-fmon-locales/tstfmon_n02n40
Expand Up @@ -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
6 changes: 6 additions & 0 deletions localedata/tst-fmon-locales/tstfmon_n10y31
Expand Up @@ -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
6 changes: 6 additions & 0 deletions localedata/tst-fmon-locales/tstfmon_n11y41
Expand Up @@ -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
6 changes: 6 additions & 0 deletions localedata/tst-fmon-locales/tstfmon_n12y11
Expand Up @@ -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
6 changes: 6 additions & 0 deletions localedata/tst-fmon-locales/tstfmon_n20n32
Expand Up @@ -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
6 changes: 6 additions & 0 deletions localedata/tst-fmon-locales/tstfmon_n30y20
Expand Up @@ -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
6 changes: 6 additions & 0 deletions localedata/tst-fmon-locales/tstfmon_n41n00
Expand Up @@ -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
6 changes: 6 additions & 0 deletions localedata/tst-fmon-locales/tstfmon_y01y10
Expand Up @@ -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
6 changes: 6 additions & 0 deletions localedata/tst-fmon-locales/tstfmon_y02n22
Expand Up @@ -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
6 changes: 6 additions & 0 deletions localedata/tst-fmon-locales/tstfmon_y22n42
Expand Up @@ -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
6 changes: 6 additions & 0 deletions localedata/tst-fmon-locales/tstfmon_y30y21
Expand Up @@ -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
6 changes: 6 additions & 0 deletions localedata/tst-fmon-locales/tstfmon_y32n31
Expand Up @@ -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
6 changes: 6 additions & 0 deletions localedata/tst-fmon-locales/tstfmon_y40y00
Expand Up @@ -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
6 changes: 6 additions & 0 deletions localedata/tst-fmon-locales/tstfmon_y42n21
Expand Up @@ -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
4 changes: 2 additions & 2 deletions localedata/tst-fmon.c
Expand Up @@ -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);
}
Expand Down
114 changes: 113 additions & 1 deletion 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.
#
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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-"
5 changes: 3 additions & 2 deletions localedata/tst-fmon.sh
Expand Up @@ -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
Expand Down

0 comments on commit dd17514

Please sign in to comment.