summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2003-01-21 15:29:19 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2003-01-21 15:29:19 +0000
commit2f14cd7405b3b0b73afda95922ef4ba0bfb9f86f (patch)
treef4f2aaf11fd0dbc7d4377bbbe42e0246fc67170b
parent9105005ad43742d558139723a97e3b41ee9adf06 (diff)
downloadgcc-2f14cd7405b3b0b73afda95922ef4ba0bfb9f86f.tar.gz
2003-01-21 Benjamin Kosnik <bkoz@redhat.com>
Reshuffle 22_locale testsuite. * 22_locale/(codecvt.cc money_get.cc codecvt_members_char_char.cc money_get_members_char.cc codecvt_members_unicode_char.cc money_get_members_wchar_t.cc codecvt_members_unicode_wchar_t.cc moneypunct_byname.cc codecvt_members_wchar_t_char.cc moneypunct.cc collate_byname.cc moneypunct_members_char.cc collate.cc moneypunct_members_wchar_t.cc collate_members_char.cc money_put.cc collate_members_wchar_t.cc money_put_members_char.cc ctor_copy_dtor.cc money_put_members_wchar_t.cc ctype.cc num_get.cc ctype_is_char.cc num_get_members_char.cc ctype_is_wchar_t.cc num_get_members_wchar_t.cc ctype_members_char.cc numpunct_byname.cc ctype_members_wchar_t.cc numpunct.cc ctype_narrow_char.cc numpunct_members_char.cc ctype_narrow_wchar_t.cc numpunct_members_wchar_t.cc ctype_scan_char.cc num_put.cc ctype_scan_wchar_t.cc num_put_members_char.cc ctype_to_char.cc num_put_members_wchar_t.cc ctype_to_wchar_t.cc operators.cc ctype_widen_char.cc static_members.cc ctype_widen_wchar_t.cc time_get.cc facet.cc time_get_members_char.cc global_templates.cc time_get_members_wchar_t.cc, members.cc, time_put.cc, messages_byname.cc, time_put_members_char.cc, messages.cc, time_put_members_wchar_t.cc, messages_members_char.cc): Splint up into individual test cases... * 22_locale/codecvt/1.cc: New. * 22_locale/codecvt/2.cc: New. * 22_locale/codecvt/always_noconv/char/1.cc: New. * 22_locale/codecvt/always_noconv/char/wrapped_env.cc: New. * 22_locale/codecvt/always_noconv/char/wrapped_locale.cc: New. * 22_locale/codecvt/always_noconv/wchar_t/1.cc: New. * 22_locale/codecvt/always_noconv/wchar_t/wrapped_env.cc: New. * 22_locale/codecvt/always_noconv/wchar_t/wrapped_locale.cc: New. * 22_locale/codecvt/encoding/char/1.cc: New. * 22_locale/codecvt/encoding/char/wrapped_env.cc: New. * 22_locale/codecvt/encoding/char/wrapped_locale.cc: New. * 22_locale/codecvt/encoding/wchar_t/1.cc: New. * 22_locale/codecvt/encoding/wchar_t/wrapped_env.cc: New. * 22_locale/codecvt/encoding/wchar_t/wrapped_locale.cc: New. * 22_locale/codecvt/in/char/1.cc: New. * 22_locale/codecvt/in/char/wrapped_env.cc: New. * 22_locale/codecvt/in/char/wrapped_locale.cc: New. * 22_locale/codecvt/in/wchar_t/1.cc: New. * 22_locale/codecvt/in/wchar_t/wrapped_env.cc: New. * 22_locale/codecvt/in/wchar_t/wrapped_locale.cc: New. * 22_locale/codecvt/length/char/1.cc: New. * 22_locale/codecvt/length/char/wrapped_env.cc: New. * 22_locale/codecvt/length/char/wrapped_locale.cc: New. * 22_locale/codecvt/length/wchar_t/1.cc: New. * 22_locale/codecvt/length/wchar_t/wrapped_env.cc: New. * 22_locale/codecvt/length/wchar_t/wrapped_locale.cc: New. * 22_locale/codecvt/max_length/char/1.cc: New. * 22_locale/codecvt/max_length/char/wrapped_env.cc: New. * 22_locale/codecvt/max_length/char/wrapped_locale.cc: New. * 22_locale/codecvt/max_length/wchar_t/1.cc: New. * 22_locale/codecvt/max_length/wchar_t/wrapped_env.cc: New. * 22_locale/codecvt/max_length/wchar_t/wrapped_locale.cc: New. * 22_locale/codecvt/out/char/1.cc: New. * 22_locale/codecvt/out/char/wrapped_env.cc: New. * 22_locale/codecvt/out/char/wrapped_locale.cc: New. * 22_locale/codecvt/out/wchar_t/1.cc: New. * 22_locale/codecvt/out/wchar_t/wrapped_env.cc: New. * 22_locale/codecvt/out/wchar_t/wrapped_locale.cc: New. * 22_locale/codecvt/unicode/char.cc: New. * 22_locale/codecvt/unicode/wchar_t.cc: New. * 22_locale/codecvt/unshift/char/1.cc: New. * 22_locale/codecvt/unshift/char/wrapped_env.cc: New. * 22_locale/codecvt/unshift/char/wrapped_locale.cc: New. * 22_locale/codecvt/unshift/wchar_t/1.cc: New. * 22_locale/codecvt/unshift/wchar_t/wrapped_env.cc: New. * 22_locale/codecvt/unshift/wchar_t/wrapped_locale.cc: New. * 22_locale/collate/1.cc: New. * 22_locale/collate/2.cc: New. * 22_locale/collate/compare/char/1.cc: New. * 22_locale/collate/compare/char/2.cc: New. * 22_locale/collate/compare/char/wrapped_env.cc: New. * 22_locale/collate/compare/char/wrapped_locale.cc: New. * 22_locale/collate/compare/wchar_t/1.cc: New. * 22_locale/collate/compare/wchar_t/2.cc: New. * 22_locale/collate/compare/wchar_t/wrapped_env.cc: New. * 22_locale/collate/compare/wchar_t/wrapped_locale.cc: New. * 22_locale/collate/hash/char/1.cc: New. * 22_locale/collate/hash/char/2.cc: New. * 22_locale/collate/hash/char/wrapped_env.cc: New. * 22_locale/collate/hash/char/wrapped_locale.cc: New. * 22_locale/collate/hash/wchar_t/1.cc: New. * 22_locale/collate/hash/wchar_t/2.cc: New. * 22_locale/collate/hash/wchar_t/wrapped_env.cc: New. * 22_locale/collate/hash/wchar_t/wrapped_locale.cc: New. * 22_locale/collate/transform/char/2.cc: New. * 22_locale/collate/transform/char/wrapped_env.cc: New. * 22_locale/collate/transform/char/wrapped_locale.cc: New. * 22_locale/collate/transform/wchar_t/2.cc: New. * 22_locale/collate/transform/wchar_t/wrapped_env.cc: New. * 22_locale/collate/transform/wchar_t/wrapped_locale.cc: New. * 22_locale/collate_byname/1.cc: New. * 22_locale/ctype/1.cc: New. * 22_locale/ctype/2.cc: New. * 22_locale/ctype/cons/char/1.cc: New. * 22_locale/ctype/cons/char/wrapped_env.cc: New. * 22_locale/ctype/cons/char/wrapped_locale.cc: New. * 22_locale/ctype/is/char/1.cc: New. * 22_locale/ctype/is/char/2.cc: New. * 22_locale/ctype/is/char/3.cc: New. * 22_locale/ctype/is/char/wrapped_env.cc: New. * 22_locale/ctype/is/char/wrapped_locale.cc: New. * 22_locale/ctype/is/wchar_t/1.cc: New. * 22_locale/ctype/is/wchar_t/2.cc: New. * 22_locale/ctype/is/wchar_t/wrapped_env.cc: New. * 22_locale/ctype/is/wchar_t/wrapped_locale.cc: New. * 22_locale/ctype/narrow/char/1.cc: New. * 22_locale/ctype/narrow/char/2.cc: New. * 22_locale/ctype/narrow/char/wrapped_env.cc: New. * 22_locale/ctype/narrow/char/wrapped_locale.cc: New. * 22_locale/ctype/narrow/wchar_t/1.cc: New. * 22_locale/ctype/narrow/wchar_t/2.cc: New. * 22_locale/ctype/narrow/wchar_t/wrapped_env.cc: New. * 22_locale/ctype/narrow/wchar_t/wrapped_locale.cc: New. * 22_locale/ctype/scan/char/1.cc: New. * 22_locale/ctype/scan/char/wrapped_env.cc: New. * 22_locale/ctype/scan/char/wrapped_locale.cc: New. * 22_locale/ctype/scan/wchar_t/1.cc: New. * 22_locale/ctype/scan/wchar_t/wrapped_env.cc: New. * 22_locale/ctype/scan/wchar_t/wrapped_locale.cc: New. * 22_locale/ctype/to/char/1.cc: New. * 22_locale/ctype/to/char/wrapped_env.cc: New. * 22_locale/ctype/to/char/wrapped_locale.cc: New. * 22_locale/ctype/to/wchar_t/1.cc: New. * 22_locale/ctype/to/wchar_t/wrapped_env.cc: New. * 22_locale/ctype/to/wchar_t/wrapped_locale.cc: New. * 22_locale/ctype/widen/char/1.cc: New. * 22_locale/ctype/widen/char/wrapped_env.cc: New. * 22_locale/ctype/widen/char/wrapped_locale.cc: New. * 22_locale/ctype/widen/wchar_t/1.cc: New. * 22_locale/ctype/widen/wchar_t/wrapped_env.cc: New. * 22_locale/ctype/widen/wchar_t/wrapped_locale.cc: New. * 22_locale/facet/1.cc: New. * 22_locale/facet/2.cc: New. * 22_locale/global_templates/1.cc: New. * 22_locale/locale/cons/1.cc: New. * 22_locale/locale/cons/2.cc: New. * 22_locale/locale/cons/3.cc: New. * 22_locale/locale/cons/4.cc: New. * 22_locale/locale/cons/5.cc: New. * 22_locale/locale/cons/6.cc: New. * 22_locale/locale/cons/7.cc: New. * 22_locale/locale/global_locale_objects/1.cc: New. * 22_locale/locale/global_locale_objects/2.cc: New. * 22_locale/locale/global_locale_objects/3.cc: New. * 22_locale/locale/operations/1.cc: New. * 22_locale/locale/operations/2.cc: New. * 22_locale/messages/1.cc: New. * 22_locale/messages/2.cc: New. * 22_locale/messages/members/char/1.cc: New. * 22_locale/messages/members/char/2.cc: New. * 22_locale/messages/members/char/3.cc: New. * 22_locale/messages/members/char/wrapped_env.cc: New. * 22_locale/messages/members/char/wrapped_locale.cc: New. * 22_locale/messages_byname/1.cc: New. * 22_locale/money_get/1.cc: New. * 22_locale/money_get/2.cc: New. * 22_locale/money_get/get/char/1.cc: New. * 22_locale/money_get/get/char/2.cc: New. * 22_locale/money_get/get/char/3.cc: New. * 22_locale/money_get/get/char/4.cc: New. * 22_locale/money_get/get/char/5.cc: New. * 22_locale/money_get/get/char/6.cc: New. * 22_locale/money_get/get/char/7.cc: New. * 22_locale/money_get/get/char/8.cc: New. * 22_locale/money_get/get/char/wrapped_env.cc: New. * 22_locale/money_get/get/char/wrapped_locale.cc: New. * 22_locale/money_get/get/wchar_t/1.cc: New. * 22_locale/money_get/get/wchar_t/2.cc: New. * 22_locale/money_get/get/wchar_t/3.cc: New. * 22_locale/money_get/get/wchar_t/4.cc: New. * 22_locale/money_get/get/wchar_t/5.cc: New. * 22_locale/money_get/get/wchar_t/6.cc: New. * 22_locale/money_get/get/wchar_t/7.cc: New. * 22_locale/money_get/get/wchar_t/8.cc: New. * 22_locale/money_get/get/wchar_t/wrapped_env.cc: New. * 22_locale/money_get/get/wchar_t/wrapped_locale.cc: New. * 22_locale/money_put/1.cc: New. * 22_locale/money_put/2.cc: New. * 22_locale/money_put/put/char/1.cc: New. * 22_locale/money_put/put/char/2.cc: New. * 22_locale/money_put/put/char/3.cc: New. * 22_locale/money_put/put/char/4.cc: New. * 22_locale/money_put/put/char/5.cc: New. * 22_locale/money_put/put/char/6.cc: New. * 22_locale/money_put/put/char/wrapped_env.cc: New. * 22_locale/money_put/put/char/wrapped_locale.cc: New. * 22_locale/money_put/put/wchar_t/1.cc: New. * 22_locale/money_put/put/wchar_t/2.cc: New. * 22_locale/money_put/put/wchar_t/3.cc: New. * 22_locale/money_put/put/wchar_t/4.cc: New. * 22_locale/money_put/put/wchar_t/5.cc: New. * 22_locale/money_put/put/wchar_t/6.cc: New. * 22_locale/money_put/put/wchar_t/wrapped_env.cc: New. * 22_locale/money_put/put/wchar_t/wrapped_locale.cc: New. * 22_locale/moneypunct/1.cc: New. * 22_locale/moneypunct/2.cc: New. * 22_locale/moneypunct/3.cc: New. * 22_locale/moneypunct/members/char/1.cc: New. * 22_locale/moneypunct/members/char/2.cc: New. * 22_locale/moneypunct/members/char/wrapped_env.cc: New. * 22_locale/moneypunct/members/char/wrapped_locale.cc: New. * 22_locale/moneypunct/members/wchar_t/1.cc: New. * 22_locale/moneypunct/members/wchar_t/2.cc: New. * 22_locale/moneypunct/members/wchar_t/wrapped_env.cc: New. * 22_locale/moneypunct/members/wchar_t/wrapped_locale.cc: New. * 22_locale/moneypunct_byname/1.cc: New. * 22_locale/num_get/1.cc: New. * 22_locale/num_get/2.cc: New. * 22_locale/num_get/get/char/1.cc: New. * 22_locale/num_get/get/char/2.cc: New. * 22_locale/num_get/get/char/3.cc: New. * 22_locale/num_get/get/char/4.cc: New. * 22_locale/num_get/get/char/5.cc: New. * 22_locale/num_get/get/char/6.cc: New. * 22_locale/num_get/get/char/wrapped_env.cc: New. * 22_locale/num_get/get/char/wrapped_locale.cc: New. * 22_locale/num_get/get/wchar_t/1.cc: New. * 22_locale/num_get/get/wchar_t/2.cc: New. * 22_locale/num_get/get/wchar_t/3.cc: New. * 22_locale/num_get/get/wchar_t/4.cc: New. * 22_locale/num_get/get/wchar_t/5.cc: New. * 22_locale/num_get/get/wchar_t/6.cc: New. * 22_locale/num_get/get/wchar_t/wrapped_env.cc: New. * 22_locale/num_get/get/wchar_t/wrapped_locale.cc: New. * 22_locale/num_put/1.cc: New. * 22_locale/num_put/2.cc: New. * 22_locale/num_put/put/char/1.cc: New. * 22_locale/num_put/put/char/2.cc: New. * 22_locale/num_put/put/char/3.cc: New. * 22_locale/num_put/put/char/4.cc: New. * 22_locale/num_put/put/char/5.cc: New. * 22_locale/num_put/put/char/wrapped_env.cc: New. * 22_locale/num_put/put/char/wrapped_locale.cc: New. * 22_locale/num_put/put/wchar_t/1.cc: New. * 22_locale/num_put/put/wchar_t/2.cc: New. * 22_locale/num_put/put/wchar_t/3.cc: New. * 22_locale/num_put/put/wchar_t/4.cc: New. * 22_locale/num_put/put/wchar_t/5.cc: New. * 22_locale/num_put/put/wchar_t/wrapped_env.cc: New. * 22_locale/num_put/put/wchar_t/wrapped_locale.cc: New. * 22_locale/numpunct/1.cc: New. * 22_locale/numpunct/2.cc: New. * 22_locale/numpunct/members/char/1.cc: New. * 22_locale/numpunct/members/char/2.cc: New. * 22_locale/numpunct/members/char/wrapped_env.cc: New. * 22_locale/numpunct/members/char/wrapped_locale.cc: New. * 22_locale/numpunct/members/wchar_t/1.cc: New. * 22_locale/numpunct/members/wchar_t/2.cc: New. * 22_locale/numpunct/members/wchar_t/wrapped_env.cc: New. * 22_locale/numpunct/members/wchar_t/wrapped_locale.cc: New. * 22_locale/numpunct_byname/1.cc: New. * 22_locale/numpunct_byname/2.cc: New. * 22_locale/time_get/1.cc: New. * 22_locale/time_get/2.cc: New. * 22_locale/time_get/date_order/char/1.cc: New. * 22_locale/time_get/date_order/char/wrapped_env.cc: New. * 22_locale/time_get/date_order/char/wrapped_locale.cc: New. * 22_locale/time_get/date_order/wchar_t/1.cc: New. * 22_locale/time_get/date_order/wchar_t/wrapped_env.cc: New. * 22_locale/time_get/date_order/wchar_t/wrapped_locale.cc: New. * 22_locale/time_get/get_date/char/1.cc: New. * 22_locale/time_get/get_date/char/2.cc: New. * 22_locale/time_get/get_date/char/3.cc: New. * 22_locale/time_get/get_date/char/wrapped_env.cc: New. * 22_locale/time_get/get_date/char/wrapped_locale.cc: New. * 22_locale/time_get/get_date/wchar_t/1.cc: New. * 22_locale/time_get/get_date/wchar_t/2.cc: New. * 22_locale/time_get/get_date/wchar_t/3.cc: New. * 22_locale/time_get/get_date/wchar_t/wrapped_env.cc: New. * 22_locale/time_get/get_date/wchar_t/wrapped_locale.cc: New. * 22_locale/time_get/get_monthname/char/1.cc: New. * 22_locale/time_get/get_monthname/char/2.cc: New. * 22_locale/time_get/get_monthname/char/3.cc: New. * 22_locale/time_get/get_monthname/char/wrapped_env.cc: New. * 22_locale/time_get/get_monthname/char/wrapped_locale.cc: New. * 22_locale/time_get/get_monthname/wchar_t/1.cc: New. * 22_locale/time_get/get_monthname/wchar_t/2.cc: New. * 22_locale/time_get/get_monthname/wchar_t/3.cc: New. * 22_locale/time_get/get_monthname/wchar_t/wrapped_env.cc: New. * 22_locale/time_get/get_monthname/wchar_t/wrapped_locale.cc: New. * 22_locale/time_get/get_time/char/1.cc: New. * 22_locale/time_get/get_time/char/2.cc: New. * 22_locale/time_get/get_time/char/3.cc: New. * 22_locale/time_get/get_time/char/wrapped_env.cc: New. * 22_locale/time_get/get_time/char/wrapped_locale.cc: New. * 22_locale/time_get/get_time/wchar_t/1.cc: New. * 22_locale/time_get/get_time/wchar_t/2.cc: New. * 22_locale/time_get/get_time/wchar_t/3.cc: New. * 22_locale/time_get/get_time/wchar_t/wrapped_env.cc: New. * 22_locale/time_get/get_time/wchar_t/wrapped_locale.cc: New. * 22_locale/time_get/get_weekday/char/1.cc: New. * 22_locale/time_get/get_weekday/char/2.cc: New. * 22_locale/time_get/get_weekday/char/3.cc: New. * 22_locale/time_get/get_weekday/char/wrapped_env.cc: New. * 22_locale/time_get/get_weekday/char/wrapped_locale.cc: New. * 22_locale/time_get/get_weekday/wchar_t/1.cc: New. * 22_locale/time_get/get_weekday/wchar_t/2.cc: New. * 22_locale/time_get/get_weekday/wchar_t/3.cc: New. * 22_locale/time_get/get_weekday/wchar_t/wrapped_env.cc: New. * 22_locale/time_get/get_weekday/wchar_t/wrapped_locale.cc: New. * 22_locale/time_get/get_year/char/1.cc: New. * 22_locale/time_get/get_year/char/3.cc: New. * 22_locale/time_get/get_year/char/wrapped_env.cc: New. * 22_locale/time_get/get_year/char/wrapped_locale.cc: New. * 22_locale/time_get/get_year/wchar_t/1.cc: New. * 22_locale/time_get/get_year/wchar_t/3.cc: New. * 22_locale/time_get/get_year/wchar_t/wrapped_env.cc: New. * 22_locale/time_get/get_year/wchar_t/wrapped_locale.cc: New. * 22_locale/time_put/1.cc: New. * 22_locale/time_put/2.cc: New. * 22_locale/time_put/put/char/1.cc: New. * 22_locale/time_put/put/char/10.cc: New. * 22_locale/time_put/put/char/2.cc: New. * 22_locale/time_put/put/char/3.cc: New. * 22_locale/time_put/put/char/4.cc: New. * 22_locale/time_put/put/char/5.cc: New. * 22_locale/time_put/put/char/6.cc: New. * 22_locale/time_put/put/char/7.cc: New. * 22_locale/time_put/put/char/8.cc: New. * 22_locale/time_put/put/char/9.cc: New. * 22_locale/time_put/put/char/wrapped_env.cc: New. * 22_locale/time_put/put/char/wrapped_locale.cc: New. * 22_locale/time_put/put/wchar_t/1.cc: New. * 22_locale/time_put/put/wchar_t/10.cc: New. * 22_locale/time_put/put/wchar_t/2.cc: New. * 22_locale/time_put/put/wchar_t/3.cc: New. * 22_locale/time_put/put/wchar_t/4.cc: New. * 22_locale/time_put/put/wchar_t/5.cc: New. * 22_locale/time_put/put/wchar_t/6.cc: New. * 22_locale/time_put/put/wchar_t/7.cc: New. * 22_locale/time_put/put/wchar_t/8.cc: New. * 22_locale/time_put/put/wchar_t/9.cc: New. * 22_locale/time_put/put/wchar_t/wrapped_env.cc: New. * 22_locale/time_put/put/wchar_t/wrapped_locale.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@61548 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog339
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/1.cc (renamed from libstdc++-v3/testsuite/22_locale/codecvt.cc)15
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/2.cc39
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/1.cc61
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/1.cc75
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/1.cc62
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/1.cc76
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/in/char/1.cc68
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/in/char/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/in/char/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/1.cc83
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/length/char/1.cc62
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/length/char/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/length/char/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/1.cc78
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/1.cc62
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/1.cc77
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/out/char/1.cc68
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/out/char/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/out/char/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/1.cc83
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/unicode/char.cc (renamed from libstdc++-v3/testsuite/22_locale/codecvt_members_unicode_char.cc)0
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/unicode/wchar_t.cc (renamed from libstdc++-v3/testsuite/22_locale/codecvt_members_unicode_wchar_t.cc)0
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/1.cc (renamed from libstdc++-v3/testsuite/22_locale/codecvt_members_char_char.cc)50
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/1.cc (renamed from libstdc++-v3/testsuite/22_locale/codecvt_members_wchar_t_char.cc)63
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/1.cc (renamed from libstdc++-v3/testsuite/22_locale/collate.cc)13
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/2.cc39
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/compare/char/1.cc79
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/compare/char/2.cc86
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/compare/char/wrapped_env.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/compare/char/wrapped_locale.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/1.cc79
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/2.cc86
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/hash/char/1.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/hash/char/2.cc75
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_env.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_locale.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/1.cc48
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/2.cc74
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/transform/char/2.cc72
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/transform/char/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/transform/char/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/2.cc72
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate_byname/1.cc (renamed from libstdc++-v3/testsuite/22_locale/collate_byname.cc)4
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate_members_char.cc187
-rw-r--r--libstdc++-v3/testsuite/22_locale/collate_members_wchar_t.cc190
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/1.cc (renamed from libstdc++-v3/testsuite/22_locale/ctype.cc)18
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/2.cc43
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/cons/char/1.cc (renamed from libstdc++-v3/testsuite/22_locale/ctype_members_char.cc)28
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/cons/char/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/cons/char/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/is/char/1.cc (renamed from libstdc++-v3/testsuite/22_locale/ctype_is_char.cc)127
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/is/char/2.cc104
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/is/char/wrapped_env.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/1.cc (renamed from libstdc++-v3/testsuite/22_locale/ctype_is_wchar_t.cc)51
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/2.cc104
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/wrapped_env.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/wrapped_locale.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/narrow/char/1.cc69
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/narrow/char/2.cc (renamed from libstdc++-v3/testsuite/22_locale/ctype_narrow_char.cc)32
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/narrow/char/wrapped_env.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/narrow/char/wrapped_locale.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/1.cc69
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/2.cc (renamed from libstdc++-v3/testsuite/22_locale/ctype_narrow_wchar_t.cc)38
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/wrapped_env.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/wrapped_locale.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/scan/char/1.cc (renamed from libstdc++-v3/testsuite/22_locale/ctype_scan_char.cc)0
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/scan/char/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/scan/char/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/scan/wchar_t/1.cc (renamed from libstdc++-v3/testsuite/22_locale/ctype_scan_wchar_t.cc)0
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/scan/wchar_t/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/to/char/1.cc (renamed from libstdc++-v3/testsuite/22_locale/ctype_to_char.cc)37
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/to/char/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/to/char/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/1.cc (renamed from libstdc++-v3/testsuite/22_locale/ctype_to_wchar_t.cc)41
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/widen/char/1.cc (renamed from libstdc++-v3/testsuite/22_locale/ctype_widen_char.cc)0
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/widen/char/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/widen/char/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/1.cc (renamed from libstdc++-v3/testsuite/22_locale/ctype_widen_wchar_t.cc)6
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype_members_wchar_t.cc49
-rw-r--r--libstdc++-v3/testsuite/22_locale/facet/1.cc (renamed from libstdc++-v3/testsuite/22_locale/facet.cc)63
-rw-r--r--libstdc++-v3/testsuite/22_locale/facet/2.cc94
-rw-r--r--libstdc++-v3/testsuite/22_locale/global_templates/1.cc (renamed from libstdc++-v3/testsuite/22_locale/global_templates.cc)0
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/1.cc39
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/2.cc (renamed from libstdc++-v3/testsuite/22_locale/ctor_copy_dtor.cc)212
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/3.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/4.cc47
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/5.cc198
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/6.cc63
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/7.cc (renamed from libstdc++-v3/testsuite/22_locale/members.cc)41
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/1.cc67
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/2.cc71
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/3.cc (renamed from libstdc++-v3/testsuite/22_locale/static_members.cc)83
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/operations/1.cc (renamed from libstdc++-v3/testsuite/22_locale/operators.cc)22
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/operations/2.cc64
-rw-r--r--libstdc++-v3/testsuite/22_locale/messages/1.cc (renamed from libstdc++-v3/testsuite/22_locale/messages.cc)15
-rw-r--r--libstdc++-v3/testsuite/22_locale/messages/2.cc39
-rw-r--r--libstdc++-v3/testsuite/22_locale/messages/members/char/1.cc (renamed from libstdc++-v3/testsuite/22_locale/messages_members_char.cc)56
-rw-r--r--libstdc++-v3/testsuite/22_locale/messages/members/char/2.cc69
-rw-r--r--libstdc++-v3/testsuite/22_locale/messages/members/char/3.cc69
-rw-r--r--libstdc++-v3/testsuite/22_locale/messages/members/char/wrapped_env.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/messages/members/char/wrapped_locale.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/messages_byname/1.cc (renamed from libstdc++-v3/testsuite/22_locale/messages_byname.cc)6
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/1.cc (renamed from libstdc++-v3/testsuite/22_locale/money_get.cc)15
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/2.cc39
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/char/1.cc151
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/char/2.cc140
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/char/3.cc96
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/char/4.cc91
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/char/5.cc71
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/char/6.cc104
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/char/7.cc70
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/char/8.cc123
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/char/wrapped_env.cc71
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/char/wrapped_locale.cc71
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/1.cc151
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/2.cc140
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/3.cc96
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/4.cc91
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/5.cc71
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/6.cc102
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/7.cc70
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/8.cc123
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/wrapped_env.cc71
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/wrapped_locale.cc71
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get_members_char.cc580
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get_members_wchar_t.cc584
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/1.cc (renamed from libstdc++-v3/testsuite/22_locale/money_put.cc)15
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/2.cc39
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/char/1.cc129
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/char/2.cc120
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/char/3.cc109
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/char/4.cc73
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/char/5.cc70
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/char/6.cc59
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/char/wrapped_env.cc61
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/char/wrapped_locale.cc61
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/1.cc129
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/2.cc120
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/3.cc109
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/4.cc73
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/5.cc70
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/6.cc59
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/wrapped_env.cc61
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/wrapped_locale.cc61
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put_members_char.cc400
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put_members_wchar_t.cc403
-rw-r--r--libstdc++-v3/testsuite/22_locale/moneypunct/1.cc44
-rw-r--r--libstdc++-v3/testsuite/22_locale/moneypunct/2.cc44
-rw-r--r--libstdc++-v3/testsuite/22_locale/moneypunct/3.cc (renamed from libstdc++-v3/testsuite/22_locale/moneypunct.cc)30
-rw-r--r--libstdc++-v3/testsuite/22_locale/moneypunct/members/char/1.cc99
-rw-r--r--libstdc++-v3/testsuite/22_locale/moneypunct/members/char/2.cc (renamed from libstdc++-v3/testsuite/22_locale/moneypunct_members_char.cc)55
-rw-r--r--libstdc++-v3/testsuite/22_locale/moneypunct/members/char/wrapped_env.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/moneypunct/members/char/wrapped_locale.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/1.cc99
-rw-r--r--libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/2.cc (renamed from libstdc++-v3/testsuite/22_locale/moneypunct_members_wchar_t.cc)61
-rw-r--r--libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/wrapped_env.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/wrapped_locale.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/moneypunct_byname/1.cc (renamed from libstdc++-v3/testsuite/22_locale/moneypunct_byname.cc)5
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/1.cc (renamed from libstdc++-v3/testsuite/22_locale/num_get.cc)15
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/2.cc39
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/char/1.cc170
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/char/2.cc140
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/char/3.cc102
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/char/4.cc112
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/char/5.cc92
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/char/6.cc57
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/char/wrapped_env.cc61
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/char/wrapped_locale.cc61
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/1.cc169
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/2.cc140
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/3.cc102
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/4.cc112
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/5.cc92
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/6.cc57
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/wrapped_env.cc61
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/wrapped_locale.cc61
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get_members_char.cc446
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get_members_wchar_t.cc456
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/1.cc (renamed from libstdc++-v3/testsuite/22_locale/num_put.cc)15
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/2.cc39
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/char/1.cc176
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/char/2.cc112
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/char/3.cc95
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/char/4.cc105
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/char/5.cc70
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/char/wrapped_env.cc56
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/char/wrapped_locale.cc56
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/1.cc176
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/2.cc112
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/3.cc95
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/4.cc105
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/5.cc70
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/wrapped_env.cc56
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/wrapped_locale.cc56
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put_members_char.cc376
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put_members_wchar_t.cc382
-rw-r--r--libstdc++-v3/testsuite/22_locale/numpunct/1.cc (renamed from libstdc++-v3/testsuite/22_locale/numpunct.cc)15
-rw-r--r--libstdc++-v3/testsuite/22_locale/numpunct/2.cc39
-rw-r--r--libstdc++-v3/testsuite/22_locale/numpunct/members/char/1.cc65
-rw-r--r--libstdc++-v3/testsuite/22_locale/numpunct/members/char/2.cc (renamed from libstdc++-v3/testsuite/22_locale/numpunct_members_char.cc)42
-rw-r--r--libstdc++-v3/testsuite/22_locale/numpunct/members/char/wrapped_env.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/numpunct/members/char/wrapped_locale.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/1.cc65
-rw-r--r--libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/2.cc (renamed from libstdc++-v3/testsuite/22_locale/numpunct_members_wchar_t.cc)51
-rw-r--r--libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/wrapped_env.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/wrapped_locale.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/numpunct_byname/1.cc (renamed from libstdc++-v3/testsuite/22_locale/numpunct_byname.cc)23
-rw-r--r--libstdc++-v3/testsuite/22_locale/numpunct_byname/2.cc45
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/1.cc (renamed from libstdc++-v3/testsuite/22_locale/time_get.cc)15
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/2.cc39
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/date_order/char/1.cc69
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/date_order/char/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/date_order/char/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/1.cc70
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/wrapped_env.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/wrapped_locale.cc36
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_date/char/1.cc112
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_date/char/2.cc108
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_date/char/3.cc72
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_date/char/wrapped_env.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_date/char/wrapped_locale.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/1.cc112
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/2.cc108
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/3.cc72
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/wrapped_env.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/wrapped_locale.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/1.cc126
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/2.cc90
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/3.cc70
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/wrapped_env.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/wrapped_locale.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/1.cc126
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/2.cc90
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/3.cc70
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/wrapped_env.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/wrapped_locale.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_time/char/1.cc127
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_time/char/2.cc80
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_time/char/3.cc71
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_time/char/wrapped_env.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_time/char/wrapped_locale.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/1.cc127
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/2.cc80
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/3.cc71
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/wrapped_env.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/wrapped_locale.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/1.cc134
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/2.cc90
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/3.cc70
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_env.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_locale.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/1.cc134
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/2.cc90
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/3.cc70
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/wrapped_env.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/wrapped_locale.cc46
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_year/char/1.cc123
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_year/char/3.cc70
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_year/char/wrapped_env.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_year/char/wrapped_locale.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/1.cc123
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/3.cc70
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/wrapped_env.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/wrapped_locale.cc41
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get_members_char.cc735
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get_members_wchar_t.cc738
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/1.cc (renamed from libstdc++-v3/testsuite/22_locale/time_put.cc)15
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/2.cc39
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc90
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/10.cc63
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/2.cc85
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/3.cc85
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/4.cc84
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc80
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc78
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc79
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc77
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/9.cc64
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_env.cc81
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_locale.cc81
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/1.cc90
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/10.cc63
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/2.cc85
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/3.cc85
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/4.cc84
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc80
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/6.cc78
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/7.cc78
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/8.cc77
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/9.cc64
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_env.cc81
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_locale.cc81
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put_members_char.cc276
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put_members_wchar_t.cc281
-rw-r--r--libstdc++-v3/testsuite/26_numerics/c99_classification_macros_c.cc5
328 files changed, 18755 insertions, 7393 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 7b08511673d..091a336e2b8 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,342 @@
+2003-01-21 Benjamin Kosnik <bkoz@redhat.com>
+
+ Reshuffle 22_locale testsuite.
+ * 22_locale/(codecvt.cc money_get.cc
+ codecvt_members_char_char.cc money_get_members_char.cc
+ codecvt_members_unicode_char.cc money_get_members_wchar_t.cc
+ codecvt_members_unicode_wchar_t.cc moneypunct_byname.cc
+ codecvt_members_wchar_t_char.cc moneypunct.cc collate_byname.cc
+ moneypunct_members_char.cc collate.cc moneypunct_members_wchar_t.cc
+ collate_members_char.cc money_put.cc collate_members_wchar_t.cc
+ money_put_members_char.cc ctor_copy_dtor.cc
+ money_put_members_wchar_t.cc ctype.cc num_get.cc ctype_is_char.cc
+ num_get_members_char.cc ctype_is_wchar_t.cc num_get_members_wchar_t.cc
+ ctype_members_char.cc numpunct_byname.cc ctype_members_wchar_t.cc
+ numpunct.cc ctype_narrow_char.cc numpunct_members_char.cc
+ ctype_narrow_wchar_t.cc numpunct_members_wchar_t.cc ctype_scan_char.cc
+ num_put.cc ctype_scan_wchar_t.cc num_put_members_char.cc
+ ctype_to_char.cc num_put_members_wchar_t.cc ctype_to_wchar_t.cc
+ operators.cc ctype_widen_char.cc static_members.cc
+ ctype_widen_wchar_t.cc time_get.cc facet.cc time_get_members_char.cc
+ global_templates.cc time_get_members_wchar_t.cc, members.cc,
+ time_put.cc, messages_byname.cc, time_put_members_char.cc,
+ messages.cc, time_put_members_wchar_t.cc, messages_members_char.cc):
+ Splint up into individual test cases...
+ * 22_locale/codecvt/1.cc: New.
+ * 22_locale/codecvt/2.cc: New.
+ * 22_locale/codecvt/always_noconv/char/1.cc: New.
+ * 22_locale/codecvt/always_noconv/char/wrapped_env.cc: New.
+ * 22_locale/codecvt/always_noconv/char/wrapped_locale.cc: New.
+ * 22_locale/codecvt/always_noconv/wchar_t/1.cc: New.
+ * 22_locale/codecvt/always_noconv/wchar_t/wrapped_env.cc: New.
+ * 22_locale/codecvt/always_noconv/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/codecvt/encoding/char/1.cc: New.
+ * 22_locale/codecvt/encoding/char/wrapped_env.cc: New.
+ * 22_locale/codecvt/encoding/char/wrapped_locale.cc: New.
+ * 22_locale/codecvt/encoding/wchar_t/1.cc: New.
+ * 22_locale/codecvt/encoding/wchar_t/wrapped_env.cc: New.
+ * 22_locale/codecvt/encoding/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/codecvt/in/char/1.cc: New.
+ * 22_locale/codecvt/in/char/wrapped_env.cc: New.
+ * 22_locale/codecvt/in/char/wrapped_locale.cc: New.
+ * 22_locale/codecvt/in/wchar_t/1.cc: New.
+ * 22_locale/codecvt/in/wchar_t/wrapped_env.cc: New.
+ * 22_locale/codecvt/in/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/codecvt/length/char/1.cc: New.
+ * 22_locale/codecvt/length/char/wrapped_env.cc: New.
+ * 22_locale/codecvt/length/char/wrapped_locale.cc: New.
+ * 22_locale/codecvt/length/wchar_t/1.cc: New.
+ * 22_locale/codecvt/length/wchar_t/wrapped_env.cc: New.
+ * 22_locale/codecvt/length/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/codecvt/max_length/char/1.cc: New.
+ * 22_locale/codecvt/max_length/char/wrapped_env.cc: New.
+ * 22_locale/codecvt/max_length/char/wrapped_locale.cc: New.
+ * 22_locale/codecvt/max_length/wchar_t/1.cc: New.
+ * 22_locale/codecvt/max_length/wchar_t/wrapped_env.cc: New.
+ * 22_locale/codecvt/max_length/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/codecvt/out/char/1.cc: New.
+ * 22_locale/codecvt/out/char/wrapped_env.cc: New.
+ * 22_locale/codecvt/out/char/wrapped_locale.cc: New.
+ * 22_locale/codecvt/out/wchar_t/1.cc: New.
+ * 22_locale/codecvt/out/wchar_t/wrapped_env.cc: New.
+ * 22_locale/codecvt/out/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/codecvt/unicode/char.cc: New.
+ * 22_locale/codecvt/unicode/wchar_t.cc: New.
+ * 22_locale/codecvt/unshift/char/1.cc: New.
+ * 22_locale/codecvt/unshift/char/wrapped_env.cc: New.
+ * 22_locale/codecvt/unshift/char/wrapped_locale.cc: New.
+ * 22_locale/codecvt/unshift/wchar_t/1.cc: New.
+ * 22_locale/codecvt/unshift/wchar_t/wrapped_env.cc: New.
+ * 22_locale/codecvt/unshift/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/collate/1.cc: New.
+ * 22_locale/collate/2.cc: New.
+ * 22_locale/collate/compare/char/1.cc: New.
+ * 22_locale/collate/compare/char/2.cc: New.
+ * 22_locale/collate/compare/char/wrapped_env.cc: New.
+ * 22_locale/collate/compare/char/wrapped_locale.cc: New.
+ * 22_locale/collate/compare/wchar_t/1.cc: New.
+ * 22_locale/collate/compare/wchar_t/2.cc: New.
+ * 22_locale/collate/compare/wchar_t/wrapped_env.cc: New.
+ * 22_locale/collate/compare/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/collate/hash/char/1.cc: New.
+ * 22_locale/collate/hash/char/2.cc: New.
+ * 22_locale/collate/hash/char/wrapped_env.cc: New.
+ * 22_locale/collate/hash/char/wrapped_locale.cc: New.
+ * 22_locale/collate/hash/wchar_t/1.cc: New.
+ * 22_locale/collate/hash/wchar_t/2.cc: New.
+ * 22_locale/collate/hash/wchar_t/wrapped_env.cc: New.
+ * 22_locale/collate/hash/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/collate/transform/char/2.cc: New.
+ * 22_locale/collate/transform/char/wrapped_env.cc: New.
+ * 22_locale/collate/transform/char/wrapped_locale.cc: New.
+ * 22_locale/collate/transform/wchar_t/2.cc: New.
+ * 22_locale/collate/transform/wchar_t/wrapped_env.cc: New.
+ * 22_locale/collate/transform/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/collate_byname/1.cc: New.
+ * 22_locale/ctype/1.cc: New.
+ * 22_locale/ctype/2.cc: New.
+ * 22_locale/ctype/cons/char/1.cc: New.
+ * 22_locale/ctype/cons/char/wrapped_env.cc: New.
+ * 22_locale/ctype/cons/char/wrapped_locale.cc: New.
+ * 22_locale/ctype/is/char/1.cc: New.
+ * 22_locale/ctype/is/char/2.cc: New.
+ * 22_locale/ctype/is/char/3.cc: New.
+ * 22_locale/ctype/is/char/wrapped_env.cc: New.
+ * 22_locale/ctype/is/char/wrapped_locale.cc: New.
+ * 22_locale/ctype/is/wchar_t/1.cc: New.
+ * 22_locale/ctype/is/wchar_t/2.cc: New.
+ * 22_locale/ctype/is/wchar_t/wrapped_env.cc: New.
+ * 22_locale/ctype/is/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/ctype/narrow/char/1.cc: New.
+ * 22_locale/ctype/narrow/char/2.cc: New.
+ * 22_locale/ctype/narrow/char/wrapped_env.cc: New.
+ * 22_locale/ctype/narrow/char/wrapped_locale.cc: New.
+ * 22_locale/ctype/narrow/wchar_t/1.cc: New.
+ * 22_locale/ctype/narrow/wchar_t/2.cc: New.
+ * 22_locale/ctype/narrow/wchar_t/wrapped_env.cc: New.
+ * 22_locale/ctype/narrow/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/ctype/scan/char/1.cc: New.
+ * 22_locale/ctype/scan/char/wrapped_env.cc: New.
+ * 22_locale/ctype/scan/char/wrapped_locale.cc: New.
+ * 22_locale/ctype/scan/wchar_t/1.cc: New.
+ * 22_locale/ctype/scan/wchar_t/wrapped_env.cc: New.
+ * 22_locale/ctype/scan/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/ctype/to/char/1.cc: New.
+ * 22_locale/ctype/to/char/wrapped_env.cc: New.
+ * 22_locale/ctype/to/char/wrapped_locale.cc: New.
+ * 22_locale/ctype/to/wchar_t/1.cc: New.
+ * 22_locale/ctype/to/wchar_t/wrapped_env.cc: New.
+ * 22_locale/ctype/to/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/ctype/widen/char/1.cc: New.
+ * 22_locale/ctype/widen/char/wrapped_env.cc: New.
+ * 22_locale/ctype/widen/char/wrapped_locale.cc: New.
+ * 22_locale/ctype/widen/wchar_t/1.cc: New.
+ * 22_locale/ctype/widen/wchar_t/wrapped_env.cc: New.
+ * 22_locale/ctype/widen/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/facet/1.cc: New.
+ * 22_locale/facet/2.cc: New.
+ * 22_locale/global_templates/1.cc: New.
+ * 22_locale/locale/cons/1.cc: New.
+ * 22_locale/locale/cons/2.cc: New.
+ * 22_locale/locale/cons/3.cc: New.
+ * 22_locale/locale/cons/4.cc: New.
+ * 22_locale/locale/cons/5.cc: New.
+ * 22_locale/locale/cons/6.cc: New.
+ * 22_locale/locale/cons/7.cc: New.
+ * 22_locale/locale/global_locale_objects/1.cc: New.
+ * 22_locale/locale/global_locale_objects/2.cc: New.
+ * 22_locale/locale/global_locale_objects/3.cc: New.
+ * 22_locale/locale/operations/1.cc: New.
+ * 22_locale/locale/operations/2.cc: New.
+ * 22_locale/messages/1.cc: New.
+ * 22_locale/messages/2.cc: New.
+ * 22_locale/messages/members/char/1.cc: New.
+ * 22_locale/messages/members/char/2.cc: New.
+ * 22_locale/messages/members/char/3.cc: New.
+ * 22_locale/messages/members/char/wrapped_env.cc: New.
+ * 22_locale/messages/members/char/wrapped_locale.cc: New.
+ * 22_locale/messages_byname/1.cc: New.
+ * 22_locale/money_get/1.cc: New.
+ * 22_locale/money_get/2.cc: New.
+ * 22_locale/money_get/get/char/1.cc: New.
+ * 22_locale/money_get/get/char/2.cc: New.
+ * 22_locale/money_get/get/char/3.cc: New.
+ * 22_locale/money_get/get/char/4.cc: New.
+ * 22_locale/money_get/get/char/5.cc: New.
+ * 22_locale/money_get/get/char/6.cc: New.
+ * 22_locale/money_get/get/char/7.cc: New.
+ * 22_locale/money_get/get/char/8.cc: New.
+ * 22_locale/money_get/get/char/wrapped_env.cc: New.
+ * 22_locale/money_get/get/char/wrapped_locale.cc: New.
+ * 22_locale/money_get/get/wchar_t/1.cc: New.
+ * 22_locale/money_get/get/wchar_t/2.cc: New.
+ * 22_locale/money_get/get/wchar_t/3.cc: New.
+ * 22_locale/money_get/get/wchar_t/4.cc: New.
+ * 22_locale/money_get/get/wchar_t/5.cc: New.
+ * 22_locale/money_get/get/wchar_t/6.cc: New.
+ * 22_locale/money_get/get/wchar_t/7.cc: New.
+ * 22_locale/money_get/get/wchar_t/8.cc: New.
+ * 22_locale/money_get/get/wchar_t/wrapped_env.cc: New.
+ * 22_locale/money_get/get/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/money_put/1.cc: New.
+ * 22_locale/money_put/2.cc: New.
+ * 22_locale/money_put/put/char/1.cc: New.
+ * 22_locale/money_put/put/char/2.cc: New.
+ * 22_locale/money_put/put/char/3.cc: New.
+ * 22_locale/money_put/put/char/4.cc: New.
+ * 22_locale/money_put/put/char/5.cc: New.
+ * 22_locale/money_put/put/char/6.cc: New.
+ * 22_locale/money_put/put/char/wrapped_env.cc: New.
+ * 22_locale/money_put/put/char/wrapped_locale.cc: New.
+ * 22_locale/money_put/put/wchar_t/1.cc: New.
+ * 22_locale/money_put/put/wchar_t/2.cc: New.
+ * 22_locale/money_put/put/wchar_t/3.cc: New.
+ * 22_locale/money_put/put/wchar_t/4.cc: New.
+ * 22_locale/money_put/put/wchar_t/5.cc: New.
+ * 22_locale/money_put/put/wchar_t/6.cc: New.
+ * 22_locale/money_put/put/wchar_t/wrapped_env.cc: New.
+ * 22_locale/money_put/put/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/moneypunct/1.cc: New.
+ * 22_locale/moneypunct/2.cc: New.
+ * 22_locale/moneypunct/3.cc: New.
+ * 22_locale/moneypunct/members/char/1.cc: New.
+ * 22_locale/moneypunct/members/char/2.cc: New.
+ * 22_locale/moneypunct/members/char/wrapped_env.cc: New.
+ * 22_locale/moneypunct/members/char/wrapped_locale.cc: New.
+ * 22_locale/moneypunct/members/wchar_t/1.cc: New.
+ * 22_locale/moneypunct/members/wchar_t/2.cc: New.
+ * 22_locale/moneypunct/members/wchar_t/wrapped_env.cc: New.
+ * 22_locale/moneypunct/members/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/moneypunct_byname/1.cc: New.
+ * 22_locale/num_get/1.cc: New.
+ * 22_locale/num_get/2.cc: New.
+ * 22_locale/num_get/get/char/1.cc: New.
+ * 22_locale/num_get/get/char/2.cc: New.
+ * 22_locale/num_get/get/char/3.cc: New.
+ * 22_locale/num_get/get/char/4.cc: New.
+ * 22_locale/num_get/get/char/5.cc: New.
+ * 22_locale/num_get/get/char/6.cc: New.
+ * 22_locale/num_get/get/char/wrapped_env.cc: New.
+ * 22_locale/num_get/get/char/wrapped_locale.cc: New.
+ * 22_locale/num_get/get/wchar_t/1.cc: New.
+ * 22_locale/num_get/get/wchar_t/2.cc: New.
+ * 22_locale/num_get/get/wchar_t/3.cc: New.
+ * 22_locale/num_get/get/wchar_t/4.cc: New.
+ * 22_locale/num_get/get/wchar_t/5.cc: New.
+ * 22_locale/num_get/get/wchar_t/6.cc: New.
+ * 22_locale/num_get/get/wchar_t/wrapped_env.cc: New.
+ * 22_locale/num_get/get/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/num_put/1.cc: New.
+ * 22_locale/num_put/2.cc: New.
+ * 22_locale/num_put/put/char/1.cc: New.
+ * 22_locale/num_put/put/char/2.cc: New.
+ * 22_locale/num_put/put/char/3.cc: New.
+ * 22_locale/num_put/put/char/4.cc: New.
+ * 22_locale/num_put/put/char/5.cc: New.
+ * 22_locale/num_put/put/char/wrapped_env.cc: New.
+ * 22_locale/num_put/put/char/wrapped_locale.cc: New.
+ * 22_locale/num_put/put/wchar_t/1.cc: New.
+ * 22_locale/num_put/put/wchar_t/2.cc: New.
+ * 22_locale/num_put/put/wchar_t/3.cc: New.
+ * 22_locale/num_put/put/wchar_t/4.cc: New.
+ * 22_locale/num_put/put/wchar_t/5.cc: New.
+ * 22_locale/num_put/put/wchar_t/wrapped_env.cc: New.
+ * 22_locale/num_put/put/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/numpunct/1.cc: New.
+ * 22_locale/numpunct/2.cc: New.
+ * 22_locale/numpunct/members/char/1.cc: New.
+ * 22_locale/numpunct/members/char/2.cc: New.
+ * 22_locale/numpunct/members/char/wrapped_env.cc: New.
+ * 22_locale/numpunct/members/char/wrapped_locale.cc: New.
+ * 22_locale/numpunct/members/wchar_t/1.cc: New.
+ * 22_locale/numpunct/members/wchar_t/2.cc: New.
+ * 22_locale/numpunct/members/wchar_t/wrapped_env.cc: New.
+ * 22_locale/numpunct/members/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/numpunct_byname/1.cc: New.
+ * 22_locale/numpunct_byname/2.cc: New.
+ * 22_locale/time_get/1.cc: New.
+ * 22_locale/time_get/2.cc: New.
+ * 22_locale/time_get/date_order/char/1.cc: New.
+ * 22_locale/time_get/date_order/char/wrapped_env.cc: New.
+ * 22_locale/time_get/date_order/char/wrapped_locale.cc: New.
+ * 22_locale/time_get/date_order/wchar_t/1.cc: New.
+ * 22_locale/time_get/date_order/wchar_t/wrapped_env.cc: New.
+ * 22_locale/time_get/date_order/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/time_get/get_date/char/1.cc: New.
+ * 22_locale/time_get/get_date/char/2.cc: New.
+ * 22_locale/time_get/get_date/char/3.cc: New.
+ * 22_locale/time_get/get_date/char/wrapped_env.cc: New.
+ * 22_locale/time_get/get_date/char/wrapped_locale.cc: New.
+ * 22_locale/time_get/get_date/wchar_t/1.cc: New.
+ * 22_locale/time_get/get_date/wchar_t/2.cc: New.
+ * 22_locale/time_get/get_date/wchar_t/3.cc: New.
+ * 22_locale/time_get/get_date/wchar_t/wrapped_env.cc: New.
+ * 22_locale/time_get/get_date/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/time_get/get_monthname/char/1.cc: New.
+ * 22_locale/time_get/get_monthname/char/2.cc: New.
+ * 22_locale/time_get/get_monthname/char/3.cc: New.
+ * 22_locale/time_get/get_monthname/char/wrapped_env.cc: New.
+ * 22_locale/time_get/get_monthname/char/wrapped_locale.cc: New.
+ * 22_locale/time_get/get_monthname/wchar_t/1.cc: New.
+ * 22_locale/time_get/get_monthname/wchar_t/2.cc: New.
+ * 22_locale/time_get/get_monthname/wchar_t/3.cc: New.
+ * 22_locale/time_get/get_monthname/wchar_t/wrapped_env.cc: New.
+ * 22_locale/time_get/get_monthname/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/time_get/get_time/char/1.cc: New.
+ * 22_locale/time_get/get_time/char/2.cc: New.
+ * 22_locale/time_get/get_time/char/3.cc: New.
+ * 22_locale/time_get/get_time/char/wrapped_env.cc: New.
+ * 22_locale/time_get/get_time/char/wrapped_locale.cc: New.
+ * 22_locale/time_get/get_time/wchar_t/1.cc: New.
+ * 22_locale/time_get/get_time/wchar_t/2.cc: New.
+ * 22_locale/time_get/get_time/wchar_t/3.cc: New.
+ * 22_locale/time_get/get_time/wchar_t/wrapped_env.cc: New.
+ * 22_locale/time_get/get_time/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/time_get/get_weekday/char/1.cc: New.
+ * 22_locale/time_get/get_weekday/char/2.cc: New.
+ * 22_locale/time_get/get_weekday/char/3.cc: New.
+ * 22_locale/time_get/get_weekday/char/wrapped_env.cc: New.
+ * 22_locale/time_get/get_weekday/char/wrapped_locale.cc: New.
+ * 22_locale/time_get/get_weekday/wchar_t/1.cc: New.
+ * 22_locale/time_get/get_weekday/wchar_t/2.cc: New.
+ * 22_locale/time_get/get_weekday/wchar_t/3.cc: New.
+ * 22_locale/time_get/get_weekday/wchar_t/wrapped_env.cc: New.
+ * 22_locale/time_get/get_weekday/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/time_get/get_year/char/1.cc: New.
+ * 22_locale/time_get/get_year/char/3.cc: New.
+ * 22_locale/time_get/get_year/char/wrapped_env.cc: New.
+ * 22_locale/time_get/get_year/char/wrapped_locale.cc: New.
+ * 22_locale/time_get/get_year/wchar_t/1.cc: New.
+ * 22_locale/time_get/get_year/wchar_t/3.cc: New.
+ * 22_locale/time_get/get_year/wchar_t/wrapped_env.cc: New.
+ * 22_locale/time_get/get_year/wchar_t/wrapped_locale.cc: New.
+ * 22_locale/time_put/1.cc: New.
+ * 22_locale/time_put/2.cc: New.
+ * 22_locale/time_put/put/char/1.cc: New.
+ * 22_locale/time_put/put/char/10.cc: New.
+ * 22_locale/time_put/put/char/2.cc: New.
+ * 22_locale/time_put/put/char/3.cc: New.
+ * 22_locale/time_put/put/char/4.cc: New.
+ * 22_locale/time_put/put/char/5.cc: New.
+ * 22_locale/time_put/put/char/6.cc: New.
+ * 22_locale/time_put/put/char/7.cc: New.
+ * 22_locale/time_put/put/char/8.cc: New.
+ * 22_locale/time_put/put/char/9.cc: New.
+ * 22_locale/time_put/put/char/wrapped_env.cc: New.
+ * 22_locale/time_put/put/char/wrapped_locale.cc: New.
+ * 22_locale/time_put/put/wchar_t/1.cc: New.
+ * 22_locale/time_put/put/wchar_t/10.cc: New.
+ * 22_locale/time_put/put/wchar_t/2.cc: New.
+ * 22_locale/time_put/put/wchar_t/3.cc: New.
+ * 22_locale/time_put/put/wchar_t/4.cc: New.
+ * 22_locale/time_put/put/wchar_t/5.cc: New.
+ * 22_locale/time_put/put/wchar_t/6.cc: New.
+ * 22_locale/time_put/put/wchar_t/7.cc: New.
+ * 22_locale/time_put/put/wchar_t/8.cc: New.
+ * 22_locale/time_put/put/wchar_t/9.cc: New.
+ * 22_locale/time_put/put/wchar_t/wrapped_env.cc: New.
+ * 22_locale/time_put/put/wchar_t/wrapped_locale.cc: New.
+
2003-01-16 Jeffrey D. Oldham <oldham@codesourcery.com>
* config/locale/generic/messages_members.h
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt.cc b/libstdc++-v3/testsuite/22_locale/codecvt/1.cc
index a4670b7c9b5..fa285752871 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/1.cc
@@ -1,6 +1,7 @@
+// { dg-do compile }
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001 Free Software Foundation
+// Copyright (C) 2001, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -20,8 +21,6 @@
// 22.2.1.5 Template class codecvt
-// { dg-do compile }
-
#include <locale>
void test01()
@@ -38,18 +37,8 @@ void test01()
typedef test_type::state_type state_type;
}
-// Should be able to instantiate this for other types besides char, wchar_t
-class gnu_codecvt: public std::codecvt<unsigned char, unsigned long, char>
-{ };
-
-void test02()
-{
- gnu_codecvt facet01;
-}
-
int main()
{
test01();
- test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/2.cc b/libstdc++-v3/testsuite/22_locale/codecvt/2.cc
new file mode 100644
index 00000000000..9811239b5ed
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/2.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.1.5 Template class codecvt
+
+#include <locale>
+
+// Should be able to instantiate this for other types besides char, wchar_t
+class gnu_codecvt: public std::codecvt<unsigned char, unsigned long, char>
+{ };
+
+void test02()
+{
+ gnu_codecvt facet01;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/1.cc
new file mode 100644
index 00000000000..523322ece87
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/1.cc
@@ -0,0 +1,61 @@
+// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com>
+
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.1.5 - Template class codecvt [lib.locale.codecvt]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Required instantiation, degenerate conversion.
+// codecvt<char, char, mbstate_t>
+void test01()
+{
+ using namespace std;
+ typedef codecvt_base::result result;
+ typedef codecvt<char, char, mbstate_t> c_codecvt;
+
+ bool test = true;
+ const char* c_lit = "black pearl jasmine tea";
+ const char* from_next;
+ int size = 25;
+ char* c_arr = new char[size];
+ char* c_ref = new char[size];
+ char* to_next;
+
+ locale loc = locale::classic();
+ c_codecvt::state_type state;
+ const c_codecvt* cvt = &use_facet<c_codecvt>(loc);
+
+ // According to the resolution of DR19 (see also libstd++/9168), in
+ // case of degenerate conversion ('noconv'), "there are no changes to
+ // the values in [to, to_limit)."
+ memset(c_ref, 'X', size);
+
+ VERIFY( cvt->always_noconv() );
+
+ delete [] c_arr;
+ delete [] c_ref;
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/1.cc
new file mode 100644
index 00000000000..fb267410804
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/1.cc
@@ -0,0 +1,75 @@
+// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com>
+
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.1.5 - Template class codecvt [lib.locale.codecvt]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Need to explicitly set the state(mbstate_t) to zero.
+// How to do this is not specified by the ISO C99 standard, so we
+// might need to add some operators to make the intuiative case
+// work:
+// w_codecvt::state_type state00;
+// state00 = 0;
+// or, can use this explicit "C" initialization:
+// w_codecvt::state_type state01 = {0, 0};
+// .. except Ulrich says: Use memset. Always use memset. Feel the force...
+void
+zero_state(std::mbstate_t& state)
+{ std::memset(&state, 0, sizeof(std::mbstate_t)); }
+
+// Required instantiation
+// codecvt<wchar_t, char, mbstate_t>
+void test01()
+{
+ using namespace std;
+ typedef codecvt<wchar_t, char, mbstate_t> w_codecvt;
+ typedef codecvt_base::result result;
+ typedef wchar_t int_type;
+ typedef char ext_type;
+ typedef char_traits<wchar_t> int_traits;
+ typedef char_traits<char> ext_traits;
+
+ bool test = true;
+ const ext_type* e_lit = "black pearl jasmine tea";
+ const ext_type* efrom_next;
+ const int_type* i_lit = L"black pearl jasmine tea";
+ const int_type* ifrom_next;
+ int size = strlen(e_lit);
+ ext_type* e_arr = new ext_type[size + 1];
+ ext_type* eto_next;
+ int_type* i_arr = new int_type[size + 1];
+ int_type* ito_next;
+
+ locale loc;
+ const w_codecvt* cvt = &use_facet<w_codecvt>(loc);
+
+ VERIFY( !cvt->always_noconv() );
+
+ delete [] e_arr;
+ delete [] i_arr;
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/1.cc
new file mode 100644
index 00000000000..9ac07c5f044
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/1.cc
@@ -0,0 +1,62 @@
+// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com>
+
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.1.5 - Template class codecvt [lib.locale.codecvt]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Required instantiation, degenerate conversion.
+// codecvt<char, char, mbstate_t>
+void test01()
+{
+ using namespace std;
+ typedef codecvt_base::result result;
+ typedef codecvt<char, char, mbstate_t> c_codecvt;
+
+ bool test = true;
+ const char* c_lit = "black pearl jasmine tea";
+ const char* from_next;
+ int size = 25;
+ char* c_arr = new char[size];
+ char* c_ref = new char[size];
+ char* to_next;
+
+ locale loc = locale::classic();
+ c_codecvt::state_type state;
+ const c_codecvt* cvt = &use_facet<c_codecvt>(loc);
+
+ // According to the resolution of DR19 (see also libstd++/9168), in
+ // case of degenerate conversion ('noconv'), "there are no changes to
+ // the values in [to, to_limit)."
+ memset(c_ref, 'X', size);
+
+ int i = cvt->encoding();
+ VERIFY( i == 1 );
+
+ delete [] c_arr;
+ delete [] c_ref;
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/1.cc
new file mode 100644
index 00000000000..0aefff30397
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/1.cc
@@ -0,0 +1,76 @@
+// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com>
+
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.1.5 - Template class codecvt [lib.locale.codecvt]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Need to explicitly set the state(mbstate_t) to zero.
+// How to do this is not specified by the ISO C99 standard, so we
+// might need to add some operators to make the intuiative case
+// work:
+// w_codecvt::state_type state00;
+// state00 = 0;
+// or, can use this explicit "C" initialization:
+// w_codecvt::state_type state01 = {0, 0};
+// .. except Ulrich says: Use memset. Always use memset. Feel the force...
+void
+zero_state(std::mbstate_t& state)
+{ std::memset(&state, 0, sizeof(std::mbstate_t)); }
+
+// Required instantiation
+// codecvt<wchar_t, char, mbstate_t>
+void test01()
+{
+ using namespace std;
+ typedef codecvt<wchar_t, char, mbstate_t> w_codecvt;
+ typedef codecvt_base::result result;
+ typedef wchar_t int_type;
+ typedef char ext_type;
+ typedef char_traits<wchar_t> int_traits;
+ typedef char_traits<char> ext_traits;
+
+ bool test = true;
+ const ext_type* e_lit = "black pearl jasmine tea";
+ const ext_type* efrom_next;
+ const int_type* i_lit = L"black pearl jasmine tea";
+ const int_type* ifrom_next;
+ int size = strlen(e_lit);
+ ext_type* e_arr = new ext_type[size + 1];
+ ext_type* eto_next;
+ int_type* i_arr = new int_type[size + 1];
+ int_type* ito_next;
+
+ locale loc;
+ const w_codecvt* cvt = &use_facet<w_codecvt>(loc);
+
+ int i = cvt->encoding();
+ VERIFY( i == 4 ); // Target-dependent.
+
+ delete [] e_arr;
+ delete [] i_arr;
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/char/1.cc
new file mode 100644
index 00000000000..71f6ac77498
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/in/char/1.cc
@@ -0,0 +1,68 @@
+// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com>
+
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.1.5 - Template class codecvt [lib.locale.codecvt]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Required instantiation, degenerate conversion.
+// codecvt<char, char, mbstate_t>
+void test01()
+{
+ using namespace std;
+ typedef codecvt_base::result result;
+ typedef codecvt<char, char, mbstate_t> c_codecvt;
+
+ bool test = true;
+ const char* c_lit = "black pearl jasmine tea";
+ const char* from_next;
+ int size = 25;
+ char* c_arr = new char[size];
+ char* c_ref = new char[size];
+ char* to_next;
+
+ locale loc = locale::classic();
+ c_codecvt::state_type state;
+ const c_codecvt* cvt = &use_facet<c_codecvt>(loc);
+
+ // According to the resolution of DR19 (see also libstd++/9168), in
+ // case of degenerate conversion ('noconv'), "there are no changes to
+ // the values in [to, to_limit)."
+ memset(c_ref, 'X', size);
+
+ // in
+ memset(c_arr, 'X', size);
+ result r1 = cvt->in(state, c_lit, c_lit + size, from_next,
+ c_arr, c_arr + size, to_next);
+ VERIFY( r1 == codecvt_base::noconv );
+ VERIFY( !memcmp(c_arr, c_ref, size) );
+ VERIFY( from_next == c_lit );
+ VERIFY( to_next == c_arr );
+
+ delete [] c_arr;
+ delete [] c_ref;
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/char/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/in/char/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/char/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/in/char/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/1.cc
new file mode 100644
index 00000000000..7340d418209
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/1.cc
@@ -0,0 +1,83 @@
+// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com>
+
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.1.5 - Template class codecvt [lib.locale.codecvt]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Need to explicitly set the state(mbstate_t) to zero.
+// How to do this is not specified by the ISO C99 standard, so we
+// might need to add some operators to make the intuiative case
+// work:
+// w_codecvt::state_type state00;
+// state00 = 0;
+// or, can use this explicit "C" initialization:
+// w_codecvt::state_type state01 = {0, 0};
+// .. except Ulrich says: Use memset. Always use memset. Feel the force...
+void
+zero_state(std::mbstate_t& state)
+{ std::memset(&state, 0, sizeof(std::mbstate_t)); }
+
+// Required instantiation
+// codecvt<wchar_t, char, mbstate_t>
+void test01()
+{
+ using namespace std;
+ typedef codecvt<wchar_t, char, mbstate_t> w_codecvt;
+ typedef codecvt_base::result result;
+ typedef wchar_t int_type;
+ typedef char ext_type;
+ typedef char_traits<wchar_t> int_traits;
+ typedef char_traits<char> ext_traits;
+
+ bool test = true;
+ const ext_type* e_lit = "black pearl jasmine tea";
+ const ext_type* efrom_next;
+ const int_type* i_lit = L"black pearl jasmine tea";
+ const int_type* ifrom_next;
+ int size = strlen(e_lit);
+ ext_type* e_arr = new ext_type[size + 1];
+ ext_type* eto_next;
+ int_type* i_arr = new int_type[size + 1];
+ int_type* ito_next;
+
+ locale loc;
+ const w_codecvt* cvt = &use_facet<w_codecvt>(loc);
+
+ // in
+ w_codecvt::state_type state01;
+ zero_state(state01);
+ result r1 = cvt->in(state01, e_lit, e_lit + size, efrom_next,
+ i_arr, i_arr + size, ito_next);
+ VERIFY( r1 == codecvt_base::ok );
+ VERIFY( !int_traits::compare(i_arr, i_lit, size) );
+ VERIFY( efrom_next == e_lit + size );
+ VERIFY( ito_next == i_arr + size );
+
+ delete [] e_arr;
+ delete [] i_arr;
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/char/1.cc
new file mode 100644
index 00000000000..1ef0f267c01
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/length/char/1.cc
@@ -0,0 +1,62 @@
+// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com>
+
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.1.5 - Template class codecvt [lib.locale.codecvt]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Required instantiation, degenerate conversion.
+// codecvt<char, char, mbstate_t>
+void test01()
+{
+ using namespace std;
+ typedef codecvt_base::result result;
+ typedef codecvt<char, char, mbstate_t> c_codecvt;
+
+ bool test = true;
+ const char* c_lit = "black pearl jasmine tea";
+ const char* from_next;
+ int size = 25;
+ char* c_arr = new char[size];
+ char* c_ref = new char[size];
+ char* to_next;
+
+ locale loc = locale::classic();
+ c_codecvt::state_type state;
+ const c_codecvt* cvt = &use_facet<c_codecvt>(loc);
+
+ // According to the resolution of DR19 (see also libstd++/9168), in
+ // case of degenerate conversion ('noconv'), "there are no changes to
+ // the values in [to, to_limit)."
+ memset(c_ref, 'X', size);
+
+ int j = cvt->length(state, c_lit, c_lit + size, 5);
+ VERIFY( j == 5 );
+
+ delete [] c_arr;
+ delete [] c_ref;
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/char/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/length/char/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/char/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/length/char/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/1.cc
new file mode 100644
index 00000000000..ca673240f46
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/1.cc
@@ -0,0 +1,78 @@
+// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com>
+
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.1.5 - Template class codecvt [lib.locale.codecvt]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Need to explicitly set the state(mbstate_t) to zero.
+// How to do this is not specified by the ISO C99 standard, so we
+// might need to add some operators to make the intuiative case
+// work:
+// w_codecvt::state_type state00;
+// state00 = 0;
+// or, can use this explicit "C" initialization:
+// w_codecvt::state_type state01 = {0, 0};
+// .. except Ulrich says: Use memset. Always use memset. Feel the force...
+void
+zero_state(std::mbstate_t& state)
+{ std::memset(&state, 0, sizeof(std::mbstate_t)); }
+
+// Required instantiation
+// codecvt<wchar_t, char, mbstate_t>
+void test01()
+{
+ using namespace std;
+ typedef codecvt<wchar_t, char, mbstate_t> w_codecvt;
+ typedef codecvt_base::result result;
+ typedef wchar_t int_type;
+ typedef char ext_type;
+ typedef char_traits<wchar_t> int_traits;
+ typedef char_traits<char> ext_traits;
+
+ bool test = true;
+ const ext_type* e_lit = "black pearl jasmine tea";
+ const ext_type* efrom_next;
+ const int_type* i_lit = L"black pearl jasmine tea";
+ const int_type* ifrom_next;
+ int size = strlen(e_lit);
+ ext_type* e_arr = new ext_type[size + 1];
+ ext_type* eto_next;
+ int_type* i_arr = new int_type[size + 1];
+ int_type* ito_next;
+
+ locale loc;
+ const w_codecvt* cvt = &use_facet<w_codecvt>(loc);
+
+ w_codecvt::state_type state04;
+ zero_state(state04);
+ int j = cvt->length(state04, e_lit, e_lit + size, 5);
+ VERIFY( j == 5 );
+
+ delete [] e_arr;
+ delete [] i_arr;
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/1.cc
new file mode 100644
index 00000000000..789007ae905
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/1.cc
@@ -0,0 +1,62 @@
+// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com>
+
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.1.5 - Template class codecvt [lib.locale.codecvt]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Required instantiation, degenerate conversion.
+// codecvt<char, char, mbstate_t>
+void test01()
+{
+ using namespace std;
+ typedef codecvt_base::result result;
+ typedef codecvt<char, char, mbstate_t> c_codecvt;
+
+ bool test = true;
+ const char* c_lit = "black pearl jasmine tea";
+ const char* from_next;
+ int size = 25;
+ char* c_arr = new char[size];
+ char* c_ref = new char[size];
+ char* to_next;
+
+ locale loc = locale::classic();
+ c_codecvt::state_type state;
+ const c_codecvt* cvt = &use_facet<c_codecvt>(loc);
+
+ // According to the resolution of DR19 (see also libstd++/9168), in
+ // case of degenerate conversion ('noconv'), "there are no changes to
+ // the values in [to, to_limit)."
+ memset(c_ref, 'X', size);
+
+ int k = cvt->max_length();
+ VERIFY( k == 1 );
+
+ delete [] c_arr;
+ delete [] c_ref;
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/1.cc
new file mode 100644
index 00000000000..028756c897c
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/1.cc
@@ -0,0 +1,77 @@
+// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com>
+
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.1.5 - Template class codecvt [lib.locale.codecvt]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+
+// Need to explicitly set the state(mbstate_t) to zero.
+// How to do this is not specified by the ISO C99 standard, so we
+// might need to add some operators to make the intuiative case
+// work:
+// w_codecvt::state_type state00;
+// state00 = 0;
+// or, can use this explicit "C" initialization:
+// w_codecvt::state_type state01 = {0, 0};
+// .. except Ulrich says: Use memset. Always use memset. Feel the force...
+void
+zero_state(std::mbstate_t& state)
+{ std::memset(&state, 0, sizeof(std::mbstate_t)); }
+
+// Required instantiation
+// codecvt<wchar_t, char, mbstate_t>
+void test01()
+{
+ using namespace std;
+ typedef codecvt<wchar_t, char, mbstate_t> w_codecvt;
+ typedef codecvt_base::result result;
+ typedef wchar_t int_type;
+ typedef char ext_type;
+ typedef char_traits<wchar_t> int_traits;
+ typedef char_traits<char> ext_traits;
+
+ bool test = true;
+ const ext_type* e_lit = "black pearl jasmine tea";
+ const ext_type* efrom_next;
+ const int_type* i_lit = L"black pearl jasmine tea";
+ const int_type* ifrom_next;
+ int size = strlen(e_lit);
+ ext_type* e_arr = new ext_type[size + 1];
+ ext_type* eto_next;
+ int_type* i_arr = new int_type[size + 1];
+ int_type* ito_next;
+
+ locale loc;
+ const w_codecvt* cvt = &use_facet<w_codecvt>(loc);
+
+ int k = cvt->max_length();
+ VERIFY( k == 1 );
+
+ delete [] e_arr;
+ delete [] i_arr;
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/char/1.cc
new file mode 100644
index 00000000000..f0ef0a5da63
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/out/char/1.cc
@@ -0,0 +1,68 @@
+// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com>
+
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.1.5 - Template class codecvt [lib.locale.codecvt]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Required instantiation, degenerate conversion.
+// codecvt<char, char, mbstate_t>
+void test01()
+{
+ using namespace std;
+ typedef codecvt_base::result result;
+ typedef codecvt<char, char, mbstate_t> c_codecvt;
+
+ bool test = true;
+ const char* c_lit = "black pearl jasmine tea";
+ const char* from_next;
+ int size = 25;
+ char* c_arr = new char[size];
+ char* c_ref = new char[size];
+ char* to_next;
+
+ locale loc = locale::classic();
+ c_codecvt::state_type state;
+ const c_codecvt* cvt = &use_facet<c_codecvt>(loc);
+
+ // According to the resolution of DR19 (see also libstd++/9168), in
+ // case of degenerate conversion ('noconv'), "there are no changes to
+ // the values in [to, to_limit)."
+ memset(c_ref, 'X', size);
+
+ // out
+ memset(c_arr, 'X', size);
+ result r2 = cvt->out(state, c_lit, c_lit + size, from_next,
+ c_arr, c_arr + size, to_next);
+ VERIFY( r2 == codecvt_base::noconv );
+ VERIFY( !memcmp(c_arr, c_ref, size) );
+ VERIFY( from_next == c_lit );
+ VERIFY( to_next == c_arr );
+
+ delete [] c_arr;
+ delete [] c_ref;
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/char/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/out/char/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/char/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/out/char/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/1.cc
new file mode 100644
index 00000000000..3727044ae38
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/1.cc
@@ -0,0 +1,83 @@
+// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com>
+
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.1.5 - Template class codecvt [lib.locale.codecvt]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Need to explicitly set the state(mbstate_t) to zero.
+// How to do this is not specified by the ISO C99 standard, so we
+// might need to add some operators to make the intuiative case
+// work:
+// w_codecvt::state_type state00;
+// state00 = 0;
+// or, can use this explicit "C" initialization:
+// w_codecvt::state_type state01 = {0, 0};
+// .. except Ulrich says: Use memset. Always use memset. Feel the force...
+void
+zero_state(std::mbstate_t& state)
+{ std::memset(&state, 0, sizeof(std::mbstate_t)); }
+
+// Required instantiation
+// codecvt<wchar_t, char, mbstate_t>
+void test01()
+{
+ using namespace std;
+ typedef codecvt<wchar_t, char, mbstate_t> w_codecvt;
+ typedef codecvt_base::result result;
+ typedef wchar_t int_type;
+ typedef char ext_type;
+ typedef char_traits<wchar_t> int_traits;
+ typedef char_traits<char> ext_traits;
+
+ bool test = true;
+ const ext_type* e_lit = "black pearl jasmine tea";
+ const ext_type* efrom_next;
+ const int_type* i_lit = L"black pearl jasmine tea";
+ const int_type* ifrom_next;
+ int size = strlen(e_lit);
+ ext_type* e_arr = new ext_type[size + 1];
+ ext_type* eto_next;
+ int_type* i_arr = new int_type[size + 1];
+ int_type* ito_next;
+
+ locale loc;
+ const w_codecvt* cvt = &use_facet<w_codecvt>(loc);
+
+ // out
+ w_codecvt::state_type state02;
+ zero_state(state02);
+ result r2 = cvt->out(state02, i_lit, i_lit + size, ifrom_next,
+ e_arr, e_arr + size, eto_next);
+ VERIFY( r2 == codecvt_base::ok );
+ VERIFY( !ext_traits::compare(e_arr, e_lit, size) );
+ VERIFY( ifrom_next == i_lit + size );
+ VERIFY( eto_next == e_arr + size );
+
+ delete [] e_arr;
+ delete [] i_arr;
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt_members_unicode_char.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unicode/char.cc
index 51bf9b9600a..51bf9b9600a 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt_members_unicode_char.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/unicode/char.cc
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt_members_unicode_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unicode/wchar_t.cc
index c944865b08f..c944865b08f 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt_members_unicode_wchar_t.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/unicode/wchar_t.cc
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt_members_char_char.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/1.cc
index b2acb675351..1a6eadd82fe 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt_members_char_char.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/1.cc
@@ -1,6 +1,6 @@
// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com>
-// Copyright (C) 2000, 2002 Free Software Foundation
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -39,7 +39,7 @@ void test01()
char* c_ref = new char[size];
char* to_next;
- locale loc;
+ locale loc = locale::classic();
c_codecvt::state_type state;
const c_codecvt* cvt = &use_facet<c_codecvt>(loc);
@@ -73,58 +73,12 @@ void test01()
VERIFY( !strcmp(c_arr, c_lit) );
VERIFY( to_next == c_arr );
- int i = cvt->encoding();
- VERIFY( i == 1 );
-
- VERIFY( cvt->always_noconv() );
-
- int j = cvt->length(state, c_lit, c_lit + size, 5);
- VERIFY( j == 5 );
-
- int k = cvt->max_length();
- VERIFY( k == 1 );
-
delete [] c_arr;
delete [] c_ref;
}
-// libstdc++/5280
-void test02()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test03()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-
int main ()
{
test01();
- test02();
- test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt_members_wchar_t_char.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/1.cc
index 1eb505fb6bd..2f31670e4c7 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt_members_wchar_t_char.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/1.cc
@@ -1,6 +1,6 @@
-// 2000-08-18 Benjamin Kosnik <bkoz@cygnus.com>
+// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com>
-// Copyright (C) 2000, 2002 Free Software Foundation
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -20,11 +20,9 @@
// 22.2.1.5 - Template class codecvt [lib.locale.codecvt]
-#include <cwchar> // for mbstate_t
#include <locale>
#include <testsuite_hooks.h>
-
// Need to explicitly set the state(mbstate_t) to zero.
// How to do this is not specified by the ISO C99 standard, so we
// might need to add some operators to make the intuiative case
@@ -34,7 +32,6 @@
// or, can use this explicit "C" initialization:
// w_codecvt::state_type state01 = {0, 0};
// .. except Ulrich says: Use memset. Always use memset. Feel the force...
-#ifdef _GLIBCPP_USE_WCHAR_T
void
zero_state(std::mbstate_t& state)
{ std::memset(&state, 0, sizeof(std::mbstate_t)); }
@@ -93,66 +90,10 @@ void test01()
VERIFY( r3 == codecvt_base::noconv );
VERIFY( !strcmp(e_arr, e_lit) );
VERIFY( eto_next == e_arr );
-
- int i = cvt->encoding();
- VERIFY( i == 4 ); // Target-dependent.
-
- VERIFY( !cvt->always_noconv() );
-
- w_codecvt::state_type state04;
- zero_state(state04);
- int j = cvt->length(state03, e_lit, e_lit + size, 5);
- VERIFY( j == 5 );
-
- int k = cvt->max_length();
- VERIFY( k == 1 );
-
- delete [] e_arr;
- delete [] i_arr;
-}
-
-// libstdc++/5280
-void test02()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test03()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
}
-#endif /* !defined(_GLIBCPP_USE_WCHAR_T) */
-
int main ()
{
-#if _GLIBCPP_USE_WCHAR_T
test01();
- test02();
- test03();
-#endif
-
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate.cc b/libstdc++-v3/testsuite/22_locale/collate/1.cc
index d7b1f16d78b..5b55b03f24f 100644
--- a/libstdc++-v3/testsuite/22_locale/collate.cc
+++ b/libstdc++-v3/testsuite/22_locale/collate/1.cc
@@ -1,3 +1,4 @@
+// { dg-do compile }
// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001 Free Software Foundation
@@ -20,8 +21,6 @@
// 22.2.4 The collate category
-// { dg-do compile }
-
#include <locale>
void test01()
@@ -37,18 +36,8 @@ void test01()
typedef test_type::string_type string_type;
}
-// Should be able to instantiate this for other types besides char, wchar_t
-class gnu_collate: public std::collate<unsigned char>
-{ };
-
-void test02()
-{
- gnu_collate facet01;
-}
-
int main()
{
test01();
- test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/2.cc b/libstdc++-v3/testsuite/22_locale/collate/2.cc
new file mode 100644
index 00000000000..98bc214943d
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/2.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4 The collate category
+
+#include <locale>
+
+// Should be able to instantiate this for other types besides char, wchar_t
+class gnu_collate: public std::collate<unsigned char>
+{ };
+
+void test02()
+{
+ gnu_collate facet01;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/char/1.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/char/1.cc
new file mode 100644
index 00000000000..74871082be3
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/compare/char/1.cc
@@ -0,0 +1,79 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Check "C" locale.
+void test01()
+{
+ using namespace std;
+ typedef std::collate<char>::string_type string_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_us("en_US");
+ locale loc_fr("fr_FR");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_us != loc_fr );
+ VERIFY( loc_us != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the collate facets
+ const collate<char>& coll_c = use_facet<collate<char> >(loc_c);
+ const collate<char>& coll_us = use_facet<collate<char> >(loc_us);
+ const collate<char>& coll_fr = use_facet<collate<char> >(loc_fr);
+ const collate<char>& coll_de = use_facet<collate<char> >(loc_de);
+
+ // int compare(const charT*, const charT*, const charT*, const charT*) const
+
+ const char* strlit1 = "monkey picked tikuanyin oolong";
+ const char* strlit2 = "imperial tea court green oolong";
+
+ int i1;
+ int i2;
+ int size1 = char_traits<char>::length(strlit1) - 1;
+ int size2 = char_traits<char>::length(strlit2) - 1;
+
+ i1 = coll_c.compare(strlit1, strlit1 + size1, strlit1, strlit1 + 7);
+ VERIFY ( i1 == 1 );
+ i1 = coll_c.compare(strlit1, strlit1 + 7, strlit1, strlit1 + size1);
+ VERIFY ( i1 == -1 );
+ i1 = coll_c.compare(strlit1, strlit1 + 7, strlit1, strlit1 + 7);
+ VERIFY ( i1 == 0 );
+
+ i2 = coll_c.compare(strlit2, strlit2 + size2, strlit2, strlit2 + 13);
+ VERIFY ( i2 == 1 );
+ i2 = coll_c.compare(strlit2, strlit2 + 13, strlit2, strlit2 + size2);
+ VERIFY ( i2 == -1 );
+ i2 = coll_c.compare(strlit2, strlit2 + size2, strlit2, strlit2 + size2);
+ VERIFY ( i2 == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/char/2.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/char/2.cc
new file mode 100644
index 00000000000..52052f9aed0
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/compare/char/2.cc
@@ -0,0 +1,86 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Check German "de_DE" locale.
+void test02()
+{
+ using namespace std;
+ typedef std::collate<char>::string_type string_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_us("en_US");
+ locale loc_fr("fr_FR");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_us != loc_fr );
+ VERIFY( loc_us != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the collate facets
+ const collate<char>& coll_c = use_facet<collate<char> >(loc_c);
+ const collate<char>& coll_us = use_facet<collate<char> >(loc_us);
+ const collate<char>& coll_fr = use_facet<collate<char> >(loc_fr);
+ const collate<char>& coll_de = use_facet<collate<char> >(loc_de);
+
+ // int compare(const charT*, const charT*, const charT*, const charT*) const
+
+ const char* strlit1 = "monkey picked tikuanyin oolong";
+ const char* strlit2 = "imperial tea court green oolong";
+ const char* strlit3 = "Äuglein Augment"; // "C" == "Augment Äuglein"
+ const char* strlit4 = "Base baß Baß Bast"; // "C" == "Base baß Baß Bast"
+
+ int i1;
+ int i2;
+ int size1 = char_traits<char>::length(strlit1) - 1;
+ int size2 = char_traits<char>::length(strlit2) - 1;
+ int size3 = char_traits<char>::length(strlit3) - 1;
+ int size4 = char_traits<char>::length(strlit4) - 1;
+
+ i1 = coll_de.compare(strlit3, strlit3 + size3, strlit3, strlit3 + 7);
+ VERIFY ( i1 == 1 );
+ i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + size1);
+ VERIFY ( i1 == -1 );
+ i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + 7);
+ VERIFY ( i1 == 0 );
+
+ i1 = coll_de.compare(strlit3, strlit3 + 6, strlit3 + 8, strlit3 + 14);
+ VERIFY ( i1 == -1 );
+
+ i2 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + 13);
+ VERIFY ( i2 == 1 );
+ i2 = coll_de.compare(strlit4, strlit4 + 13, strlit4, strlit4 + size4);
+ VERIFY ( i2 == -1 );
+ i2 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + size4);
+ VERIFY ( i2 == 0 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/char/wrapped_env.cc
new file mode 100644
index 00000000000..4f1d5e3f6a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/compare/char/wrapped_env.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/char/wrapped_locale.cc
new file mode 100644
index 00000000000..8d7871815db
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/compare/char/wrapped_locale.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/1.cc
new file mode 100644
index 00000000000..0ba7b05835e
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/1.cc
@@ -0,0 +1,79 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Check "C" locale.
+void test01()
+{
+ using namespace std;
+ typedef std::collate<wchar_t>::string_type string_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_us("en_US");
+ locale loc_fr("fr_FR");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_us != loc_fr );
+ VERIFY( loc_us != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the collate facets
+ const collate<wchar_t>& coll_c = use_facet<collate<wchar_t> >(loc_c);
+ const collate<wchar_t>& coll_us = use_facet<collate<wchar_t> >(loc_us);
+ const collate<wchar_t>& coll_fr = use_facet<collate<wchar_t> >(loc_fr);
+ const collate<wchar_t>& coll_de = use_facet<collate<wchar_t> >(loc_de);
+
+ // int compare(const charT*, const charT*, const charT*, const charT*) const
+
+ const wchar_t* strlit1 = L"monkey picked tikuanyin oolong";
+ const wchar_t* strlit2 = L"imperial tea court green oolong";
+
+ int i1;
+ int i2;
+ int size1 = char_traits<wchar_t>::length(strlit1) - 1;
+ int size2 = char_traits<wchar_t>::length(strlit2) - 1;
+
+ i1 = coll_c.compare(strlit1, strlit1 + size1, strlit1, strlit1 + 7);
+ VERIFY ( i1 == 1 );
+ i1 = coll_c.compare(strlit1, strlit1 + 7, strlit1, strlit1 + size1);
+ VERIFY ( i1 == -1 );
+ i1 = coll_c.compare(strlit1, strlit1 + 7, strlit1, strlit1 + 7);
+ VERIFY ( i1 == 0 );
+
+ i2 = coll_c.compare(strlit2, strlit2 + size2, strlit2, strlit2 + 13);
+ VERIFY ( i2 == 1 );
+ i2 = coll_c.compare(strlit2, strlit2 + 13, strlit2, strlit2 + size2);
+ VERIFY ( i2 == -1 );
+ i2 = coll_c.compare(strlit2, strlit2 + size2, strlit2, strlit2 + size2);
+ VERIFY ( i2 == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/2.cc
new file mode 100644
index 00000000000..24b327f979b
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/2.cc
@@ -0,0 +1,86 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Check German "de_DE" locale.
+void test02()
+{
+ using namespace std;
+ typedef std::collate<wchar_t>::string_type string_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_us("en_US");
+ locale loc_fr("fr_FR");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_us != loc_fr );
+ VERIFY( loc_us != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the collate facets
+ const collate<wchar_t>& coll_c = use_facet<collate<wchar_t> >(loc_c);
+ const collate<wchar_t>& coll_us = use_facet<collate<wchar_t> >(loc_us);
+ const collate<wchar_t>& coll_fr = use_facet<collate<wchar_t> >(loc_fr);
+ const collate<wchar_t>& coll_de = use_facet<collate<wchar_t> >(loc_de);
+
+ // int compare(const charT*, const charT*, const charT*, const charT*) const
+
+ const wchar_t* strlit1 = L"monkey picked tikuanyin oolong";
+ const wchar_t* strlit2 = L"imperial tea court green oolong";
+ const wchar_t* strlit3 = L"Äuglein Augment"; // "C" == "Augment Äuglein"
+ const wchar_t* strlit4 = L"Base baß Baß Bast"; // "C" == "Base baß Baß Bast"
+
+ int i1;
+ int i2;
+ int size1 = char_traits<wchar_t>::length(strlit1) - 1;
+ int size2 = char_traits<wchar_t>::length(strlit2) - 1;
+ int size3 = char_traits<wchar_t>::length(strlit3) - 1;
+ int size4 = char_traits<wchar_t>::length(strlit4) - 1;
+
+ i1 = coll_de.compare(strlit3, strlit3 + size3, strlit3, strlit3 + 7);
+ VERIFY ( i1 == 1 );
+ i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + size1);
+ VERIFY ( i1 == -1 );
+ i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + 7);
+ VERIFY ( i1 == 0 );
+
+ i1 = coll_de.compare(strlit3, strlit3 + 6, strlit3 + 8, strlit3 + 14);
+ VERIFY ( i1 == -1 );
+
+ i2 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + 13);
+ VERIFY ( i2 == 1 );
+ i2 = coll_de.compare(strlit4, strlit4 + 13, strlit4, strlit4 + size4);
+ VERIFY ( i2 == -1 );
+ i2 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + size4);
+ VERIFY ( i2 == 0 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..4f1d5e3f6a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..8d7871815db
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/char/1.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/char/1.cc
new file mode 100644
index 00000000000..9be618a8f4a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/hash/char/1.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Check "C" locale.
+void test01()
+{
+ bool test = true;
+
+ std::string str1("fffff");
+ std::string str2("ffffffffffff");
+
+ const std::locale cloc = std::locale::classic();
+ const std::collate<char> &col = std::use_facet<std::collate<char> >(cloc);
+
+ long l1 = col.hash(str1.c_str(), str1.c_str() + str1.size());
+ long l2 = col.hash(str2.c_str(), str2.c_str() + str2.size());
+ VERIFY( l1 != l2 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/char/2.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/char/2.cc
new file mode 100644
index 00000000000..75eb202da28
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/hash/char/2.cc
@@ -0,0 +1,75 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Check German "de_DE" locale.
+void test02()
+{
+ using namespace std;
+ typedef std::collate<char>::string_type string_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_us("en_US");
+ locale loc_fr("fr_FR");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_us != loc_fr );
+ VERIFY( loc_us != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the collate facets
+ const collate<char>& coll_c = use_facet<collate<char> >(loc_c);
+ const collate<char>& coll_us = use_facet<collate<char> >(loc_us);
+ const collate<char>& coll_fr = use_facet<collate<char> >(loc_fr);
+ const collate<char>& coll_de = use_facet<collate<char> >(loc_de);
+
+ // long hash(const charT*, const charT*) cosnt
+ const char* strlit1 = "monkey picked tikuanyin oolong";
+ const char* strlit2 = "imperial tea court green oolong";
+ const char* strlit3 = "Äuglein Augment"; // "C" == "Augment Äuglein"
+ const char* strlit4 = "Base baß Baß Bast"; // "C" == "Base baß Baß Bast"
+
+ int i1;
+ int i2;
+ long l1;
+ long l2;
+ int size3 = char_traits<char>::length(strlit4) - 1;
+ int size4 = char_traits<char>::length(strlit3) - 1;
+
+ l1 = coll_de.hash(strlit3, strlit3 + size3);
+ l2 = coll_de.hash(strlit3, strlit3 + size3 - 1);
+ VERIFY ( l1 != l2 );
+ l1 = coll_de.hash(strlit3, strlit3 + size3);
+ l2 = coll_de.hash(strlit4, strlit4 + size4);
+ VERIFY ( l1 != l2 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_env.cc
new file mode 100644
index 00000000000..4f1d5e3f6a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_env.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_locale.cc
new file mode 100644
index 00000000000..8d7871815db
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_locale.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/1.cc
new file mode 100644
index 00000000000..73f8da142ca
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/1.cc
@@ -0,0 +1,48 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Check "C" locale.
+void test01()
+{
+ using namespace std;
+ typedef std::collate<wchar_t>::string_type string_type;
+ bool test = true;
+
+ string_type str1(L"fffff");
+ string_type str2(L"ffffffffffff");
+
+ const std::locale cloc = std::locale::classic();
+ const std::collate<wchar_t> &col = std::use_facet<std::collate<wchar_t> >(cloc);
+
+ long l1 = col.hash(str1.c_str(), str1.c_str() + str1.size());
+ long l2 = col.hash(str2.c_str(), str2.c_str() + str2.size());
+ VERIFY( l1 != l2 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/2.cc
new file mode 100644
index 00000000000..b11be4a9990
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/2.cc
@@ -0,0 +1,74 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Check German "de_DE" locale.
+void test02()
+{
+ using namespace std;
+ typedef std::collate<wchar_t>::string_type string_type;
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_us("en_US");
+ locale loc_fr("fr_FR");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_us != loc_fr );
+ VERIFY( loc_us != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the collate facets
+ const collate<wchar_t>& coll_c = use_facet<collate<wchar_t> >(loc_c);
+ const collate<wchar_t>& coll_us = use_facet<collate<wchar_t> >(loc_us);
+ const collate<wchar_t>& coll_fr = use_facet<collate<wchar_t> >(loc_fr);
+ const collate<wchar_t>& coll_de = use_facet<collate<wchar_t> >(loc_de);
+
+ // long hash(const charT*, const charT*) cosnt
+ const wchar_t* strlit1 = L"monkey picked tikuanyin oolong";
+ const wchar_t* strlit2 = L"imperial tea court green oolong";
+ const wchar_t* strlit3 = L"Äuglein Augment"; // "C" == "Augment Äuglein"
+ const wchar_t* strlit4 = L"Base baß Baß Bast"; // "C" == "Base baß Baß Bast"
+
+ int i1;
+ int i2;
+ long l1;
+ long l2;
+ int size3 = char_traits<wchar_t>::length(strlit4) - 1;
+ int size4 = char_traits<wchar_t>::length(strlit3) - 1;
+
+ l1 = coll_de.hash(strlit3, strlit3 + size3);
+ l2 = coll_de.hash(strlit3, strlit3 + size3 - 1);
+ VERIFY ( l1 != l2 );
+ l1 = coll_de.hash(strlit3, strlit3 + size3);
+ l2 = coll_de.hash(strlit4, strlit4 + size4);
+ VERIFY ( l1 != l2 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..4f1d5e3f6a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..8d7871815db
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/char/2.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/char/2.cc
new file mode 100644
index 00000000000..dc2b395bd66
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/transform/char/2.cc
@@ -0,0 +1,72 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef std::collate<char>::string_type string_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_us("en_US");
+ locale loc_fr("fr_FR");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_us != loc_fr );
+ VERIFY( loc_us != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the collate facets
+ const collate<char>& coll_c = use_facet<collate<char> >(loc_c);
+ const collate<char>& coll_us = use_facet<collate<char> >(loc_us);
+ const collate<char>& coll_fr = use_facet<collate<char> >(loc_fr);
+ const collate<char>& coll_de = use_facet<collate<char> >(loc_de);
+
+ // long hash(const charT*, const charT*) cosnt
+ const char* strlit1 = "monkey picked tikuanyin oolong";
+ const char* strlit2 = "imperial tea court green oolong";
+ const char* strlit3 = "Äuglein Augment"; // "C" == "Augment Äuglein"
+ const char* strlit4 = "Base baß Baß Bast"; // "C" == "Base baß Baß Bast"
+
+ int i1;
+ int i2;
+ int size3 = char_traits<char>::length(strlit3) - 1;
+ int size4 = char_traits<char>::length(strlit4) - 1;
+
+ string_type str3 = coll_de.transform(strlit3, strlit3 + size3);
+ string_type str4 = coll_de.transform(strlit4, strlit4 + size4);
+ i1 = str3.compare(str4);
+ i2 = coll_de.compare(strlit3, strlit3 + size3, strlit4, strlit4 + size4);
+ VERIFY ( i2 == -1 );
+ VERIFY ( i1 * i2 > 0 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/char/wrapped_env.cc
new file mode 100644
index 00000000000..9f9d1aade91
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/transform/char/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test02);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/char/wrapped_locale.cc
new file mode 100644
index 00000000000..2ef10fd5765
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/transform/char/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test02);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/2.cc
new file mode 100644
index 00000000000..f643fd68da6
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/2.cc
@@ -0,0 +1,72 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef std::collate<wchar_t>::string_type string_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_us("en_US");
+ locale loc_fr("fr_FR");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_us != loc_fr );
+ VERIFY( loc_us != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the collate facets
+ const collate<wchar_t>& coll_c = use_facet<collate<wchar_t> >(loc_c);
+ const collate<wchar_t>& coll_us = use_facet<collate<wchar_t> >(loc_us);
+ const collate<wchar_t>& coll_fr = use_facet<collate<wchar_t> >(loc_fr);
+ const collate<wchar_t>& coll_de = use_facet<collate<wchar_t> >(loc_de);
+
+ // long hash(const charT*, const charT*) cosnt
+ const wchar_t* strlit1 = L"monkey picked tikuanyin oolong";
+ const wchar_t* strlit2 = L"imperial tea court green oolong";
+ const wchar_t* strlit3 = L"Äuglein Augment"; // "C" == "Augment Äuglein"
+ const wchar_t* strlit4 = L"Base baß Baß Bast"; // "C" == "Base baß Baß Bast"
+
+ int i1;
+ int i2;
+ int size3 = char_traits<wchar_t>::length(strlit3) - 1;
+ int size4 = char_traits<wchar_t>::length(strlit4) - 1;
+
+ string_type str3 = coll_de.transform(strlit3, strlit3 + size3);
+ string_type str4 = coll_de.transform(strlit4, strlit4 + size4);
+ i1 = str3.compare(str4);
+ i2 = coll_de.compare(strlit3, strlit3 + size3, strlit4, strlit4 + size4);
+ VERIFY ( i2 == -1 );
+ VERIFY ( i1 * i2 > 0 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..9f9d1aade91
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test02);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..2ef10fd5765
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test02);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate_byname.cc b/libstdc++-v3/testsuite/22_locale/collate_byname/1.cc
index a4d76829b21..62986628790 100644
--- a/libstdc++-v3/testsuite/22_locale/collate_byname.cc
+++ b/libstdc++-v3/testsuite/22_locale/collate_byname/1.cc
@@ -23,9 +23,6 @@
#include <locale>
#include <testsuite_hooks.h>
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
void test01()
{
using namespace std;
@@ -135,6 +132,5 @@ void test01()
int main()
{
test01();
-
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/collate_members_char.cc b/libstdc++-v3/testsuite/22_locale/collate_members_char.cc
deleted file mode 100644
index eccf7caae1c..00000000000
--- a/libstdc++-v3/testsuite/22_locale/collate_members_char.cc
+++ /dev/null
@@ -1,187 +0,0 @@
-// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2001, 2002 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This 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 General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.4.1.1 collate members
-
-#include <locale>
-#include <testsuite_hooks.h>
-
-// XXX This may not work for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-void test01()
-{
- using namespace std;
- typedef std::collate<char>::string_type string_type;
-
- bool test = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_us("en_US");
- locale loc_fr("fr_FR");
- locale loc_de("de_DE");
- VERIFY( loc_c != loc_de );
- VERIFY( loc_us != loc_fr );
- VERIFY( loc_us != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the collate facets
- const collate<char>& coll_c = use_facet<collate<char> >(loc_c);
- const collate<char>& coll_us = use_facet<collate<char> >(loc_us);
- const collate<char>& coll_fr = use_facet<collate<char> >(loc_fr);
- const collate<char>& coll_de = use_facet<collate<char> >(loc_de);
-
- // int compare(const charT*, const charT*, const charT*, const charT*) const
- // long hash(const charT*, const charT*) cosnt
- // string_type transform(const charT*, const charT*) const
-
- // Check "C" locale.
- const char* strlit1 = "monkey picked tikuanyin oolong";
- const char* strlit2 = "imperial tea court green oolong";
-
- int i1;
- int size1 = strlen(strlit1) - 1;
- i1 = coll_c.compare(strlit1, strlit1 + size1, strlit1, strlit1 + 7);
- VERIFY ( i1 == 1 );
- i1 = coll_c.compare(strlit1, strlit1 + 7, strlit1, strlit1 + size1);
- VERIFY ( i1 == -1 );
- i1 = coll_c.compare(strlit1, strlit1 + 7, strlit1, strlit1 + 7);
- VERIFY ( i1 == 0 );
-
- int i2;
- int size2 = strlen(strlit2) - 1;
- i2 = coll_c.compare(strlit2, strlit2 + size2, strlit2, strlit2 + 13);
- VERIFY ( i2 == 1 );
- i2 = coll_c.compare(strlit2, strlit2 + 13, strlit2, strlit2 + size2);
- VERIFY ( i2 == -1 );
- i2 = coll_c.compare(strlit2, strlit2 + size2, strlit2, strlit2 + size2);
- VERIFY ( i2 == 0 );
-
- long l1;
- long l2;
- l1 = coll_c.hash(strlit1, strlit1 + size1);
- l2 = coll_c.hash(strlit1, strlit1 + size1 - 1);
- VERIFY ( l1 != l2 );
- l1 = coll_c.hash(strlit1, strlit1 + size1);
- l2 = coll_c.hash(strlit2, strlit2 + size2);
- VERIFY ( l1 != l2 );
-
- string str1 = coll_c.transform(strlit1, strlit1 + size1);
- string str2 = coll_c.transform(strlit2, strlit2 + size2);
- i1 = str1.compare(str2);
- i2 = coll_c.compare(strlit1, strlit1 + size1, strlit2, strlit2 + size2);
- VERIFY ( i2 == 1 );
- VERIFY ( i1 * i2 > 0 );
-
- // Check German "de_DE" locale.
- const char* strlit3 = "Äuglein Augment"; // "C" == "Augment Äuglein"
- const char* strlit4 = "Base baß Baß Bast"; // "C" == "Base baß Baß Bast"
-
- int size3 = strlen(strlit3) - 1;
- i1 = coll_de.compare(strlit3, strlit3 + size3, strlit3, strlit3 + 7);
- VERIFY ( i1 == 1 );
- i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + size1);
- VERIFY ( i1 == -1 );
- i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + 7);
- VERIFY ( i1 == 0 );
-
- i1 = coll_de.compare(strlit3, strlit3 + 6, strlit3 + 8, strlit3 + 14);
- VERIFY ( i1 == -1 );
-
- int size4 = strlen(strlit4) - 1;
- i2 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + 13);
- VERIFY ( i2 == 1 );
- i2 = coll_de.compare(strlit4, strlit4 + 13, strlit4, strlit4 + size4);
- VERIFY ( i2 == -1 );
- i2 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + size4);
- VERIFY ( i2 == 0 );
-
- l1 = coll_de.hash(strlit3, strlit3 + size3);
- l2 = coll_de.hash(strlit3, strlit3 + size3 - 1);
- VERIFY ( l1 != l2 );
- l1 = coll_de.hash(strlit3, strlit3 + size3);
- l2 = coll_de.hash(strlit4, strlit4 + size4);
- VERIFY ( l1 != l2 );
-
- string str3 = coll_de.transform(strlit3, strlit3 + size3);
- string str4 = coll_de.transform(strlit4, strlit4 + size4);
- i1 = str3.compare(str4);
- i2 = coll_de.compare(strlit3, strlit3 + size3, strlit4, strlit4 + size4);
- VERIFY ( i2 == -1 );
- VERIFY ( i1 * i2 > 0 );
-}
-
-// libstdc++/5280
-void test02()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-void test03()
-{
- bool test = true;
- std::string str1("fffff");
- std::string str2("ffffffffffff");
-
- const std::locale cloc = std::locale::classic();
- const std::collate<char> &col = std::use_facet<std::collate<char> >(cloc);
-
- long l1 = col.hash(str1.c_str(), str1.c_str() + str1.size());
- long l2 = col.hash(str2.c_str(), str2.c_str() + str2.size());
- VERIFY( l1 != l2 );
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test04()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- test03();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-
-int main()
-{
- test01();
- test02();
- test03();
- test04();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/collate_members_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/collate_members_wchar_t.cc
deleted file mode 100644
index c59ab329ebd..00000000000
--- a/libstdc++-v3/testsuite/22_locale/collate_members_wchar_t.cc
+++ /dev/null
@@ -1,190 +0,0 @@
-// 2001-08-17 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2001, 2002 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This 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 General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.4.1.1 collate members
-
-#include <locale>
-#include <testsuite_hooks.h>
-
-// XXX This may not work for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-#ifdef _GLIBCPP_USE_WCHAR_T
-void test01()
-{
- using namespace std;
- typedef std::collate<wchar_t>::string_type string_type;
-
- bool test = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_us("en_US");
- locale loc_fr("fr_FR");
- locale loc_de("de_DE");
- VERIFY( loc_c != loc_de );
- VERIFY( loc_us != loc_fr );
- VERIFY( loc_us != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the collate facets
- const collate<wchar_t>& coll_c = use_facet<collate<wchar_t> >(loc_c);
- const collate<wchar_t>& coll_us = use_facet<collate<wchar_t> >(loc_us);
- const collate<wchar_t>& coll_fr = use_facet<collate<wchar_t> >(loc_fr);
- const collate<wchar_t>& coll_de = use_facet<collate<wchar_t> >(loc_de);
-
- // int compare(const charT*, const charT*, const charT*, const charT*) const
- // long hash(const charT*, const charT*) cosnt
- // string_type transform(const charT*, const charT*) const
-
- // Check "C" locale.
- const wchar_t* strlit1 = L"monkey picked tikuanyin oolong";
- const wchar_t* strlit2 = L"imperial tea court green oolong";
-
- int i1;
- int size1 = char_traits<wchar_t>::length(strlit1) - 1;
- i1 = coll_c.compare(strlit1, strlit1 + size1, strlit1, strlit1 + 7);
- VERIFY ( i1 == 1 );
- i1 = coll_c.compare(strlit1, strlit1 + 7, strlit1, strlit1 + size1);
- VERIFY ( i1 == -1 );
- i1 = coll_c.compare(strlit1, strlit1 + 7, strlit1, strlit1 + 7);
- VERIFY ( i1 == 0 );
-
- int i2;
- int size2 = char_traits<wchar_t>::length(strlit2) - 1;
- i2 = coll_c.compare(strlit2, strlit2 + size2, strlit2, strlit2 + 13);
- VERIFY ( i2 == 1 );
- i2 = coll_c.compare(strlit2, strlit2 + 13, strlit2, strlit2 + size2);
- VERIFY ( i2 == -1 );
- i2 = coll_c.compare(strlit2, strlit2 + size2, strlit2, strlit2 + size2);
- VERIFY ( i2 == 0 );
-
- long l1;
- long l2;
- l1 = coll_c.hash(strlit1, strlit1 + size1);
- l2 = coll_c.hash(strlit1, strlit1 + size1 - 1);
- VERIFY ( l1 != l2 );
- l1 = coll_c.hash(strlit1, strlit1 + size1);
- l2 = coll_c.hash(strlit2, strlit2 + size2);
- VERIFY ( l1 != l2 );
-
- wstring str1 = coll_c.transform(strlit1, strlit1 + size1);
- wstring str2 = coll_c.transform(strlit2, strlit2 + size2);
- i1 = str1.compare(str2);
- i2 = coll_c.compare(strlit1, strlit1 + size1, strlit2, strlit2 + size2);
- VERIFY ( i2 == 1 );
- VERIFY ( i1 * i2 > 0 );
-
- // Check German "de_DE" locale.
- const wchar_t* strlit3 = L"Äuglein Augment"; // "C" == "Augment Äuglein"
- const wchar_t* strlit4 = L"Base baß Baß Bast"; // "C" == "Base baß Baß Bast"
-
- int size3 = char_traits<wchar_t>::length(strlit3) - 1;
- i1 = coll_de.compare(strlit3, strlit3 + size3, strlit3, strlit3 + 7);
- VERIFY ( i1 == 1 );
- i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + size1);
- VERIFY ( i1 == -1 );
- i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + 7);
- VERIFY ( i1 == 0 );
-
- i1 = coll_de.compare(strlit3, strlit3 + 6, strlit3 + 8, strlit3 + 14);
- VERIFY ( i1 == -1 );
-
- int size4 = char_traits<wchar_t>::length(strlit4) - 1;
- i2 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + 13);
- VERIFY ( i2 == 1 );
- i2 = coll_de.compare(strlit4, strlit4 + 13, strlit4, strlit4 + size4);
- VERIFY ( i2 == -1 );
- i2 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + size4);
- VERIFY ( i2 == 0 );
-
- l1 = coll_de.hash(strlit3, strlit3 + size3);
- l2 = coll_de.hash(strlit3, strlit3 + size3 - 1);
- VERIFY ( l1 != l2 );
- l1 = coll_de.hash(strlit3, strlit3 + size3);
- l2 = coll_de.hash(strlit4, strlit4 + size4);
- VERIFY ( l1 != l2 );
-
- wstring str3 = coll_de.transform(strlit3, strlit3 + size3);
- wstring str4 = coll_de.transform(strlit4, strlit4 + size4);
- i1 = str3.compare(str4);
- i2 = coll_de.compare(strlit3, strlit3 + size3, strlit4, strlit4 + size4);
- VERIFY ( i2 == -1 );
- VERIFY ( i1 * i2 > 0 );
-}
-
-// libstdc++/5280
-void test02()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-void test03()
-{
- bool test = true;
- std::wstring str1(L"fffff");
- std::wstring str2(L"ffffffffffff");
-
- const std::locale cloc = std::locale::classic();
- const std::collate<wchar_t> &col = std::use_facet<std::collate<wchar_t> >(cloc);
-
- long l1 = col.hash(str1.c_str(), str1.c_str() + str1.size());
- long l2 = col.hash(str2.c_str(), str2.c_str() + str2.size());
- VERIFY( l1 != l2 );
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test04()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- test03();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-#endif
-
-int main()
-{
-#if _GLIBCPP_USE_WCHAR_T
- test01();
- test02();
- test03();
- test04();
-#endif
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype.cc b/libstdc++-v3/testsuite/22_locale/ctype/1.cc
index b13fe231489..541f2b9c237 100644
--- a/libstdc++-v3/testsuite/22_locale/ctype.cc
+++ b/libstdc++-v3/testsuite/22_locale/ctype/1.cc
@@ -1,6 +1,7 @@
+// { dg-do compile }
// 1999-08-24 bkoz
-// Copyright (C) 2000, 1999 Free Software Foundation
+// Copyright (C) 1999, 2000, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -20,8 +21,6 @@
// 22.2.1 The ctype category
-// { dg-do compile }
-
// 1: Test that the locale headers are picking up the correct declaration
// of the internal type `ctype_base::mask'.
int mask ();
@@ -155,21 +154,8 @@ test01()
m01 ^= m02;
}
-class gnu_obj
-{ };
-
-class gnu_ctype2: public std::ctype<gnu_obj>
-{ };
-
-// libstdc++/3017
-void test02()
-{
- gnu_ctype2 obj;
-}
-
int main()
{
test01();
- test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/2.cc b/libstdc++-v3/testsuite/22_locale/ctype/2.cc
new file mode 100644
index 00000000000..924efddedba
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/2.cc
@@ -0,0 +1,43 @@
+// { dg-do compile }
+// 1999-08-24 bkoz
+
+// Copyright (C) 1999, 2000, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.1 The ctype category
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+class gnu_obj
+{ };
+
+class gnu_ctype2: public std::ctype<gnu_obj>
+{ };
+
+// libstdc++/3017
+void test02()
+{
+ gnu_ctype2 obj;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_members_char.cc b/libstdc++-v3/testsuite/22_locale/ctype/cons/char/1.cc
index 54fc5d3e91d..65fc62667d5 100644
--- a/libstdc++-v3/testsuite/22_locale/ctype_members_char.cc
+++ b/libstdc++-v3/testsuite/22_locale/ctype/cons/char/1.cc
@@ -1,6 +1,6 @@
// 2000-02-16 bkoz
-// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -37,11 +37,31 @@ class comma_ctype: public std::ctype<char>
{
public:
comma_ctype(): std::ctype<char>() { }
- static void get_table()
- { classic_table(); }
-};
+ comma_ctype(const std::ctype_base::mask* m): std::ctype<char>(m) { }
+
+ const mask*
+ get_classic_table()
+ { return std::ctype<char>::classic_table(); }
+
+ const mask*
+ get_table()
+ { return this->table(); }
+};
+
+void test01()
+{
+ using namespace std;
+
+ comma_ctype obj;
+ const ctype_base::mask* tmp = obj.get_classic_table();
+
+ comma_ctype obj2(tmp);
+ const ctype_base::mask* ctable = obj2.get_table();
+ VERIFY ( tmp = ctable );
+}
int main()
{
+ test01();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/cons/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/cons/char/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/cons/char/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/cons/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/cons/char/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/cons/char/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_is_char.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/char/1.cc
index 1b97b4aac2f..8e80fd2fb96 100644
--- a/libstdc++-v3/testsuite/22_locale/ctype_is_char.cc
+++ b/libstdc++-v3/testsuite/22_locale/ctype/is/char/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -28,12 +28,8 @@
// 22.2.1.3.2 ctype<char> members
#include <locale>
-#include <vector>
#include <testsuite_hooks.h>
-// XXX This test (test02) is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
typedef char char_type;
class gnu_ctype: public std::ctype<char_type> { };
@@ -147,129 +143,8 @@ void test01()
VERIFY( gctype.is(m02[8], cc0[8]) );
}
-// libstdc++/4456, libstdc++/4457, libstdc++/4458
-void test02()
-{
- using namespace std;
- typedef ctype_base::mask mask;
- typedef vector<mask> vector_type;
-
- bool test = true;
-
- // const int max = numeric_limits<char>::max();
- const int max = 255;
- const int ctype_mask_max = 10;
- vector_type v_c(max);
- vector_type v_de(max);
-
- // "C"
- locale loc_c = locale::classic();
- const ctype<char>& ctype_c = use_facet<ctype<char> >(loc_c);
- for (int i = 0; i < max; ++i)
- {
- char_type c = static_cast<char>(i);
- mask mask_test = static_cast<mask>(0);
- mask mask_is = static_cast<mask>(0);
- for (int j = 0; j <= ctype_mask_max; ++j)
- {
- mask_test = static_cast<mask>(1 << j);
- if (ctype_c.is(mask_test, c))
- mask_is |= mask_test;
- }
- v_c[i] = mask_is;
- }
-
- // "de_DE"
- locale loc_de("de_DE");
- const ctype<char>& ctype_de = use_facet<ctype<char> >(loc_de);
- for (int i = 0; i < max; ++i)
- {
- char_type c = static_cast<char>(i);
- mask mask_test = static_cast<mask>(0);
- mask mask_is = static_cast<mask>(0);
- for (int j = 0; j <= ctype_mask_max; ++j)
- {
- mask_test = static_cast<mask>(1 << j);
- if (ctype_de.is(mask_test, c))
- mask_is |= mask_test;
- }
- v_de[i] = mask_is;
- }
-
-#if QUANNUM_VERBOSE_LYRICALLY_ADEPT_BAY_AREA_MCS_MODE
- for (int i = 0; i < max; ++i)
- {
- char_type mark = v_c[i] == v_de[i] ? ' ' : '-';
- cout << i << ' ' << mark << ' ' << static_cast<char>(i) << '\t' ;
- cout << "v_c: " << setw(4) << v_c[i] << '\t';
- cout << "v_de: " << setw(4) << v_de[i] << endl;
- }
- cout << (v_c == v_de) << endl;
-#endif
-
- VERIFY( v_c != v_de );
-}
-
-// Per Liboriussen <liborius@stofanet.dk>
-void test03()
-{
- bool test = true;
- std::ctype_base::mask maskdata[256];
- for (int i = 0; i < 256; ++i)
- maskdata[i] = std::ctype_base::alpha;
- std::ctype<char>* f = new std::ctype<char>(maskdata);
- std::locale global;
- std::locale loc(global, f);
- for (int i = 0; i < 256; ++i)
- {
- char_type ch = i;
- VERIFY( std::isalpha(ch, loc) );
- }
-}
-
-// libstdc++/5280
-void test04()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- test02();
- test03();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test05()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- test02();
- test03();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-
int main()
{
test01();
- test02();
- test03();
- test04();
- test05();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/char/2.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/char/2.cc
new file mode 100644
index 00000000000..6e54ab89127
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/is/char/2.cc
@@ -0,0 +1,104 @@
+// { dg-do run { xfail *-*-![linux]* } }
+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 22.2.1.3.2 ctype<char> members
+
+#include <locale>
+#include <vector>
+#include <testsuite_hooks.h>
+
+typedef char char_type;
+
+// libstdc++/4456, libstdc++/4457, libstdc++/4458
+void test02()
+{
+ using namespace std;
+ typedef ctype_base::mask mask;
+ typedef vector<mask> vector_type;
+
+ bool test = true;
+
+ // const int max = numeric_limits<char>::max();
+ const int max = 255;
+ const int ctype_mask_max = 10;
+ vector_type v_c(max);
+ vector_type v_de(max);
+
+ // "C"
+ locale loc_c = locale::classic();
+ const ctype<char>& ctype_c = use_facet<ctype<char> >(loc_c);
+ for (int i = 0; i < max; ++i)
+ {
+ char_type c = static_cast<char>(i);
+ mask mask_test = static_cast<mask>(0);
+ mask mask_is = static_cast<mask>(0);
+ for (int j = 0; j <= ctype_mask_max; ++j)
+ {
+ mask_test = static_cast<mask>(1 << j);
+ if (ctype_c.is(mask_test, c))
+ mask_is |= mask_test;
+ }
+ v_c[i] = mask_is;
+ }
+
+ // "de_DE"
+ locale loc_de("de_DE");
+ const ctype<char>& ctype_de = use_facet<ctype<char> >(loc_de);
+ for (int i = 0; i < max; ++i)
+ {
+ char_type c = static_cast<char>(i);
+ mask mask_test = static_cast<mask>(0);
+ mask mask_is = static_cast<mask>(0);
+ for (int j = 0; j <= ctype_mask_max; ++j)
+ {
+ mask_test = static_cast<mask>(1 << j);
+ if (ctype_de.is(mask_test, c))
+ mask_is |= mask_test;
+ }
+ v_de[i] = mask_is;
+ }
+
+#if QUANNUM_VERBOSE_LYRICALLY_ADEPT_BAY_AREA_MCS_MODE
+ for (int i = 0; i < max; ++i)
+ {
+ char_type mark = v_c[i] == v_de[i] ? ' ' : '-';
+ cout << i << ' ' << mark << ' ' << static_cast<char>(i) << '\t' ;
+ cout << "v_c: " << setw(4) << v_c[i] << '\t';
+ cout << "v_de: " << setw(4) << v_de[i] << endl;
+ }
+ cout << (v_c == v_de) << endl;
+#endif
+
+ VERIFY( v_c != v_de );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/char/wrapped_env.cc
new file mode 100644
index 00000000000..3f042d9ec42
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/is/char/wrapped_env.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_is_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/1.cc
index 5ca171b51e8..ff115d2cdbe 100644
--- a/libstdc++-v3/testsuite/22_locale/ctype_is_wchar_t.cc
+++ b/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -28,13 +28,8 @@
// 22.2.1.3.2 ctype<char> members
#include <locale>
-#include <vector>
#include <testsuite_hooks.h>
-// XXX This test (test02) is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-#ifdef _GLIBCPP_USE_WCHAR_T
typedef wchar_t char_type;
class gnu_ctype: public std::ctype<char_type> { };
@@ -117,12 +112,6 @@ void test01()
VERIFY( m01[1] == m00 );
VERIFY( m01[2] == m00 );
- cc0 = strlit00;
- m01[0] = m00;
- m01[1] = m00;
- m01[2] = m00;
- cc2 = gctype.is(cc0, cc0 + 3, m01);
- VERIFY( cc2 == strlit00 + 3);
#if 0
VERIFY( m01[0] != m00 );
VERIFY( m01[1] != m00 );
@@ -152,46 +141,8 @@ void test01()
#endif
}
-// libstdc++/5280
-void test04()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test05()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-#endif
-
int main()
{
-#ifdef _GLIBCPP_USE_WCHAR_T
test01();
- test04();
- test05();
-#endif
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/2.cc
new file mode 100644
index 00000000000..b1b565f3780
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/2.cc
@@ -0,0 +1,104 @@
+// { dg-do run { xfail *-*-![linux]* } }
+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 22.2.1.3.2 ctype<char> members
+
+#include <locale>
+#include <vector>
+#include <testsuite_hooks.h>
+
+typedef wchar_t char_type;
+
+// libstdc++/4456, libstdc++/4457, libstdc++/4458
+void test02()
+{
+ using namespace std;
+ typedef ctype_base::mask mask;
+ typedef vector<mask> vector_type;
+
+ bool test = true;
+
+ // const int max = numeric_limits<char>::max();
+ const int max = 255;
+ const int ctype_mask_max = 10;
+ vector_type v_c(max);
+ vector_type v_de(max);
+
+ // "C"
+ locale loc_c = locale::classic();
+ const ctype<wchar_t>& ctype_c = use_facet<ctype<wchar_t> >(loc_c);
+ for (int i = 0; i < max; ++i)
+ {
+ char_type c = static_cast<wchar_t>(i);
+ mask mask_test = static_cast<mask>(0);
+ mask mask_is = static_cast<mask>(0);
+ for (int j = 0; j <= ctype_mask_max; ++j)
+ {
+ mask_test = static_cast<mask>(1 << j);
+ if (ctype_c.is(mask_test, c))
+ mask_is |= mask_test;
+ }
+ v_c[i] = mask_is;
+ }
+
+ // "de_DE"
+ locale loc_de("de_DE");
+ const ctype<wchar_t>& ctype_de = use_facet<ctype<wchar_t> >(loc_de);
+ for (int i = 0; i < max; ++i)
+ {
+ char_type c = static_cast<wchar_t>(i);
+ mask mask_test = static_cast<mask>(0);
+ mask mask_is = static_cast<mask>(0);
+ for (int j = 0; j <= ctype_mask_max; ++j)
+ {
+ mask_test = static_cast<mask>(1 << j);
+ if (ctype_de.is(mask_test, c))
+ mask_is |= mask_test;
+ }
+ v_de[i] = mask_is;
+ }
+
+#if QUANNUM_VERBOSE_LYRICALLY_ADEPT_BAY_AREA_MCS_MODE
+ for (int i = 0; i < max; ++i)
+ {
+ char_type mark = v_c[i] == v_de[i] ? ' ' : '-';
+ cout << i << ' ' << mark << ' ' << static_cast<wchar_t>(i) << '\t' ;
+ cout << "v_c: " << setw(4) << v_c[i] << '\t';
+ cout << "v_de: " << setw(4) << v_de[i] << endl;
+ }
+ cout << (v_c == v_de) << endl;
+#endif
+
+ VERIFY( v_c != v_de );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..4f1d5e3f6a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/wrapped_env.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..8d7871815db
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/wrapped_locale.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/1.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/1.cc
new file mode 100644
index 00000000000..b349a38aedd
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/1.cc
@@ -0,0 +1,69 @@
+// 2002-05-24 bkoz
+
+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 22.2.1.3.2 ctype<char> members
+
+#include <locale>
+#include <vector>
+#include <testsuite_hooks.h>
+
+// libstdc++/6701
+void test01()
+{
+ using namespace std;
+ typedef char wide_type;
+
+ bool test = true;
+ const char dfault = '?';
+ const locale loc_c = locale::classic();
+ const ctype<wide_type>& ctype_c = use_facet<ctype<wide_type> >(loc_c);
+
+ basic_string<wide_type> wide("wibble");
+ basic_string<char> narrow("wibble");
+ vector<char> narrow_chars(wide.length() + 1);
+
+ // narrow(charT c, char dfault) const
+ for (int i = 0; i < wide.length(); ++i)
+ {
+ char c = ctype_c.narrow(wide[i], dfault);
+ VERIFY( c == narrow[i] );
+ }
+
+ // narrow(const charT* low, const charT* high, char dfault, char* dest) const
+ ctype_c.narrow(&wide[0], &wide[wide.length()], dfault, &narrow_chars[0]);
+ VERIFY( narrow_chars[0] != dfault );
+ for (int i = 0; i < wide.length(); ++i)
+ VERIFY( narrow_chars[i] == narrow[i] );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_narrow_char.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/2.cc
index cfbc49db72b..31805ae1ecc 100644
--- a/libstdc++-v3/testsuite/22_locale/ctype_narrow_char.cc
+++ b/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/2.cc
@@ -1,6 +1,6 @@
// 2002-05-24 bkoz
-// Copyright (C) 2002 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -33,35 +33,6 @@
#include <vector>
#include <testsuite_hooks.h>
-// libstdc++/6701
-void test01()
-{
- using namespace std;
- typedef char wide_type;
-
- bool test = true;
- const char dfault = '?';
- const locale loc_c = locale::classic();
- const ctype<wide_type>& ctype_c = use_facet<ctype<wide_type> >(loc_c);
-
- basic_string<wide_type> wide("wibble");
- basic_string<char> narrow("wibble");
- vector<char> narrow_chars(wide.length() + 1);
-
- // narrow(charT c, char dfault) const
- for (int i = 0; i < wide.length(); ++i)
- {
- char c = ctype_c.narrow(wide[i], dfault);
- VERIFY( c == narrow[i] );
- }
-
- // narrow(const charT* low, const charT* high, char dfault, char* dest) const
- ctype_c.narrow(&wide[0], &wide[wide.length()], dfault, &narrow_chars[0]);
- VERIFY( narrow_chars[0] != dfault );
- for (int i = 0; i < wide.length(); ++i)
- VERIFY( narrow_chars[i] == narrow[i] );
-}
-
void test02()
{
using namespace std;
@@ -97,7 +68,6 @@ void test02()
int main()
{
- test01();
test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/wrapped_env.cc
new file mode 100644
index 00000000000..4f1d5e3f6a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/wrapped_env.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/wrapped_locale.cc
new file mode 100644
index 00000000000..8d7871815db
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/wrapped_locale.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/1.cc
new file mode 100644
index 00000000000..820fe6c99bc
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/1.cc
@@ -0,0 +1,69 @@
+// 2002-05-24 bkoz
+
+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 22.2.1.3.2 ctype<char> members
+
+#include <locale>
+#include <vector>
+#include <testsuite_hooks.h>
+
+// libstdc++/6701
+void test01()
+{
+ using namespace std;
+ typedef wchar_t wide_type;
+
+ bool test = true;
+ const char dfault = '?';
+ const locale loc_c = locale::classic();
+ const ctype<wide_type>& ctype_c = use_facet<ctype<wide_type> >(loc_c);
+
+ basic_string<wide_type> wide(L"wibble");
+ basic_string<char> narrow("wibble");
+ vector<char> narrow_chars(wide.length() + 1);
+
+ // narrow(charT c, char dfault) const
+ for (int i = 0; i < wide.length(); ++i)
+ {
+ char c = ctype_c.narrow(wide[i], dfault);
+ VERIFY( c == narrow[i] );
+ }
+
+ // narrow(const charT* low, const charT* high, char dfault, char* dest) const
+ ctype_c.narrow(&wide[0], &wide[wide.length()], dfault, &narrow_chars[0]);
+ VERIFY( narrow_chars[0] != dfault );
+ for (int i = 0; i < wide.length(); ++i)
+ VERIFY( narrow_chars[i] == narrow[i] );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_narrow_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/2.cc
index 18745b9e3a4..2d7750629b1 100644
--- a/libstdc++-v3/testsuite/22_locale/ctype_narrow_wchar_t.cc
+++ b/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/2.cc
@@ -1,6 +1,6 @@
// 2002-05-24 bkoz
-// Copyright (C) 2002 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -33,36 +33,6 @@
#include <vector>
#include <testsuite_hooks.h>
-#ifdef _GLIBCPP_USE_WCHAR_T
-// libstdc++/6701
-void test01()
-{
- using namespace std;
- typedef wchar_t wide_type;
-
- bool test = true;
- const char dfault = '?';
- const locale loc_c = locale::classic();
- const ctype<wide_type>& ctype_c = use_facet<ctype<wide_type> >(loc_c);
-
- basic_string<wide_type> wide(L"wibble");
- basic_string<char> narrow("wibble");
- vector<char> narrow_chars(wide.length() + 1);
-
- // narrow(charT c, char dfault) const
- for (int i = 0; i < wide.length(); ++i)
- {
- char c = ctype_c.narrow(wide[i], dfault);
- VERIFY( c == narrow[i] );
- }
-
- // narrow(const charT* low, const charT* high, char dfault, char* dest) const
- ctype_c.narrow(&wide[0], &wide[wide.length()], dfault, &narrow_chars[0]);
- VERIFY( narrow_chars[0] != dfault );
- for (int i = 0; i < wide.length(); ++i)
- VERIFY( narrow_chars[i] == narrow[i] );
-}
-
void test02()
{
using namespace std;
@@ -95,13 +65,9 @@ void test02()
for (int i = 0; i < wide.length(); ++i)
VERIFY( narrow_chars[i] == narrow[i] );
}
-#endif
int main()
{
-#ifdef _GLIBCPP_USE_WCHAR_T
- test01();
test02();
-#endif
- return 0;
+ return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..4f1d5e3f6a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/wrapped_env.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..8d7871815db
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/wrapped_locale.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_scan_char.cc b/libstdc++-v3/testsuite/22_locale/ctype/scan/char/1.cc
index 6e8d1d31e26..6e8d1d31e26 100644
--- a/libstdc++-v3/testsuite/22_locale/ctype_scan_char.cc
+++ b/libstdc++-v3/testsuite/22_locale/ctype/scan/char/1.cc
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/scan/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/scan/char/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/scan/char/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/scan/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/scan/char/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/scan/char/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_scan_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/ctype/scan/wchar_t/1.cc
index 7af4fae26b2..7af4fae26b2 100644
--- a/libstdc++-v3/testsuite/22_locale/ctype_scan_wchar_t.cc
+++ b/libstdc++-v3/testsuite/22_locale/ctype/scan/wchar_t/1.cc
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/scan/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/scan/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/scan/wchar_t/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_to_char.cc b/libstdc++-v3/testsuite/22_locale/ctype/to/char/1.cc
index ed350955572..a337d8e5ed4 100644
--- a/libstdc++-v3/testsuite/22_locale/ctype_to_char.cc
+++ b/libstdc++-v3/testsuite/22_locale/ctype/to/char/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -98,43 +98,8 @@ void test01()
VERIFY( !std::char_traits<char_type>::compare(c_array, strlit02, len - 1) );
}
-// libstdc++/5280
-void test04()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test05()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-
int main()
{
test01();
- test04();
- test05();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/to/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/to/char/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/to/char/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/to/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/to/char/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/to/char/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_to_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/1.cc
index 52180356a0a..9f042abc438 100644
--- a/libstdc++-v3/testsuite/22_locale/ctype_to_wchar_t.cc
+++ b/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -30,7 +30,6 @@
#include <locale>
#include <testsuite_hooks.h>
-#ifdef _GLIBCPP_USE_WCHAR_T
typedef wchar_t char_type;
class gnu_ctype: public std::ctype<char_type> { };
@@ -99,46 +98,8 @@ void test01()
VERIFY( !std::char_traits<char_type>::compare(c_array, strlit02, len - 1) );
}
-// libstdc++/5280
-void test04()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test05()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-#endif
-
int main()
{
-#ifdef _GLIBCPP_USE_WCHAR_T
test01();
- test04();
- test05();
-#endif
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_widen_char.cc b/libstdc++-v3/testsuite/22_locale/ctype/widen/char/1.cc
index ea206059bfb..ea206059bfb 100644
--- a/libstdc++-v3/testsuite/22_locale/ctype_widen_char.cc
+++ b/libstdc++-v3/testsuite/22_locale/ctype/widen/char/1.cc
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/widen/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/widen/char/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/widen/char/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/widen/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/widen/char/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/widen/char/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_widen_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/1.cc
index d07a58d2201..e0b33155bb9 100644
--- a/libstdc++-v3/testsuite/22_locale/ctype_widen_wchar_t.cc
+++ b/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/1.cc
@@ -1,6 +1,6 @@
// 2002-05-24 bkoz
-// Copyright (C) 2002 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -33,7 +33,6 @@
#include <vector>
#include <testsuite_hooks.h>
-#ifdef _GLIBCPP_USE_WCHAR_T
void test01()
{
using namespace std;
@@ -60,12 +59,9 @@ void test01()
for (int i = 0; i < narrow.length(); ++i)
VERIFY( wide_chars[i] == wide[i] );
}
-#endif
int main()
{
-#ifdef _GLIBCPP_USE_WCHAR_T
test01();
-#endif
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_members_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/ctype_members_wchar_t.cc
deleted file mode 100644
index 31b1bcbf160..00000000000
--- a/libstdc++-v3/testsuite/22_locale/ctype_members_wchar_t.cc
+++ /dev/null
@@ -1,49 +0,0 @@
-// 2000-09-01 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This 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 General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// 22.2.1.3.2 ctype<char> members
-
-#include <locale>
-#include <testsuite_hooks.h>
-
-#if _GLIBCPP_USE_WCHAR_T
-void test01()
-{
- // Nothing, right now.
-}
-#endif /* !defined(_GLIBCPP_USE_WCHAR_T) */
-
-int main()
-{
-#if _GLIBCPP_USE_WCHAR_T
- test01();
-#endif
-
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/facet.cc b/libstdc++-v3/testsuite/22_locale/facet/1.cc
index 9c613b4c203..f93265bd7d1 100644
--- a/libstdc++-v3/testsuite/22_locale/facet.cc
+++ b/libstdc++-v3/testsuite/22_locale/facet/1.cc
@@ -1,6 +1,6 @@
// 2000-08-31 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2000, 2002 Free Software Foundation
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -234,69 +234,8 @@ void test01()
}
}
-// Static counter for use in checking ctors/dtors.
-static std::size_t counter;
-
-class surf : public std::locale::facet
-{
-public:
- static std::locale::id id;
- surf(size_t refs = 0): std::locale::facet(refs) { ++counter; }
- ~surf() { --counter; }
-};
-
-std::locale::id surf::id;
-
-typedef surf facet_type;
-
-void test02()
-{
- using namespace std;
- bool test = true;
-
- // 1: Destroyed when out of scope.
- VERIFY( counter == 0 );
- {
- locale loc01(locale::classic(), new facet_type);
- VERIFY( counter == 1 );
- }
- VERIFY( counter == 0 );
-
- // 2: Not destroyed when out of scope, deliberately leaked.
- VERIFY( counter == 0 );
- {
- // Default refs argument is zero.
- locale loc02(locale::classic(), new facet_type(1));
- VERIFY( counter == 1 );
- }
- VERIFY( counter == 1 );
-
- // 3: Pathological.
- counter = 0;
- {
- // Test bounds.
- facet_type* f = new facet_type(numeric_limits<size_t>::max());
- VERIFY( counter == 1 );
- // Add a reference.
- locale loc01(locale::classic(), f);
- {
- // Add another reference...
- locale loc02(locale::classic(), f);
- }
- VERIFY( counter == 1 );
- }
-
- // 4: Named locale should destroy facets when it goes out of scope.
- // Not quite sure how to test for this w/o valgrind at the moment.
- {
- locale loc03("es_MX");
- }
-}
-
int main ()
{
test01();
-
- test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/facet/2.cc b/libstdc++-v3/testsuite/22_locale/facet/2.cc
new file mode 100644
index 00000000000..abda43ec351
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/facet/2.cc
@@ -0,0 +1,94 @@
+// 2000-08-31 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.1.1.1.2 - class locale::facet [lib.locale.facet]
+
+#include <cwchar> // for mbstate_t
+#include <locale>
+#include <stdexcept>
+#include <string>
+#include <iterator>
+#include <limits>
+#include <testsuite_hooks.h>
+
+// Static counter for use in checking ctors/dtors.
+static std::size_t counter;
+
+class surf : public std::locale::facet
+{
+public:
+ static std::locale::id id;
+ surf(size_t refs = 0): std::locale::facet(refs) { ++counter; }
+ ~surf() { --counter; }
+};
+
+std::locale::id surf::id;
+
+typedef surf facet_type;
+
+void test02()
+{
+ using namespace std;
+ bool test = true;
+
+ // 1: Destroyed when out of scope.
+ VERIFY( counter == 0 );
+ {
+ locale loc01(locale::classic(), new facet_type);
+ VERIFY( counter == 1 );
+ }
+ VERIFY( counter == 0 );
+
+ // 2: Not destroyed when out of scope, deliberately leaked.
+ VERIFY( counter == 0 );
+ {
+ // Default refs argument is zero.
+ locale loc02(locale::classic(), new facet_type(1));
+ VERIFY( counter == 1 );
+ }
+ VERIFY( counter == 1 );
+
+ // 3: Pathological.
+ counter = 0;
+ {
+ // Test bounds.
+ facet_type* f = new facet_type(numeric_limits<size_t>::max());
+ VERIFY( counter == 1 );
+ // Add a reference.
+ locale loc01(locale::classic(), f);
+ {
+ // Add another reference...
+ locale loc02(locale::classic(), f);
+ }
+ VERIFY( counter == 1 );
+ }
+
+ // 4: Named locale should destroy facets when it goes out of scope.
+ // Not quite sure how to test for this w/o valgrind at the moment.
+ {
+ locale loc03("es_MX");
+ }
+}
+
+int main ()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/global_templates.cc b/libstdc++-v3/testsuite/22_locale/global_templates/1.cc
index 49886aa18bf..49886aa18bf 100644
--- a/libstdc++-v3/testsuite/22_locale/global_templates.cc
+++ b/libstdc++-v3/testsuite/22_locale/global_templates/1.cc
diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/1.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/1.cc
new file mode 100644
index 00000000000..f95b06e6e4f
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/locale/cons/1.cc
@@ -0,0 +1,39 @@
+// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.1.1.2 locale constructors and destructors [lib.locale.cons]
+
+#include <cwchar> // for mbstate_t
+#include <locale>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void test00()
+{
+ // Should be able to do this as the first thing that happens in a
+ // file and have it not crash.
+ std::locale loc("C");
+}
+
+int main()
+{
+ test00();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctor_copy_dtor.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/2.cc
index 2b26f4a0dab..1f13c23992e 100644
--- a/libstdc++-v3/testsuite/22_locale/ctor_copy_dtor.cc
+++ b/libstdc++-v3/testsuite/22_locale/locale/cons/2.cc
@@ -1,6 +1,6 @@
// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2000, 2001, 2002 Free Software Foundation
+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -25,13 +25,6 @@
#include <stdexcept>
#include <testsuite_hooks.h>
-void test00()
-{
- // Should be able to do this as the first thing that happens in a
- // file and have it not crash.
- std::locale loc("C");
-}
-
#if _GLIBCPP_USE___ENC_TRAITS
typedef std::codecvt<char, char, std::mbstate_t> c_codecvt;
typedef std::codecvt_byname<char, char, std::mbstate_t> c_codecvt_byname;
@@ -296,213 +289,10 @@ void test01()
}
#endif // _GLIBCPP_USE___ENC_TRAITS
-// libstdc++/7222
-void test02()
-{
- bool test = true;
- std::locale loc_c1("C");
- std::locale loc_c2 ("C");
-
- std::locale loc_1("");
- std::locale loc_2("");
-
- VERIFY( loc_c1 == loc_c2 );
- VERIFY( loc_1 == loc_2 );
-}
-
-// libstdc++/7811
-void test03()
-{
- bool test = true;
-#ifdef _GLIBCPP_HAVE_SETENV
- const char* LC_ALL_orig = getenv("LC_ALL");
- if (!setenv("LC_ALL", "it_IT", 1))
- {
- std::locale loc("");
- VERIFY( loc.name() == "it_IT" );
- setenv("LC_ALL", LC_ALL_orig ? LC_ALL_orig : "", 1);
- }
-#endif
-}
-
-
-// More tests for locale("") == POSIX locale::name.
-void test04()
-{
- bool test = true;
- using namespace std;
-
-#ifdef _GLIBCPP_HAVE_SETENV
-
- const char* LANG_orig = getenv("LANG") ? strdup(getenv("LANG")) : "";
- const char* LC_ALL_orig = getenv("LC_ALL") ? strdup(getenv("LC_ALL")) : "";
- const char* LC_CTYPE_orig =
- getenv("LC_CTYPE") ? strdup(getenv("LC_CTYPE")) : "";
- const char* LC_NUMERIC_orig =
- getenv("LC_NUMERIC") ? strdup(getenv("LC_NUMERIC")) : "";
- const char* LC_TIME_orig =
- getenv("LC_TIME") ? strdup(getenv("LC_TIME")) : "";
- const char* LC_COLLATE_orig =
- getenv("LC_COLLATE") ? strdup(getenv("LC_COLLATE")) : "";
- const char* LC_MONETARY_orig =
- getenv("LC_MONETARY") ? strdup(getenv("LC_MONETARY")) : "";
- const char* LC_MESSAGES_orig =
- getenv("LC_MESSAGES") ? strdup(getenv("LC_MESSAGES")) : "";
-#if _GLIBCPP_NUM_CATEGORIES
- const char* LC_PAPER_orig =
- getenv("LC_PAPER") ? strdup(getenv("LC_PAPER")) : "";
- const char* LC_NAME_orig =
- getenv("LC_NAME") ? strdup(getenv("LC_NAME")) : "";
- const char* LC_ADDRESS_orig =
- getenv("LC_ADDRESS") ? strdup(getenv("LC_ADDRESS")) : "";
- const char* LC_TELEPHONE_orig =
- getenv("LC_TELEPHONE") ? strdup(getenv("LC_TELEPHONE")) : "";
- const char* LC_MEASUREMENT_orig =
- getenv("LC_MEASUREMENT") ? strdup(getenv("LC_MEASUREMENT")) : "";
- const char* LC_IDENTIFICATION_orig =
- getenv("LC_IDENTIFICATION") ? strdup(getenv("LC_IDENTIFICATION")) : "";
-#endif
-
- // Check that a "POSIX" LC_ALL is equivalent to "C".
- if (!setenv("LC_ALL", "POSIX", 1))
- {
- locale loc("");
- VERIFY( loc.name() == "C" );
- }
- setenv("LC_ALL", "", 1);
-
- // Check that a "en_PH" LC_ALL is equivalent to "en_PH".
- if (!setenv("LC_ALL", "en_PH", 1))
- {
- locale loc("");
- VERIFY( loc.name() == "en_PH" );
- }
- setenv("LC_ALL", "", 1);
-
- // Explicit check that LC_ALL sets regardless of LC_* and LANG.
- if (!setenv("LANG", "es_MX", 1) && !setenv("LC_COLLATE", "de_DE", 1))
- {
- if (!setenv("LC_ALL", "en_PH", 1))
- {
- locale loc("");
- VERIFY( loc.name() == "en_PH" );
- }
- setenv("LC_ALL", "", 1);
- setenv("LANG", LANG_orig ? LANG_orig : "", 1);
- setenv("LC_COLLATE", LC_COLLATE_orig ? LC_COLLATE_orig : "", 1);
- }
-
- // NB: LANG checks all LC_* macro settings. As such, all LC_* macros
- // must be cleared for these tests, and then restored.
- setenv("LC_ALL", "", 1);
- setenv("LC_CTYPE", "", 1);
- setenv("LC_NUMERIC", "", 1);
- setenv("LC_TIME", "", 1);
- setenv("LC_COLLATE", "", 1);
- setenv("LC_MONETARY", "", 1);
- setenv("LC_MESSAGES", "", 1);
-#if _GLIBCPP_NUM_CATEGORIES
- setenv("LC_PAPER", "", 1);
- setenv("LC_NAME", "", 1);
- setenv("LC_ADDRESS", "", 1);
- setenv("LC_TELEPHONE", "", 1);
- setenv("LC_MEASUREMENT", "", 1);
- setenv("LC_IDENTIFICATION", "", 1);
-#endif
-
- // Check the default set by LANG.
- if (!setenv("LANG", "fr_FR", 1))
- {
- locale loc("");
- VERIFY( loc.name() == "fr_FR" );
- }
-
- // Check that a "POSIX" LANG is equivalent to "C".
- if (!setenv("LANG", "POSIX", 1))
- {
- locale loc("");
- VERIFY( loc.name() == "C" );
- }
-
- // Setting a category in the "C" default.
- if (!setenv("LC_COLLATE", "de_DE", 1))
- {
- locale loc("");
-
-#if _GLIBCPP_NUM_CATEGORIES
- VERIFY( loc.name() == "LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=C;"
- "LC_COLLATE=de_DE;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;"
- "LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;"
- "LC_IDENTIFICATION=C" );
-#else
- VERIFY( loc.name() == "LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=C;"
- "LC_COLLATE=de_DE;LC_MONETARY=C;LC_MESSAGES=C" );
-#endif
- }
-
- // Changing the LANG default while LC_COLLATE is set.
- if (!setenv("LANG", "fr_FR", 1))
- {
- locale loc("");
-#if _GLIBCPP_NUM_CATEGORIES
- VERIFY( loc.name() == "LC_CTYPE=fr_FR;LC_NUMERIC=fr_FR;"
- "LC_TIME=fr_FR;LC_COLLATE=de_DE;LC_MONETARY=fr_FR;"
- "LC_MESSAGES=fr_FR;LC_PAPER=fr_FR;LC_NAME=fr_FR;"
- "LC_ADDRESS=fr_FR;LC_TELEPHONE=fr_FR;LC_MEASUREMENT=fr_FR;"
- "LC_IDENTIFICATION=fr_FR" );
-#else
- VERIFY( loc.name() == "LC_CTYPE=fr_FR;LC_NUMERIC=fr_FR;"
- "LC_TIME=fr_FR;LC_COLLATE=de_DE;LC_MONETARY=fr_FR;"
- "LC_MESSAGES=fr_FR" );
-#endif
- }
-
- // Changing another (C only) category.
-#if _GLIBCPP_NUM_CATEGORIES
- if (!setenv("LC_IDENTIFICATION", "it_IT", 1))
- {
- locale loc("");
- VERIFY( loc.name() == "LC_CTYPE=fr_FR;LC_NUMERIC=fr_FR;"
- "LC_TIME=fr_FR;LC_COLLATE=de_DE;LC_MONETARY=fr_FR;"
- "LC_MESSAGES=fr_FR;LC_PAPER=fr_FR;LC_NAME=fr_FR;"
- "LC_ADDRESS=fr_FR;LC_TELEPHONE=fr_FR;LC_MEASUREMENT=fr_FR;"
- "LC_IDENTIFICATION=it_IT" );
- }
-#endif
-
- // Restore the environment.
- setenv("LANG", LANG_orig ? LANG_orig : "", 1);
- setenv("LC_ALL", LC_ALL_orig ? LC_ALL_orig : "", 1);
- setenv("LC_CTYPE", LC_CTYPE_orig ? LC_CTYPE_orig : "", 1);
- setenv("LC_NUMERIC", LC_NUMERIC_orig ? LC_NUMERIC_orig : "", 1);
- setenv("LC_TIME", LC_TIME_orig ? LC_TIME_orig : "", 1);
- setenv("LC_COLLATE", LC_COLLATE_orig ? LC_COLLATE_orig : "", 1);
- setenv("LC_MONETARY", LC_MONETARY_orig ? LC_MONETARY_orig : "", 1);
- setenv("LC_MESSAGES", LC_MESSAGES_orig ? LC_MESSAGES_orig : "", 1);
-#if _GLIBCPP_NUM_CATEGORIES
- setenv("LC_PAPER", LC_PAPER_orig ? LC_PAPER_orig : "", 1);
- setenv("LC_NAME", LC_NAME_orig ? LC_NAME_orig : "", 1);
- setenv("LC_ADDRESS", LC_ADDRESS_orig ? LC_ADDRESS_orig : "", 1);
- setenv("LC_TELEPHONE", LC_TELEPHONE_orig ? LC_TELEPHONE_orig : "", 1);
- setenv("LC_MEASUREMENT", LC_MEASUREMENT_orig ? LC_MEASUREMENT_orig : "", 1);
- setenv("LC_IDENTIFICATION",
- LC_IDENTIFICATION_orig ? LC_IDENTIFICATION_orig : "", 1);
-#endif
-
-#endif
-}
-
int main()
{
- test00();
-
#if _GLIBCPP_USE___ENC_TRAITS
test01();
#endif
-
- test02();
- test03();
- test04();
-
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/3.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/3.cc
new file mode 100644
index 00000000000..7cc91261c98
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/locale/cons/3.cc
@@ -0,0 +1,46 @@
+// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.1.1.2 locale constructors and destructors [lib.locale.cons]
+
+#include <cwchar> // for mbstate_t
+#include <locale>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+// libstdc++/7222
+void test02()
+{
+ bool test = true;
+ std::locale loc_c1("C");
+ std::locale loc_c2 ("C");
+
+ std::locale loc_1("");
+ std::locale loc_2("");
+
+ VERIFY( loc_c1 == loc_c2 );
+ VERIFY( loc_1 == loc_2 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/4.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/4.cc
new file mode 100644
index 00000000000..26d3aaf31d1
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/locale/cons/4.cc
@@ -0,0 +1,47 @@
+// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.1.1.2 locale constructors and destructors [lib.locale.cons]
+
+#include <cwchar> // for mbstate_t
+#include <locale>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+// libstdc++/7811
+void test03()
+{
+ bool test = true;
+#ifdef _GLIBCPP_HAVE_SETENV
+ const char* LC_ALL_orig = getenv("LC_ALL");
+ if (!setenv("LC_ALL", "it_IT", 1))
+ {
+ std::locale loc("");
+ VERIFY( loc.name() == "it_IT" );
+ setenv("LC_ALL", LC_ALL_orig ? LC_ALL_orig : "", 1);
+ }
+#endif
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/5.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/5.cc
new file mode 100644
index 00000000000..b9e1391977d
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/locale/cons/5.cc
@@ -0,0 +1,198 @@
+// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.1.1.2 locale constructors and destructors [lib.locale.cons]
+
+#include <cwchar> // for mbstate_t
+#include <locale>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+// More tests for locale("") == POSIX locale::name.
+void test04()
+{
+ bool test = true;
+ using namespace std;
+
+#ifdef _GLIBCPP_HAVE_SETENV
+
+ const char* LANG_orig = getenv("LANG") ? strdup(getenv("LANG")) : "";
+ const char* LC_ALL_orig = getenv("LC_ALL") ? strdup(getenv("LC_ALL")) : "";
+ const char* LC_CTYPE_orig =
+ getenv("LC_CTYPE") ? strdup(getenv("LC_CTYPE")) : "";
+ const char* LC_NUMERIC_orig =
+ getenv("LC_NUMERIC") ? strdup(getenv("LC_NUMERIC")) : "";
+ const char* LC_TIME_orig =
+ getenv("LC_TIME") ? strdup(getenv("LC_TIME")) : "";
+ const char* LC_COLLATE_orig =
+ getenv("LC_COLLATE") ? strdup(getenv("LC_COLLATE")) : "";
+ const char* LC_MONETARY_orig =
+ getenv("LC_MONETARY") ? strdup(getenv("LC_MONETARY")) : "";
+ const char* LC_MESSAGES_orig =
+ getenv("LC_MESSAGES") ? strdup(getenv("LC_MESSAGES")) : "";
+#if _GLIBCPP_NUM_CATEGORIES
+ const char* LC_PAPER_orig =
+ getenv("LC_PAPER") ? strdup(getenv("LC_PAPER")) : "";
+ const char* LC_NAME_orig =
+ getenv("LC_NAME") ? strdup(getenv("LC_NAME")) : "";
+ const char* LC_ADDRESS_orig =
+ getenv("LC_ADDRESS") ? strdup(getenv("LC_ADDRESS")) : "";
+ const char* LC_TELEPHONE_orig =
+ getenv("LC_TELEPHONE") ? strdup(getenv("LC_TELEPHONE")) : "";
+ const char* LC_MEASUREMENT_orig =
+ getenv("LC_MEASUREMENT") ? strdup(getenv("LC_MEASUREMENT")) : "";
+ const char* LC_IDENTIFICATION_orig =
+ getenv("LC_IDENTIFICATION") ? strdup(getenv("LC_IDENTIFICATION")) : "";
+#endif
+
+ // Check that a "POSIX" LC_ALL is equivalent to "C".
+ if (!setenv("LC_ALL", "POSIX", 1))
+ {
+ locale loc("");
+ VERIFY( loc.name() == "C" );
+ }
+ setenv("LC_ALL", "", 1);
+
+ // Check that a "en_PH" LC_ALL is equivalent to "en_PH".
+ if (!setenv("LC_ALL", "en_PH", 1))
+ {
+ locale loc("");
+ VERIFY( loc.name() == "en_PH" );
+ }
+ setenv("LC_ALL", "", 1);
+
+ // Explicit check that LC_ALL sets regardless of LC_* and LANG.
+ if (!setenv("LANG", "es_MX", 1) && !setenv("LC_COLLATE", "de_DE", 1))
+ {
+ if (!setenv("LC_ALL", "en_PH", 1))
+ {
+ locale loc("");
+ VERIFY( loc.name() == "en_PH" );
+ }
+ setenv("LC_ALL", "", 1);
+ setenv("LANG", LANG_orig ? LANG_orig : "", 1);
+ setenv("LC_COLLATE", LC_COLLATE_orig ? LC_COLLATE_orig : "", 1);
+ }
+
+ // NB: LANG checks all LC_* macro settings. As such, all LC_* macros
+ // must be cleared for these tests, and then restored.
+ setenv("LC_ALL", "", 1);
+ setenv("LC_CTYPE", "", 1);
+ setenv("LC_NUMERIC", "", 1);
+ setenv("LC_TIME", "", 1);
+ setenv("LC_COLLATE", "", 1);
+ setenv("LC_MONETARY", "", 1);
+ setenv("LC_MESSAGES", "", 1);
+#if _GLIBCPP_NUM_CATEGORIES
+ setenv("LC_PAPER", "", 1);
+ setenv("LC_NAME", "", 1);
+ setenv("LC_ADDRESS", "", 1);
+ setenv("LC_TELEPHONE", "", 1);
+ setenv("LC_MEASUREMENT", "", 1);
+ setenv("LC_IDENTIFICATION", "", 1);
+#endif
+
+ // Check the default set by LANG.
+ if (!setenv("LANG", "fr_FR", 1))
+ {
+ locale loc("");
+ VERIFY( loc.name() == "fr_FR" );
+ }
+
+ // Check that a "POSIX" LANG is equivalent to "C".
+ if (!setenv("LANG", "POSIX", 1))
+ {
+ locale loc("");
+ VERIFY( loc.name() == "C" );
+ }
+
+ // Setting a category in the "C" default.
+ if (!setenv("LC_COLLATE", "de_DE", 1))
+ {
+ locale loc("");
+
+#if _GLIBCPP_NUM_CATEGORIES
+ VERIFY( loc.name() == "LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=C;"
+ "LC_COLLATE=de_DE;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;"
+ "LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;"
+ "LC_IDENTIFICATION=C" );
+#else
+ VERIFY( loc.name() == "LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=C;"
+ "LC_COLLATE=de_DE;LC_MONETARY=C;LC_MESSAGES=C" );
+#endif
+ }
+
+ // Changing the LANG default while LC_COLLATE is set.
+ if (!setenv("LANG", "fr_FR", 1))
+ {
+ locale loc("");
+#if _GLIBCPP_NUM_CATEGORIES
+ VERIFY( loc.name() == "LC_CTYPE=fr_FR;LC_NUMERIC=fr_FR;"
+ "LC_TIME=fr_FR;LC_COLLATE=de_DE;LC_MONETARY=fr_FR;"
+ "LC_MESSAGES=fr_FR;LC_PAPER=fr_FR;LC_NAME=fr_FR;"
+ "LC_ADDRESS=fr_FR;LC_TELEPHONE=fr_FR;LC_MEASUREMENT=fr_FR;"
+ "LC_IDENTIFICATION=fr_FR" );
+#else
+ VERIFY( loc.name() == "LC_CTYPE=fr_FR;LC_NUMERIC=fr_FR;"
+ "LC_TIME=fr_FR;LC_COLLATE=de_DE;LC_MONETARY=fr_FR;"
+ "LC_MESSAGES=fr_FR" );
+#endif
+ }
+
+ // Changing another (C only) category.
+#if _GLIBCPP_NUM_CATEGORIES
+ if (!setenv("LC_IDENTIFICATION", "it_IT", 1))
+ {
+ locale loc("");
+ VERIFY( loc.name() == "LC_CTYPE=fr_FR;LC_NUMERIC=fr_FR;"
+ "LC_TIME=fr_FR;LC_COLLATE=de_DE;LC_MONETARY=fr_FR;"
+ "LC_MESSAGES=fr_FR;LC_PAPER=fr_FR;LC_NAME=fr_FR;"
+ "LC_ADDRESS=fr_FR;LC_TELEPHONE=fr_FR;LC_MEASUREMENT=fr_FR;"
+ "LC_IDENTIFICATION=it_IT" );
+ }
+#endif
+
+ // Restore the environment.
+ setenv("LANG", LANG_orig ? LANG_orig : "", 1);
+ setenv("LC_ALL", LC_ALL_orig ? LC_ALL_orig : "", 1);
+ setenv("LC_CTYPE", LC_CTYPE_orig ? LC_CTYPE_orig : "", 1);
+ setenv("LC_NUMERIC", LC_NUMERIC_orig ? LC_NUMERIC_orig : "", 1);
+ setenv("LC_TIME", LC_TIME_orig ? LC_TIME_orig : "", 1);
+ setenv("LC_COLLATE", LC_COLLATE_orig ? LC_COLLATE_orig : "", 1);
+ setenv("LC_MONETARY", LC_MONETARY_orig ? LC_MONETARY_orig : "", 1);
+ setenv("LC_MESSAGES", LC_MESSAGES_orig ? LC_MESSAGES_orig : "", 1);
+#if _GLIBCPP_NUM_CATEGORIES
+ setenv("LC_PAPER", LC_PAPER_orig ? LC_PAPER_orig : "", 1);
+ setenv("LC_NAME", LC_NAME_orig ? LC_NAME_orig : "", 1);
+ setenv("LC_ADDRESS", LC_ADDRESS_orig ? LC_ADDRESS_orig : "", 1);
+ setenv("LC_TELEPHONE", LC_TELEPHONE_orig ? LC_TELEPHONE_orig : "", 1);
+ setenv("LC_MEASUREMENT", LC_MEASUREMENT_orig ? LC_MEASUREMENT_orig : "", 1);
+ setenv("LC_IDENTIFICATION",
+ LC_IDENTIFICATION_orig ? LC_IDENTIFICATION_orig : "", 1);
+#endif
+
+#endif
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/6.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/6.cc
new file mode 100644
index 00000000000..6b11ac1e9a1
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/locale/cons/6.cc
@@ -0,0 +1,63 @@
+// 2001-01-19 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.1.1 - Class locale [lib.locale]
+
+#include <locale>
+#include <string>
+#include <testsuite_hooks.h>
+
+// creating unnamed locales 1 using new + combine
+void
+test01()
+{
+ using namespace std;
+ bool test = true;
+ const string name_c("C");
+ const string str_unnamed("*");
+ string str;
+
+ // construct a locale object with the specialized facet.
+ locale loc_c = locale::classic();
+ locale loc_1(locale::classic(), new numpunct<char>);
+
+ // check names
+ VERIFY( loc_c.name() == name_c );
+ VERIFY( loc_1.name() == str_unnamed );
+
+ // sanity check the constructed locale has the specialized facet.
+ VERIFY( has_facet<numpunct<char> >(loc_1) );
+ VERIFY( has_facet<numpunct<char> >(loc_c) );
+
+ // extract facet
+ const numpunct<char>& f_nump_1 = use_facet<numpunct<char> >(loc_1);
+ const numpunct<char>& f_nump_c = use_facet<numpunct<char> >(loc_c);
+
+ // attempt to re-synthesize classic locale
+ locale loc_2 = loc_1.combine<numpunct<char> >(loc_c);
+ VERIFY( loc_2.name() == str_unnamed );
+ VERIFY( loc_2 != loc_c );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/members.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/7.cc
index 3b579782d48..75598e2a6c3 100644
--- a/libstdc++-v3/testsuite/22_locale/members.cc
+++ b/libstdc++-v3/testsuite/22_locale/locale/cons/7.cc
@@ -1,6 +1,6 @@
// 2001-01-19 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001 Free Software Foundation
+// Copyright (C) 2001, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -18,48 +18,12 @@
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
-// 22.2.3.1.1 numpunct members
+// 22.1.1 - Class locale [lib.locale]
#include <locale>
#include <string>
#include <testsuite_hooks.h>
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-// creating unnamed locales 1 using new + combine
-void
-test01()
-{
- using namespace std;
- bool test = true;
- const string name_c("C");
- const string str_unnamed("*");
- string str;
-
- // construct a locale object with the specialized facet.
- locale loc_c = locale::classic();
- locale loc_1(locale::classic(), new numpunct<char>);
-
- // check names
- VERIFY( loc_c.name() == name_c );
- VERIFY( loc_1.name() == str_unnamed );
-
- // sanity check the constructed locale has the specialized facet.
- VERIFY( has_facet<numpunct<char> >(loc_1) );
- VERIFY( has_facet<numpunct<char> >(loc_c) );
-
- // extract facet
- const numpunct<char>& f_nump_1 = use_facet<numpunct<char> >(loc_1);
- const numpunct<char>& f_nump_c = use_facet<numpunct<char> >(loc_c);
-
- // attempt to re-synthesize classic locale
- locale loc_2 = loc_1.combine<numpunct<char> >(loc_c);
- VERIFY( loc_2.name() == str_unnamed );
- VERIFY( loc_2 != loc_c );
-}
-
-
void
test02()
{
@@ -135,7 +99,6 @@ test02()
int main()
{
- test01();
test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/1.cc b/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/1.cc
new file mode 100644
index 00000000000..3d2c931ec6d
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/1.cc
@@ -0,0 +1,67 @@
+// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.1.1.5 locale static members [lib.locale.statics]
+
+#include <cwchar> // for mbstate_t
+#include <locale>
+#include <testsuite_hooks.h>
+
+typedef std::codecvt<char, char, std::mbstate_t> ccodecvt;
+class gnu_codecvt: public ccodecvt { };
+
+void test01()
+{
+ using namespace std;
+ bool test = true;
+
+ string str1, str2;
+
+ // Construct a locale object with the C facet.
+ const locale loc01 = locale::classic();
+
+ // Construct a locale object with the specialized facet.
+ locale loc02(locale::classic(), new gnu_codecvt);
+ VERIFY ( loc01 != loc02 );
+ VERIFY ( !(loc01 == loc02) );
+
+ // classic
+ locale loc06("C");
+ VERIFY (loc06 == loc01);
+ str1 = loc06.name();
+ VERIFY( str1 == "C" );
+
+ // global
+ locale loc03;
+ VERIFY ( loc03 == loc01);
+ locale global_orig = locale::global(loc02);
+ locale loc05;
+ VERIFY (loc05 != loc03);
+ VERIFY (loc05 == loc02);
+
+ // Reset global settings.
+ locale::global(global_orig);
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/2.cc b/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/2.cc
new file mode 100644
index 00000000000..bde35e26347
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/2.cc
@@ -0,0 +1,71 @@
+// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.1.1.5 locale static members [lib.locale.statics]
+
+#include <cwchar> // for mbstate_t
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Sanity check locale::global(loc) and setlocale.
+void test02()
+{
+ using namespace std;
+ bool test = true;
+
+ const string ph("en_PH");
+ const string mx("es_MX");
+ const char* orig = setlocale(LC_ALL, NULL);
+ const char* testph = setlocale(LC_ALL, ph.c_str());
+ const char* testmx = setlocale(LC_ALL, mx.c_str());
+ setlocale(LC_ALL, orig);
+
+ // If the underlying locale doesn't support these names, setlocale
+ // won't be reset. Therefore, disable unless we know these specific
+ // named locales work.
+ if (testph && testmx)
+ {
+ const locale loc_ph(ph.c_str());
+ const locale loc_mx(mx.c_str());
+
+ // Use setlocale between two calls to locale("")
+ const locale loc_env_1("");
+ setlocale(LC_ALL, ph.c_str());
+ const locale loc_env_2("");
+ VERIFY( loc_env_1 == loc_env_2 );
+
+ // Change global locale.
+ locale global_orig = locale::global(loc_mx);
+ const char* lc_all_mx = setlocale(LC_ALL, NULL);
+ if (lc_all_mx)
+ {
+ VERIFY( mx == lc_all_mx );
+ }
+
+ // Restore global settings.
+ locale::global(global_orig);
+ }
+}
+
+int main ()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/static_members.cc b/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/3.cc
index 9811dd9a806..87d8193051e 100644
--- a/libstdc++-v3/testsuite/22_locale/static_members.cc
+++ b/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/3.cc
@@ -1,6 +1,6 @@
// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2000, 2002 Free Software Foundation
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -22,86 +22,8 @@
#include <cwchar> // for mbstate_t
#include <locale>
-#include <iostream>
#include <testsuite_hooks.h>
-typedef std::codecvt<char, char, std::mbstate_t> ccodecvt;
-class gnu_codecvt: public ccodecvt { };
-
-void test01()
-{
- using namespace std;
- bool test = true;
-
- string str1, str2;
-
- // Construct a locale object with the C facet.
- const locale loc01 = locale::classic();
-
- // Construct a locale object with the specialized facet.
- locale loc02(locale::classic(), new gnu_codecvt);
- VERIFY ( loc01 != loc02 );
- VERIFY ( !(loc01 == loc02) );
-
- // classic
- locale loc06("C");
- VERIFY (loc06 == loc01);
- str1 = loc06.name();
- VERIFY( str1 == "C" );
-
- // global
- locale loc03;
- VERIFY ( loc03 == loc01);
- locale global_orig = locale::global(loc02);
- locale loc05;
- VERIFY (loc05 != loc03);
- VERIFY (loc05 == loc02);
-
- // Reset global settings.
- locale::global(global_orig);
-}
-
-// Sanity check locale::global(loc) and setlocale.
-void test02()
-{
- using namespace std;
- bool test = true;
-
- const string ph("en_PH");
- const string mx("es_MX");
- const char* orig = setlocale(LC_ALL, NULL);
- const char* testph = setlocale(LC_ALL, ph.c_str());
- const char* testmx = setlocale(LC_ALL, mx.c_str());
- setlocale(LC_ALL, orig);
-
- // If the underlying locale doesn't support these names, setlocale
- // won't be reset. Therefore, disable unless we know these specific
- // named locales work.
- if (testph && testmx)
- {
- const locale loc_ph(ph.c_str());
- const locale loc_mx(mx.c_str());
-
- // Use setlocale between two calls to locale("")
- const locale loc_env_1("");
- setlocale(LC_ALL, ph.c_str());
- const locale loc_env_2("");
- VERIFY( loc_env_1 == loc_env_2 );
-
- // Change global locale.
- locale global_orig = locale::global(loc_mx);
- const char* lc_all_mx = setlocale(LC_ALL, NULL);
- if (lc_all_mx)
- {
- cout << "lc_all_mx is " << lc_all_mx << endl;
- VERIFY( mx == lc_all_mx );
- }
-
- // Restore global settings.
- locale::global(global_orig);
- }
-}
-
// Static counter for use in checking ctors/dtors.
static std::size_t counter;
@@ -186,9 +108,6 @@ void test03()
int main ()
{
- test01();
- test02();
-
test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/operators.cc b/libstdc++-v3/testsuite/22_locale/locale/operations/1.cc
index f0e40d4a116..8fe6aa7ea3d 100644
--- a/libstdc++-v3/testsuite/22_locale/operators.cc
+++ b/libstdc++-v3/testsuite/22_locale/locale/operations/1.cc
@@ -1,6 +1,6 @@
// 2000-09-11 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2000, 2001, 2002 Free Software Foundation
+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -57,29 +57,9 @@ protected:
{ ++gnu_count; return 0; }
};
-void test02()
-{
- using namespace std;
- bool test = true;
-
- // Sanity check.
- locale loc_c = locale::classic();
- string s01("land of ");
- string s02("land of look behind");
- VERIFY( !loc_c(s01, s01) );
- VERIFY( loc_c(s01, s02) );
-
- // Derivation, MF check.
- locale loc_gnu(loc_c, new gnu_collate);
- gnu_count = 0;
- loc_gnu(s01, s02);
- VERIFY( gnu_count == 1 );
-}
-
int main ()
{
test01();
- test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/locale/operations/2.cc b/libstdc++-v3/testsuite/22_locale/locale/operations/2.cc
new file mode 100644
index 00000000000..ed06e10a635
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/locale/operations/2.cc
@@ -0,0 +1,64 @@
+// 2000-09-11 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.1.1.4 locale operators [lib.locale.operators]
+
+#include <cwchar> // for mbstate_t
+#include <locale>
+#include <testsuite_hooks.h>
+
+// bool operator()(const string_type&, const string_type&) const
+long gnu_count;
+
+class gnu_collate: public std::collate<char>
+{
+protected:
+ virtual int
+ do_compare(const char*, const char*, const char*, const char*) const
+ { ++gnu_count; return 0; }
+};
+
+void test02()
+{
+ using namespace std;
+ bool test = true;
+
+ // Sanity check.
+ locale loc_c = locale::classic();
+ string s01("land of ");
+ string s02("land of look behind");
+ VERIFY( !loc_c(s01, s01) );
+ VERIFY( loc_c(s01, s02) );
+
+ // Derivation, MF check.
+ locale loc_gnu(loc_c, new gnu_collate);
+ gnu_count = 0;
+ loc_gnu(s01, s02);
+ VERIFY( gnu_count == 1 );
+}
+
+int main ()
+{
+ test02();
+ return 0;
+}
+
+
+
diff --git a/libstdc++-v3/testsuite/22_locale/messages.cc b/libstdc++-v3/testsuite/22_locale/messages/1.cc
index 083a1bb58e0..6eb593239b1 100644
--- a/libstdc++-v3/testsuite/22_locale/messages.cc
+++ b/libstdc++-v3/testsuite/22_locale/messages/1.cc
@@ -1,6 +1,7 @@
+// { dg-do compile }
// 2001-07-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001 Free Software Foundation
+// Copyright (C) 2001, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -20,8 +21,6 @@
// 22.2.7 The message retrieval category
-// { dg-do compile }
-
#include <locale>
void test01()
@@ -39,18 +38,8 @@ void test01()
typedef test_type::string_type string_type;
}
-// Should be able to instantiate this for other types besides char, wchar_t
-class gnu_messages: public std::messages<unsigned char>
-{ };
-
-void test02()
-{
- gnu_messages facet01;
-}
-
int main()
{
test01();
- test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/messages/2.cc b/libstdc++-v3/testsuite/22_locale/messages/2.cc
new file mode 100644
index 00000000000..52f25e7bd84
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/messages/2.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+// 2001-07-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.7 The message retrieval category
+
+#include <locale>
+
+// Should be able to instantiate this for other types besides char, wchar_t
+class gnu_messages: public std::messages<unsigned char>
+{ };
+
+void test02()
+{
+ gnu_messages facet01;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/messages_members_char.cc b/libstdc++-v3/testsuite/22_locale/messages/members/char/1.cc
index 62126557c16..05116d934d5 100644
--- a/libstdc++-v3/testsuite/22_locale/messages_members_char.cc
+++ b/libstdc++-v3/testsuite/22_locale/messages/members/char/1.cc
@@ -1,6 +1,6 @@
// 2001-07-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -23,9 +23,6 @@
#include <locale>
#include <testsuite_hooks.h>
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
void test01()
{
using namespace std;
@@ -63,61 +60,10 @@ void test01()
VERIFY ( s01 == "bitte" );
VERIFY ( s02 == "danke" );
mssg_de.close(cat_de);
-
- // Check French (fr_FR) locale.
- catalog cat_fr = mssg_fr.open("libstdc++", loc_c, dir);
- s01 = mssg_fr.get(cat_fr, 0, 0, "please");
- s02 = mssg_fr.get(cat_fr, 0, 0, "thank you");
- VERIFY ( s01 == "s'il vous plaît" );
- VERIFY ( s02 == "merci" );
- mssg_fr.close(cat_fr);
-
- // Check US (en_US) locale.
- catalog cat_us = mssg_fr.open("libstdc++", loc_c, dir);
- s01 = mssg_us.get(cat_us, 0, 0, "please");
- s02 = mssg_us.get(cat_us, 0, 0, "thank you");
- VERIFY ( s01 == "please" );
- VERIFY ( s02 == "thank you" );
- mssg_us.close(cat_us);
-}
-
-// libstdc++/5280
-void test02()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test03()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
}
int main()
{
test01();
- test02();
- test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/messages/members/char/2.cc b/libstdc++-v3/testsuite/22_locale/messages/members/char/2.cc
new file mode 100644
index 00000000000..3234ef6f4ce
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/messages/members/char/2.cc
@@ -0,0 +1,69 @@
+// 2001-07-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.7.1.1 messages members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef std::messages<char>::catalog catalog;
+ typedef std::messages<char>::string_type string_type;
+
+ bool test = true;
+ // This is exported through RUNTESTFLAGS in testsuite/Makefile.am.
+ const char* dir = LOCALEDIR;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_us("en_US");
+ locale loc_fr("fr_FR");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_us != loc_fr );
+ VERIFY( loc_us != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the messages facets
+ const messages<char>& mssg_c = use_facet<messages<char> >(loc_c);
+ const messages<char>& mssg_us = use_facet<messages<char> >(loc_us);
+ const messages<char>& mssg_fr = use_facet<messages<char> >(loc_fr);
+ const messages<char>& mssg_de = use_facet<messages<char> >(loc_de);
+
+ // catalog open(const string&, const locale&) const;
+ // string_type get(catalog, int, int, const string_type& ) const;
+ // void close(catalog) const;
+
+ // Check French (fr_FR) locale.
+ catalog cat_fr = mssg_fr.open("libstdc++", loc_c, dir);
+ string s01 = mssg_fr.get(cat_fr, 0, 0, "please");
+ string s02 = mssg_fr.get(cat_fr, 0, 0, "thank you");
+ VERIFY ( s01 == "s'il vous plaît" );
+ VERIFY ( s02 == "merci" );
+ mssg_fr.close(cat_fr);
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/messages/members/char/3.cc b/libstdc++-v3/testsuite/22_locale/messages/members/char/3.cc
new file mode 100644
index 00000000000..d8346b29156
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/messages/members/char/3.cc
@@ -0,0 +1,69 @@
+// 2001-07-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.7.1.1 messages members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ typedef std::messages<char>::catalog catalog;
+ typedef std::messages<char>::string_type string_type;
+
+ bool test = true;
+ // This is exported through RUNTESTFLAGS in testsuite/Makefile.am.
+ const char* dir = LOCALEDIR;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_us("en_US");
+ locale loc_fr("fr_FR");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_us != loc_fr );
+ VERIFY( loc_us != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the messages facets
+ const messages<char>& mssg_c = use_facet<messages<char> >(loc_c);
+ const messages<char>& mssg_us = use_facet<messages<char> >(loc_us);
+ const messages<char>& mssg_fr = use_facet<messages<char> >(loc_fr);
+ const messages<char>& mssg_de = use_facet<messages<char> >(loc_de);
+
+ // catalog open(const string&, const locale&) const;
+ // string_type get(catalog, int, int, const string_type& ) const;
+ // void close(catalog) const;
+
+ // Check US (en_US) locale.
+ catalog cat_us = mssg_fr.open("libstdc++", loc_c, dir);
+ string s01 = mssg_us.get(cat_us, 0, 0, "please");
+ string s02 = mssg_us.get(cat_us, 0, 0, "thank you");
+ VERIFY ( s01 == "please" );
+ VERIFY ( s02 == "thank you" );
+ mssg_us.close(cat_us);
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/messages/members/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/messages/members/char/wrapped_env.cc
new file mode 100644
index 00000000000..3f042d9ec42
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/messages/members/char/wrapped_env.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/messages/members/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/messages/members/char/wrapped_locale.cc
new file mode 100644
index 00000000000..61086ad6da8
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/messages/members/char/wrapped_locale.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/messages_byname.cc b/libstdc++-v3/testsuite/22_locale/messages_byname/1.cc
index 1f5782cb835..1c6fc5b99b2 100644
--- a/libstdc++-v3/testsuite/22_locale/messages_byname.cc
+++ b/libstdc++-v3/testsuite/22_locale/messages_byname/1.cc
@@ -1,6 +1,6 @@
// 2001-07-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001 Free Software Foundation
+// Copyright (C) 2001, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -23,9 +23,6 @@
#include <locale>
#include <testsuite_hooks.h>
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
void test01()
{
using namespace std;
@@ -77,6 +74,5 @@ void test01()
int main()
{
test01();
-
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get.cc b/libstdc++-v3/testsuite/22_locale/money_get/1.cc
index 938bbaa6fdb..86fcd18b501 100644
--- a/libstdc++-v3/testsuite/22_locale/money_get.cc
+++ b/libstdc++-v3/testsuite/22_locale/money_get/1.cc
@@ -1,6 +1,7 @@
+// { dg-do compile }
// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001 Free Software Foundation
+// Copyright (C) 2001, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -20,8 +21,6 @@
// 22.2.6.1 Template class money_get
-// { dg-do compile }
-
#include <locale>
void test01()
@@ -38,18 +37,8 @@ void test01()
typedef test_type::iter_type iter_type;
}
-// Should be able to instantiate this for other types besides char, wchar_t
-class gnu_money_get: public std::money_get<unsigned char>
-{ };
-
-void test02()
-{
- gnu_money_get facet01;
-}
-
int main()
{
test01();
- test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/2.cc b/libstdc++-v3/testsuite/22_locale/money_get/2.cc
new file mode 100644
index 00000000000..516f11bf169
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/2.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1 Template class money_get
+
+#include <locale>
+
+// Should be able to instantiate this for other types besides char, wchar_t
+class gnu_money_get: public std::money_get<unsigned char>
+{ };
+
+void test02()
+{
+ gnu_money_get facet01;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/1.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/1.cc
new file mode 100644
index 00000000000..7bbfc88a952
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/char/1.cc
@@ -0,0 +1,151 @@
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// test string version
+void test01()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE@euro");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the moneypunct facets
+ typedef moneypunct<char, true> __money_true;
+ typedef moneypunct<char, false> __money_false;
+ const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
+ const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
+ const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
+ const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
+ const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
+ const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
+
+ // sanity check the data is correct.
+ const string empty;
+
+ // total EPA budget FY 2002
+ const string digits1("720000000000");
+
+ // est. cost, national missile "defense", expressed as a loss in USD 2001
+ const string digits2("-10000000000000");
+
+ // not valid input
+ const string digits3("-A");
+
+ // input less than frac_digits
+ const string digits4("-1");
+
+ iterator_type end;
+ istringstream iss;
+ iss.imbue(loc_de);
+ // cache the money_get facet
+ const money_get<char>& mon_get = use_facet<money_get<char> >(iss.getloc());
+
+
+ iss.str("7.200.000.000,00 ");
+ iterator_type is_it01(iss);
+ string result1;
+ ios_base::iostate err01 = ios_base::goodbit;
+ mon_get.get(is_it01, end, true, iss, err01, result1);
+ VERIFY( result1 == digits1 );
+ VERIFY( err01 == ios_base::eofbit );
+
+ iss.str("7.200.000.000,00 ");
+ iterator_type is_it02(iss);
+ string result2;
+ ios_base::iostate err02 = ios_base::goodbit;
+ mon_get.get(is_it02, end, true, iss, err02, result2);
+ VERIFY( result2 == digits1 );
+ VERIFY( err02 == ios_base::eofbit );
+
+ iss.str("7.200.000.000,00 a");
+ iterator_type is_it03(iss);
+ string result3;
+ ios_base::iostate err03 = ios_base::goodbit;
+ mon_get.get(is_it03, end, true, iss, err03, result3);
+ VERIFY( result3 == digits1 );
+ VERIFY( err03 == ios_base::goodbit );
+
+ iss.str("");
+ iterator_type is_it04(iss);
+ string result4;
+ ios_base::iostate err04 = ios_base::goodbit;
+ mon_get.get(is_it04, end, true, iss, err04, result4);
+ VERIFY( result4 == empty );
+ VERIFY( err04 == ios_base::failbit | ios_base::eofbit );
+
+ iss.str("working for enlightenment and peace in a mad world");
+ iterator_type is_it05(iss);
+ string result5;
+ ios_base::iostate err05 = ios_base::goodbit;
+ mon_get.get(is_it05, end, true, iss, err05, result5);
+ VERIFY( result5 == empty );
+ VERIFY( err05 == ios_base::failbit );
+
+ // now try with showbase, to get currency symbol in format
+ iss.setf(ios_base::showbase);
+
+ iss.str("7.200.000.000,00 EUR ");
+ iterator_type is_it06(iss);
+ string result6;
+ ios_base::iostate err06 = ios_base::goodbit;
+ mon_get.get(is_it06, end, true, iss, err06, result6);
+ VERIFY( result6 == digits1 );
+ VERIFY( err06 == ios_base::eofbit );
+
+ iss.str("7.200.000.000,00 EUR "); // Extra space.
+ iterator_type is_it07(iss);
+ string result7;
+ ios_base::iostate err07 = ios_base::goodbit;
+ mon_get.get(is_it07, end, true, iss, err07, result7);
+ VERIFY( result7 == digits1 );
+ VERIFY( err07 == ios_base::goodbit );
+
+ iss.str("7.200.000.000,00 \244");
+ iterator_type is_it08(iss);
+ string result8;
+ ios_base::iostate err08 = ios_base::goodbit;
+ mon_get.get(is_it08, end, false, iss, err08, result8);
+ VERIFY( result8 == digits1 );
+ VERIFY( err08 == ios_base::eofbit );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/2.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/2.cc
new file mode 100644
index 00000000000..0ca281fe5fb
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/char/2.cc
@@ -0,0 +1,140 @@
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// test string version
+void test02()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE@euro");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the moneypunct facets
+ typedef moneypunct<char, true> __money_true;
+ typedef moneypunct<char, false> __money_false;
+ const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
+ const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
+ const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
+ const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
+ const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
+ const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
+
+ // sanity check the data is correct.
+ const string empty;
+
+ // total EPA budget FY 2002
+ const string digits1("720000000000");
+
+ // est. cost, national missile "defense", expressed as a loss in USD 2001
+ const string digits2("-10000000000000");
+
+ // not valid input
+ const string digits3("-A");
+
+ // input less than frac_digits
+ const string digits4("-1");
+
+ iterator_type end;
+ istringstream iss;
+ iss.imbue(loc_hk);
+ // cache the money_get facet
+ const money_get<char>& mon_get = use_facet<money_get<char> >(iss.getloc());
+
+ // now try with showbase, to get currency symbol in format
+ iss.setf(ios_base::showbase);
+
+ iss.str("HK$7,200,000,000.00");
+ iterator_type is_it09(iss);
+ string result9;
+ ios_base::iostate err09 = ios_base::goodbit;
+ mon_get.get(is_it09, end, false, iss, err09, result9);
+ VERIFY( result9 == digits1 );
+ VERIFY( err09 == ios_base::eofbit );
+
+ iss.str("(HKD 100,000,000,000.00)");
+ iterator_type is_it10(iss);
+ string result10;
+ ios_base::iostate err10 = ios_base::goodbit;
+ mon_get.get(is_it10, end, true, iss, err10, result10);
+ VERIFY( result10 == digits2 );
+ VERIFY( err10 == ios_base::goodbit );
+
+ iss.str("(HKD .01)");
+ iterator_type is_it11(iss);
+ string result11;
+ ios_base::iostate err11 = ios_base::goodbit;
+ mon_get.get(is_it11, end, true, iss, err11, result11);
+ VERIFY( result11 == digits4 );
+ VERIFY( err11 == ios_base::goodbit );
+
+ // for the "en_HK" locale the parsing of the very same input streams must
+ // be successful without showbase too, since the symbol field appears in
+ // the first positions in the format and the symbol, when present, must be
+ // consumed.
+ iss.unsetf(ios_base::showbase);
+
+ iss.str("HK$7,200,000,000.00");
+ iterator_type is_it12(iss);
+ string result12;
+ ios_base::iostate err12 = ios_base::goodbit;
+ mon_get.get(is_it12, end, false, iss, err12, result12);
+ VERIFY( result12 == digits1 );
+ VERIFY( err12 == ios_base::eofbit );
+
+ iss.str("(HKD 100,000,000,000.00)");
+ iterator_type is_it13(iss);
+ string result13;
+ ios_base::iostate err13 = ios_base::goodbit;
+ mon_get.get(is_it13, end, true, iss, err13, result13);
+ VERIFY( result13 == digits2 );
+ VERIFY( err13 == ios_base::goodbit );
+
+ iss.str("(HKD .01)");
+ iterator_type is_it14(iss);
+ string result14;
+ ios_base::iostate err14 = ios_base::goodbit;
+ mon_get.get(is_it14, end, true, iss, err14, result14);
+ VERIFY( result14 == digits4 );
+ VERIFY( err14 == ios_base::goodbit );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/3.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/3.cc
new file mode 100644
index 00000000000..eb8ef9c1c57
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/char/3.cc
@@ -0,0 +1,96 @@
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// test double version
+void test03()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE@euro");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the moneypunct facets
+ typedef moneypunct<char, true> __money_true;
+ typedef moneypunct<char, false> __money_false;
+ const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
+ const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
+ const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
+ const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
+ const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
+ const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
+
+ // sanity check the data is correct.
+ const string empty;
+
+ // total EPA budget FY 2002
+ const long double digits1 = 720000000000.0;
+
+ // est. cost, national missile "defense", expressed as a loss in USD 2001
+ const long double digits2 = -10000000000000.0;
+
+ // input less than frac_digits
+ const long double digits4 = -1.0;
+
+ iterator_type end;
+ istringstream iss;
+ iss.imbue(loc_de);
+ // cache the money_get facet
+ const money_get<char>& mon_get = use_facet<money_get<char> >(iss.getloc());
+
+ iss.str("7.200.000.000,00 ");
+ iterator_type is_it01(iss);
+ long double result1;
+ ios_base::iostate err01 = ios_base::goodbit;
+ mon_get.get(is_it01, end, true, iss, err01, result1);
+ VERIFY( result1 == digits1 );
+ VERIFY( err01 == ios_base::eofbit );
+
+ iss.str("7.200.000.000,00 ");
+ iterator_type is_it02(iss);
+ long double result2;
+ ios_base::iostate err02 = ios_base::goodbit;
+ mon_get.get(is_it02, end, false, iss, err02, result2);
+ VERIFY( result2 == digits1 );
+ VERIFY( err02 == ios_base::eofbit );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/4.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/4.cc
new file mode 100644
index 00000000000..3a6aa18039c
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/char/4.cc
@@ -0,0 +1,91 @@
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// test double version
+void test04()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE@euro");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the moneypunct facets
+ typedef moneypunct<char, true> __money_true;
+ typedef moneypunct<char, false> __money_false;
+ const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
+ const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
+ const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
+ const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
+ const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
+ const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
+
+ // sanity check the data is correct.
+ const string empty;
+
+ // total EPA budget FY 2002
+ const long double digits1 = 720000000000.0;
+
+ // est. cost, national missile "defense", expressed as a loss in USD 2001
+ const long double digits2 = -10000000000000.0;
+
+ // input less than frac_digits
+ const long double digits4 = -1.0;
+
+ iterator_type end;
+ istringstream iss;
+ iss.imbue(loc_hk);
+ // cache the money_get facet
+ const money_get<char>& mon_get = use_facet<money_get<char> >(iss.getloc());
+
+ // now try with showbase, to get currency symbol in format
+ iss.setf(ios_base::showbase);
+
+ iss.str("(HKD .01)");
+ iterator_type is_it03(iss);
+ long double result3;
+ ios_base::iostate err03 = ios_base::goodbit;
+ mon_get.get(is_it03, end, true, iss, err03, result3);
+ VERIFY( result3 == digits4 );
+ VERIFY( err03 == ios_base::goodbit );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/5.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/5.cc
new file mode 100644
index 00000000000..f886c887ebd
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/char/5.cc
@@ -0,0 +1,71 @@
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test05()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check money_get works with other iterators besides streambuf
+ // input iterators.
+ typedef string::const_iterator iter_type;
+ typedef money_get<char, iter_type> mon_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+ const string str = "0.01Eleanor Roosevelt";
+
+ istringstream iss;
+ iss.imbue(locale(loc_c, new mon_get_type));
+
+ // Iterator advanced, state, output.
+ const mon_get_type& mg = use_facet<mon_get_type>(iss.getloc());
+
+ // 01 string
+ string res1;
+ iter_type end1 = mg.get(str.begin(), str.end(), false, iss, err, res1);
+ string rem1(end1, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( res1 == "1" );
+ VERIFY( rem1 == "Eleanor Roosevelt" );
+
+ // 02 long double
+ iss.clear();
+ err = goodbit;
+ long double res2;
+ iter_type end2 = mg.get(str.begin(), str.end(), false, iss, err, res2);
+ string rem2(end2, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( res2 == 1 );
+ VERIFY( rem2 == "Eleanor Roosevelt" );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/6.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/6.cc
new file mode 100644
index 00000000000..f9afb1e1fa4
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/char/6.cc
@@ -0,0 +1,104 @@
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+struct My_money_io : public std::moneypunct<char,false>
+{
+ char_type do_decimal_point() const { return '.'; }
+ std::string do_grouping() const { return "\004"; }
+
+ std::string do_curr_symbol() const { return "$"; }
+ std::string do_positive_sign() const { return ""; }
+ std::string do_negative_sign() const { return "-"; }
+
+ int do_frac_digits() const { return 2; }
+
+ pattern do_pos_format() const
+ {
+ pattern pat = { { symbol, none, sign, value } };
+ return pat;
+ }
+
+ pattern do_neg_format() const
+ {
+ pattern pat = { { symbol, none, sign, value } };
+ return pat;
+ }
+};
+
+// libstdc++/5579
+void test06()
+{
+ using namespace std;
+ typedef istreambuf_iterator<char> InIt;
+
+ bool test = true;
+
+ locale loc(locale::classic(), new My_money_io);
+
+ string bufferp("$1234.56");
+ string buffern("$-1234.56");
+ string bufferp_ns("1234.56");
+ string buffern_ns("-1234.56");
+
+ bool intl = false;
+
+ InIt iendp, iendn, iendp_ns, iendn_ns;
+ ios_base::iostate err;
+ string valp, valn, valp_ns, valn_ns;
+
+ const money_get<char,InIt>& mg =
+ use_facet<money_get<char, InIt> >(loc);
+
+ istringstream fmtp(bufferp);
+ fmtp.imbue(loc);
+ InIt ibegp(fmtp);
+ mg.get(ibegp,iendp,intl,fmtp,err,valp);
+ VERIFY( valp == "123456" );
+
+ istringstream fmtn(buffern);
+ fmtn.imbue(loc);
+ InIt ibegn(fmtn);
+ mg.get(ibegn,iendn,intl,fmtn,err,valn);
+ VERIFY( valn == "-123456" );
+
+ istringstream fmtp_ns(bufferp_ns);
+ fmtp_ns.imbue(loc);
+ InIt ibegp_ns(fmtp_ns);
+ mg.get(ibegp_ns,iendp_ns,intl,fmtp_ns,err,valp_ns);
+ VERIFY( valp_ns == "123456" );
+
+ istringstream fmtn_ns(buffern_ns);
+ fmtn_ns.imbue(loc);
+ InIt ibegn_ns(fmtn_ns);
+ mg.get(ibegn_ns,iendn_ns,intl,fmtn_ns,err,valn_ns);
+ VERIFY( valn_ns == "-123456" );
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/7.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/7.cc
new file mode 100644
index 00000000000..f275d4e59d4
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/char/7.cc
@@ -0,0 +1,70 @@
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// We were appending to the string val passed by reference, instead
+// of constructing a temporary candidate, eventually copied into
+// val in case of successful parsing.
+void test07()
+{
+ using namespace std;
+ bool test = true;
+
+ typedef istreambuf_iterator<char> InIt;
+ InIt iend1, iend2, iend3;
+
+ locale loc_c = locale::classic();
+ string buffer1("123");
+ string buffer2("456");
+ string buffer3("Golgafrincham"); // From Nathan's original idea.
+
+ string val;
+
+ ios_base::iostate err;
+
+ const money_get<char,InIt>& mg = use_facet<money_get<char, InIt> >(loc_c);
+
+ istringstream fmt1(buffer1);
+ InIt ibeg1(fmt1);
+ mg.get(ibeg1,iend1,false,fmt1,err,val);
+ VERIFY( val == buffer1 );
+
+ istringstream fmt2(buffer2);
+ InIt ibeg2(fmt2);
+ mg.get(ibeg2,iend2,false,fmt2,err,val);
+ VERIFY( val == buffer2 );
+
+ val = buffer3;
+ istringstream fmt3(buffer3);
+ InIt ibeg3(fmt3);
+ mg.get(ibeg3,iend3,false,fmt3,err,val);
+ VERIFY( val == buffer3 );
+}
+
+int main()
+{
+ test07();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/8.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/8.cc
new file mode 100644
index 00000000000..8c811e99a63
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/char/8.cc
@@ -0,0 +1,123 @@
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+struct My_money_io_a : public std::moneypunct<char,false>
+{
+ char_type do_decimal_point() const { return '.'; }
+ std::string do_grouping() const { return "\004"; }
+
+ std::string do_curr_symbol() const { return "$"; }
+ std::string do_positive_sign() const { return "()"; }
+
+ int do_frac_digits() const { return 2; }
+
+ pattern do_pos_format() const
+ {
+ pattern pat = { { sign, value, space, symbol } };
+ return pat;
+ }
+};
+
+struct My_money_io_b : public std::moneypunct<char,false>
+{
+ char_type do_decimal_point() const { return '.'; }
+ std::string do_grouping() const { return "\004"; }
+
+ std::string do_curr_symbol() const { return "$"; }
+ std::string do_positive_sign() const { return "()"; }
+
+ int do_frac_digits() const { return 2; }
+
+ pattern do_pos_format() const
+ {
+ pattern pat = { { sign, value, symbol, none } };
+ return pat;
+ }
+};
+
+// This one exercises patterns of the type { X, Y, Z, symbol } and
+// { X, Y, symbol, none } for a two character long sign. Therefore
+// the optional symbol (showbase is false by default) must be consumed
+// if present, since "rest of the sign" is left to read.
+void test08()
+{
+ using namespace std;
+ typedef istreambuf_iterator<char> InIt;
+
+ bool intl = false;
+ bool test = true;
+ ios_base::iostate err;
+
+ locale loc_a(locale::classic(), new My_money_io_a);
+
+ string buffer_a("(1234.56 $)");
+ string buffer_a_ns("(1234.56 )");
+
+ InIt iend_a, iend_a_ns;
+ string val_a, val_a_ns;
+
+ const money_get<char,InIt>& mg_a = use_facet<money_get<char, InIt> >(loc_a);
+
+ istringstream fmt_a(buffer_a);
+ fmt_a.imbue(loc_a);
+ InIt ibeg_a(fmt_a);
+ mg_a.get(ibeg_a,iend_a,intl,fmt_a,err,val_a);
+ VERIFY( val_a == "123456" );
+
+ istringstream fmt_a_ns(buffer_a_ns);
+ fmt_a_ns.imbue(loc_a);
+ InIt ibeg_a_ns(fmt_a_ns);
+ mg_a.get(ibeg_a_ns,iend_a_ns,intl,fmt_a_ns,err,val_a_ns);
+ VERIFY( val_a_ns == "123456" );
+
+ locale loc_b(locale::classic(), new My_money_io_b);
+
+ string buffer_b("(1234.56$)");
+ string buffer_b_ns("(1234.56)");
+
+ InIt iend_b, iend_b_ns;
+ string val_b, val_b_ns;
+
+ const money_get<char,InIt>& mg_b = use_facet<money_get<char, InIt> >(loc_b);
+
+ istringstream fmt_b(buffer_b);
+ fmt_b.imbue(loc_b);
+ InIt ibeg_b(fmt_b);
+ mg_b.get(ibeg_b,iend_b,intl,fmt_b,err,val_b);
+ VERIFY( val_b == "123456" );
+
+ istringstream fmt_b_ns(buffer_b_ns);
+ fmt_b_ns.imbue(loc_b);
+ InIt ibeg_b_ns(fmt_b_ns);
+ mg_b.get(ibeg_b_ns,iend_b_ns,intl,fmt_b_ns,err,val_b_ns);
+ VERIFY( val_b_ns == "123456" );
+}
+
+int main()
+{
+ test08();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/wrapped_env.cc
new file mode 100644
index 00000000000..b9872d9c7b0
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/char/wrapped_env.cc
@@ -0,0 +1,71 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+#define main discard_main_7
+#include "7.cc"
+#undef main
+
+#define main discard_main_8
+#include "8.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ two.push_back(&test07);
+ two.push_back(&test08);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/wrapped_locale.cc
new file mode 100644
index 00000000000..996af345b58
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/char/wrapped_locale.cc
@@ -0,0 +1,71 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+#define main discard_main_7
+#include "7.cc"
+#undef main
+
+#define main discard_main_8
+#include "8.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ two.push_back(&test07);
+ two.push_back(&test08);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/1.cc
new file mode 100644
index 00000000000..d8d86f2cfaf
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/1.cc
@@ -0,0 +1,151 @@
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// test wstring version
+void test01()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE@euro");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the moneypunct facets
+ typedef moneypunct<wchar_t, true> __money_true;
+ typedef moneypunct<wchar_t, false> __money_false;
+ const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
+ const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
+ const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
+ const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
+ const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
+ const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
+
+ // sanity check the data is correct.
+ const wstring empty;
+
+ // total EPA budget FY 2002
+ const wstring digits1(L"720000000000");
+
+ // est. cost, national missile "defense", expressed as a loss in USD 2001
+ const wstring digits2(L"-10000000000000");
+
+ // not valid input
+ const wstring digits3(L"-A");
+
+ // input less than frac_digits
+ const wstring digits4(L"-1");
+
+ iterator_type end;
+ wistringstream iss;
+ iss.imbue(loc_de);
+ // cache the money_get facet
+ const money_get<wchar_t>& mon_get = use_facet<money_get<wchar_t> >(iss.getloc());
+
+
+ iss.str(L"7.200.000.000,00 ");
+ iterator_type is_it01(iss);
+ wstring result1;
+ ios_base::iostate err01 = ios_base::goodbit;
+ mon_get.get(is_it01, end, true, iss, err01, result1);
+ VERIFY( result1 == digits1 );
+ VERIFY( err01 == ios_base::eofbit );
+
+ iss.str(L"7.200.000.000,00 ");
+ iterator_type is_it02(iss);
+ wstring result2;
+ ios_base::iostate err02 = ios_base::goodbit;
+ mon_get.get(is_it02, end, true, iss, err02, result2);
+ VERIFY( result2 == digits1 );
+ VERIFY( err02 == ios_base::eofbit );
+
+ iss.str(L"7.200.000.000,00 a");
+ iterator_type is_it03(iss);
+ wstring result3;
+ ios_base::iostate err03 = ios_base::goodbit;
+ mon_get.get(is_it03, end, true, iss, err03, result3);
+ VERIFY( result3 == digits1 );
+ VERIFY( err03 == ios_base::goodbit );
+
+ iss.str(L"");
+ iterator_type is_it04(iss);
+ wstring result4;
+ ios_base::iostate err04 = ios_base::goodbit;
+ mon_get.get(is_it04, end, true, iss, err04, result4);
+ VERIFY( result4 == empty );
+ VERIFY( err04 == ios_base::failbit | ios_base::eofbit );
+
+ iss.str(L"working for enlightenment and peace in a mad world");
+ iterator_type is_it05(iss);
+ wstring result5;
+ ios_base::iostate err05 = ios_base::goodbit;
+ mon_get.get(is_it05, end, true, iss, err05, result5);
+ VERIFY( result5 == empty );
+ VERIFY( err05 == ios_base::failbit );
+
+ // now try with showbase, to get currency symbol in format
+ iss.setf(ios_base::showbase);
+
+ iss.str(L"7.200.000.000,00 EUR ");
+ iterator_type is_it06(iss);
+ wstring result6;
+ ios_base::iostate err06 = ios_base::goodbit;
+ mon_get.get(is_it06, end, true, iss, err06, result6);
+ VERIFY( result6 == digits1 );
+ VERIFY( err06 == ios_base::eofbit );
+
+ iss.str(L"7.200.000.000,00 EUR "); // Extra space.
+ iterator_type is_it07(iss);
+ wstring result7;
+ ios_base::iostate err07 = ios_base::goodbit;
+ mon_get.get(is_it07, end, true, iss, err07, result7);
+ VERIFY( result7 == digits1 );
+ VERIFY( err07 == ios_base::goodbit );
+
+ iss.str(L"7.200.000.000,00 \x20ac");
+ iterator_type is_it08(iss);
+ wstring result8;
+ ios_base::iostate err08 = ios_base::goodbit;
+ mon_get.get(is_it08, end, false, iss, err08, result8);
+ VERIFY( result8 == digits1 );
+ VERIFY( err08 == ios_base::eofbit );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/2.cc
new file mode 100644
index 00000000000..9b3c8741e32
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/2.cc
@@ -0,0 +1,140 @@
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// test wstring version
+void test02()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE@euro");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the moneypunct facets
+ typedef moneypunct<wchar_t, true> __money_true;
+ typedef moneypunct<wchar_t, false> __money_false;
+ const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
+ const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
+ const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
+ const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
+ const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
+ const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
+
+ // sanity check the data is correct.
+ const wstring empty;
+
+ // total EPA budget FY 2002
+ const wstring digits1(L"720000000000");
+
+ // est. cost, national missile "defense", expressed as a loss in USD 2001
+ const wstring digits2(L"-10000000000000");
+
+ // not valid input
+ const wstring digits3(L"-A");
+
+ // input less than frac_digits
+ const wstring digits4(L"-1");
+
+ iterator_type end;
+ wistringstream iss;
+ iss.imbue(loc_hk);
+ // cache the money_get facet
+ const money_get<wchar_t>& mon_get = use_facet<money_get<wchar_t> >(iss.getloc());
+
+ // now try with showbase, to get currency symbol in format
+ iss.setf(ios_base::showbase);
+
+ iss.str(L"HK$7,200,000,000.00");
+ iterator_type is_it09(iss);
+ wstring result9;
+ ios_base::iostate err09 = ios_base::goodbit;
+ mon_get.get(is_it09, end, false, iss, err09, result9);
+ VERIFY( result9 == digits1 );
+ VERIFY( err09 == ios_base::eofbit );
+
+ iss.str(L"(HKD 100,000,000,000.00)");
+ iterator_type is_it10(iss);
+ wstring result10;
+ ios_base::iostate err10 = ios_base::goodbit;
+ mon_get.get(is_it10, end, true, iss, err10, result10);
+ VERIFY( result10 == digits2 );
+ VERIFY( err10 == ios_base::goodbit );
+
+ iss.str(L"(HKD .01)");
+ iterator_type is_it11(iss);
+ wstring result11;
+ ios_base::iostate err11 = ios_base::goodbit;
+ mon_get.get(is_it11, end, true, iss, err11, result11);
+ VERIFY( result11 == digits4 );
+ VERIFY( err11 == ios_base::goodbit );
+
+ // for the "en_HK" locale the parsing of the very same input streams must
+ // be successful without showbase too, since the symbol field appears in
+ // the first positions in the format and the symbol, when present, must be
+ // consumed.
+ iss.unsetf(ios_base::showbase);
+
+ iss.str(L"HK$7,200,000,000.00");
+ iterator_type is_it12(iss);
+ wstring result12;
+ ios_base::iostate err12 = ios_base::goodbit;
+ mon_get.get(is_it12, end, false, iss, err12, result12);
+ VERIFY( result12 == digits1 );
+ VERIFY( err12 == ios_base::eofbit );
+
+ iss.str(L"(HKD 100,000,000,000.00)");
+ iterator_type is_it13(iss);
+ wstring result13;
+ ios_base::iostate err13 = ios_base::goodbit;
+ mon_get.get(is_it13, end, true, iss, err13, result13);
+ VERIFY( result13 == digits2 );
+ VERIFY( err13 == ios_base::goodbit );
+
+ iss.str(L"(HKD .01)");
+ iterator_type is_it14(iss);
+ wstring result14;
+ ios_base::iostate err14 = ios_base::goodbit;
+ mon_get.get(is_it14, end, true, iss, err14, result14);
+ VERIFY( result14 == digits4 );
+ VERIFY( err14 == ios_base::goodbit );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/3.cc
new file mode 100644
index 00000000000..747b4944494
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/3.cc
@@ -0,0 +1,96 @@
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// test double version
+void test03()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE@euro");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the moneypunct facets
+ typedef moneypunct<wchar_t, true> __money_true;
+ typedef moneypunct<wchar_t, false> __money_false;
+ const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
+ const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
+ const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
+ const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
+ const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
+ const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
+
+ // sanity check the data is correct.
+ const wstring empty;
+
+ // total EPA budget FY 2002
+ const long double digits1 = 720000000000.0;
+
+ // est. cost, national missile "defense", expressed as a loss in USD 2001
+ const long double digits2 = -10000000000000.0;
+
+ // input less than frac_digits
+ const long double digits4 = -1.0;
+
+ iterator_type end;
+ wistringstream iss;
+ iss.imbue(loc_de);
+ // cache the money_get facet
+ const money_get<wchar_t>& mon_get = use_facet<money_get<wchar_t> >(iss.getloc());
+
+ iss.str(L"7.200.000.000,00 ");
+ iterator_type is_it01(iss);
+ long double result1;
+ ios_base::iostate err01 = ios_base::goodbit;
+ mon_get.get(is_it01, end, true, iss, err01, result1);
+ VERIFY( result1 == digits1 );
+ VERIFY( err01 == ios_base::eofbit );
+
+ iss.str(L"7.200.000.000,00 ");
+ iterator_type is_it02(iss);
+ long double result2;
+ ios_base::iostate err02 = ios_base::goodbit;
+ mon_get.get(is_it02, end, false, iss, err02, result2);
+ VERIFY( result2 == digits1 );
+ VERIFY( err02 == ios_base::eofbit );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/4.cc
new file mode 100644
index 00000000000..030c47a2994
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/4.cc
@@ -0,0 +1,91 @@
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// test double version
+void test04()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE@euro");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the moneypunct facets
+ typedef moneypunct<wchar_t, true> __money_true;
+ typedef moneypunct<wchar_t, false> __money_false;
+ const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
+ const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
+ const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
+ const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
+ const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
+ const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
+
+ // sanity check the data is correct.
+ const wstring empty;
+
+ // total EPA budget FY 2002
+ const long double digits1 = 720000000000.0;
+
+ // est. cost, national missile "defense", expressed as a loss in USD 2001
+ const long double digits2 = -10000000000000.0;
+
+ // input less than frac_digits
+ const long double digits4 = -1.0;
+
+ iterator_type end;
+ wistringstream iss;
+ iss.imbue(loc_hk);
+ // cache the money_get facet
+ const money_get<wchar_t>& mon_get = use_facet<money_get<wchar_t> >(iss.getloc());
+
+ // now try with showbase, to get currency symbol in format
+ iss.setf(ios_base::showbase);
+
+ iss.str(L"(HKD .01)");
+ iterator_type is_it03(iss);
+ long double result3;
+ ios_base::iostate err03 = ios_base::goodbit;
+ mon_get.get(is_it03, end, true, iss, err03, result3);
+ VERIFY( result3 == digits4 );
+ VERIFY( err03 == ios_base::goodbit );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/5.cc
new file mode 100644
index 00000000000..fd0c53ef313
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/5.cc
@@ -0,0 +1,71 @@
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test05()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check money_get works with other iterators besides streambuf
+ // input iterators.
+ typedef wstring::const_iterator iter_type;
+ typedef money_get<wchar_t, iter_type> mon_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+ const wstring str = L"0.01Eleanor Roosevelt";
+
+ wistringstream iss;
+ iss.imbue(locale(loc_c, new mon_get_type));
+
+ // Iterator advanced, state, output.
+ const mon_get_type& mg = use_facet<mon_get_type>(iss.getloc());
+
+ // 01 wstring
+ wstring res1;
+ iter_type end1 = mg.get(str.begin(), str.end(), false, iss, err, res1);
+ wstring rem1(end1, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( res1 == L"1" );
+ VERIFY( rem1 == L"Eleanor Roosevelt" );
+
+ // 02 long double
+ iss.clear();
+ err = goodbit;
+ long double res2;
+ iter_type end2 = mg.get(str.begin(), str.end(), false, iss, err, res2);
+ wstring rem2(end2, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( res2 == 1 );
+ VERIFY( rem2 == L"Eleanor Roosevelt" );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/6.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/6.cc
new file mode 100644
index 00000000000..0015cd92ca6
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/6.cc
@@ -0,0 +1,102 @@
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+struct My_money_io : public std::moneypunct<wchar_t,false>
+{
+ char_type do_decimal_point() const { return '.'; }
+ std::string do_grouping() const { return "\004"; }
+
+ std::wstring do_curr_symbol() const { return L"$"; }
+ std::wstring do_positive_sign() const { return L""; }
+ std::wstring do_negative_sign() const { return L"-"; }
+
+ int do_frac_digits() const { return 2; }
+
+ pattern do_pos_format() const
+ {
+ pattern pat = { { symbol, none, sign, value } };
+ return pat;
+ }
+
+ pattern do_neg_format() const
+ {
+ pattern pat = { { symbol, none, sign, value } };
+ return pat;
+ }
+};
+
+// libstdc++/5579
+void test06()
+{
+ using namespace std;
+ typedef istreambuf_iterator<wchar_t> InIt;
+
+ bool test = true;
+
+ locale loc(locale::classic(), new My_money_io);
+
+ wstring bufferp(L"$1234.56");
+ wstring buffern(L"$-1234.56");
+ wstring bufferp_ns(L"1234.56");
+ wstring buffern_ns(L"-1234.56");
+
+ bool intl = false;
+
+ InIt iendp, iendn, iendp_ns, iendn_ns;
+ ios_base::iostate err;
+ wstring valp, valn, valp_ns, valn_ns;
+
+ const money_get<wchar_t,InIt>& mg = use_facet<money_get<wchar_t, InIt> >(loc);
+ wistringstream fmtp(bufferp);
+ fmtp.imbue(loc);
+ InIt ibegp(fmtp);
+ mg.get(ibegp,iendp,intl,fmtp,err,valp);
+ VERIFY( valp == L"123456" );
+
+ wistringstream fmtn(buffern);
+ fmtn.imbue(loc);
+ InIt ibegn(fmtn);
+ mg.get(ibegn,iendn,intl,fmtn,err,valn);
+ VERIFY( valn == L"-123456" );
+
+ wistringstream fmtp_ns(bufferp_ns);
+ fmtp_ns.imbue(loc);
+ InIt ibegp_ns(fmtp_ns);
+ mg.get(ibegp_ns,iendp_ns,intl,fmtp_ns,err,valp_ns);
+ VERIFY( valp_ns == L"123456" );
+
+ wistringstream fmtn_ns(buffern_ns);
+ fmtn_ns.imbue(loc);
+ InIt ibegn_ns(fmtn_ns);
+ mg.get(ibegn_ns,iendn_ns,intl,fmtn_ns,err,valn_ns);
+ VERIFY( valn_ns == L"-123456" );
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/7.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/7.cc
new file mode 100644
index 00000000000..bf8615f1748
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/7.cc
@@ -0,0 +1,70 @@
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// We were appending to the string val passed by reference, instead
+// of constructing a temporary candidate, eventually copied into
+// val in case of successful parsing.
+void test07()
+{
+ using namespace std;
+ bool test = true;
+
+ typedef istreambuf_iterator<wchar_t> InIt;
+ InIt iend1, iend2, iend3;
+
+ locale loc_c = locale::classic();
+ wstring buffer1(L"123");
+ wstring buffer2(L"456");
+ wstring buffer3(L"Golgafrincham"); // From Nathan's original idea.
+
+ wstring val;
+
+ ios_base::iostate err;
+
+ const money_get<wchar_t,InIt>& mg = use_facet<money_get<wchar_t, InIt> >(loc_c);
+
+ wistringstream fmt1(buffer1);
+ InIt ibeg1(fmt1);
+ mg.get(ibeg1,iend1,false,fmt1,err,val);
+ VERIFY( val == buffer1 );
+
+ wistringstream fmt2(buffer2);
+ InIt ibeg2(fmt2);
+ mg.get(ibeg2,iend2,false,fmt2,err,val);
+ VERIFY( val == buffer2 );
+
+ val = buffer3;
+ wistringstream fmt3(buffer3);
+ InIt ibeg3(fmt3);
+ mg.get(ibeg3,iend3,false,fmt3,err,val);
+ VERIFY( val == buffer3 );
+}
+
+int main()
+{
+ test07();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/8.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/8.cc
new file mode 100644
index 00000000000..ab1de4d3e10
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/8.cc
@@ -0,0 +1,123 @@
+// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+struct My_money_io_a : public std::moneypunct<wchar_t,false>
+{
+ char_type do_decimal_point() const { return '.'; }
+ std::string do_grouping() const { return "\004"; }
+
+ std::wstring do_curr_symbol() const { return L"$"; }
+ std::wstring do_positive_sign() const { return L"()"; }
+
+ int do_frac_digits() const { return 2; }
+
+ pattern do_pos_format() const
+ {
+ pattern pat = { { sign, value, space, symbol } };
+ return pat;
+ }
+};
+
+struct My_money_io_b : public std::moneypunct<wchar_t,false>
+{
+ char_type do_decimal_point() const { return '.'; }
+ std::string do_grouping() const { return "\004"; }
+
+ std::wstring do_curr_symbol() const { return L"$"; }
+ std::wstring do_positive_sign() const { return L"()"; }
+
+ int do_frac_digits() const { return 2; }
+
+ pattern do_pos_format() const
+ {
+ pattern pat = { { sign, value, symbol, none } };
+ return pat;
+ }
+};
+
+// This one exercises patterns of the type { X, Y, Z, symbol } and
+// { X, Y, symbol, none } for a two character long sign. Therefore
+// the optional symbol (showbase is false by default) must be consumed
+// if present, since "rest of the sign" is left to read.
+void test08()
+{
+ using namespace std;
+ typedef istreambuf_iterator<wchar_t> InIt;
+
+ bool intl = false;
+ bool test = true;
+ ios_base::iostate err;
+
+ locale loc_a(locale::classic(), new My_money_io_a);
+
+ wstring buffer_a(L"(1234.56 $)");
+ wstring buffer_a_ns(L"(1234.56 )");
+
+ InIt iend_a, iend_a_ns;
+ wstring val_a, val_a_ns;
+
+ const money_get<wchar_t,InIt>& mg_a = use_facet<money_get<wchar_t, InIt> >(loc_a);
+
+ wistringstream fmt_a(buffer_a);
+ fmt_a.imbue(loc_a);
+ InIt ibeg_a(fmt_a);
+ mg_a.get(ibeg_a,iend_a,intl,fmt_a,err,val_a);
+ VERIFY( val_a == L"123456" );
+
+ wistringstream fmt_a_ns(buffer_a_ns);
+ fmt_a_ns.imbue(loc_a);
+ InIt ibeg_a_ns(fmt_a_ns);
+ mg_a.get(ibeg_a_ns,iend_a_ns,intl,fmt_a_ns,err,val_a_ns);
+ VERIFY( val_a_ns == L"123456" );
+
+ locale loc_b(locale::classic(), new My_money_io_b);
+
+ wstring buffer_b(L"(1234.56$)");
+ wstring buffer_b_ns(L"(1234.56)");
+
+ InIt iend_b, iend_b_ns;
+ wstring val_b, val_b_ns;
+
+ const money_get<wchar_t,InIt>& mg_b = use_facet<money_get<wchar_t, InIt> >(loc_b);
+
+ wistringstream fmt_b(buffer_b);
+ fmt_b.imbue(loc_b);
+ InIt ibeg_b(fmt_b);
+ mg_b.get(ibeg_b,iend_b,intl,fmt_b,err,val_b);
+ VERIFY( val_b == L"123456" );
+
+ wistringstream fmt_b_ns(buffer_b_ns);
+ fmt_b_ns.imbue(loc_b);
+ InIt ibeg_b_ns(fmt_b_ns);
+ mg_b.get(ibeg_b_ns,iend_b_ns,intl,fmt_b_ns,err,val_b_ns);
+ VERIFY( val_b_ns == L"123456" );
+}
+
+int main()
+{
+ test08();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..b9872d9c7b0
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/wrapped_env.cc
@@ -0,0 +1,71 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+#define main discard_main_7
+#include "7.cc"
+#undef main
+
+#define main discard_main_8
+#include "8.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ two.push_back(&test07);
+ two.push_back(&test08);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..996af345b58
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/wrapped_locale.cc
@@ -0,0 +1,71 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+#define main discard_main_7
+#include "7.cc"
+#undef main
+
+#define main discard_main_8
+#include "8.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ two.push_back(&test07);
+ two.push_back(&test08);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get_members_char.cc b/libstdc++-v3/testsuite/22_locale/money_get_members_char.cc
deleted file mode 100644
index bf2e47e3a9c..00000000000
--- a/libstdc++-v3/testsuite/22_locale/money_get_members_char.cc
+++ /dev/null
@@ -1,580 +0,0 @@
-// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2001, 2002 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This 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 General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.6.1.1 money_get members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-// test string version
-void test01()
-{
- using namespace std;
- typedef money_base::part part;
- typedef money_base::pattern pattern;
- typedef istreambuf_iterator<char> iterator_type;
-
- bool test = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE@euro");
- VERIFY( loc_c != loc_de );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the moneypunct facets
- typedef moneypunct<char, true> __money_true;
- typedef moneypunct<char, false> __money_false;
- const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
- const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
- const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
- const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
- const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
- const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
-
- // sanity check the data is correct.
- const string empty;
-
- // total EPA budget FY 2002
- const string digits1("720000000000");
-
- // est. cost, national missile "defense", expressed as a loss in USD 2001
- const string digits2("-10000000000000");
-
- // not valid input
- const string digits3("-A");
-
- // input less than frac_digits
- const string digits4("-1");
-
- iterator_type end;
- istringstream iss;
- iss.imbue(loc_de);
- // cache the money_get facet
- const money_get<char>& mon_get = use_facet<money_get<char> >(iss.getloc());
-
-
- iss.str("7.200.000.000,00 ");
- iterator_type is_it01(iss);
- string result1;
- ios_base::iostate err01 = ios_base::goodbit;
- mon_get.get(is_it01, end, true, iss, err01, result1);
- VERIFY( result1 == digits1 );
- VERIFY( err01 == ios_base::eofbit );
-
- iss.str("7.200.000.000,00 ");
- iterator_type is_it02(iss);
- string result2;
- ios_base::iostate err02 = ios_base::goodbit;
- mon_get.get(is_it02, end, true, iss, err02, result2);
- VERIFY( result2 == digits1 );
- VERIFY( err02 == ios_base::eofbit );
-
- iss.str("7.200.000.000,00 a");
- iterator_type is_it03(iss);
- string result3;
- ios_base::iostate err03 = ios_base::goodbit;
- mon_get.get(is_it03, end, true, iss, err03, result3);
- VERIFY( result3 == digits1 );
- VERIFY( err03 == ios_base::goodbit );
-
- iss.str("");
- iterator_type is_it04(iss);
- string result4;
- ios_base::iostate err04 = ios_base::goodbit;
- mon_get.get(is_it04, end, true, iss, err04, result4);
- VERIFY( result4 == empty );
- VERIFY( err04 == ios_base::failbit | ios_base::eofbit );
-
- iss.str("working for enlightenment and peace in a mad world");
- iterator_type is_it05(iss);
- string result5;
- ios_base::iostate err05 = ios_base::goodbit;
- mon_get.get(is_it05, end, true, iss, err05, result5);
- VERIFY( result5 == empty );
- VERIFY( err05 == ios_base::failbit );
-
- // now try with showbase, to get currency symbol in format
- iss.setf(ios_base::showbase);
-
- iss.str("7.200.000.000,00 EUR ");
- iterator_type is_it06(iss);
- string result6;
- ios_base::iostate err06 = ios_base::goodbit;
- mon_get.get(is_it06, end, true, iss, err06, result6);
- VERIFY( result6 == digits1 );
- VERIFY( err06 == ios_base::eofbit );
-
- iss.str("7.200.000.000,00 EUR "); // Extra space.
- iterator_type is_it07(iss);
- string result7;
- ios_base::iostate err07 = ios_base::goodbit;
- mon_get.get(is_it07, end, true, iss, err07, result7);
- VERIFY( result7 == digits1 );
- VERIFY( err07 == ios_base::goodbit );
-
- iss.str("7.200.000.000,00 \244");
- iterator_type is_it08(iss);
- string result8;
- ios_base::iostate err08 = ios_base::goodbit;
- mon_get.get(is_it08, end, false, iss, err08, result8);
- VERIFY( result8 == digits1 );
- VERIFY( err08 == ios_base::eofbit );
-
- iss.imbue(loc_hk);
- iss.str("HK$7,200,000,000.00");
- iterator_type is_it09(iss);
- string result9;
- ios_base::iostate err09 = ios_base::goodbit;
- mon_get.get(is_it09, end, false, iss, err09, result9);
- VERIFY( result9 == digits1 );
- VERIFY( err09 == ios_base::eofbit );
-
- iss.str("(HKD 100,000,000,000.00)");
- iterator_type is_it10(iss);
- string result10;
- ios_base::iostate err10 = ios_base::goodbit;
- mon_get.get(is_it10, end, true, iss, err10, result10);
- VERIFY( result10 == digits2 );
- VERIFY( err10 == ios_base::goodbit );
-
- iss.str("(HKD .01)");
- iterator_type is_it11(iss);
- string result11;
- ios_base::iostate err11 = ios_base::goodbit;
- mon_get.get(is_it11, end, true, iss, err11, result11);
- VERIFY( result11 == digits4 );
- VERIFY( err11 == ios_base::goodbit );
-
- // for the "en_HK" locale the parsing of the very same input streams must
- // be successful without showbase too, since the symbol field appears in
- // the first positions in the format and the symbol, when present, must be
- // consumed.
- iss.unsetf(ios_base::showbase);
-
- iss.str("HK$7,200,000,000.00");
- iterator_type is_it12(iss);
- string result12;
- ios_base::iostate err12 = ios_base::goodbit;
- mon_get.get(is_it12, end, false, iss, err12, result12);
- VERIFY( result12 == digits1 );
- VERIFY( err12 == ios_base::eofbit );
-
- iss.str("(HKD 100,000,000,000.00)");
- iterator_type is_it13(iss);
- string result13;
- ios_base::iostate err13 = ios_base::goodbit;
- mon_get.get(is_it13, end, true, iss, err13, result13);
- VERIFY( result13 == digits2 );
- VERIFY( err13 == ios_base::goodbit );
-
- iss.str("(HKD .01)");
- iterator_type is_it14(iss);
- string result14;
- ios_base::iostate err14 = ios_base::goodbit;
- mon_get.get(is_it14, end, true, iss, err14, result14);
- VERIFY( result14 == digits4 );
- VERIFY( err14 == ios_base::goodbit );
-}
-
-// test double version
-void test02()
-{
- using namespace std;
- typedef money_base::part part;
- typedef money_base::pattern pattern;
- typedef istreambuf_iterator<char> iterator_type;
-
- bool test = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE@euro");
- VERIFY( loc_c != loc_de );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the moneypunct facets
- typedef moneypunct<char, true> __money_true;
- typedef moneypunct<char, false> __money_false;
- const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
- const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
- const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
- const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
- const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
- const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
-
- // sanity check the data is correct.
- const string empty;
-
- // total EPA budget FY 2002
- const long double digits1 = 720000000000.0;
-
- // est. cost, national missile "defense", expressed as a loss in USD 2001
- const long double digits2 = -10000000000000.0;
-
- // input less than frac_digits
- const long double digits4 = -1.0;
-
- iterator_type end;
- istringstream iss;
- iss.imbue(loc_de);
- // cache the money_get facet
- const money_get<char>& mon_get = use_facet<money_get<char> >(iss.getloc());
-
- iss.str("7.200.000.000,00 ");
- iterator_type is_it01(iss);
- long double result1;
- ios_base::iostate err01 = ios_base::goodbit;
- mon_get.get(is_it01, end, true, iss, err01, result1);
- VERIFY( result1 == digits1 );
- VERIFY( err01 == ios_base::eofbit );
-
- iss.str("7.200.000.000,00 ");
- iterator_type is_it02(iss);
- long double result2;
- ios_base::iostate err02 = ios_base::goodbit;
- mon_get.get(is_it02, end, false, iss, err02, result2);
- VERIFY( result2 == digits1 );
- VERIFY( err02 == ios_base::eofbit );
-
- // now try with showbase, to get currency symbol in format
- iss.setf(ios_base::showbase);
-
- iss.imbue(loc_hk);
- iss.str("(HKD .01)");
- iterator_type is_it03(iss);
- long double result3;
- ios_base::iostate err03 = ios_base::goodbit;
- mon_get.get(is_it03, end, true, iss, err03, result3);
- VERIFY( result3 == digits4 );
- VERIFY( err03 == ios_base::goodbit );
-}
-
-void test03()
-{
- using namespace std;
- bool test = true;
-
- // Check money_get works with other iterators besides streambuf
- // input iterators.
- typedef string::const_iterator iter_type;
- typedef money_get<char, iter_type> mon_get_type;
- const ios_base::iostate goodbit = ios_base::goodbit;
- const ios_base::iostate eofbit = ios_base::eofbit;
- ios_base::iostate err = goodbit;
- const locale loc_c = locale::classic();
- const string str = "0.01Eleanor Roosevelt";
-
- istringstream iss;
- iss.imbue(locale(loc_c, new mon_get_type));
-
- // Iterator advanced, state, output.
- const mon_get_type& mg = use_facet<mon_get_type>(iss.getloc());
-
- // 01 string
- string res1;
- iter_type end1 = mg.get(str.begin(), str.end(), false, iss, err, res1);
- string rem1(end1, str.end());
- VERIFY( err == goodbit );
- VERIFY( res1 == "1" );
- VERIFY( rem1 == "Eleanor Roosevelt" );
-
- // 02 long double
- iss.clear();
- err = goodbit;
- long double res2;
- iter_type end2 = mg.get(str.begin(), str.end(), false, iss, err, res2);
- string rem2(end2, str.end());
- VERIFY( err == goodbit );
- VERIFY( res2 == 1 );
- VERIFY( rem2 == "Eleanor Roosevelt" );
-}
-
-// libstdc++/5280
-void test04()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE@euro");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE@euro.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE@euro", 1))
- {
- test01();
- test02();
- test03();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-struct My_money_io : public std::moneypunct<char,false>
-{
- char_type do_decimal_point() const { return '.'; }
- std::string do_grouping() const { return "\004"; }
-
- std::string do_curr_symbol() const { return "$"; }
- std::string do_positive_sign() const { return ""; }
- std::string do_negative_sign() const { return "-"; }
-
- int do_frac_digits() const { return 2; }
-
- pattern do_pos_format() const
- {
- pattern pat = { { symbol, none, sign, value } };
- return pat;
- }
-
- pattern do_neg_format() const
- {
- pattern pat = { { symbol, none, sign, value } };
- return pat;
- }
-};
-
-// libstdc++/5579
-void test05()
-{
- using namespace std;
- typedef istreambuf_iterator<char> InIt;
-
- bool test = true;
-
- locale loc(locale::classic(), new My_money_io);
-
- string bufferp("$1234.56");
- string buffern("$-1234.56");
- string bufferp_ns("1234.56");
- string buffern_ns("-1234.56");
-
- bool intl = false;
-
- InIt iendp, iendn, iendp_ns, iendn_ns;
- ios_base::iostate err;
- string valp, valn, valp_ns, valn_ns;
-
- const money_get<char,InIt>& mg =
- use_facet<money_get<char, InIt> >(loc);
-
- istringstream fmtp(bufferp);
- fmtp.imbue(loc);
- InIt ibegp(fmtp);
- mg.get(ibegp,iendp,intl,fmtp,err,valp);
- VERIFY( valp == "123456" );
-
- istringstream fmtn(buffern);
- fmtn.imbue(loc);
- InIt ibegn(fmtn);
- mg.get(ibegn,iendn,intl,fmtn,err,valn);
- VERIFY( valn == "-123456" );
-
- istringstream fmtp_ns(bufferp_ns);
- fmtp_ns.imbue(loc);
- InIt ibegp_ns(fmtp_ns);
- mg.get(ibegp_ns,iendp_ns,intl,fmtp_ns,err,valp_ns);
- VERIFY( valp_ns == "123456" );
-
- istringstream fmtn_ns(buffern_ns);
- fmtn_ns.imbue(loc);
- InIt ibegn_ns(fmtn_ns);
- mg.get(ibegn_ns,iendn_ns,intl,fmtn_ns,err,valn_ns);
- VERIFY( valn_ns == "-123456" );
-}
-
-// We were appending to the string val passed by reference, instead
-// of constructing a temporary candidate, eventually copied into
-// val in case of successful parsing.
-void test06()
-{
- using namespace std;
- bool test = true;
-
- typedef istreambuf_iterator<char> InIt;
- InIt iend1, iend2, iend3;
-
- locale loc;
- string buffer1("123");
- string buffer2("456");
- string buffer3("Golgafrincham"); // From Nathan's original idea.
-
- string val;
-
- ios_base::iostate err;
-
- const money_get<char,InIt>& mg =
- use_facet<money_get<char, InIt> >(loc);
-
- istringstream fmt1(buffer1);
- InIt ibeg1(fmt1);
- mg.get(ibeg1,iend1,false,fmt1,err,val);
- VERIFY( val == buffer1 );
-
- istringstream fmt2(buffer2);
- InIt ibeg2(fmt2);
- mg.get(ibeg2,iend2,false,fmt2,err,val);
- VERIFY( val == buffer2 );
-
- val = buffer3;
- istringstream fmt3(buffer3);
- InIt ibeg3(fmt3);
- mg.get(ibeg3,iend3,false,fmt3,err,val);
- VERIFY( val == buffer3 );
-}
-
-struct My_money_io_a : public std::moneypunct<char,false>
-{
- char_type do_decimal_point() const { return '.'; }
- std::string do_grouping() const { return "\004"; }
-
- std::string do_curr_symbol() const { return "$"; }
- std::string do_positive_sign() const { return "()"; }
-
- int do_frac_digits() const { return 2; }
-
- pattern do_pos_format() const
- {
- pattern pat = { { sign, value, space, symbol } };
- return pat;
- }
-};
-
-struct My_money_io_b : public std::moneypunct<char,false>
-{
- char_type do_decimal_point() const { return '.'; }
- std::string do_grouping() const { return "\004"; }
-
- std::string do_curr_symbol() const { return "$"; }
- std::string do_positive_sign() const { return "()"; }
-
- int do_frac_digits() const { return 2; }
-
- pattern do_pos_format() const
- {
- pattern pat = { { sign, value, symbol, none } };
- return pat;
- }
-};
-
-// This one exercises patterns of the type { X, Y, Z, symbol } and
-// { X, Y, symbol, none } for a two character long sign. Therefore
-// the optional symbol (showbase is false by default) must be consumed
-// if present, since "rest of the sign" is left to read.
-void test07()
-{
- using namespace std;
- typedef istreambuf_iterator<char> InIt;
-
- bool intl = false;
- bool test = true;
- ios_base::iostate err;
-
- locale loc_a(locale::classic(), new My_money_io_a);
-
- string buffer_a("(1234.56 $)");
- string buffer_a_ns("(1234.56 )");
-
- InIt iend_a, iend_a_ns;
- string val_a, val_a_ns;
-
- const money_get<char,InIt>& mg_a =
- use_facet<money_get<char, InIt> >(loc_a);
-
- istringstream fmt_a(buffer_a);
- fmt_a.imbue(loc_a);
- InIt ibeg_a(fmt_a);
- mg_a.get(ibeg_a,iend_a,intl,fmt_a,err,val_a);
- VERIFY( val_a == "123456" );
-
- istringstream fmt_a_ns(buffer_a_ns);
- fmt_a_ns.imbue(loc_a);
- InIt ibeg_a_ns(fmt_a_ns);
- mg_a.get(ibeg_a_ns,iend_a_ns,intl,fmt_a_ns,err,val_a_ns);
- VERIFY( val_a_ns == "123456" );
-
- locale loc_b(locale::classic(), new My_money_io_b);
-
- string buffer_b("(1234.56$)");
- string buffer_b_ns("(1234.56)");
-
- InIt iend_b, iend_b_ns;
- string val_b, val_b_ns;
-
- const money_get<char,InIt>& mg_b =
- use_facet<money_get<char, InIt> >(loc_b);
-
- istringstream fmt_b(buffer_b);
- fmt_b.imbue(loc_b);
- InIt ibeg_b(fmt_b);
- mg_b.get(ibeg_b,iend_b,intl,fmt_b,err,val_b);
- VERIFY( val_b == "123456" );
-
- istringstream fmt_b_ns(buffer_b_ns);
- fmt_b_ns.imbue(loc_b);
- InIt ibeg_b_ns(fmt_b_ns);
- mg_b.get(ibeg_b_ns,iend_b_ns,intl,fmt_b_ns,err,val_b_ns);
- VERIFY( val_b_ns == "123456" );
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test08()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- test02();
- test03();
- test05();
- test06();
- test07();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-
-int main()
-{
- test01();
- test02();
- test03();
- test04();
- test05();
- test06();
- test07();
- test08();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get_members_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/money_get_members_wchar_t.cc
deleted file mode 100644
index 3ac25d0204a..00000000000
--- a/libstdc++-v3/testsuite/22_locale/money_get_members_wchar_t.cc
+++ /dev/null
@@ -1,584 +0,0 @@
-// 2001-09-14 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2001, 2002 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This 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 General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.6.1.1 money_get members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-// test string version
-void test01()
-{
- using namespace std;
- typedef money_base::part part;
- typedef money_base::pattern pattern;
- typedef istreambuf_iterator<wchar_t> iterator_type;
-
- bool test = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE@euro");
- VERIFY( loc_c != loc_de );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the moneypunct facets
- typedef moneypunct<wchar_t, true> __money_true;
- typedef moneypunct<wchar_t, false> __money_false;
- const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
- const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
- const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
- const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
- const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
- const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
-
- // sanity check the data is correct.
- const wstring empty;
-
- // total EPA budget FY 2002
- const wstring digits1(L"720000000000");
-
- // est. cost, national missile "defense", expressed as a loss in USD 2001
- const wstring digits2(L"-10000000000000");
-
- // not valid input
- const wstring digits3(L"-A");
-
- // input less than frac_digits
- const wstring digits4(L"-1");
-
- iterator_type end;
- wistringstream iss;
- iss.imbue(loc_de);
- // cache the money_get facet
- const money_get<wchar_t>& mon_get = use_facet<money_get<wchar_t> >(iss.getloc());
-
-
- iss.str(L"7.200.000.000,00 ");
- iterator_type is_it01(iss);
- wstring result1;
- ios_base::iostate err01 = ios_base::goodbit;
- mon_get.get(is_it01, end, true, iss, err01, result1);
- VERIFY( result1 == digits1 );
- VERIFY( err01 == ios_base::eofbit );
-
- iss.str(L"7.200.000.000,00 ");
- iterator_type is_it02(iss);
- wstring result2;
- ios_base::iostate err02 = ios_base::goodbit;
- mon_get.get(is_it02, end, true, iss, err02, result2);
- VERIFY( result2 == digits1 );
- VERIFY( err02 == ios_base::eofbit );
-
- iss.str(L"7.200.000.000,00 a");
- iterator_type is_it03(iss);
- wstring result3;
- ios_base::iostate err03 = ios_base::goodbit;
- mon_get.get(is_it03, end, true, iss, err03, result3);
- VERIFY( result3 == digits1 );
- VERIFY( err03 == ios_base::goodbit );
-
- iss.str(L"");
- iterator_type is_it04(iss);
- wstring result4;
- ios_base::iostate err04 = ios_base::goodbit;
- mon_get.get(is_it04, end, true, iss, err04, result4);
- VERIFY( result4 == empty );
- VERIFY( err04 == ios_base::failbit | ios_base::eofbit );
-
- iss.str(L"working for enlightenment and peace in a mad world");
- iterator_type is_it05(iss);
- wstring result5;
- ios_base::iostate err05 = ios_base::goodbit;
- mon_get.get(is_it05, end, true, iss, err05, result5);
- VERIFY( result5 == empty );
- VERIFY( err05 == ios_base::failbit );
-
- // now try with showbase, to get currency symbol in format
- iss.setf(ios_base::showbase);
-
- iss.str(L"7.200.000.000,00 EUR ");
- iterator_type is_it06(iss);
- wstring result6;
- ios_base::iostate err06 = ios_base::goodbit;
- mon_get.get(is_it06, end, true, iss, err06, result6);
- VERIFY( result6 == digits1 );
- VERIFY( err06 == ios_base::eofbit );
-
- iss.str(L"7.200.000.000,00 EUR "); // Extra space.
- iterator_type is_it07(iss);
- wstring result7;
- ios_base::iostate err07 = ios_base::goodbit;
- mon_get.get(is_it07, end, true, iss, err07, result7);
- VERIFY( result7 == digits1 );
- VERIFY( err07 == ios_base::goodbit );
-
- iss.str(L"7.200.000.000,00 \x20ac");
- iterator_type is_it08(iss);
- wstring result8;
- ios_base::iostate err08 = ios_base::goodbit;
- mon_get.get(is_it08, end, false, iss, err08, result8);
- VERIFY( result8 == digits1 );
- VERIFY( err08 == ios_base::eofbit );
-
- iss.imbue(loc_hk);
- iss.str(L"HK$7,200,000,000.00");
- iterator_type is_it09(iss);
- wstring result9;
- ios_base::iostate err09 = ios_base::goodbit;
- mon_get.get(is_it09, end, false, iss, err09, result9);
- VERIFY( result9 == digits1 );
- VERIFY( err09 == ios_base::eofbit );
-
- iss.str(L"(HKD 100,000,000,000.00)");
- iterator_type is_it10(iss);
- wstring result10;
- ios_base::iostate err10 = ios_base::goodbit;
- mon_get.get(is_it10, end, true, iss, err10, result10);
- VERIFY( result10 == digits2 );
- VERIFY( err10 == ios_base::goodbit );
-
- iss.str(L"(HKD .01)");
- iterator_type is_it11(iss);
- wstring result11;
- ios_base::iostate err11 = ios_base::goodbit;
- mon_get.get(is_it11, end, true, iss, err11, result11);
- VERIFY( result11 == digits4 );
- VERIFY( err11 == ios_base::goodbit );
-
- // for the "en_HK" locale the parsing of the very same input streams must
- // be successful without showbase too, since the symbol field appears in
- // the first positions in the format and the symbol, when present, must be
- // consumed.
- iss.unsetf(ios_base::showbase);
-
- iss.str(L"HK$7,200,000,000.00");
- iterator_type is_it12(iss);
- wstring result12;
- ios_base::iostate err12 = ios_base::goodbit;
- mon_get.get(is_it12, end, false, iss, err12, result12);
- VERIFY( result12 == digits1 );
- VERIFY( err12 == ios_base::eofbit );
-
- iss.str(L"(HKD 100,000,000,000.00)");
- iterator_type is_it13(iss);
- wstring result13;
- ios_base::iostate err13 = ios_base::goodbit;
- mon_get.get(is_it13, end, true, iss, err13, result13);
- VERIFY( result13 == digits2 );
- VERIFY( err13 == ios_base::goodbit );
-
- iss.str(L"(HKD .01)");
- iterator_type is_it14(iss);
- wstring result14;
- ios_base::iostate err14 = ios_base::goodbit;
- mon_get.get(is_it14, end, true, iss, err14, result14);
- VERIFY( result14 == digits4 );
- VERIFY( err14 == ios_base::goodbit );
-}
-
-
-// test double/wstring versions
-void test02()
-{
- using namespace std;
- typedef money_base::part part;
- typedef money_base::pattern pattern;
- typedef istreambuf_iterator<wchar_t> iterator_type;
-
- bool test = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE@euro");
- VERIFY( loc_c != loc_de );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the moneypunct facets
- typedef moneypunct<wchar_t, true> __money_true;
- typedef moneypunct<wchar_t, false> __money_false;
- const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
- const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
- const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
- const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
- const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
- const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
-
- // sanity check the data is correct.
- const wstring empty;
-
- // total EPA budget FY 2002
- const long double digits1 = 720000000000.0;
-
- // est. cost, national missile "defense", expressed as a loss in USD 2001
- const long double digits2 = -10000000000000.0;
-
- // input less than frac_digits
- const long double digits4 = -1.0;
-
- iterator_type end;
- wistringstream iss;
- iss.imbue(loc_de);
- // cache the money_get facet
- const money_get<wchar_t>& mon_get = use_facet<money_get<wchar_t> >(iss.getloc());
-
- iss.str(L"7.200.000.000,00 ");
- iterator_type is_it01(iss);
- long double result1;
- ios_base::iostate err01 = ios_base::goodbit;
- mon_get.get(is_it01, end, true, iss, err01, result1);
- VERIFY( result1 == digits1 );
- VERIFY( err01 == ios_base::eofbit );
-
- iss.str(L"7.200.000.000,00 ");
- iterator_type is_it02(iss);
- long double result2;
- ios_base::iostate err02 = ios_base::goodbit;
- mon_get.get(is_it02, end, false, iss, err02, result2);
- VERIFY( result2 == digits1 );
- VERIFY( err02 == ios_base::eofbit );
-
- // now try with showbase, to get currency symbol in format
- iss.setf(ios_base::showbase);
-
- iss.imbue(loc_hk);
- iss.str(L"(HKD .01)");
- iterator_type is_it03(iss);
- long double result3;
- ios_base::iostate err03 = ios_base::goodbit;
- mon_get.get(is_it03, end, true, iss, err03, result3);
- VERIFY( result3 == digits4 );
- VERIFY( err03 == ios_base::goodbit );
-}
-
-void test03()
-{
- using namespace std;
- bool test = true;
-
- // Check money_get works with other iterators besides streambuf
- // output iterators.
- typedef wstring::const_iterator iter_type;
- typedef money_get<wchar_t, iter_type> mon_get_type;
- const ios_base::iostate goodbit = ios_base::goodbit;
- const ios_base::iostate eofbit = ios_base::eofbit;
- ios_base::iostate err = goodbit;
- const locale loc_c = locale::classic();
- const wstring str = L"0.01Eleanor Roosevelt";
-
- wistringstream iss;
- iss.imbue(locale(loc_c, new mon_get_type));
-
- // Iterator advanced, state, output.
- const mon_get_type& mg = use_facet<mon_get_type>(iss.getloc());
-
- // 01 string
- wstring res1;
- iter_type end1 = mg.get(str.begin(), str.end(), false, iss, err, res1);
- wstring rem1(end1, str.end());
- VERIFY( err == goodbit );
- VERIFY( res1 == L"1" );
- VERIFY( rem1 == L"Eleanor Roosevelt" );
-
- // 02 long double
- iss.clear();
- err = goodbit;
- long double res2;
- iter_type end2 = mg.get(str.begin(), str.end(), false, iss, err, res2);
- wstring rem2(end2, str.end());
- VERIFY( err == goodbit );
- VERIFY( res2 == 1 );
- VERIFY( rem2 == L"Eleanor Roosevelt" );
-}
-
-// libstdc++/5280
-void test04()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE@euro");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE@euro.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE@euro", 1))
- {
- test01();
- test02();
- test03();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-struct My_money_io : public std::moneypunct<wchar_t,false>
-{
- char_type do_decimal_point() const { return L'.'; }
- std::string do_grouping() const { return "\004"; }
-
- std::wstring do_curr_symbol() const { return L"$"; }
- std::wstring do_positive_sign() const { return L""; }
- std::wstring do_negative_sign() const { return L"-"; }
-
- int do_frac_digits() const { return 2; }
-
- pattern do_pos_format() const
- {
- pattern pat = { { symbol, none, sign, value } };
- return pat;
- }
-
- pattern do_neg_format() const
- {
- pattern pat = { { symbol, none, sign, value } };
- return pat;
- }
-};
-
-// libstdc++/5579
-void test05()
-{
- using namespace std;
- bool test = true;
- typedef istreambuf_iterator<wchar_t> InIt;
-
- locale loc(locale::classic(), new My_money_io);
-
- wstring bufferp(L"$1234.56");
- wstring buffern(L"$-1234.56");
- wstring bufferp_ns(L"1234.56");
- wstring buffern_ns(L"-1234.56");
-
- bool intl = false;
-
- InIt iendp, iendn, iendp_ns, iendn_ns;
- ios_base::iostate err;
- wstring valp, valn, valp_ns, valn_ns;
-
- const money_get<wchar_t,InIt>& mg =
- use_facet<money_get<wchar_t, InIt> >(loc);
-
- wistringstream fmtp(bufferp);
- fmtp.imbue(loc);
- InIt ibegp(fmtp);
- mg.get(ibegp,iendp,intl,fmtp,err,valp);
- VERIFY( valp == L"123456" );
-
- wistringstream fmtn(buffern);
- fmtn.imbue(loc);
- InIt ibegn(fmtn);
- mg.get(ibegn,iendn,intl,fmtn,err,valn);
- VERIFY( valn == L"-123456" );
-
- wistringstream fmtp_ns(bufferp_ns);
- fmtp_ns.imbue(loc);
- InIt ibegp_ns(fmtp_ns);
- mg.get(ibegp_ns,iendp_ns,intl,fmtp_ns,err,valp_ns);
- VERIFY( valp_ns == L"123456" );
-
- wistringstream fmtn_ns(buffern_ns);
- fmtn_ns.imbue(loc);
- InIt ibegn_ns(fmtn_ns);
- mg.get(ibegn_ns,iendn_ns,intl,fmtn_ns,err,valn_ns);
- VERIFY( valn_ns == L"-123456" );
-}
-
-// We were appending to the string val passed by reference, instead
-// of constructing a temporary candidate, eventually copied into
-// val in case of successful parsing.
-void test06()
-{
- using namespace std;
- bool test = true;
-
- typedef istreambuf_iterator<wchar_t> InIt;
- InIt iend1, iend2, iend3;
-
- locale loc;
- wstring buffer1(L"123");
- wstring buffer2(L"456");
- wstring buffer3(L"Golgafrincham");
-
- wstring val;
-
- ios_base::iostate err;
-
- const money_get<wchar_t,InIt>& mg =
- use_facet<money_get<wchar_t, InIt> >(loc);
-
- wistringstream fmt1(buffer1);
- InIt ibeg1(fmt1);
- mg.get(ibeg1,iend1,false,fmt1,err,val);
- VERIFY( val == buffer1 );
-
- wistringstream fmt2(buffer2);
- InIt ibeg2(fmt2);
- mg.get(ibeg2,iend2,false,fmt2,err,val);
- VERIFY( val == buffer2 );
-
- val = buffer3;
- wistringstream fmt3(buffer3);
- InIt ibeg3(fmt3);
- mg.get(ibeg3,iend3,false,fmt3,err,val);
- VERIFY( val == buffer3 );
-}
-
-struct My_money_io_a : public std::moneypunct<wchar_t,false>
-{
- char_type do_decimal_point() const { return L'.'; }
- std::string do_grouping() const { return "\004"; }
-
- std::wstring do_curr_symbol() const { return L"$"; }
- std::wstring do_positive_sign() const { return L"()"; }
-
- int do_frac_digits() const { return 2; }
-
- pattern do_pos_format() const
- {
- pattern pat = { { sign, value, space, symbol } };
- return pat;
- }
-};
-
-struct My_money_io_b : public std::moneypunct<wchar_t,false>
-{
- char_type do_decimal_point() const { return L'.'; }
- std::string do_grouping() const { return "\004"; }
-
- std::wstring do_curr_symbol() const { return L"$"; }
- std::wstring do_positive_sign() const { return L"()"; }
-
- int do_frac_digits() const { return 2; }
-
- pattern do_pos_format() const
- {
- pattern pat = { { sign, value, symbol, none } };
- return pat;
- }
-};
-
-// This one exercises patterns of the type { X, Y, Z, symbol } and
-// { X, Y, symbol, none } for a two character long sign. Therefore
-// the optional symbol (showbase is false by default) must be consumed
-// if present, since "rest of the sign" is left to read.
-void test07()
-{
- using namespace std;
- bool test = true;
- typedef istreambuf_iterator<wchar_t> InIt;
-
- bool intl = false;
- ios_base::iostate err;
-
- locale loc_a(locale::classic(), new My_money_io_a);
-
- wstring buffer_a(L"(1234.56 $)");
- wstring buffer_a_ns(L"(1234.56 )");
-
- InIt iend_a, iend_a_ns;
- wstring val_a, val_a_ns;
-
- const money_get<wchar_t,InIt>& mg_a =
- use_facet<money_get<wchar_t, InIt> >(loc_a);
-
- wistringstream fmt_a(buffer_a);
- fmt_a.imbue(loc_a);
- InIt ibeg_a(fmt_a);
- mg_a.get(ibeg_a,iend_a,intl,fmt_a,err,val_a);
- VERIFY( val_a == L"123456" );
-
- wistringstream fmt_a_ns(buffer_a_ns);
- fmt_a_ns.imbue(loc_a);
- InIt ibeg_a_ns(fmt_a_ns);
- mg_a.get(ibeg_a_ns,iend_a_ns,intl,fmt_a_ns,err,val_a_ns);
- VERIFY( val_a_ns == L"123456" );
-
- locale loc_b(locale::classic(), new My_money_io_b);
-
- wstring buffer_b(L"(1234.56$)");
- wstring buffer_b_ns(L"(1234.56)");
-
- InIt iend_b, iend_b_ns;
- wstring val_b, val_b_ns;
-
- const money_get<wchar_t,InIt>& mg_b =
- use_facet<money_get<wchar_t, InIt> >(loc_b);
-
- wistringstream fmt_b(buffer_b);
- fmt_b.imbue(loc_b);
- InIt ibeg_b(fmt_b);
- mg_b.get(ibeg_b,iend_b,intl,fmt_b,err,val_b);
- VERIFY( val_b == L"123456" );
-
- wistringstream fmt_b_ns(buffer_b_ns);
- fmt_b_ns.imbue(loc_b);
- InIt ibeg_b_ns(fmt_b_ns);
- mg_b.get(ibeg_b_ns,iend_b_ns,intl,fmt_b_ns,err,val_b_ns);
- VERIFY( val_b_ns == L"123456" );
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test08()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- test02();
- test03();
- test05();
- test06();
- test07();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-#endif
-
-int main()
-{
-#ifdef _GLIBCPP_USE_WCHAR_T
- test01();
- test02();
- test03();
- test04();
- test05();
- test06();
- test07();
- test08();
-#endif
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put.cc b/libstdc++-v3/testsuite/22_locale/money_put/1.cc
index d8398f4ddda..e4f27c723db 100644
--- a/libstdc++-v3/testsuite/22_locale/money_put.cc
+++ b/libstdc++-v3/testsuite/22_locale/money_put/1.cc
@@ -1,6 +1,7 @@
+// { dg-do compile }
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001 Free Software Foundation
+// Copyright (C) 2001, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -20,8 +21,6 @@
// 22.2.6.2 Template class money_put
-// { dg-do compile }
-
#include <locale>
void test01()
@@ -38,18 +37,8 @@ void test01()
typedef test_type::iter_type iter_type;
}
-// Should be able to instantiate this for other types besides char, wchar_t
-class gnu_money_put: public std::money_put<unsigned char>
-{ };
-
-void test02()
-{
- gnu_money_put facet01;
-}
-
int main()
{
test01();
- test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/2.cc b/libstdc++-v3/testsuite/22_locale/money_put/2.cc
new file mode 100644
index 00000000000..13f57a95637
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/2.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.2 Template class money_put
+
+#include <locale>
+
+// Should be able to instantiate this for other types besides char, wchar_t
+class gnu_money_put: public std::money_put<unsigned char>
+{ };
+
+void test02()
+{
+ gnu_money_put facet01;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/1.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/1.cc
new file mode 100644
index 00000000000..cbc78895129
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/char/1.cc
@@ -0,0 +1,129 @@
+// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.2.1 money_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// test string version
+void test01()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+ typedef ostreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE@euro");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the moneypunct facets
+ typedef moneypunct<char, true> __money_true;
+ typedef moneypunct<char, false> __money_false;
+ const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
+ const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
+ const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
+ const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
+ const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
+ const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
+
+ // sanity check the data is correct.
+ const string empty;
+
+ // total EPA budget FY 2002
+ const string digits1("720000000000");
+
+ // est. cost, national missile "defense", expressed as a loss in USD 2001
+ const string digits2("-10000000000000");
+
+ // not valid input
+ const string digits3("-A");
+
+ // input less than frac_digits
+ const string digits4("-1");
+
+ // cache the money_put facet
+ ostringstream oss;
+ oss.imbue(loc_de);
+ const money_put<char>& mon_put = use_facet<money_put<char> >(oss.getloc());
+
+ iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
+ string result1 = oss.str();
+ VERIFY( result1 == "7.200.000.000,00 ");
+
+ oss.str(empty);
+ iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
+ string result2 = oss.str();
+ VERIFY( result2 == "7.200.000.000,00 ");
+
+ // intl and non-intl versions should be the same.
+ VERIFY( result1 == result2 );
+
+ // now try with showbase, to get currency symbol in format
+ oss.setf(ios_base::showbase);
+
+ oss.str(empty);
+ iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
+ string result3 = oss.str();
+ VERIFY( result3 == "7.200.000.000,00 EUR ");
+
+ oss.str(empty);
+ iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
+ string result4 = oss.str();
+ VERIFY( result4 == "7.200.000.000,00 \244");
+
+ // intl and non-intl versions should be different.
+ VERIFY( result3 != result4 );
+ VERIFY( result3 != result1 );
+ VERIFY( result4 != result2 );
+
+ oss.unsetf(ios_base::showbase);
+
+ // test io.width() > length
+ // test various fill strategies
+ oss.str(empty);
+ oss.width(20);
+ iterator_type os_it10 = mon_put.put(oss.rdbuf(), true, oss, '*', digits4);
+ string result10 = oss.str();
+ VERIFY( result10 == "***************-,01*");
+
+ oss.str(empty);
+ oss.width(20);
+ oss.setf(ios_base::internal);
+ iterator_type os_it11 = mon_put.put(oss.rdbuf(), true, oss, '*', digits4);
+ string result11 = oss.str();
+ VERIFY( result11 == "-,01****************");
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/2.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/2.cc
new file mode 100644
index 00000000000..72428445d22
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/char/2.cc
@@ -0,0 +1,120 @@
+// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.2.1 money_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// test string version
+void test02()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+ typedef ostreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE@euro");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the moneypunct facets
+ typedef moneypunct<char, true> __money_true;
+ typedef moneypunct<char, false> __money_false;
+ const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
+ const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
+ const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
+ const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
+ const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
+ const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
+
+ // sanity check the data is correct.
+ const string empty;
+
+ // total EPA budget FY 2002
+ const string digits1("720000000000");
+
+ // est. cost, national missile "defense", expressed as a loss in USD 2001
+ const string digits2("-10000000000000");
+
+ // not valid input
+ const string digits3("-A");
+
+ // input less than frac_digits
+ const string digits4("-1");
+
+ // cache the money_put facet
+ ostringstream oss;
+ oss.imbue(loc_hk);
+ const money_put<char>& mon_put = use_facet<money_put<char> >(oss.getloc());
+
+ // now try with showbase, to get currency symbol in format
+ oss.setf(ios_base::showbase);
+
+ // test sign of more than one digit, say hong kong.
+ oss.str(empty);
+ iterator_type os_it05 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
+ string result5 = oss.str();
+ VERIFY( result5 == "HK$7,200,000,000.00");
+
+ oss.str(empty);
+ iterator_type os_it06 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits2);
+ string result6 = oss.str();
+ VERIFY( result6 == "(HKD 100,000,000,000.00)");
+
+ // test one-digit formats without zero padding
+ oss.imbue(loc_c);
+ oss.str(empty);
+ const money_put<char>& mon_put2 = use_facet<money_put<char> >(oss.getloc());
+ iterator_type os_it07 = mon_put2.put(oss.rdbuf(), true, oss, ' ', digits4);
+ string result7 = oss.str();
+ VERIFY( result7 == "1");
+
+ // test one-digit formats with zero padding, zero frac widths
+ oss.imbue(loc_hk);
+ oss.str(empty);
+ const money_put<char>& mon_put3 = use_facet<money_put<char> >(oss.getloc());
+ iterator_type os_it08 = mon_put3.put(oss.rdbuf(), true, oss, ' ', digits4);
+ string result8 = oss.str();
+ VERIFY( result8 == "(HKD .01)");
+
+ oss.unsetf(ios_base::showbase);
+
+ // test bunk input
+ oss.str(empty);
+ iterator_type os_it09 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits3);
+ string result9 = oss.str();
+ VERIFY( result9 == "");
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/3.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/3.cc
new file mode 100644
index 00000000000..58e3ff47099
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/char/3.cc
@@ -0,0 +1,109 @@
+// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.2.1 money_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// test double version
+void test03()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+ typedef ostreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE@euro");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the moneypunct facets
+ typedef moneypunct<char, true> __money_true;
+ typedef moneypunct<char, false> __money_false;
+ const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
+ const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
+ const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
+ const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
+ const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
+ const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
+
+ // sanity check the data is correct.
+ const string empty;
+
+ // total EPA budget FY 2002
+ const long double digits1 = 720000000000.0;
+
+ // est. cost, national missile "defense", expressed as a loss in USD 2001
+ const long double digits2 = -10000000000000.0;
+
+ // input less than frac_digits
+ const long double digits4 = -1.0;
+
+ // cache the money_put facet
+ ostringstream oss;
+ oss.imbue(loc_de);
+ const money_put<char>& mon_put = use_facet<money_put<char> >(oss.getloc());
+
+ iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
+ string result1 = oss.str();
+ VERIFY( result1 == "7.200.000.000,00 ");
+
+ oss.str(empty);
+ iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
+ string result2 = oss.str();
+ VERIFY( result2 == "7.200.000.000,00 ");
+
+ // intl and non-intl versions should be the same.
+ VERIFY( result1 == result2 );
+
+ // now try with showbase, to get currency symbol in format
+ oss.setf(ios_base::showbase);
+
+ oss.str(empty);
+ iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
+ string result3 = oss.str();
+ VERIFY( result3 == "7.200.000.000,00 EUR ");
+
+ oss.str(empty);
+ iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
+ string result4 = oss.str();
+ VERIFY( result4 == "7.200.000.000,00 \244");
+
+ // intl and non-intl versions should be different.
+ VERIFY( result3 != result4 );
+ VERIFY( result3 != result1 );
+ VERIFY( result4 != result2 );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/4.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/4.cc
new file mode 100644
index 00000000000..4d4518fb776
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/char/4.cc
@@ -0,0 +1,73 @@
+// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.2.1 money_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test04()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check money_put works with other iterators besides streambuf
+ // output iterators. (As long as output_iterator requirements are met.)
+ typedef string::iterator iter_type;
+ typedef money_put<char, iter_type> mon_put_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+ // woman, art, thief (stole the blues)
+ const string str("1943 Janis Joplin");
+ const long double ld = 1943.0;
+ const string x(str.size(), 'x'); // have to have allocated string!
+ string res;
+
+ ostringstream oss;
+ oss.imbue(locale(loc_c, new mon_put_type));
+
+ // Iterator advanced, state, output.
+ const mon_put_type& mp = use_facet<mon_put_type>(oss.getloc());
+
+ // 01 string
+ res = x;
+ iter_type ret1 = mp.put(res.begin(), false, oss, ' ', str);
+ string sanity1(res.begin(), ret1);
+ VERIFY( err == goodbit );
+ VERIFY( res == "1943xxxxxxxxxxxxx" );
+ VERIFY( sanity1 == "1943" );
+
+ // 02 long double
+ res = x;
+ iter_type ret2 = mp.put(res.begin(), false, oss, ' ', ld);
+ string sanity2(res.begin(), ret2);
+ VERIFY( err == goodbit );
+ VERIFY( res == "1943xxxxxxxxxxxxx" );
+ VERIFY( sanity2 == "1943" );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/5.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/5.cc
new file mode 100644
index 00000000000..86a006d0023
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/char/5.cc
@@ -0,0 +1,70 @@
+// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.2.1 money_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+struct My_money_io : public std::moneypunct<char,false>
+{
+ char_type do_decimal_point() const { return '.'; }
+ char_type do_thousands_sep() const { return ','; }
+ std::string do_grouping() const { return "\003"; }
+
+ std::string do_negative_sign() const { return "()"; }
+
+ int do_frac_digits() const { return 2; }
+
+ pattern do_neg_format() const
+ {
+ pattern pat = { { symbol, space, sign, value } };
+ return pat;
+ }
+};
+
+// libstdc++/5708
+void test05()
+{
+ using namespace std;
+ bool test = true;
+ typedef ostreambuf_iterator<char> OutIt;
+
+ locale loc(locale::classic(), new My_money_io);
+
+ bool intl = false;
+
+ string val("-123456");
+ const money_put<char,OutIt>& mp =
+ use_facet<money_put<char, OutIt> >(loc);
+
+ ostringstream fmt;
+ fmt.imbue(loc);
+ OutIt out(fmt);
+ mp.put(out,intl,fmt,'*',val);
+ VERIFY( fmt.str() == "*(1,234.56)" );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/6.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/6.cc
new file mode 100644
index 00000000000..b663d76bbe2
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/char/6.cc
@@ -0,0 +1,59 @@
+// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.2.1 money_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+struct My_money_io_2 : public std::moneypunct<char,false>
+{
+ char_type do_thousands_sep() const { return ','; }
+ std::string do_grouping() const { return "\001"; }
+};
+
+// Make sure we can output a very big amount of money (with grouping too).
+void test06()
+{
+ using namespace std;
+ bool test = true;
+ typedef ostreambuf_iterator<char> OutIt;
+
+ locale loc(locale::classic(), new My_money_io_2);
+
+ bool intl = false;
+
+ long double val = 1.0e50L;
+ const money_put<char,OutIt>& mp =
+ use_facet<money_put<char, OutIt> >(loc);
+
+ ostringstream fmt;
+ fmt.imbue(loc);
+ OutIt out(fmt);
+ mp.put(out,intl,fmt,'*',val);
+ VERIFY( fmt.good() );
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/wrapped_env.cc
new file mode 100644
index 00000000000..c04f700e5cd
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/char/wrapped_env.cc
@@ -0,0 +1,61 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/wrapped_locale.cc
new file mode 100644
index 00000000000..88f84572a91
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/char/wrapped_locale.cc
@@ -0,0 +1,61 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/1.cc
new file mode 100644
index 00000000000..400ce026ce7
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/1.cc
@@ -0,0 +1,129 @@
+// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.2.1 money_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// test wstring version
+void test01()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE@euro");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the moneypunct facets
+ typedef moneypunct<wchar_t, true> __money_true;
+ typedef moneypunct<wchar_t, false> __money_false;
+ const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
+ const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
+ const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
+ const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
+ const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
+ const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
+
+ // sanity check the data is correct.
+ const wstring empty;
+
+ // total EPA budget FY 2002
+ const wstring digits1(L"720000000000");
+
+ // est. cost, national missile "defense", expressed as a loss in USD 2001
+ const wstring digits2(L"-10000000000000");
+
+ // not valid input
+ const wstring digits3(L"-A");
+
+ // input less than frac_digits
+ const wstring digits4(L"-1");
+
+ // cache the money_put facet
+ wostringstream oss;
+ oss.imbue(loc_de);
+ const money_put<wchar_t>& mon_put = use_facet<money_put<wchar_t> >(oss.getloc());
+
+ iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
+ wstring result1 = oss.str();
+ VERIFY( result1 == L"7.200.000.000,00 ");
+
+ oss.str(empty);
+ iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
+ wstring result2 = oss.str();
+ VERIFY( result2 == L"7.200.000.000,00 ");
+
+ // intl and non-intl versions should be the same.
+ VERIFY( result1 == result2 );
+
+ // now try with showbase, to get currency symbol in format
+ oss.setf(ios_base::showbase);
+
+ oss.str(empty);
+ iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
+ wstring result3 = oss.str();
+ VERIFY( result3 == L"7.200.000.000,00 EUR ");
+
+ oss.str(empty);
+ iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
+ wstring result4 = oss.str();
+ VERIFY( result4 == L"7.200.000.000,00 \x20ac");
+
+ // intl and non-intl versions should be different.
+ VERIFY( result3 != result4 );
+ VERIFY( result3 != result1 );
+ VERIFY( result4 != result2 );
+
+ oss.unsetf(ios_base::showbase);
+
+ // test io.width() > length
+ // test various fill strategies
+ oss.str(empty);
+ oss.width(20);
+ iterator_type os_it10 = mon_put.put(oss.rdbuf(), true, oss, '*', digits4);
+ wstring result10 = oss.str();
+ VERIFY( result10 == L"***************-,01*");
+
+ oss.str(empty);
+ oss.width(20);
+ oss.setf(ios_base::internal);
+ iterator_type os_it11 = mon_put.put(oss.rdbuf(), true, oss, '*', digits4);
+ wstring result11 = oss.str();
+ VERIFY( result11 == L"-,01****************");
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/2.cc
new file mode 100644
index 00000000000..d99a240ff0a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/2.cc
@@ -0,0 +1,120 @@
+// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.2.1 money_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// test wstring version
+void test02()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE@euro");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the moneypunct facets
+ typedef moneypunct<wchar_t, true> __money_true;
+ typedef moneypunct<wchar_t, false> __money_false;
+ const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
+ const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
+ const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
+ const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
+ const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
+ const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
+
+ // sanity check the data is correct.
+ const wstring empty;
+
+ // total EPA budget FY 2002
+ const wstring digits1(L"720000000000");
+
+ // est. cost, national missile "defense", expressed as a loss in USD 2001
+ const wstring digits2(L"-10000000000000");
+
+ // not valid input
+ const wstring digits3(L"-A");
+
+ // input less than frac_digits
+ const wstring digits4(L"-1");
+
+ // cache the money_put facet
+ wostringstream oss;
+ oss.imbue(loc_hk);
+ const money_put<wchar_t>& mon_put = use_facet<money_put<wchar_t> >(oss.getloc());
+
+ // now try with showbase, to get currency symbol in format
+ oss.setf(ios_base::showbase);
+
+ // test sign of more than one digit, say hong kong.
+ oss.str(empty);
+ iterator_type os_it05 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
+ wstring result5 = oss.str();
+ VERIFY( result5 == L"HK$7,200,000,000.00");
+
+ oss.str(empty);
+ iterator_type os_it06 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits2);
+ wstring result6 = oss.str();
+ VERIFY( result6 == L"(HKD 100,000,000,000.00)");
+
+ // test one-digit formats without zero padding
+ oss.imbue(loc_c);
+ oss.str(empty);
+ const money_put<wchar_t>& mon_put2 = use_facet<money_put<wchar_t> >(oss.getloc());
+ iterator_type os_it07 = mon_put2.put(oss.rdbuf(), true, oss, ' ', digits4);
+ wstring result7 = oss.str();
+ VERIFY( result7 == L"1");
+
+ // test one-digit formats with zero padding, zero frac widths
+ oss.imbue(loc_hk);
+ oss.str(empty);
+ const money_put<wchar_t>& mon_put3 = use_facet<money_put<wchar_t> >(oss.getloc());
+ iterator_type os_it08 = mon_put3.put(oss.rdbuf(), true, oss, ' ', digits4);
+ wstring result8 = oss.str();
+ VERIFY( result8 == L"(HKD .01)");
+
+ oss.unsetf(ios_base::showbase);
+
+ // test bunk input
+ oss.str(empty);
+ iterator_type os_it09 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits3);
+ wstring result9 = oss.str();
+ VERIFY( result9 == L"");
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/3.cc
new file mode 100644
index 00000000000..8a7778396bc
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/3.cc
@@ -0,0 +1,109 @@
+// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.2.1 money_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// test double version
+void test03()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE@euro");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the moneypunct facets
+ typedef moneypunct<wchar_t, true> __money_true;
+ typedef moneypunct<wchar_t, false> __money_false;
+ const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
+ const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
+ const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
+ const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
+ const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
+ const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
+
+ // sanity check the data is correct.
+ const wstring empty;
+
+ // total EPA budget FY 2002
+ const long double digits1 = 720000000000.0;
+
+ // est. cost, national missile "defense", expressed as a loss in USD 2001
+ const long double digits2 = -10000000000000.0;
+
+ // input less than frac_digits
+ const long double digits4 = -1.0;
+
+ // cache the money_put facet
+ wostringstream oss;
+ oss.imbue(loc_de);
+ const money_put<wchar_t>& mon_put = use_facet<money_put<wchar_t> >(oss.getloc());
+
+ iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
+ wstring result1 = oss.str();
+ VERIFY( result1 == L"7.200.000.000,00 ");
+
+ oss.str(empty);
+ iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
+ wstring result2 = oss.str();
+ VERIFY( result2 == L"7.200.000.000,00 ");
+
+ // intl and non-intl versions should be the same.
+ VERIFY( result1 == result2 );
+
+ // now try with showbase, to get currency symbol in format
+ oss.setf(ios_base::showbase);
+
+ oss.str(empty);
+ iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
+ wstring result3 = oss.str();
+ VERIFY( result3 == L"7.200.000.000,00 EUR ");
+
+ oss.str(empty);
+ iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
+ wstring result4 = oss.str();
+ VERIFY( result4 == L"7.200.000.000,00 \x20ac");
+
+ // intl and non-intl versions should be different.
+ VERIFY( result3 != result4 );
+ VERIFY( result3 != result1 );
+ VERIFY( result4 != result2 );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/4.cc
new file mode 100644
index 00000000000..397fd2ea7fe
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/4.cc
@@ -0,0 +1,73 @@
+// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.2.1 money_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test04()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check money_put works with other iterators besides streambuf
+ // output iterators. (As long as output_iterator requirements are met.)
+ typedef wstring::iterator iter_type;
+ typedef money_put<wchar_t, iter_type> mon_put_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+ // woman, art, thief (stole the blues)
+ const wstring str(L"1943 Janis Joplin");
+ const long double ld = 1943.0;
+ const wstring x(str.size(), 'x'); // have to have allocated wstring!
+ wstring res;
+
+ ostringstream oss;
+ oss.imbue(locale(loc_c, new mon_put_type));
+
+ // Iterator advanced, state, output.
+ const mon_put_type& mp = use_facet<mon_put_type>(oss.getloc());
+
+ // 01 wstring
+ res = x;
+ iter_type ret1 = mp.put(res.begin(), false, oss, ' ', str);
+ wstring sanity1(res.begin(), ret1);
+ VERIFY( err == goodbit );
+ VERIFY( res == L"1943xxxxxxxxxxxxx" );
+ VERIFY( sanity1 == L"1943" );
+
+ // 02 long double
+ res = x;
+ iter_type ret2 = mp.put(res.begin(), false, oss, ' ', ld);
+ wstring sanity2(res.begin(), ret2);
+ VERIFY( err == goodbit );
+ VERIFY( res == L"1943xxxxxxxxxxxxx" );
+ VERIFY( sanity2 == L"1943" );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/5.cc
new file mode 100644
index 00000000000..aa5a18c93d9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/5.cc
@@ -0,0 +1,70 @@
+// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.2.1 money_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+struct My_money_io : public std::moneypunct<wchar_t,false>
+{
+ char_type do_decimal_point() const { return '.'; }
+ char_type do_thousands_sep() const { return ','; }
+ std::string do_grouping() const { return "\003"; }
+
+ std::wstring do_negative_sign() const { return L"()"; }
+
+ int do_frac_digits() const { return 2; }
+
+ pattern do_neg_format() const
+ {
+ pattern pat = { { symbol, space, sign, value } };
+ return pat;
+ }
+};
+
+// libstdc++/5708
+void test05()
+{
+ using namespace std;
+ bool test = true;
+ typedef ostreambuf_iterator<wchar_t> OutIt;
+
+ locale loc(locale::classic(), new My_money_io);
+
+ bool intl = false;
+
+ wstring val(L"-123456");
+ const money_put<wchar_t,OutIt>& mp =
+ use_facet<money_put<wchar_t, OutIt> >(loc);
+
+ wostringstream fmt;
+ fmt.imbue(loc);
+ OutIt out(fmt);
+ mp.put(out,intl,fmt,'*',val);
+ VERIFY( fmt.str() == L"*(1,234.56)" );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/6.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/6.cc
new file mode 100644
index 00000000000..d92619c554d
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/6.cc
@@ -0,0 +1,59 @@
+// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.2.1 money_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+struct My_money_io_2 : public std::moneypunct<wchar_t,false>
+{
+ char_type do_thousands_sep() const { return ','; }
+ std::string do_grouping() const { return "\001"; }
+};
+
+// Make sure we can output a very big amount of money (with grouping too).
+void test06()
+{
+ using namespace std;
+ bool test = true;
+ typedef ostreambuf_iterator<wchar_t> OutIt;
+
+ locale loc(locale::classic(), new My_money_io_2);
+
+ bool intl = false;
+
+ long double val = 1.0e50L;
+ const money_put<wchar_t,OutIt>& mp =
+ use_facet<money_put<wchar_t, OutIt> >(loc);
+
+ wostringstream fmt;
+ fmt.imbue(loc);
+ OutIt out(fmt);
+ mp.put(out,intl,fmt,'*',val);
+ VERIFY( fmt.good() );
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..c04f700e5cd
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/wrapped_env.cc
@@ -0,0 +1,61 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..88f84572a91
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/wrapped_locale.cc
@@ -0,0 +1,61 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put_members_char.cc b/libstdc++-v3/testsuite/22_locale/money_put_members_char.cc
deleted file mode 100644
index 708ae4243ff..00000000000
--- a/libstdc++-v3/testsuite/22_locale/money_put_members_char.cc
+++ /dev/null
@@ -1,400 +0,0 @@
-// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2001, 2002 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This 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 General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.6.2.1 money_put members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-// test string version
-void test01()
-{
- using namespace std;
- typedef money_base::part part;
- typedef money_base::pattern pattern;
- typedef ostreambuf_iterator<char> iterator_type;
-
- bool test = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE@euro");
- VERIFY( loc_c != loc_de );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the moneypunct facets
- typedef moneypunct<char, true> __money_true;
- typedef moneypunct<char, false> __money_false;
- const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
- const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
- const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
- const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
- const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
- const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
-
- // sanity check the data is correct.
- const string empty;
-
- // total EPA budget FY 2002
- const string digits1("720000000000");
-
- // est. cost, national missile "defense", expressed as a loss in USD 2001
- const string digits2("-10000000000000");
-
- // not valid input
- const string digits3("-A");
-
- // input less than frac_digits
- const string digits4("-1");
-
-
- ostringstream oss;
- oss.imbue(loc_de);
- // cache the money_put facet
- const money_put<char>& mon_put = use_facet<money_put<char> >(oss.getloc());
-
-
- iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
- string result1 = oss.str();
- VERIFY( result1 == "7.200.000.000,00 ");
-
- oss.str(empty);
- iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
- string result2 = oss.str();
- VERIFY( result2 == "7.200.000.000,00 ");
-
- // intl and non-intl versions should be the same.
- VERIFY( result1 == result2 );
-
- // now try with showbase, to get currency symbol in format
- oss.setf(ios_base::showbase);
-
- oss.str(empty);
- iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
- string result3 = oss.str();
- VERIFY( result3 == "7.200.000.000,00 EUR ");
-
- oss.str(empty);
- iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
- string result4 = oss.str();
- VERIFY( result4 == "7.200.000.000,00 \244");
-
- // intl and non-intl versions should be different.
- VERIFY( result3 != result4 );
- VERIFY( result3 != result1 );
- VERIFY( result4 != result2 );
-
- // test sign of more than one digit, say hong kong.
- oss.imbue(loc_hk);
- oss.str(empty);
- iterator_type os_it05 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
- string result5 = oss.str();
- VERIFY( result5 == "HK$7,200,000,000.00");
-
- oss.str(empty);
- iterator_type os_it06 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits2);
- string result6 = oss.str();
- VERIFY( result6 == "(HKD 100,000,000,000.00)");
-
- // test one-digit formats without zero padding
- oss.imbue(loc_c);
- oss.str(empty);
- iterator_type os_it07 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits4);
- string result7 = oss.str();
- VERIFY( result7 == "1");
-
- // test one-digit formats with zero padding, zero frac widths
- oss.imbue(loc_hk);
- oss.str(empty);
- iterator_type os_it08 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits4);
- string result8 = oss.str();
- VERIFY( result8 == "(HKD .01)");
-
- oss.unsetf(ios_base::showbase);
-
- // test bunk input
- oss.str(empty);
- iterator_type os_it09 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits3);
- string result9 = oss.str();
- VERIFY( result9 == "");
-
- // test io.width() > length
- // test various fill strategies
- oss.imbue(loc_de);
-
- oss.str(empty);
- oss.width(20);
- iterator_type os_it10 = mon_put.put(oss.rdbuf(), true, oss, '*', digits4);
- string result10 = oss.str();
- VERIFY( result10 == "***************-,01*");
-
- oss.str(empty);
- oss.width(20);
- oss.setf(ios_base::internal);
- iterator_type os_it11 = mon_put.put(oss.rdbuf(), true, oss, '*', digits4);
- string result11 = oss.str();
- VERIFY( result11 == "-,01****************");
-}
-
-// test double version
-void test02()
-{
- using namespace std;
- typedef money_base::part part;
- typedef money_base::pattern pattern;
- typedef ostreambuf_iterator<char> iterator_type;
-
- bool test = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE@euro");
- VERIFY( loc_c != loc_de );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the moneypunct facets
- typedef moneypunct<char, true> __money_true;
- typedef moneypunct<char, false> __money_false;
- const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
- const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
- const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
- const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
- const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
- const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
-
- // sanity check the data is correct.
- const string empty;
-
- // total EPA budget FY 2002
- const long double digits1 = 720000000000.0;
-
- // est. cost, national missile "defense", expressed as a loss in USD 2001
- const long double digits2 = -10000000000000.0;
-
- // input less than frac_digits
- const long double digits4 = -1.0;
-
-
- ostringstream oss;
- oss.imbue(loc_de);
- // cache the money_put facet
- const money_put<char>& mon_put = use_facet<money_put<char> >(oss.getloc());
-
-
- iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
- string result1 = oss.str();
- VERIFY( result1 == "7.200.000.000,00 ");
-
- oss.str(empty);
- iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
- string result2 = oss.str();
- VERIFY( result2 == "7.200.000.000,00 ");
-
- // intl and non-intl versions should be the same.
- VERIFY( result1 == result2 );
-
- // now try with showbase, to get currency symbol in format
- oss.setf(ios_base::showbase);
-
- oss.str(empty);
- iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
- string result3 = oss.str();
- VERIFY( result3 == "7.200.000.000,00 EUR ");
-
- oss.str(empty);
- iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
- string result4 = oss.str();
- VERIFY( result4 == "7.200.000.000,00 \244");
-
- // intl and non-intl versions should be different.
- VERIFY( result3 != result4 );
- VERIFY( result3 != result1 );
- VERIFY( result4 != result2 );
-}
-
-void test03()
-{
- using namespace std;
- bool test = true;
-
- // Check money_put works with other iterators besides streambuf
- // output iterators. (As long as output_iterator requirements are met.)
- typedef string::iterator iter_type;
- typedef money_put<char, iter_type> mon_put_type;
- const ios_base::iostate goodbit = ios_base::goodbit;
- const ios_base::iostate eofbit = ios_base::eofbit;
- ios_base::iostate err = goodbit;
- const locale loc_c = locale::classic();
- // woman, art, thief (stole the blues)
- const string str("1943 Janis Joplin");
- const long double ld = 1943.0;
- const string x(str.size(), 'x'); // have to have allocated string!
- string res;
-
- ostringstream oss;
- oss.imbue(locale(loc_c, new mon_put_type));
-
- // Iterator advanced, state, output.
- const mon_put_type& mp = use_facet<mon_put_type>(oss.getloc());
-
- // 01 string
- res = x;
- iter_type ret1 = mp.put(res.begin(), false, oss, ' ', str);
- string sanity1(res.begin(), ret1);
- VERIFY( err == goodbit );
- VERIFY( res == "1943xxxxxxxxxxxxx" );
- VERIFY( sanity1 == "1943" );
-
- // 02 long double
- res = x;
- iter_type ret2 = mp.put(res.begin(), false, oss, ' ', ld);
- string sanity2(res.begin(), ret2);
- VERIFY( err == goodbit );
- VERIFY( res == "1943xxxxxxxxxxxxx" );
- VERIFY( sanity2 == "1943" );
-}
-
-// libstdc++/5280
-void test04()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE@euro");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE@euro.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE@euro", 1))
- {
- test01();
- test02();
- test03();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-struct My_money_io : public std::moneypunct<char,false>
-{
- char_type do_decimal_point() const { return '.'; }
- char_type do_thousands_sep() const { return ','; }
- std::string do_grouping() const { return "\003"; }
-
- std::string do_negative_sign() const { return "()"; }
-
- int do_frac_digits() const { return 2; }
-
- pattern do_neg_format() const
- {
- pattern pat = { { symbol, space, sign, value } };
- return pat;
- }
-};
-
-// libstdc++/5708
-void test05()
-{
- using namespace std;
- typedef ostreambuf_iterator<char> OutIt;
-
- locale loc(locale::classic(), new My_money_io);
-
- bool intl = false;
-
- string val("-123456");
- const money_put<char,OutIt>& mp =
- use_facet<money_put<char, OutIt> >(loc);
-
- ostringstream fmt;
- fmt.imbue(loc);
- OutIt out(fmt);
- mp.put(out,intl,fmt,'*',val);
- VERIFY( fmt.str() == "*(1,234.56)" );
-}
-
-struct My_money_io_2 : public std::moneypunct<char,false>
-{
- char_type do_thousands_sep() const { return ','; }
- std::string do_grouping() const { return "\001"; }
-};
-
-// Make sure we can output a very big amount of money (with grouping too).
-void test06()
-{
- using namespace std;
- typedef ostreambuf_iterator<char> OutIt;
-
- locale loc(locale::classic(), new My_money_io_2);
-
- bool intl = false;
-
- long double val = 1.0e50L;
- const money_put<char,OutIt>& mp =
- use_facet<money_put<char, OutIt> >(loc);
-
- ostringstream fmt;
- fmt.imbue(loc);
- OutIt out(fmt);
- mp.put(out,intl,fmt,'*',val);
- VERIFY( fmt );
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test07()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- test02();
- test03();
- test05();
- test06();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-
-int main()
-{
- test01();
- test02();
- test03();
- test04();
- test05();
- test06();
- test07();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put_members_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/money_put_members_wchar_t.cc
deleted file mode 100644
index 1bfe86ba808..00000000000
--- a/libstdc++-v3/testsuite/22_locale/money_put_members_wchar_t.cc
+++ /dev/null
@@ -1,403 +0,0 @@
-// 2001-09-09 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2001, 2002 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This 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 General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.6.2.1 money_put members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-// test string version
-void test01()
-{
- using namespace std;
- typedef money_base::part part;
- typedef money_base::pattern pattern;
- typedef ostreambuf_iterator<wchar_t> iterator_type;
-
- bool test = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE@euro");
- VERIFY( loc_c != loc_de );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the moneypunct facets
- typedef moneypunct<wchar_t, true> __money_true;
- typedef moneypunct<wchar_t, false> __money_false;
- const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
- const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
- const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
- const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
- const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
- const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
-
- // sanity check the data is correct.
- const wstring empty;
-
- // total EPA budget FY 2002
- const wstring digits1(L"720000000000");
-
- // est. cost, national missile "defense", expressed as a loss in USD 2001
- const wstring digits2(L"-10000000000000");
-
- // not valid input
- const wstring digits3(L"-A");
-
- // input less than frac_digits
- const wstring digits4(L"-1");
-
- wostringstream oss;
- oss.imbue(loc_de);
- // cache the money_put facet
- const money_put<wchar_t>& mon_put = use_facet<money_put<wchar_t> >(oss.getloc());
-
-
- iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
- wstring result1 = oss.str();
- VERIFY( result1 == L"7.200.000.000,00 ");
-
- oss.str(empty);
- iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
- wstring result2 = oss.str();
- VERIFY( result2 == L"7.200.000.000,00 ");
-
- // intl and non-intl versions should be the same.
- VERIFY( result1 == result2 );
-
- // now try with showbase, to get currency symbol in format
- oss.setf(ios_base::showbase);
-
- oss.str(empty);
- iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
- wstring result3 = oss.str();
- VERIFY( result3 == L"7.200.000.000,00 EUR ");
-
- oss.str(empty);
- iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
- wstring result4 = oss.str();
- VERIFY( result4 == L"7.200.000.000,00 \x20ac");
-
- // intl and non-intl versions should be different.
- VERIFY( result3 != result4 );
- VERIFY( result3 != result1 );
- VERIFY( result4 != result2 );
-
- // test sign of more than one digit, say hong kong.
- oss.imbue(loc_hk);
- oss.str(empty);
- iterator_type os_it05 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
- wstring result5 = oss.str();
- VERIFY( result5 == L"HK$7,200,000,000.00");
-
- oss.str(empty);
- iterator_type os_it06 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits2);
- wstring result6 = oss.str();
- VERIFY( result6 == L"(HKD 100,000,000,000.00)");
-
- // test one-digit formats without zero padding
- oss.imbue(loc_c);
- oss.str(empty);
- iterator_type os_it07 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits4);
- wstring result7 = oss.str();
- VERIFY( result7 == L"1");
-
- // test one-digit formats with zero padding, zero frac widths
- oss.imbue(loc_hk);
- oss.str(empty);
- iterator_type os_it08 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits4);
- wstring result8 = oss.str();
- VERIFY( result8 == L"(HKD .01)");
-
- oss.unsetf(ios_base::showbase);
-
- // test bunk input
- oss.str(empty);
- iterator_type os_it09 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits3);
- wstring result9 = oss.str();
- VERIFY( result9 == L"");
-
- // test io.width() > length
- // test various fill strategies
- oss.imbue(loc_de);
-
- oss.str(empty);
- oss.width(20);
- iterator_type os_it10 = mon_put.put(oss.rdbuf(), true, oss, '*', digits4);
- wstring result10 = oss.str();
- VERIFY( result10 == L"***************-,01*");
-
- oss.str(empty);
- oss.width(20);
- oss.setf(ios_base::internal);
- iterator_type os_it11 = mon_put.put(oss.rdbuf(), true, oss, '*', digits4);
- wstring result11 = oss.str();
- VERIFY( result11 == L"-,01****************");
-}
-
-// test double/wstring versions
-void test02()
-{
- using namespace std;
- typedef money_base::part part;
- typedef money_base::pattern pattern;
- typedef ostreambuf_iterator<wchar_t> iterator_type;
-
- bool test = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE@euro");
- VERIFY( loc_c != loc_de );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the moneypunct facets
- typedef moneypunct<wchar_t, true> __money_true;
- typedef moneypunct<wchar_t, false> __money_false;
- const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c);
- const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de);
- const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c);
- const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de);
- const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk);
- const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk);
-
- // sanity check the data is correct.
- const wstring empty;
-
- // total EPA budget FY 2002
- const long double digits1 = 720000000000.0;
-
- // est. cost, national missile "defense", expressed as a loss in USD 2001
- const long double digits2 = -10000000000000.0;
-
- // input less than frac_digits
- const long double digits4 = -1.0;
-
-
- wostringstream oss;
- oss.imbue(loc_de);
- // cache the money_put facet
- const money_put<wchar_t>& mon_put = use_facet<money_put<wchar_t> >(oss.getloc());
-
-
- iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
- wstring result1 = oss.str();
- VERIFY( result1 == L"7.200.000.000,00 ");
-
- oss.str(empty);
- iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
- wstring result2 = oss.str();
- VERIFY( result2 == L"7.200.000.000,00 ");
-
- // intl and non-intl versions should be the same.
- VERIFY( result1 == result2 );
-
- // now try with showbase, to get currency symbol in format
- oss.setf(ios_base::showbase);
-
- oss.str(empty);
- iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
- wstring result3 = oss.str();
- VERIFY( result3 == L"7.200.000.000,00 EUR ");
-
- oss.str(empty);
- iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
- wstring result4 = oss.str();
- VERIFY( result4 == L"7.200.000.000,00 \x20ac");
-
- // intl and non-intl versions should be different.
- VERIFY( result3 != result4 );
- VERIFY( result3 != result1 );
- VERIFY( result4 != result2 );
-}
-
-void test03()
-{
- using namespace std;
- bool test = true;
-
- // Check money_put works with other iterators besides streambuf
- // output iterators. (As long as output_iterator requirements are met.)
- typedef wstring::iterator iter_type;
- typedef money_put<wchar_t, iter_type> mon_put_type;
- const ios_base::iostate goodbit = ios_base::goodbit;
- const ios_base::iostate eofbit = ios_base::eofbit;
- ios_base::iostate err = goodbit;
- const locale loc_c = locale::classic();
- // woman, art, thief (stole the blues)
- const wstring str(L"1943 Janis Joplin");
- const long double ld = 1943.0;
- const wstring x(str.size(), 'x'); // have to have allocated string!
- wstring res;
-
- wostringstream oss;
- oss.imbue(locale(loc_c, new mon_put_type));
-
- // Iterator advanced, state, output.
- const mon_put_type& mp = use_facet<mon_put_type>(oss.getloc());
-
- // 01 string
- res = x;
- iter_type ret1 = mp.put(res.begin(), false, oss, ' ', str);
- wstring sanity1(res.begin(), ret1);
- VERIFY( err == goodbit );
- VERIFY( res == L"1943xxxxxxxxxxxxx" );
- VERIFY( sanity1 == L"1943" );
-
- // 02 long double
- res = x;
- iter_type ret2 = mp.put(res.begin(), false, oss, ' ', ld);
- wstring sanity2(res.begin(), ret2);
- VERIFY( err == goodbit );
- VERIFY( res == L"1943xxxxxxxxxxxxx" );
- VERIFY( sanity2 == L"1943" );
-}
-
-// libstdc++/5280
-void test04()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE@euro");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE@euro.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE@euro", 1))
- {
- test01();
- test02();
- test03();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-struct My_money_io : public std::moneypunct<wchar_t,false>
-{
- char_type do_decimal_point() const { return L'.'; }
- char_type do_thousands_sep() const { return L','; }
- std::string do_grouping() const { return "\003"; }
-
- std::wstring do_negative_sign() const { return L"()"; }
-
- int do_frac_digits() const { return 2; }
-
- pattern do_neg_format() const
- {
- pattern pat = { { symbol, space, sign, value } };
- return pat;
- }
-};
-
-// libstdc++/5708
-void test05()
-{
- using namespace std;
- typedef ostreambuf_iterator<wchar_t> OutIt;
-
- locale loc(locale::classic(), new My_money_io);
-
- bool intl = false;
-
- wstring val(L"-123456");
- const money_put<wchar_t,OutIt>& mp =
- use_facet<money_put<wchar_t, OutIt> >(loc);
-
- wostringstream fmt;
- fmt.imbue(loc);
- OutIt out(fmt);
- mp.put(out,intl,fmt,L'*',val);
- VERIFY( fmt.str() == L"*(1,234.56)" );
-}
-
-struct My_money_io_2 : public std::moneypunct<wchar_t,false>
-{
- char_type do_thousands_sep() const { return L','; }
- std::string do_grouping() const { return "\001"; }
-};
-
-// Make sure we can output a very big amount of money (with grouping too).
-void test06()
-{
- using namespace std;
- typedef ostreambuf_iterator<wchar_t> OutIt;
-
- locale loc(locale::classic(), new My_money_io_2);
-
- bool intl = false;
-
- long double val = 1.0e50L;
- const money_put<wchar_t,OutIt>& mp =
- use_facet<money_put<wchar_t, OutIt> >(loc);
-
- wostringstream fmt;
- fmt.imbue(loc);
- OutIt out(fmt);
- mp.put(out,intl,fmt,'*',val);
- VERIFY( fmt );
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test07()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- test02();
- test03();
- test05();
- test06();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-#endif
-
-int main()
-{
-#ifdef _GLIBCPP_USE_WCHAR_T
- test01();
- test02();
- test03();
- test04();
- test05();
- test06();
- test07();
-#endif
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/1.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/1.cc
new file mode 100644
index 00000000000..6ab09c61a61
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/moneypunct/1.cc
@@ -0,0 +1,44 @@
+// { dg-do compile }
+// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.3 Template class moneypunct
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::moneypunct<char, true> test_type;
+ typedef std::locale::facet base_type;
+ const test_type& obj = std::use_facet<test_type>(std::locale());
+ const base_type* base = &obj;
+
+ // Check for required typedefs
+ typedef test_type::char_type char_type;
+ typedef test_type::string_type string_type;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/2.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/2.cc
new file mode 100644
index 00000000000..edfefbbf89b
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/moneypunct/2.cc
@@ -0,0 +1,44 @@
+// { dg-do compile }
+// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.3 Template class moneypunct
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ // Check for required base class.
+ typedef std::moneypunct<char, false> test_type;
+ typedef std::locale::facet base_type;
+ const test_type& obj = std::use_facet<test_type>(std::locale());
+ const base_type* base = &obj;
+
+ // Check for required typedefs
+ typedef test_type::char_type char_type;
+ typedef test_type::string_type string_type;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/3.cc
index 5d5e7b791da..db6c93c4541 100644
--- a/libstdc++-v3/testsuite/22_locale/moneypunct.cc
+++ b/libstdc++-v3/testsuite/22_locale/moneypunct/3.cc
@@ -1,6 +1,6 @@
// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001 Free Software Foundation
+// Copyright (C) 2001, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -25,32 +25,6 @@
#include <locale>
#include <testsuite_hooks.h>
-void test01()
-{
- // Check for required base class.
- typedef std::moneypunct<char, true> test_type;
- typedef std::locale::facet base_type;
- const test_type& obj = std::use_facet<test_type>(std::locale());
- const base_type* base = &obj;
-
- // Check for required typedefs
- typedef test_type::char_type char_type;
- typedef test_type::string_type string_type;
-}
-
-void test02()
-{
- // Check for required base class.
- typedef std::moneypunct<char, false> test_type;
- typedef std::locale::facet base_type;
- const test_type& obj = std::use_facet<test_type>(std::locale());
- const base_type* base = &obj;
-
- // Check for required typedefs
- typedef test_type::char_type char_type;
- typedef test_type::string_type string_type;
-}
-
// Should be able to instantiate this for other types besides char, wchar_t
class gnu_moneypunct_t: public std::moneypunct<unsigned char, true>
{ };
@@ -68,8 +42,6 @@ void test03()
int main()
{
- test01();
- test02();
test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/1.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/1.cc
new file mode 100644
index 00000000000..c8d7b994904
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/1.cc
@@ -0,0 +1,99 @@
+// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.3.1 moneypunct members
+
+#include <locale>
+#include <string>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+
+ // cache the moneypunct facets
+ typedef moneypunct<char, true> __money_true;
+ typedef moneypunct<char, false> __money_false;
+ const __money_true& monp_c_t = use_facet<__money_true>(loc_c);
+ const __money_false& monp_c_f = use_facet<__money_false>(loc_c);
+
+ // quick sanity check for data.
+ char q1 = monp_c_t.decimal_point();
+ char q2 = monp_c_t.thousands_sep();
+ char q3 = monp_c_f.decimal_point();
+ char q4 = monp_c_f.thousands_sep();
+ string g1 = monp_c_t.grouping();
+ string g2 = monp_c_f.grouping();
+ string cs1 = monp_c_t.curr_symbol();
+ string cs2 = monp_c_f.curr_symbol();
+ string ps1 = monp_c_t.positive_sign();
+ string ns1 = monp_c_t.negative_sign();
+ string ps2 = monp_c_f.positive_sign();
+ string ns2 = monp_c_f.negative_sign();
+ int fd1 = monp_c_t.frac_digits();
+ int fd2 = monp_c_f.frac_digits();
+ pattern pos1 = monp_c_t.pos_format();
+ pattern neg1 = monp_c_t.neg_format();
+ pattern pos2 = monp_c_f.pos_format();
+ pattern neg2 = monp_c_f.neg_format();
+
+ VERIFY( q1 == '.' );
+ VERIFY( q3 == '.' );
+ VERIFY( q2 == ',' );
+ VERIFY( q4 == ',' );
+ VERIFY( g1 == "" );
+ VERIFY( g2 == "" );
+ VERIFY( cs1 == "" );
+ VERIFY( cs2 == "" );
+ VERIFY( ps1 == "" );
+ VERIFY( ps2 == "" );
+ VERIFY( ns1 == "" );
+ VERIFY( ns2 == "" );
+ VERIFY( fd1 == 0 );
+ VERIFY( fd2 == 0 );
+
+ VERIFY(static_cast<part>(pos1.field[0]) == static_cast<part>(pos2.field[0]));
+ VERIFY(static_cast<part>(pos1.field[1]) == static_cast<part>(pos2.field[1]));
+ VERIFY(static_cast<part>(pos1.field[2]) == static_cast<part>(pos2.field[2]));
+ VERIFY(static_cast<part>(pos1.field[3]) == static_cast<part>(pos2.field[3]));
+
+#if 0
+ VERIFY( pos1[0] == money_base::_S_default_pattern[0] );
+ VERIFY( pos1[1] == money_base::_S_default_pattern[1] );
+ VERIFY( pos1[2] == money_base::_S_default_pattern[2] );
+ VERIFY( pos1[3] == money_base::_S_default_pattern[3] );
+ VERIFY( pos2 == money_base::_S_default_pattern );
+ VERIFY( neg1 == money_base::_S_default_pattern );
+ VERIFY( neg2 == money_base::_S_default_pattern );
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct_members_char.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/2.cc
index 3cb6c88a880..5434ea81575 100644
--- a/libstdc++-v3/testsuite/22_locale/moneypunct_members_char.cc
+++ b/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/2.cc
@@ -1,6 +1,6 @@
// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -21,12 +21,10 @@
// 22.2.6.3.1 moneypunct members
#include <locale>
+#include <string>
#include <testsuite_hooks.h>
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-void test01()
+void test02()
{
using namespace std;
typedef money_base::part part;
@@ -36,24 +34,14 @@ void test01()
// basic construction
locale loc_c = locale::classic();
- locale loc_us("en_US");
- locale loc_fr("fr_FR");
locale loc_de("de_DE");
- VERIFY( loc_c != loc_de );
- VERIFY( loc_us != loc_fr );
- VERIFY( loc_us != loc_de );
- VERIFY( loc_de != loc_fr );
// cache the moneypunct facets
typedef moneypunct<char, true> __money_true;
typedef moneypunct<char, false> __money_false;
const __money_true& monp_c_t = use_facet<__money_true>(loc_c);
- const __money_true& monp_us_t = use_facet<__money_true>(loc_us);
- const __money_true& monp_fr_t = use_facet<__money_true>(loc_fr);
- const __money_true& monp_de_t = use_facet<__money_true>(loc_de);
const __money_false& monp_c_f = use_facet<__money_false>(loc_c);
- const __money_false& monp_us_f = use_facet<__money_false>(loc_us);
- const __money_false& monp_fr_f = use_facet<__money_false>(loc_fr);
+ const __money_true& monp_de_t = use_facet<__money_true>(loc_de);
const __money_false& monp_de_f = use_facet<__money_false>(loc_de);
// quick sanity check for data.
@@ -105,43 +93,8 @@ void test01()
VERIFY(static_cast<part>(neg1.field[3]) != static_cast<part>(neg2.field[3]));
}
-// libstdc++/5280
-void test02()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test03()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-
int main()
{
- test01();
test02();
- test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/wrapped_env.cc
new file mode 100644
index 00000000000..4f1d5e3f6a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/wrapped_env.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/wrapped_locale.cc
new file mode 100644
index 00000000000..8d7871815db
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/wrapped_locale.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/1.cc
new file mode 100644
index 00000000000..7f0d017bf1d
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/1.cc
@@ -0,0 +1,99 @@
+// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.6.3.1 moneypunct members
+
+#include <locale>
+#include <string>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+
+ // cache the moneypunct facets
+ typedef moneypunct<wchar_t, true> __money_true;
+ typedef moneypunct<wchar_t, false> __money_false;
+ const __money_true& monp_c_t = use_facet<__money_true>(loc_c);
+ const __money_false& monp_c_f = use_facet<__money_false>(loc_c);
+
+ // quick sanity check for data.
+ wchar_t q1 = monp_c_t.decimal_point();
+ wchar_t q2 = monp_c_t.thousands_sep();
+ wchar_t q3 = monp_c_f.decimal_point();
+ wchar_t q4 = monp_c_f.thousands_sep();
+ string g1 = monp_c_t.grouping();
+ string g2 = monp_c_f.grouping();
+ wstring cs1 = monp_c_t.curr_symbol();
+ wstring cs2 = monp_c_f.curr_symbol();
+ wstring ps1 = monp_c_t.positive_sign();
+ wstring ns1 = monp_c_t.negative_sign();
+ wstring ps2 = monp_c_f.positive_sign();
+ wstring ns2 = monp_c_f.negative_sign();
+ int fd1 = monp_c_t.frac_digits();
+ int fd2 = monp_c_f.frac_digits();
+ pattern pos1 = monp_c_t.pos_format();
+ pattern neg1 = monp_c_t.neg_format();
+ pattern pos2 = monp_c_f.pos_format();
+ pattern neg2 = monp_c_f.neg_format();
+
+ VERIFY( q1 == L'.' );
+ VERIFY( q3 == L'.' );
+ VERIFY( q2 == L',' );
+ VERIFY( q4 == L',' );
+ VERIFY( g1 == "" );
+ VERIFY( g2 == "" );
+ VERIFY( cs1 == L"" );
+ VERIFY( cs2 == L"" );
+ VERIFY( ps1 == L"" );
+ VERIFY( ps2 == L"" );
+ VERIFY( ns1 == L"" );
+ VERIFY( ns2 == L"" );
+ VERIFY( fd1 == 0 );
+ VERIFY( fd2 == 0 );
+
+ VERIFY(static_cast<part>(pos1.field[0]) == static_cast<part>(pos2.field[0]));
+ VERIFY(static_cast<part>(pos1.field[1]) == static_cast<part>(pos2.field[1]));
+ VERIFY(static_cast<part>(pos1.field[2]) == static_cast<part>(pos2.field[2]));
+ VERIFY(static_cast<part>(pos1.field[3]) == static_cast<part>(pos2.field[3]));
+
+#if 0
+ VERIFY( pos1[0] == money_base::_S_default_pattern[0] );
+ VERIFY( pos1[1] == money_base::_S_default_pattern[1] );
+ VERIFY( pos1[2] == money_base::_S_default_pattern[2] );
+ VERIFY( pos1[3] == money_base::_S_default_pattern[3] );
+ VERIFY( pos2 == money_base::_S_default_pattern );
+ VERIFY( neg1 == money_base::_S_default_pattern );
+ VERIFY( neg2 == money_base::_S_default_pattern );
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct_members_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/2.cc
index a81fe0a2362..2e258f9ce2c 100644
--- a/libstdc++-v3/testsuite/22_locale/moneypunct_members_wchar_t.cc
+++ b/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/2.cc
@@ -1,6 +1,6 @@
-// 2001-09-09 Benjamin Kosnik <bkoz@redhat.com>
+// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -21,13 +21,10 @@
// 22.2.6.3.1 moneypunct members
#include <locale>
+#include <string>
#include <testsuite_hooks.h>
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-void test01()
+void test02()
{
using namespace std;
typedef money_base::part part;
@@ -37,24 +34,14 @@ void test01()
// basic construction
locale loc_c = locale::classic();
- locale loc_us("en_US");
- locale loc_fr("fr_FR");
locale loc_de("de_DE");
- VERIFY( loc_c != loc_de );
- VERIFY( loc_us != loc_fr );
- VERIFY( loc_us != loc_de );
- VERIFY( loc_de != loc_fr );
// cache the moneypunct facets
typedef moneypunct<wchar_t, true> __money_true;
typedef moneypunct<wchar_t, false> __money_false;
const __money_true& monp_c_t = use_facet<__money_true>(loc_c);
- const __money_true& monp_us_t = use_facet<__money_true>(loc_us);
- const __money_true& monp_fr_t = use_facet<__money_true>(loc_fr);
- const __money_true& monp_de_t = use_facet<__money_true>(loc_de);
const __money_false& monp_c_f = use_facet<__money_false>(loc_c);
- const __money_false& monp_us_f = use_facet<__money_false>(loc_us);
- const __money_false& monp_fr_f = use_facet<__money_false>(loc_fr);
+ const __money_true& monp_de_t = use_facet<__money_true>(loc_de);
const __money_false& monp_de_f = use_facet<__money_false>(loc_de);
// quick sanity check for data.
@@ -106,46 +93,8 @@ void test01()
VERIFY(static_cast<part>(neg1.field[3]) != static_cast<part>(neg2.field[3]));
}
-// libstdc++/5280
-void test02()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test03()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-#endif
-
int main()
{
-#ifdef _GLIBCPP_USE_WCHAR_T
- test01();
test02();
- test03();
-#endif
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..4f1d5e3f6a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/wrapped_env.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..8d7871815db
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/wrapped_locale.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct_byname.cc b/libstdc++-v3/testsuite/22_locale/moneypunct_byname/1.cc
index e86c80e7426..01c761b5669 100644
--- a/libstdc++-v3/testsuite/22_locale/moneypunct_byname.cc
+++ b/libstdc++-v3/testsuite/22_locale/moneypunct_byname/1.cc
@@ -1,6 +1,6 @@
// 2001-08-24 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001 Free Software Foundation
+// Copyright (C) 2001, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -23,9 +23,6 @@
#include <locale>
#include <testsuite_hooks.h>
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
void test01()
{
using namespace std;
diff --git a/libstdc++-v3/testsuite/22_locale/num_get.cc b/libstdc++-v3/testsuite/22_locale/num_get/1.cc
index f8f3e1646a0..4a3ced974cf 100644
--- a/libstdc++-v3/testsuite/22_locale/num_get.cc
+++ b/libstdc++-v3/testsuite/22_locale/num_get/1.cc
@@ -1,6 +1,7 @@
+// { dg-do compile }
// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001 Free Software Foundation
+// Copyright (C) 2001, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -20,8 +21,6 @@
// 22.2.2.1 Template class num_get
-// { dg-do compile }
-
#include <locale>
void test01()
@@ -37,18 +36,8 @@ void test01()
typedef test_type::iter_type iter_type;
}
-// Should be able to instantiate this for other types besides char, wchar_t
-class gnu_num_get: public std::num_get<unsigned char>
-{ };
-
-void test02()
-{
- gnu_num_get facet01;
-}
-
int main()
{
test01();
- test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/2.cc b/libstdc++-v3/testsuite/22_locale/num_get/2.cc
new file mode 100644
index 00000000000..c41a13c44e7
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/2.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.1 Template class num_get
+
+#include <locale>
+
+// Should be able to instantiate this for other types besides char, wchar_t
+class gnu_num_get: public std::num_get<unsigned char>
+{ };
+
+void test02()
+{
+ gnu_num_get facet01;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/1.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/1.cc
new file mode 100644
index 00000000000..7cc897c36f5
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/char/1.cc
@@ -0,0 +1,170 @@
+// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.1.1 num_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the numpunct facets
+ const numpunct<char>& numpunct_c = use_facet<numpunct<char> >(loc_c);
+ const numpunct<char>& numpunct_de = use_facet<numpunct<char> >(loc_de);
+ const numpunct<char>& numpunct_hk = use_facet<numpunct<char> >(loc_hk);
+
+ // sanity check the data is correct.
+ const string empty;
+ char c;
+
+ bool b1 = true;
+ bool b0 = false;
+ long l1 = 2147483647;
+ long l2 = -2147483647;
+ long l;
+ unsigned long ul1 = 1294967294;
+ unsigned long ul2 = 0;
+ unsigned long ul;
+ double d1 = 1.02345e+308;
+ double d2 = 3.15e-308;
+ double d;
+ long double ld1 = 6.630025e+4;
+ long double ld2 = 0.0;
+ long double ld;
+ void* v;
+ const void* cv = &ul2;
+
+ // cache the num_get facet
+ istringstream iss;
+ iss.imbue(loc_de);
+ const num_get<char>& ng = use_facet<num_get<char> >(iss.getloc());
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = ios_base::goodbit;
+
+ // bool, simple
+ iss.str("1");
+ iterator_type os_it00 = iss.rdbuf();
+ iterator_type os_it01 = ng.get(os_it00, 0, iss, err, b1);
+ VERIFY( b1 == true );
+ VERIFY( err & ios_base::eofbit );
+
+ iss.str("0");
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, b0);
+ VERIFY( b0 == false );
+ VERIFY( err & eofbit );
+
+ // ... and one that does
+ iss.imbue(loc_de);
+ iss.str("1.294.967.294+++++++");
+ iss.clear();
+ iss.width(20);
+ iss.setf(ios_base::left, ios_base::adjustfield);
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( ul == ul1 );
+ VERIFY( err == goodbit );
+
+ iss.str("+1,02345e+308");
+ iss.clear();
+ iss.width(20);
+ iss.setf(ios_base::right, ios_base::adjustfield);
+ iss.setf(ios_base::scientific, ios_base::floatfield);
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, d);
+ VERIFY( d == d1 );
+ VERIFY( err == eofbit );
+
+ iss.str("3,15E-308 ");
+ iss.clear();
+ iss.width(20);
+ iss.precision(10);
+ iss.setf(ios_base::right, ios_base::adjustfield);
+ iss.setf(ios_base::scientific, ios_base::floatfield);
+ iss.setf(ios_base::uppercase);
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, d);
+ VERIFY( d == d2 );
+ VERIFY( err == goodbit );
+
+ // long double
+ iss.str("6,630025e+4");
+ iss.clear();
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ld);
+ VERIFY( ld == ld1 );
+ VERIFY( err == eofbit );
+
+ iss.str("0 ");
+ iss.clear();
+ iss.precision(0);
+ iss.setf(ios_base::fixed, ios_base::floatfield);
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ld);
+ VERIFY( ld == 0 );
+ VERIFY( err == goodbit );
+
+ // const void
+ iss.str("0xbffff74c,");
+ iss.clear();
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, v);
+ VERIFY( &v != &cv );
+ VERIFY( err == goodbit );
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ long long ll1 = 9223372036854775807LL;
+ long long ll2 = -9223372036854775807LL;
+ long long ll;
+
+ iss.str("9.223.372.036.854.775.807");
+ iss.clear();
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ll);
+ VERIFY( ll == ll1 );
+ VERIFY( err == eofbit );
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
+
+// Kathleen Hannah, humanitarian, woman, art-thief
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/2.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/2.cc
new file mode 100644
index 00000000000..4604d11ca91
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/char/2.cc
@@ -0,0 +1,140 @@
+// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.1.1 num_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the numpunct facets
+ const numpunct<char>& numpunct_c = use_facet<numpunct<char> >(loc_c);
+ const numpunct<char>& numpunct_de = use_facet<numpunct<char> >(loc_de);
+ const numpunct<char>& numpunct_hk = use_facet<numpunct<char> >(loc_hk);
+
+ // sanity check the data is correct.
+ const string empty;
+ char c;
+
+ bool b1 = true;
+ bool b0 = false;
+ long l1 = 2147483647;
+ long l2 = -2147483647;
+ long l;
+ unsigned long ul1 = 1294967294;
+ unsigned long ul2 = 0;
+ unsigned long ul;
+ double d1 = 1.02345e+308;
+ double d2 = 3.15e-308;
+ double d;
+ long double ld1 = 6.630025e+4;
+ long double ld2 = 0.0;
+ long double ld;
+ void* v;
+ const void* cv = &ul2;
+
+ // cache the num_get facet
+ istringstream iss;
+ iss.imbue(loc_c);
+ const num_get<char>& ng = use_facet<num_get<char> >(iss.getloc());
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = ios_base::goodbit;
+
+ // C
+ // bool, more twisted examples
+ iss.str("true ");
+ iss.clear();
+ iss.setf(ios_base::boolalpha);
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, b0);
+ VERIFY( b0 == true );
+ VERIFY( err == goodbit );
+
+ iss.str("false ");
+ iss.clear();
+ iss.setf(ios_base::boolalpha);
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, b1);
+ VERIFY( b1 == false );
+ VERIFY( err == goodbit );
+
+ // unsigned long, in a locale that does not group
+ iss.imbue(loc_c);
+ iss.str("1294967294");
+ iss.clear();
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( ul == ul1);
+ VERIFY( err == eofbit );
+
+ iss.str("0+++++++++++++++++++");
+ iss.clear();
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( ul == ul2);
+ VERIFY( err == goodbit );
+
+ // double
+ iss.imbue(loc_c);
+ iss.str("1.02345e+308++++++++");
+ iss.clear();
+ iss.width(20);
+ iss.setf(ios_base::left, ios_base::adjustfield);
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, d);
+ VERIFY( d == d1 );
+ VERIFY( err == goodbit );
+
+ iss.str("+3.15e-308");
+ iss.clear();
+ iss.width(20);
+ iss.setf(ios_base::right, ios_base::adjustfield);
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, d);
+ VERIFY( d == d2 );
+ VERIFY( err == eofbit );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
+
+
+// Kathleen Hannah, humanitarian, woman, art-thief
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/3.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/3.cc
new file mode 100644
index 00000000000..253e73561eb
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/char/3.cc
@@ -0,0 +1,102 @@
+// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.1.1 num_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the numpunct facets
+ const numpunct<char>& numpunct_c = use_facet<numpunct<char> >(loc_c);
+ const numpunct<char>& numpunct_de = use_facet<numpunct<char> >(loc_de);
+ const numpunct<char>& numpunct_hk = use_facet<numpunct<char> >(loc_hk);
+
+ // sanity check the data is correct.
+ const string empty;
+ char c;
+
+ bool b1 = true;
+ bool b0 = false;
+ long l1 = 2147483647;
+ long l2 = -2147483647;
+ long l;
+ unsigned long ul1 = 1294967294;
+ unsigned long ul2 = 0;
+ unsigned long ul;
+ double d1 = 1.02345e+308;
+ double d2 = 3.15e-308;
+ double d;
+ long double ld1 = 6.630025e+4;
+ long double ld2 = 0.0;
+ long double ld;
+ void* v;
+ const void* cv = &ul2;
+
+ // cache the num_get facet
+ istringstream iss;
+ iss.imbue(loc_hk);
+ const num_get<char>& ng = use_facet<num_get<char> >(iss.getloc());
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = ios_base::goodbit;
+
+ // HK
+ // long, in a locale that expects grouping
+ iss.str("2,147,483,647 ");
+ iss.clear();
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, l);
+ VERIFY( l == l1 );
+ VERIFY( err == goodbit );
+
+ iss.str("-2,147,483,647++++++");
+ iss.clear();
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, l);
+ VERIFY( l == l2 );
+ VERIFY( err == goodbit );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
+
+
+// Kathleen Hannah, humanitarian, woman, art-thief
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/4.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/4.cc
new file mode 100644
index 00000000000..aed5fcb4370
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/char/4.cc
@@ -0,0 +1,112 @@
+// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.1.1 num_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// 2002-01-10 David Seymour <seymour_dj@yahoo.com>
+// libstdc++/5331
+void test04()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check num_get works with other iterators besides streambuf
+ // output iterators. (As long as output_iterator requirements are met.)
+ typedef string::const_iterator iter_type;
+ typedef num_get<char, iter_type> num_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = ios_base::goodbit;
+ const locale loc_c = locale::classic();
+ const string str("20000106 Elizabeth Durack");
+ const string str2("0 true 0xbffff74c Durack");
+
+ istringstream iss; // need an ios, add my num_get facet
+ iss.imbue(locale(loc_c, new num_get_type));
+
+ // Iterator advanced, state, output.
+ const num_get_type& ng = use_facet<num_get_type>(iss.getloc());
+
+ // 01 get(long)
+ // 02 get(long double)
+ // 03 get(bool)
+ // 04 get(void*)
+
+ // 01 get(long)
+ long i = 0;
+ err = goodbit;
+ iter_type end1 = ng.get(str.begin(), str.end(), iss, err, i);
+ string rem1(end1, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( i == 20000106);
+ VERIFY( rem1 == " Elizabeth Durack" );
+
+ // 02 get(long double)
+ long double ld = 0.0;
+ err = goodbit;
+ iter_type end2 = ng.get(str.begin(), str.end(), iss, err, ld);
+ string rem2(end2, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( ld == 20000106);
+ VERIFY( rem2 == " Elizabeth Durack" );
+
+ // 03 get(bool)
+ bool b = 1;
+ iss.clear();
+ err = goodbit;
+ iter_type end3 = ng.get(str2.begin(), str2.end(), iss, err, b);
+ string rem3(end3, str2.end());
+ VERIFY( err == goodbit );
+ VERIFY( b == 0 );
+ VERIFY( rem3 == " true 0xbffff74c Durack" );
+
+ iss.clear();
+ err = goodbit;
+ iss.setf(ios_base::boolalpha);
+ iter_type end4 = ng.get(++end3, str2.end(), iss, err, b);
+ string rem4(end4, str2.end());
+ VERIFY( err == goodbit );
+ VERIFY( b == true );
+ VERIFY( rem4 == " 0xbffff74c Durack" );
+
+ // 04 get(void*)
+ void* v;
+ iss.clear();
+ err = goodbit;
+ iss.setf(ios_base::fixed, ios_base::floatfield);
+ iter_type end5 = ng.get(++end4, str2.end(), iss, err, v);
+ string rem5(end5, str2.end());
+ VERIFY( err == goodbit );
+ VERIFY( b == true );
+ VERIFY( rem5 == " Durack" );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
+
+
+// Kathleen Hannah, humanitarian, woman, art-thief
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/5.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/5.cc
new file mode 100644
index 00000000000..21f7bef0012
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/char/5.cc
@@ -0,0 +1,92 @@
+// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.1.1 num_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// Testing the correct parsing of grouped hexadecimals and octals.
+void test05()
+{
+ using namespace std;
+
+ bool test = true;
+
+ unsigned long ul;
+
+ istringstream iss;
+
+ // A locale that expects grouping
+ locale loc_de("de_DE");
+ iss.imbue(loc_de);
+
+ const num_get<char>& ng = use_facet<num_get<char> >(iss.getloc());
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ ios_base::iostate err = ios_base::goodbit;
+
+ iss.setf(ios::hex, ios::basefield);
+ iss.str("0xbf.fff.74c ");
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( err == goodbit );
+ VERIFY( ul == 0xbffff74c );
+
+ iss.str("0Xf.fff ");
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( err == goodbit );
+ VERIFY( ul == 0xffff );
+
+ iss.str("ffe ");
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( err == goodbit );
+ VERIFY( ul == 0xffe );
+
+ iss.setf(ios::oct, ios::basefield);
+ iss.str("07.654.321 ");
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( err == goodbit );
+ VERIFY( ul == 07654321 );
+
+ iss.str("07.777 ");
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( err == goodbit );
+ VERIFY( ul == 07777 );
+
+ iss.str("776 ");
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( err == goodbit );
+ VERIFY( ul == 0776 );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
+
+
+// Kathleen Hannah, humanitarian, woman, art-thief
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/6.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/6.cc
new file mode 100644
index 00000000000..49f3a46e5c8
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/char/6.cc
@@ -0,0 +1,57 @@
+// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.1.1 num_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/5816
+void test06()
+{
+ using namespace std;
+ bool test = true;
+
+ double d = 0.0;
+
+ istringstream iss;
+ locale loc_de("de_DE");
+ iss.imbue(loc_de);
+
+ const num_get<char>& ng = use_facet<num_get<char> >(iss.getloc());
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ ios_base::iostate err = ios_base::goodbit;
+
+ iss.str("1234,5 ");
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, d);
+ VERIFY( err == goodbit );
+ VERIFY( d == 1234.5 );
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
+
+
+// Kathleen Hannah, humanitarian, woman, art-thief
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/wrapped_env.cc
new file mode 100644
index 00000000000..c04f700e5cd
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/char/wrapped_env.cc
@@ -0,0 +1,61 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/wrapped_locale.cc
new file mode 100644
index 00000000000..88f84572a91
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/char/wrapped_locale.cc
@@ -0,0 +1,61 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/1.cc
new file mode 100644
index 00000000000..a30cf971946
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/1.cc
@@ -0,0 +1,169 @@
+// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.1.1 num_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the numpunct facets
+ const numpunct<wchar_t>& numpunct_c = use_facet<numpunct<wchar_t> >(loc_c);
+ const numpunct<wchar_t>& numpunct_de = use_facet<numpunct<wchar_t> >(loc_de);
+ const numpunct<wchar_t>& numpunct_hk = use_facet<numpunct<wchar_t> >(loc_hk);
+
+ // sanity check the data is correct.
+ const wstring empty;
+ char c;
+
+ bool b1 = true;
+ bool b0 = false;
+ long l1 = 2147483647;
+ long l2 = -2147483647;
+ long l;
+ unsigned long ul1 = 1294967294;
+ unsigned long ul2 = 0;
+ unsigned long ul;
+ double d1 = 1.02345e+308;
+ double d2 = 3.15e-308;
+ double d;
+ long double ld1 = 6.630025e+4;
+ long double ld2 = 0.0;
+ long double ld;
+ void* v;
+ const void* cv = &ul2;
+
+ // cache the num_get facet
+ wistringstream iss;
+ iss.imbue(loc_de);
+ const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc());
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = ios_base::goodbit;
+
+ // bool, simple
+ iss.str(L"1");
+ iterator_type os_it00 = iss.rdbuf();
+ iterator_type os_it01 = ng.get(os_it00, 0, iss, err, b1);
+ VERIFY( b1 == true );
+ VERIFY( err & ios_base::eofbit );
+
+ iss.str(L"0");
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, b0);
+ VERIFY( b0 == false );
+ VERIFY( err & eofbit );
+
+ // ... and one that does
+ iss.str(L"1.294.967.294+++++++");
+ iss.clear();
+ iss.width(20);
+ iss.setf(ios_base::left, ios_base::adjustfield);
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( ul == ul1 );
+ VERIFY( err == goodbit );
+
+ iss.str(L"+1,02345e+308");
+ iss.clear();
+ iss.width(20);
+ iss.setf(ios_base::right, ios_base::adjustfield);
+ iss.setf(ios_base::scientific, ios_base::floatfield);
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, d);
+ VERIFY( d == d1 );
+ VERIFY( err == eofbit );
+
+ iss.str(L"3,15E-308 ");
+ iss.clear();
+ iss.width(20);
+ iss.precision(10);
+ iss.setf(ios_base::right, ios_base::adjustfield);
+ iss.setf(ios_base::scientific, ios_base::floatfield);
+ iss.setf(ios_base::uppercase);
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, d);
+ VERIFY( d == d2 );
+ VERIFY( err == goodbit );
+
+ // long double
+ iss.str(L"6,630025e+4");
+ iss.clear();
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ld);
+ VERIFY( ld == ld1 );
+ VERIFY( err == eofbit );
+
+ iss.str(L"0 ");
+ iss.clear();
+ iss.precision(0);
+ iss.setf(ios_base::fixed, ios_base::floatfield);
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ld);
+ VERIFY( ld == 0 );
+ VERIFY( err == goodbit );
+
+ // const void
+ iss.str(L"0xbffff74c,");
+ iss.clear();
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, v);
+ VERIFY( &v != &cv );
+ VERIFY( err == goodbit );
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ long long ll1 = 9223372036854775807LL;
+ long long ll2 = -9223372036854775807LL;
+ long long ll;
+
+ iss.str(L"9.223.372.036.854.775.807");
+ iss.clear();
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ll);
+ VERIFY( ll == ll1 );
+ VERIFY( err == eofbit );
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
+
+// Kathleen Hannah, humanitarian, woman, art-thief
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/2.cc
new file mode 100644
index 00000000000..dc11885adf2
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/2.cc
@@ -0,0 +1,140 @@
+// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.1.1 num_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the numpunct facets
+ const numpunct<wchar_t>& numpunct_c = use_facet<numpunct<wchar_t> >(loc_c);
+ const numpunct<wchar_t>& numpunct_de = use_facet<numpunct<wchar_t> >(loc_de);
+ const numpunct<wchar_t>& numpunct_hk = use_facet<numpunct<wchar_t> >(loc_hk);
+
+ // sanity check the data is correct.
+ const wstring empty;
+ char c;
+
+ bool b1 = true;
+ bool b0 = false;
+ long l1 = 2147483647;
+ long l2 = -2147483647;
+ long l;
+ unsigned long ul1 = 1294967294;
+ unsigned long ul2 = 0;
+ unsigned long ul;
+ double d1 = 1.02345e+308;
+ double d2 = 3.15e-308;
+ double d;
+ long double ld1 = 6.630025e+4;
+ long double ld2 = 0.0;
+ long double ld;
+ void* v;
+ const void* cv = &ul2;
+
+ // cache the num_get facet
+ wistringstream iss;
+ iss.imbue(loc_c);
+ const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc());
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = ios_base::goodbit;
+
+ // C
+ // bool, more twisted examples
+ iss.str(L"true ");
+ iss.clear();
+ iss.setf(ios_base::boolalpha);
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, b0);
+ VERIFY( b0 == true );
+ VERIFY( err == goodbit );
+
+ iss.str(L"false ");
+ iss.clear();
+ iss.setf(ios_base::boolalpha);
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, b1);
+ VERIFY( b1 == false );
+ VERIFY( err == goodbit );
+
+ // unsigned long, in a locale that does not group
+ iss.imbue(loc_c);
+ iss.str(L"1294967294");
+ iss.clear();
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( ul == ul1);
+ VERIFY( err == eofbit );
+
+ iss.str(L"0+++++++++++++++++++");
+ iss.clear();
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( ul == ul2);
+ VERIFY( err == goodbit );
+
+ // double
+ iss.imbue(loc_c);
+ iss.str(L"1.02345e+308++++++++");
+ iss.clear();
+ iss.width(20);
+ iss.setf(ios_base::left, ios_base::adjustfield);
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, d);
+ VERIFY( d == d1 );
+ VERIFY( err == goodbit );
+
+ iss.str(L"+3.15e-308");
+ iss.clear();
+ iss.width(20);
+ iss.setf(ios_base::right, ios_base::adjustfield);
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, d);
+ VERIFY( d == d2 );
+ VERIFY( err == eofbit );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
+
+
+// Kathleen Hannah, humanitarian, woman, art-thief
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/3.cc
new file mode 100644
index 00000000000..d3b1118354b
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/3.cc
@@ -0,0 +1,102 @@
+// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.1.1 num_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the numpunct facets
+ const numpunct<wchar_t>& numpunct_c = use_facet<numpunct<wchar_t> >(loc_c);
+ const numpunct<wchar_t>& numpunct_de = use_facet<numpunct<wchar_t> >(loc_de);
+ const numpunct<wchar_t>& numpunct_hk = use_facet<numpunct<wchar_t> >(loc_hk);
+
+ // sanity check the data is correct.
+ const wstring empty;
+ char c;
+
+ bool b1 = true;
+ bool b0 = false;
+ long l1 = 2147483647;
+ long l2 = -2147483647;
+ long l;
+ unsigned long ul1 = 1294967294;
+ unsigned long ul2 = 0;
+ unsigned long ul;
+ double d1 = 1.02345e+308;
+ double d2 = 3.15e-308;
+ double d;
+ long double ld1 = 6.630025e+4;
+ long double ld2 = 0.0;
+ long double ld;
+ void* v;
+ const void* cv = &ul2;
+
+ // cache the num_get facet
+ wistringstream iss;
+ iss.imbue(loc_hk);
+ const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc());
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = ios_base::goodbit;
+
+ // HK
+ // long, in a locale that expects grouping
+ iss.str(L"2,147,483,647 ");
+ iss.clear();
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, l);
+ VERIFY( l == l1 );
+ VERIFY( err == goodbit );
+
+ iss.str(L"-2,147,483,647++++++");
+ iss.clear();
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, l);
+ VERIFY( l == l2 );
+ VERIFY( err == goodbit );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
+
+
+// Kathleen Hannah, humanitarian, woman, art-thief
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/4.cc
new file mode 100644
index 00000000000..f23aa0f1555
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/4.cc
@@ -0,0 +1,112 @@
+// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.1.1 num_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// 2002-01-10 David Seymour <seymour_dj@yahoo.com>
+// libstdc++/5331
+void test04()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check num_get works with other iterators besides streambuf
+ // output iterators. (As long as output_iterator requirements are met.)
+ typedef wstring::const_iterator iter_type;
+ typedef num_get<wchar_t, iter_type> num_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = ios_base::goodbit;
+ const locale loc_c = locale::classic();
+ const wstring str(L"20000106 Elizabeth Durack");
+ const wstring str2(L"0 true 0xbffff74c Durack");
+
+ wistringstream iss; // need an ios, add my num_get facet
+ iss.imbue(locale(loc_c, new num_get_type));
+
+ // Iterator advanced, state, output.
+ const num_get_type& ng = use_facet<num_get_type>(iss.getloc());
+
+ // 01 get(long)
+ // 02 get(long double)
+ // 03 get(bool)
+ // 04 get(void*)
+
+ // 01 get(long)
+ long i = 0;
+ err = goodbit;
+ iter_type end1 = ng.get(str.begin(), str.end(), iss, err, i);
+ wstring rem1(end1, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( i == 20000106);
+ VERIFY( rem1 == L" Elizabeth Durack" );
+
+ // 02 get(long double)
+ long double ld = 0.0;
+ err = goodbit;
+ iter_type end2 = ng.get(str.begin(), str.end(), iss, err, ld);
+ wstring rem2(end2, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( ld == 20000106);
+ VERIFY( rem2 == L" Elizabeth Durack" );
+
+ // 03 get(bool)
+ bool b = 1;
+ iss.clear();
+ err = goodbit;
+ iter_type end3 = ng.get(str2.begin(), str2.end(), iss, err, b);
+ wstring rem3(end3, str2.end());
+ VERIFY( err == goodbit );
+ VERIFY( b == 0 );
+ VERIFY( rem3 == L" true 0xbffff74c Durack" );
+
+ iss.clear();
+ err = goodbit;
+ iss.setf(ios_base::boolalpha);
+ iter_type end4 = ng.get(++end3, str2.end(), iss, err, b);
+ wstring rem4(end4, str2.end());
+ VERIFY( err == goodbit );
+ VERIFY( b == true );
+ VERIFY( rem4 == L" 0xbffff74c Durack" );
+
+ // 04 get(void*)
+ void* v;
+ iss.clear();
+ err = goodbit;
+ iss.setf(ios_base::fixed, ios_base::floatfield);
+ iter_type end5 = ng.get(++end4, str2.end(), iss, err, v);
+ wstring rem5(end5, str2.end());
+ VERIFY( err == goodbit );
+ VERIFY( b == true );
+ VERIFY( rem5 == L" Durack" );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
+
+
+// Kathleen Hannah, humanitarian, woman, art-thief
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/5.cc
new file mode 100644
index 00000000000..7eaaa89e9f7
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/5.cc
@@ -0,0 +1,92 @@
+// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.1.1 num_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// Testing the correct parsing of grouped hexadecimals and octals.
+void test05()
+{
+ using namespace std;
+
+ bool test = true;
+
+ unsigned long ul;
+
+ wistringstream iss;
+
+ // A locale that expects grouping
+ locale loc_de("de_DE");
+ iss.imbue(loc_de);
+
+ const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc());
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ ios_base::iostate err = ios_base::goodbit;
+
+ iss.setf(ios::hex, ios::basefield);
+ iss.str(L"0xbf.fff.74c ");
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( err == goodbit );
+ VERIFY( ul == 0xbffff74c );
+
+ iss.str(L"0Xf.fff ");
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( err == goodbit );
+ VERIFY( ul == 0xffff );
+
+ iss.str(L"ffe ");
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( err == goodbit );
+ VERIFY( ul == 0xffe );
+
+ iss.setf(ios::oct, ios::basefield);
+ iss.str(L"07.654.321 ");
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( err == goodbit );
+ VERIFY( ul == 07654321 );
+
+ iss.str(L"07.777 ");
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( err == goodbit );
+ VERIFY( ul == 07777 );
+
+ iss.str(L"776 ");
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, ul);
+ VERIFY( err == goodbit );
+ VERIFY( ul == 0776 );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
+
+
+// Kathleen Hannah, humanitarian, woman, art-thief
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/6.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/6.cc
new file mode 100644
index 00000000000..2f4bb1bb0b4
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/6.cc
@@ -0,0 +1,57 @@
+// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.1.1 num_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/5816
+void test06()
+{
+ using namespace std;
+ bool test = true;
+
+ double d = 0.0;
+
+ wistringstream iss;
+ locale loc_de("de_DE");
+ iss.imbue(loc_de);
+
+ const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc());
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ ios_base::iostate err = ios_base::goodbit;
+
+ iss.str(L"1234,5 ");
+ err = goodbit;
+ ng.get(iss.rdbuf(), 0, iss, err, d);
+ VERIFY( err == goodbit );
+ VERIFY( d == 1234.5 );
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
+
+
+// Kathleen Hannah, humanitarian, woman, art-thief
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..c04f700e5cd
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/wrapped_env.cc
@@ -0,0 +1,61 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..88f84572a91
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/wrapped_locale.cc
@@ -0,0 +1,61 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/num_get_members_char.cc b/libstdc++-v3/testsuite/22_locale/num_get_members_char.cc
deleted file mode 100644
index 06e3322e0ad..00000000000
--- a/libstdc++-v3/testsuite/22_locale/num_get_members_char.cc
+++ /dev/null
@@ -1,446 +0,0 @@
-// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2001, 2002 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This 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 General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.2.1.1 num_get members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-void test01()
-{
- using namespace std;
- typedef istreambuf_iterator<char> iterator_type;
-
- bool test = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE");
- VERIFY( loc_c != loc_de );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the numpunct facets
- const numpunct<char>& numpunct_c = use_facet<numpunct<char> >(loc_c);
- const numpunct<char>& numpunct_de = use_facet<numpunct<char> >(loc_de);
- const numpunct<char>& numpunct_hk = use_facet<numpunct<char> >(loc_hk);
-
- // sanity check the data is correct.
- const string empty;
- char c;
-
- bool b1 = true;
- bool b0 = false;
- long l1 = 2147483647;
- long l2 = -2147483647;
- long l;
- unsigned long ul1 = 1294967294;
- unsigned long ul2 = 0;
- unsigned long ul;
- double d1 = 1.02345e+308;
- double d2 = 3.15e-308;
- double d;
- long double ld1 = 6.630025e+4;
- long double ld2 = 0.0;
- long double ld;
- void* v;
- const void* cv = &ul2;
-
- // cache the num_get facet
- istringstream iss;
- iss.imbue(loc_de);
- const num_get<char>& ng = use_facet<num_get<char> >(iss.getloc());
- const ios_base::iostate goodbit = ios_base::goodbit;
- const ios_base::iostate eofbit = ios_base::eofbit;
- ios_base::iostate err = ios_base::goodbit;
-
- // bool, simple
- iss.str("1");
- iterator_type os_it00 = iss.rdbuf();
- iterator_type os_it01 = ng.get(os_it00, 0, iss, err, b1);
- VERIFY( b1 == true );
- VERIFY( err & ios_base::eofbit );
-
- iss.str("0");
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, b0);
- VERIFY( b0 == false );
- VERIFY( err & eofbit );
-
- // bool, more twisted examples
- iss.imbue(loc_c);
- iss.str("true ");
- iss.clear();
- iss.setf(ios_base::boolalpha);
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, b0);
- VERIFY( b0 == true );
- VERIFY( err == goodbit );
-
- iss.str("false ");
- iss.clear();
- iss.setf(ios_base::boolalpha);
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, b1);
- VERIFY( b1 == false );
- VERIFY( err == goodbit );
-
- // long, in a locale that expects grouping
- iss.imbue(loc_hk);
- iss.str("2,147,483,647 ");
- iss.clear();
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, l);
- VERIFY( l == l1 );
- VERIFY( err == goodbit );
-
- iss.str("-2,147,483,647++++++");
- iss.clear();
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, l);
- VERIFY( l == l2 );
- VERIFY( err == goodbit );
-
- // unsigned long, in a locale that does not group
- iss.imbue(loc_c);
- iss.str("1294967294");
- iss.clear();
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( ul == ul1);
- VERIFY( err == eofbit );
-
- iss.str("0+++++++++++++++++++");
- iss.clear();
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( ul == ul2);
- VERIFY( err == goodbit );
-
- // ... and one that does
- iss.imbue(loc_de);
- iss.str("1.294.967.294+++++++");
- iss.clear();
- iss.width(20);
- iss.setf(ios_base::left, ios_base::adjustfield);
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( ul == ul1 );
- VERIFY( err == goodbit );
-
- // double
- iss.imbue(loc_c);
- iss.str("1.02345e+308++++++++");
- iss.clear();
- iss.width(20);
- iss.setf(ios_base::left, ios_base::adjustfield);
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, d);
- VERIFY( d == d1 );
- VERIFY( err == goodbit );
-
- iss.str("+3.15e-308");
- iss.clear();
- iss.width(20);
- iss.setf(ios_base::right, ios_base::adjustfield);
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, d);
- VERIFY( d == d2 );
- VERIFY( err == eofbit );
-
- iss.imbue(loc_de);
- iss.str("+1,02345e+308");
- iss.clear();
- iss.width(20);
- iss.setf(ios_base::right, ios_base::adjustfield);
- iss.setf(ios_base::scientific, ios_base::floatfield);
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, d);
- VERIFY( d == d1 );
- VERIFY( err == eofbit );
-
- iss.str("3,15E-308 ");
- iss.clear();
- iss.width(20);
- iss.precision(10);
- iss.setf(ios_base::right, ios_base::adjustfield);
- iss.setf(ios_base::scientific, ios_base::floatfield);
- iss.setf(ios_base::uppercase);
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, d);
- VERIFY( d == d2 );
- VERIFY( err == goodbit );
-
- // long double
- iss.str("6,630025e+4");
- iss.clear();
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ld);
- VERIFY( ld == ld1 );
- VERIFY( err == eofbit );
-
- iss.str("0 ");
- iss.clear();
- iss.precision(0);
- iss.setf(ios_base::fixed, ios_base::floatfield);
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ld);
- VERIFY( ld == 0 );
- VERIFY( err == goodbit );
-
- // const void
- iss.str("0xbffff74c,");
- iss.clear();
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, v);
- VERIFY( &v != &cv );
- VERIFY( err == goodbit );
-
-
-#ifdef _GLIBCPP_USE_LONG_LONG
- long long ll1 = 9223372036854775807LL;
- long long ll2 = -9223372036854775807LL;
- long long ll;
-
- iss.str("9.223.372.036.854.775.807");
- iss.clear();
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ll);
- VERIFY( ll == ll1 );
- VERIFY( err == eofbit );
-#endif
-}
-
-// 2002-01-10 David Seymour <seymour_dj@yahoo.com>
-// libstdc++/5331
-void test02()
-{
- using namespace std;
- bool test = true;
-
- // Check num_get works with other iterators besides streambuf
- // output iterators. (As long as output_iterator requirements are met.)
- typedef string::const_iterator iter_type;
- typedef num_get<char, iter_type> num_get_type;
- const ios_base::iostate goodbit = ios_base::goodbit;
- const ios_base::iostate eofbit = ios_base::eofbit;
- ios_base::iostate err = ios_base::goodbit;
- const locale loc_c = locale::classic();
- const string str("20000106 Elizabeth Durack");
- const string str2("0 true 0xbffff74c Durack");
-
- istringstream iss; // need an ios, add my num_get facet
- iss.imbue(locale(loc_c, new num_get_type));
-
- // Iterator advanced, state, output.
- const num_get_type& ng = use_facet<num_get_type>(iss.getloc());
-
- // 01 get(long)
- // 02 get(long double)
- // 03 get(bool)
- // 04 get(void*)
-
- // 01 get(long)
- long i = 0;
- err = goodbit;
- iter_type end1 = ng.get(str.begin(), str.end(), iss, err, i);
- string rem1(end1, str.end());
- VERIFY( err == goodbit );
- VERIFY( i == 20000106);
- VERIFY( rem1 == " Elizabeth Durack" );
-
- // 02 get(long double)
- long double ld = 0.0;
- err = goodbit;
- iter_type end2 = ng.get(str.begin(), str.end(), iss, err, ld);
- string rem2(end2, str.end());
- VERIFY( err == goodbit );
- VERIFY( ld == 20000106);
- VERIFY( rem2 == " Elizabeth Durack" );
-
- // 03 get(bool)
- bool b = 1;
- iss.clear();
- err = goodbit;
- iter_type end3 = ng.get(str2.begin(), str2.end(), iss, err, b);
- string rem3(end3, str2.end());
- VERIFY( err == goodbit );
- VERIFY( b == 0 );
- VERIFY( rem3 == " true 0xbffff74c Durack" );
-
- iss.clear();
- err = goodbit;
- iss.setf(ios_base::boolalpha);
- iter_type end4 = ng.get(++end3, str2.end(), iss, err, b);
- string rem4(end4, str2.end());
- VERIFY( err == goodbit );
- VERIFY( b == true );
- VERIFY( rem4 == " 0xbffff74c Durack" );
-
- // 04 get(void*)
- void* v;
- iss.clear();
- err = goodbit;
- iss.setf(ios_base::fixed, ios_base::floatfield);
- iter_type end5 = ng.get(++end4, str2.end(), iss, err, v);
- string rem5(end5, str2.end());
- VERIFY( err == goodbit );
- VERIFY( b == true );
- VERIFY( rem5 == " Durack" );
-}
-
-// libstdc++/5280
-void test03()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- test02();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// Testing the correct parsing of grouped hexadecimals and octals.
-void test04()
-{
- using namespace std;
-
- bool test = true;
-
- unsigned long ul;
-
- istringstream iss;
-
- // A locale that expects grouping
- locale loc_de("de_DE");
- iss.imbue(loc_de);
-
- const num_get<char>& ng = use_facet<num_get<char> >(iss.getloc());
- const ios_base::iostate goodbit = ios_base::goodbit;
- ios_base::iostate err = ios_base::goodbit;
-
- iss.setf(ios::hex, ios::basefield);
- iss.str("0xbf.fff.74c ");
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( err == goodbit );
- VERIFY( ul == 0xbffff74c );
-
- iss.str("0Xf.fff ");
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( err == goodbit );
- VERIFY( ul == 0xffff );
-
- iss.str("ffe ");
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( err == goodbit );
- VERIFY( ul == 0xffe );
-
- iss.setf(ios::oct, ios::basefield);
- iss.str("07.654.321 ");
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( err == goodbit );
- VERIFY( ul == 07654321 );
-
- iss.str("07.777 ");
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( err == goodbit );
- VERIFY( ul == 07777 );
-
- iss.str("776 ");
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( err == goodbit );
- VERIFY( ul == 0776 );
-}
-
-// libstdc++/5816
-void test05()
-{
- using namespace std;
- bool test = true;
-
- double d = 0.0;
-
- istringstream iss;
- locale loc_de("de_DE");
- iss.imbue(loc_de);
-
- const num_get<char>& ng = use_facet<num_get<char> >(iss.getloc());
- const ios_base::iostate goodbit = ios_base::goodbit;
- ios_base::iostate err = ios_base::goodbit;
-
- iss.str("1234,5 ");
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, d);
- VERIFY( err == goodbit );
- VERIFY( d == 1234.5 );
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test06()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- test02();
- test04();
- test05();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-
-int main()
-{
- test01();
- test02();
- test03();
- test04();
- test05();
- test06();
- return 0;
-}
-
-
-// Kathleen Hannah, humanitarian, woman, art-thief
diff --git a/libstdc++-v3/testsuite/22_locale/num_get_members_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/num_get_members_wchar_t.cc
deleted file mode 100644
index 088d4f8c9e3..00000000000
--- a/libstdc++-v3/testsuite/22_locale/num_get_members_wchar_t.cc
+++ /dev/null
@@ -1,456 +0,0 @@
-// 2001-11-26 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2001, 2002 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This 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 General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.2.1.1 num_get members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-void test01()
-{
- using namespace std;
- typedef istreambuf_iterator<wchar_t> iterator_type;
-
- bool test = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE");
- VERIFY( loc_c != loc_de );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the numpunct facets
- const numpunct<wchar_t>& numpunct_c = use_facet<numpunct<wchar_t> >(loc_c);
- const numpunct<wchar_t>& numpunct_de = use_facet<numpunct<wchar_t> >(loc_de);
- const numpunct<wchar_t>& numpunct_hk = use_facet<numpunct<wchar_t> >(loc_hk);
-
- // sanity check the data is correct.
- const string empty;
- char c;
-
- bool b1 = true;
- bool b0 = false;
- long l1 = 2147483647;
- long l2 = -2147483647;
- long l;
- unsigned long ul1 = 1294967294;
- unsigned long ul2 = 0;
- unsigned long ul;
- double d1 = 1.02345e+308;
- double d2 = 3.15e-308;
- double d;
- long double ld1 = 6.630025e+4;
- long double ld2 = 0.0;
- long double ld;
- void* v;
- const void* cv = &ul2;
-
- // cache the num_get facet
- wistringstream iss;
- iss.imbue(loc_de);
- const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc());
- const ios_base::iostate goodbit = ios_base::goodbit;
- const ios_base::iostate eofbit = ios_base::eofbit;
- ios_base::iostate err = ios_base::goodbit;
-
- // bool, simple
- iss.str(L"1");
- iterator_type os_it00 = iss.rdbuf();
- iterator_type os_it01 = ng.get(os_it00, 0, iss, err, b1);
- VERIFY( b1 == true );
- VERIFY( err & ios_base::eofbit );
-
- iss.str(L"0");
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, b0);
- VERIFY( b0 == false );
- VERIFY( err & eofbit );
-
- // bool, more twisted examples
- iss.imbue(loc_c);
- iss.str(L"true ");
- iss.clear();
- iss.setf(ios_base::boolalpha);
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, b0);
- VERIFY( b0 == true );
- VERIFY( err == goodbit );
-
- iss.str(L"false ");
- iss.clear();
- iss.setf(ios_base::boolalpha);
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, b1);
- VERIFY( b1 == false );
- VERIFY( err == goodbit );
-
- // long, in a locale that expects grouping
- iss.imbue(loc_hk);
- iss.str(L"2,147,483,647 ");
- iss.clear();
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, l);
- VERIFY( l == l1 );
- VERIFY( err == goodbit );
-
- iss.str(L"-2,147,483,647++++++");
- iss.clear();
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, l);
- VERIFY( l == l2 );
- VERIFY( err == goodbit );
-
- // unsigned long, in a locale that does not group
- iss.imbue(loc_c);
- iss.str(L"1294967294");
- iss.clear();
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( ul == ul1);
- VERIFY( err == eofbit );
-
- iss.str(L"0+++++++++++++++++++");
- iss.clear();
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( ul == ul2);
- VERIFY( err == goodbit );
-
- // ... and one that does
- iss.imbue(loc_de);
- iss.str(L"1.294.967.294+++++++");
- iss.clear();
- iss.width(20);
- iss.setf(ios_base::left, ios_base::adjustfield);
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( ul == ul1 );
- VERIFY( err == goodbit );
-
- // double
- iss.imbue(loc_c);
- iss.str(L"1.02345e+308++++++++");
- iss.clear();
- iss.width(20);
- iss.setf(ios_base::left, ios_base::adjustfield);
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, d);
- VERIFY( d == d1 );
- VERIFY( err == goodbit );
-
- iss.str(L"+3.15e-308");
- iss.clear();
- iss.width(20);
- iss.setf(ios_base::right, ios_base::adjustfield);
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, d);
- VERIFY( d == d2 );
- VERIFY( err == eofbit );
-
- iss.imbue(loc_de);
- iss.str(L"+1,02345e+308");
- iss.clear();
- iss.width(20);
- iss.setf(ios_base::right, ios_base::adjustfield);
- iss.setf(ios_base::scientific, ios_base::floatfield);
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, d);
- VERIFY( d == d1 );
- VERIFY( err == eofbit );
-
- iss.str(L"3,15E-308 ");
- iss.clear();
- iss.width(20);
- iss.precision(10);
- iss.setf(ios_base::right, ios_base::adjustfield);
- iss.setf(ios_base::scientific, ios_base::floatfield);
- iss.setf(ios_base::uppercase);
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, d);
- VERIFY( d == d2 );
- VERIFY( err == goodbit );
-
- // long double
- iss.str(L"6,630025e+4");
- iss.clear();
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ld);
- VERIFY( ld == ld1 );
- VERIFY( err == eofbit );
-
- iss.str(L"0 ");
- iss.clear();
- iss.precision(0);
- iss.setf(ios_base::fixed, ios_base::floatfield);
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ld);
- VERIFY( ld == 0 );
- VERIFY( err == goodbit );
-
- // const void
- iss.str(L"0xbffff74c,");
- iss.clear();
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, v);
- VERIFY( &v != &cv );
- VERIFY( err == goodbit );
-
-
-#ifdef _GLIBCPP_USE_LONG_LONG
- long long ll1 = 9223372036854775807LL;
- long long ll2 = -9223372036854775807LL;
- long long ll;
-
- iss.str(L"9.223.372.036.854.775.807");
- iss.clear();
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ll);
- VERIFY( ll == ll1 );
- VERIFY( err == eofbit );
-#endif
-}
-
-// 2002-01-10 David Seymour <seymour_dj@yahoo.com>
-// libstdc++/5331
-void test02()
-{
- using namespace std;
- bool test = true;
-
- // Check num_get works with other iterators besides streambuf
- // output iterators. (As long as output_iterator requirements are met.)
- typedef wstring::const_iterator iter_type;
- typedef num_get<wchar_t, iter_type> num_get_type;
- const ios_base::iostate goodbit = ios_base::goodbit;
- const ios_base::iostate eofbit = ios_base::eofbit;
- ios_base::iostate err = ios_base::goodbit;
- const locale loc_c = locale::classic();
- const wstring str(L"20000106 Elizabeth Durack");
- const wstring str2(L"0 true 0xbffff74c Durack");
-
- istringstream iss; // need an ios, add my num_get facet
- iss.imbue(locale(loc_c, new num_get_type));
-
- // Iterator advanced, state, output.
- const num_get_type& ng = use_facet<num_get_type>(iss.getloc());
-
- // 01 get(long)
- // 02 get(long double)
- // 03 get(bool)
- // 04 get(void*)
-
- // 01 get(long)
- long i = 0;
- err = goodbit;
- iter_type end1 = ng.get(str.begin(), str.end(), iss, err, i);
- wstring rem1(end1, str.end());
- VERIFY( err == goodbit );
- VERIFY( i == 20000106);
- VERIFY( rem1 == L" Elizabeth Durack" );
-
- // 02 get(long double)
- long double ld = 0.0;
- err = goodbit;
- iter_type end2 = ng.get(str.begin(), str.end(), iss, err, ld);
- wstring rem2(end2, str.end());
- VERIFY( err == goodbit );
- VERIFY( ld == 20000106);
- VERIFY( rem2 == L" Elizabeth Durack" );
-
- // 03 get(bool)
- // const string str2("0 true 0xbffff74c Durack");
- bool b = 1;
- iss.clear();
- err = goodbit;
- iter_type end3 = ng.get(str2.begin(), str2.end(), iss, err, b);
- wstring rem3(end3, str2.end());
- VERIFY( err == goodbit );
- VERIFY( b == 0 );
- VERIFY( rem3 == L" true 0xbffff74c Durack" );
-
- iss.clear();
- err = goodbit;
- iss.setf(ios_base::boolalpha);
- iter_type end4 = ng.get(++end3, str2.end(), iss, err, b);
- wstring rem4(end4, str2.end());
- VERIFY( err == goodbit );
- VERIFY( b == true );
- VERIFY( rem4 == L" 0xbffff74c Durack" );
-
- // 04 get(void*)
- void* v;
- iss.clear();
- err = goodbit;
- iss.setf(ios_base::fixed, ios_base::floatfield);
- iter_type end5 = ng.get(++end4, str2.end(), iss, err, v);
- wstring rem5(end5, str2.end());
- VERIFY( err == goodbit );
- VERIFY( b == true );
- VERIFY( rem5 == L" Durack" );
-}
-
-// libstdc++/5280
-void test03()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- test02();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// Testing the correct parsing of grouped hexadecimals and octals.
-void test04()
-{
- using namespace std;
-
- bool test = true;
-
- unsigned long ul;
-
- wistringstream iss;
-
- // A locale that expects grouping
- locale loc_de("de_DE");
- iss.imbue(loc_de);
-
- const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc());
- const ios_base::iostate goodbit = ios_base::goodbit;
- ios_base::iostate err = ios_base::goodbit;
-
- iss.setf(ios::hex, ios::basefield);
- iss.str(L"0xbf.fff.74c ");
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( err == goodbit );
- VERIFY( ul == 0xbffff74c );
-
- iss.str(L"0Xf.fff ");
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( err == goodbit );
- VERIFY( ul == 0xffff );
-
- iss.str(L"ffe ");
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( err == goodbit );
- VERIFY( ul == 0xffe );
-
- iss.setf(ios::oct, ios::basefield);
- iss.str(L"07.654.321 ");
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( err == goodbit );
- VERIFY( ul == 07654321 );
-
- iss.str(L"07.777 ");
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( err == goodbit );
- VERIFY( ul == 07777 );
-
- iss.str(L"776 ");
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, ul);
- VERIFY( err == goodbit );
- VERIFY( ul == 0776 );
-}
-
-// libstdc++/5816
-void test05()
-{
- using namespace std;
- bool test = true;
-
- double d = 0.0;
-
- wistringstream iss;
- locale loc_de("de_DE");
- iss.imbue(loc_de);
-
- const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc());
- const ios_base::iostate goodbit = ios_base::goodbit;
- ios_base::iostate err = ios_base::goodbit;
-
- iss.str(L"1234,5 ");
- err = goodbit;
- ng.get(iss.rdbuf(), 0, iss, err, d);
- VERIFY( err == goodbit );
- VERIFY( d == 1234.5 );
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test06()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- test02();
- test04();
- test05();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-#endif
-
-int main()
-{
-#ifdef _GLIBCPP_USE_WCHAR_T
- test01();
- test02();
- test03();
- test04();
- test05();
- test06();
-#endif
- return 0;
-}
-
-
-// Kathleen Hannah, humanitarian, woman, art-thief
-
-
-
-
-
diff --git a/libstdc++-v3/testsuite/22_locale/num_put.cc b/libstdc++-v3/testsuite/22_locale/num_put/1.cc
index 1d0d7f1a372..2dabe86d830 100644
--- a/libstdc++-v3/testsuite/22_locale/num_put.cc
+++ b/libstdc++-v3/testsuite/22_locale/num_put/1.cc
@@ -1,6 +1,7 @@
+// { dg-do compile }
// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001 Free Software Foundation
+// Copyright (C) 2001, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -20,8 +21,6 @@
// 22.2.2.2 Template class num_put
-// { dg-do compile }
-
#include <locale>
void test01()
@@ -37,18 +36,8 @@ void test01()
typedef test_type::iter_type iter_type;
}
-// Should be able to instantiate this for other types besides char, wchar_t
-class gnu_num_put: public std::num_put<unsigned char>
-{ };
-
-void test02()
-{
- gnu_num_put facet01;
-}
-
int main()
{
test01();
- test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/2.cc b/libstdc++-v3/testsuite/22_locale/num_put/2.cc
new file mode 100644
index 00000000000..67aeefaffec
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/2.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.2 Template class num_put
+
+#include <locale>
+
+// Should be able to instantiate this for other types besides char, wchar_t
+class gnu_num_put: public std::num_put<unsigned char>
+{ };
+
+void test02()
+{
+ gnu_num_put facet01;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/1.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/1.cc
new file mode 100644
index 00000000000..d73ceb733f4
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/1.cc
@@ -0,0 +1,176 @@
+// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.2.1 num_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the numpunct facets
+ const numpunct<char>& numpunct_c = use_facet<numpunct<char> >(loc_c);
+ const numpunct<char>& numpunct_de = use_facet<numpunct<char> >(loc_de);
+ const numpunct<char>& numpunct_hk = use_facet<numpunct<char> >(loc_hk);
+
+ // sanity check the data is correct.
+ const string empty;
+ string result1;
+ string result2;
+ char c;
+
+ bool b1 = true;
+ bool b0 = false;
+ long l1 = 2147483647;
+ long l2 = -2147483647;
+ unsigned long ul1 = 1294967294;
+ unsigned long ul2 = 0;
+ double d1 = 1.7976931348623157e+308;
+ double d2 = 2.2250738585072014e-308;
+ long double ld1 = 1.7976931348623157e+308;
+ long double ld2 = 2.2250738585072014e-308;
+ const void* cv = &ld1;
+
+ // cache the num_put facet
+ ostringstream oss;
+ oss.imbue(loc_de);
+ const num_put<char>& np = use_facet<num_put<char> >(oss.getloc());
+
+ // bool, simple
+ iterator_type os_it00 = oss.rdbuf();
+ iterator_type os_it01 = np.put(os_it00, oss, '+', b1);
+ result1 = oss.str();
+ VERIFY( result1 == "1" );
+ // VERIFY( os_it00 != os_it01 );
+
+ oss.str(empty);
+ np.put(oss.rdbuf(), oss, '+', b0);
+ result2 = oss.str();
+ VERIFY( result2 == "0" );
+
+ // ... and one that does
+ oss.imbue(loc_de);
+ oss.str(empty);
+ oss.clear();
+ oss.width(20);
+ oss.setf(ios_base::left, ios_base::adjustfield);
+ np.put(oss.rdbuf(), oss, '+', ul1);
+ result1 = oss.str();
+ VERIFY( result1 == "1.294.967.294+++++++" );
+
+ // double
+ oss.str(empty);
+ oss.clear();
+ oss.width(20);
+ oss.setf(ios_base::left, ios_base::adjustfield);
+ np.put(oss.rdbuf(), oss, '+', d1);
+ result1 = oss.str();
+ VERIFY( result1 == "1,79769e+308++++++++" );
+
+ oss.str(empty);
+ oss.clear();
+ oss.width(20);
+ oss.setf(ios_base::right, ios_base::adjustfield);
+ np.put(oss.rdbuf(), oss, '+', d2);
+ result1 = oss.str();
+ VERIFY( result1 == "++++++++2,22507e-308" );
+
+ oss.str(empty);
+ oss.clear();
+ oss.width(20);
+ oss.setf(ios_base::right, ios_base::adjustfield);
+ oss.setf(ios_base::scientific, ios_base::floatfield);
+ np.put(oss.rdbuf(), oss, '+', d2);
+ result2 = oss.str();
+ VERIFY( result2 == "+++++++2,225074e-308" );
+
+ oss.str(empty);
+ oss.clear();
+ oss.width(20);
+ oss.precision(10);
+ oss.setf(ios_base::right, ios_base::adjustfield);
+ oss.setf(ios_base::scientific, ios_base::floatfield);
+ oss.setf(ios_base::uppercase);
+ np.put(oss.rdbuf(), oss, '+', d2);
+ result1 = oss.str();
+ VERIFY( result1 == "+++2,2250738585E-308" );
+
+ // long double
+ oss.str(empty);
+ oss.clear();
+ np.put(oss.rdbuf(), oss, '+', ld1);
+ result1 = oss.str();
+ VERIFY( result1 == "1,7976931349E+308" );
+
+ oss.str(empty);
+ oss.clear();
+ oss.precision(0);
+ oss.setf(ios_base::fixed, ios_base::floatfield);
+ np.put(oss.rdbuf(), oss, '+', ld2);
+ result1 = oss.str();
+ VERIFY( result1 == "0" );
+
+ // const void
+ oss.str(empty);
+ oss.clear();
+ np.put(oss.rdbuf(), oss, '+', cv);
+ result1 = oss.str();
+ // No grouping characters.
+ VERIFY( !char_traits<char>::find(result1.c_str(),
+ result1.size(),
+ numpunct_de.decimal_point()) );
+ // Should contain an 'x'.
+ VERIFY( result1.find('x') == 1 );
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ long long ll1 = 9223372036854775807LL;
+ long long ll2 = -9223372036854775807LL;
+
+ oss.str(empty);
+ oss.clear();
+ np.put(oss.rdbuf(), oss, '+', ll1);
+ result1 = oss.str();
+ VERIFY( result1 == "9.223.372.036.854.775.807" );
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/2.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/2.cc
new file mode 100644
index 00000000000..dab92047cf9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/2.cc
@@ -0,0 +1,112 @@
+// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.2.1 num_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the numpunct facets
+ const numpunct<char>& numpunct_c = use_facet<numpunct<char> >(loc_c);
+ const numpunct<char>& numpunct_de = use_facet<numpunct<char> >(loc_de);
+ const numpunct<char>& numpunct_hk = use_facet<numpunct<char> >(loc_hk);
+
+ // sanity check the data is correct.
+ const string empty;
+ string result1;
+ string result2;
+ char c;
+
+ bool b1 = true;
+ bool b0 = false;
+ long l1 = 2147483647;
+ long l2 = -2147483647;
+ unsigned long ul1 = 1294967294;
+ unsigned long ul2 = 0;
+ double d1 = 1.7976931348623157e+308;
+ double d2 = 2.2250738585072014e-308;
+ long double ld1 = 1.7976931348623157e+308;
+ long double ld2 = 2.2250738585072014e-308;
+ const void* cv = &ld1;
+
+ // cache the num_put facet
+ ostringstream oss;
+ oss.imbue(loc_c);
+ const num_put<char>& np = use_facet<num_put<char> >(oss.getloc());
+
+ // C
+ // bool, more twisted examples
+ oss.str(empty);
+ oss.width(20);
+ oss.setf(ios_base::right, ios_base::adjustfield);
+ np.put(oss.rdbuf(), oss, '+', b0);
+ result1 = oss.str();
+ VERIFY( result1 == "+++++++++++++++++++0" );
+
+ oss.str(empty);
+ oss.width(20);
+ oss.setf(ios_base::left, ios_base::adjustfield);
+ oss.setf(ios_base::boolalpha);
+ np.put(oss.rdbuf(), oss, '+', b1);
+ result2 = oss.str();
+ VERIFY( result2 == "true++++++++++++++++" );
+
+ // unsigned long, in a locale that does not group
+ oss.imbue(loc_c);
+ oss.str(empty);
+ oss.clear();
+ np.put(oss.rdbuf(), oss, '+', ul1);
+ result1 = oss.str();
+ VERIFY( result1 == "1294967294" );
+
+ oss.str(empty);
+ oss.clear();
+ oss.width(20);
+ oss.setf(ios_base::left, ios_base::adjustfield);
+ np.put(oss.rdbuf(), oss, '+', ul2);
+ result1 = oss.str();
+ VERIFY( result1 == "0+++++++++++++++++++" );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/3.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/3.cc
new file mode 100644
index 00000000000..201403a0e54
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/3.cc
@@ -0,0 +1,95 @@
+// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.2.1 num_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the numpunct facets
+ const numpunct<char>& numpunct_c = use_facet<numpunct<char> >(loc_c);
+ const numpunct<char>& numpunct_de = use_facet<numpunct<char> >(loc_de);
+ const numpunct<char>& numpunct_hk = use_facet<numpunct<char> >(loc_hk);
+
+ // sanity check the data is correct.
+ const string empty;
+ string result1;
+ string result2;
+ char c;
+
+ bool b1 = true;
+ bool b0 = false;
+ long l1 = 2147483647;
+ long l2 = -2147483647;
+ unsigned long ul1 = 1294967294;
+ unsigned long ul2 = 0;
+ double d1 = 1.7976931348623157e+308;
+ double d2 = 2.2250738585072014e-308;
+ long double ld1 = 1.7976931348623157e+308;
+ long double ld2 = 2.2250738585072014e-308;
+ const void* cv = &ld1;
+
+ // cache the num_put facet
+ ostringstream oss;
+ oss.imbue(loc_hk);
+ const num_put<char>& np = use_facet<num_put<char> >(oss.getloc());
+
+ // HK
+ // long, in a locale that expects grouping
+ oss.str(empty);
+ oss.clear();
+ np.put(oss.rdbuf(), oss, '+', l1);
+ result1 = oss.str();
+ VERIFY( result1 == "2,147,483,647" );
+
+ oss.str(empty);
+ oss.clear();
+ oss.width(20);
+ oss.setf(ios_base::left, ios_base::adjustfield);
+ np.put(oss.rdbuf(), oss, '+', l2);
+ result1 = oss.str();
+ VERIFY( result1 == "-2,147,483,647++++++" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/4.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/4.cc
new file mode 100644
index 00000000000..7ce358311fe
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/4.cc
@@ -0,0 +1,105 @@
+// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.2.1 num_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test04()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check num_put works with other iterators besides streambuf
+ // output iterators. (As long as output_iterator requirements are met.)
+ typedef string::iterator iter_type;
+ typedef char_traits<char> traits;
+ typedef num_put<char, iter_type> num_put_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ const locale loc_c = locale::classic();
+ const string str("1798 Lady Elgin");
+ const string str2("0 true 0xbffff74c Mary Nisbet");
+ const string x(15, 'x'); // have to have allocated string!
+ string res;
+
+ ostringstream oss;
+ oss.imbue(locale(loc_c, new num_put_type));
+
+ // Iterator advanced, state, output.
+ const num_put_type& tp = use_facet<num_put_type>(oss.getloc());
+
+ // 01 put(long)
+ // 02 put(long double)
+ // 03 put(bool)
+ // 04 put(void*)
+
+ // 01 put(long)
+ const long l = 1798;
+ res = x;
+ iter_type ret1 = tp.put(res.begin(), oss, ' ', l);
+ string sanity1(res.begin(), ret1);
+ VERIFY( res == "1798xxxxxxxxxxx" );
+ VERIFY( sanity1 == "1798" );
+
+ // 02 put(long double)
+ const long double ld = 1798.0;
+ res = x;
+ iter_type ret2 = tp.put(res.begin(), oss, ' ', ld);
+ string sanity2(res.begin(), ret2);
+ VERIFY( res == "1798xxxxxxxxxxx" );
+ VERIFY( sanity2 == "1798" );
+
+ // 03 put(bool)
+ bool b = 1;
+ res = x;
+ iter_type ret3 = tp.put(res.begin(), oss, ' ', b);
+ string sanity3(res.begin(), ret3);
+ VERIFY( res == "1xxxxxxxxxxxxxx" );
+ VERIFY( sanity3 == "1" );
+
+ b = 0;
+ res = x;
+ oss.setf(ios_base::boolalpha);
+ iter_type ret4 = tp.put(res.begin(), oss, ' ', b);
+ string sanity4(res.begin(), ret4);
+ VERIFY( res == "falsexxxxxxxxxx" );
+ VERIFY( sanity4 == "false" );
+
+ // 04 put(void*)
+ oss.clear();
+ const void* cv = &ld;
+ res = x;
+ oss.setf(ios_base::fixed, ios_base::floatfield);
+ iter_type ret5 = tp.put(res.begin(), oss, ' ', cv);
+ string sanity5(res.begin(), ret5);
+ VERIFY( sanity5.size() );
+ VERIFY( sanity5[1] == 'x' );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/5.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/5.cc
new file mode 100644
index 00000000000..0af3d3cf611
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/5.cc
@@ -0,0 +1,70 @@
+// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.2.1 num_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// Make sure that, in a locale that expects grouping, when showbase
+// is true, an hexadecimal or octal zero is correctly output (the case
+// of zero is special since there is no 0x, 0 respectively, prefix)
+void test05()
+{
+ using namespace std;
+ bool test = true;
+
+ // A locale that expects grouping.
+ locale loc_de("de_DE");
+
+ const string empty;
+ string result;
+
+ ostringstream oss;
+ oss.imbue(loc_de);
+ const num_put<char>& np = use_facet<num_put<char> >(oss.getloc());
+
+ long l = 0;
+
+ oss.str(empty);
+ oss.clear();
+ oss.setf(ios::showbase);
+ oss.setf(ios::hex, ios::basefield);
+ np.put(oss.rdbuf(), oss, '+', l);
+ result = oss.str();
+ VERIFY( result == "0" );
+
+ oss.str(empty);
+ oss.clear();
+ oss.setf(ios::showbase);
+ oss.setf(ios::oct, ios::basefield);
+ np.put(oss.rdbuf(), oss, '+', l);
+ result = oss.str();
+ VERIFY( result == "0" );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/wrapped_env.cc
new file mode 100644
index 00000000000..2baa3a44950
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/wrapped_env.cc
@@ -0,0 +1,56 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/wrapped_locale.cc
new file mode 100644
index 00000000000..63e7a470160
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/wrapped_locale.cc
@@ -0,0 +1,56 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/1.cc
new file mode 100644
index 00000000000..9c5bdc5968e
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/1.cc
@@ -0,0 +1,176 @@
+// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.2.1 num_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the numpunct facets
+ const numpunct<wchar_t>& numpunct_c = use_facet<numpunct<wchar_t> >(loc_c);
+ const numpunct<wchar_t>& numpunct_de = use_facet<numpunct<wchar_t> >(loc_de);
+ const numpunct<wchar_t>& numpunct_hk = use_facet<numpunct<wchar_t> >(loc_hk);
+
+ // sanity check the data is correct.
+ const wstring empty;
+ wstring result1;
+ wstring result2;
+ char c;
+
+ bool b1 = true;
+ bool b0 = false;
+ long l1 = 2147483647;
+ long l2 = -2147483647;
+ unsigned long ul1 = 1294967294;
+ unsigned long ul2 = 0;
+ double d1 = 1.7976931348623157e+308;
+ double d2 = 2.2250738585072014e-308;
+ long double ld1 = 1.7976931348623157e+308;
+ long double ld2 = 2.2250738585072014e-308;
+ const void* cv = &ld1;
+
+ // cache the num_put facet
+ wostringstream oss;
+ oss.imbue(loc_de);
+ const num_put<wchar_t>& np = use_facet<num_put<wchar_t> >(oss.getloc());
+
+ // bool, simple
+ iterator_type os_it00 = oss.rdbuf();
+ iterator_type os_it01 = np.put(os_it00, oss, '+', b1);
+ result1 = oss.str();
+ VERIFY( result1 == L"1" );
+ // VERIFY( os_it00 != os_it01 );
+
+ oss.str(empty);
+ np.put(oss.rdbuf(), oss, '+', b0);
+ result2 = oss.str();
+ VERIFY( result2 == L"0" );
+
+ // ... and one that does
+ oss.imbue(loc_de);
+ oss.str(empty);
+ oss.clear();
+ oss.width(20);
+ oss.setf(ios_base::left, ios_base::adjustfield);
+ np.put(oss.rdbuf(), oss, '+', ul1);
+ result1 = oss.str();
+ VERIFY( result1 == L"1.294.967.294+++++++" );
+
+ // double
+ oss.str(empty);
+ oss.clear();
+ oss.width(20);
+ oss.setf(ios_base::left, ios_base::adjustfield);
+ np.put(oss.rdbuf(), oss, '+', d1);
+ result1 = oss.str();
+ VERIFY( result1 == L"1,79769e+308++++++++" );
+
+ oss.str(empty);
+ oss.clear();
+ oss.width(20);
+ oss.setf(ios_base::right, ios_base::adjustfield);
+ np.put(oss.rdbuf(), oss, '+', d2);
+ result1 = oss.str();
+ VERIFY( result1 == L"++++++++2,22507e-308" );
+
+ oss.str(empty);
+ oss.clear();
+ oss.width(20);
+ oss.setf(ios_base::right, ios_base::adjustfield);
+ oss.setf(ios_base::scientific, ios_base::floatfield);
+ np.put(oss.rdbuf(), oss, '+', d2);
+ result2 = oss.str();
+ VERIFY( result2 == L"+++++++2,225074e-308" );
+
+ oss.str(empty);
+ oss.clear();
+ oss.width(20);
+ oss.precision(10);
+ oss.setf(ios_base::right, ios_base::adjustfield);
+ oss.setf(ios_base::scientific, ios_base::floatfield);
+ oss.setf(ios_base::uppercase);
+ np.put(oss.rdbuf(), oss, '+', d2);
+ result1 = oss.str();
+ VERIFY( result1 == L"+++2,2250738585E-308" );
+
+ // long double
+ oss.str(empty);
+ oss.clear();
+ np.put(oss.rdbuf(), oss, '+', ld1);
+ result1 = oss.str();
+ VERIFY( result1 == L"1,7976931349E+308" );
+
+ oss.str(empty);
+ oss.clear();
+ oss.precision(0);
+ oss.setf(ios_base::fixed, ios_base::floatfield);
+ np.put(oss.rdbuf(), oss, '+', ld2);
+ result1 = oss.str();
+ VERIFY( result1 == L"0" );
+
+ // const void
+ oss.str(empty);
+ oss.clear();
+ np.put(oss.rdbuf(), oss, '+', cv);
+ result1 = oss.str();
+ // No grouping characters.
+ VERIFY( !char_traits<wchar_t>::find(result1.c_str(),
+ result1.size(),
+ numpunct_de.decimal_point()) );
+ // Should contain an 'x'.
+ VERIFY( result1.find(L'x') == 1 );
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ long long ll1 = 9223372036854775807LL;
+ long long ll2 = -9223372036854775807LL;
+
+ oss.str(empty);
+ oss.clear();
+ np.put(oss.rdbuf(), oss, '+', ll1);
+ result1 = oss.str();
+ VERIFY( result1 == L"9.223.372.036.854.775.807" );
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/2.cc
new file mode 100644
index 00000000000..de08c093745
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/2.cc
@@ -0,0 +1,112 @@
+// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.2.1 num_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the numpunct facets
+ const numpunct<wchar_t>& numpunct_c = use_facet<numpunct<wchar_t> >(loc_c);
+ const numpunct<wchar_t>& numpunct_de = use_facet<numpunct<wchar_t> >(loc_de);
+ const numpunct<wchar_t>& numpunct_hk = use_facet<numpunct<wchar_t> >(loc_hk);
+
+ // sanity check the data is correct.
+ const wstring empty;
+ wstring result1;
+ wstring result2;
+ char c;
+
+ bool b1 = true;
+ bool b0 = false;
+ long l1 = 2147483647;
+ long l2 = -2147483647;
+ unsigned long ul1 = 1294967294;
+ unsigned long ul2 = 0;
+ double d1 = 1.7976931348623157e+308;
+ double d2 = 2.2250738585072014e-308;
+ long double ld1 = 1.7976931348623157e+308;
+ long double ld2 = 2.2250738585072014e-308;
+ const void* cv = &ld1;
+
+ // cache the num_put facet
+ wostringstream oss;
+ oss.imbue(loc_c);
+ const num_put<wchar_t>& np = use_facet<num_put<wchar_t> >(oss.getloc());
+
+ // C
+ // bool, more twisted examples
+ oss.str(empty);
+ oss.width(20);
+ oss.setf(ios_base::right, ios_base::adjustfield);
+ np.put(oss.rdbuf(), oss, '+', b0);
+ result1 = oss.str();
+ VERIFY( result1 == L"+++++++++++++++++++0" );
+
+ oss.str(empty);
+ oss.width(20);
+ oss.setf(ios_base::left, ios_base::adjustfield);
+ oss.setf(ios_base::boolalpha);
+ np.put(oss.rdbuf(), oss, '+', b1);
+ result2 = oss.str();
+ VERIFY( result2 == L"true++++++++++++++++" );
+
+ // unsigned long, in a locale that does not group
+ oss.imbue(loc_c);
+ oss.str(empty);
+ oss.clear();
+ np.put(oss.rdbuf(), oss, '+', ul1);
+ result1 = oss.str();
+ VERIFY( result1 == L"1294967294" );
+
+ oss.str(empty);
+ oss.clear();
+ oss.width(20);
+ oss.setf(ios_base::left, ios_base::adjustfield);
+ np.put(oss.rdbuf(), oss, '+', ul2);
+ result1 = oss.str();
+ VERIFY( result1 == L"0+++++++++++++++++++" );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/3.cc
new file mode 100644
index 00000000000..ae2d0cfac8c
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/3.cc
@@ -0,0 +1,95 @@
+// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.2.1 num_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the numpunct facets
+ const numpunct<wchar_t>& numpunct_c = use_facet<numpunct<wchar_t> >(loc_c);
+ const numpunct<wchar_t>& numpunct_de = use_facet<numpunct<wchar_t> >(loc_de);
+ const numpunct<wchar_t>& numpunct_hk = use_facet<numpunct<wchar_t> >(loc_hk);
+
+ // sanity check the data is correct.
+ const wstring empty;
+ wstring result1;
+ wstring result2;
+ char c;
+
+ bool b1 = true;
+ bool b0 = false;
+ long l1 = 2147483647;
+ long l2 = -2147483647;
+ unsigned long ul1 = 1294967294;
+ unsigned long ul2 = 0;
+ double d1 = 1.7976931348623157e+308;
+ double d2 = 2.2250738585072014e-308;
+ long double ld1 = 1.7976931348623157e+308;
+ long double ld2 = 2.2250738585072014e-308;
+ const void* cv = &ld1;
+
+ // cache the num_put facet
+ wostringstream oss;
+ oss.imbue(loc_hk);
+ const num_put<wchar_t>& np = use_facet<num_put<wchar_t> >(oss.getloc());
+
+ // HK
+ // long, in a locale that expects grouping
+ oss.str(empty);
+ oss.clear();
+ np.put(oss.rdbuf(), oss, '+', l1);
+ result1 = oss.str();
+ VERIFY( result1 == L"2,147,483,647" );
+
+ oss.str(empty);
+ oss.clear();
+ oss.width(20);
+ oss.setf(ios_base::left, ios_base::adjustfield);
+ np.put(oss.rdbuf(), oss, '+', l2);
+ result1 = oss.str();
+ VERIFY( result1 == L"-2,147,483,647++++++" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/4.cc
new file mode 100644
index 00000000000..1057a85f42d
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/4.cc
@@ -0,0 +1,105 @@
+// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.2.1 num_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test04()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check num_put works with other iterators besides streambuf
+ // output iterators. (As long as output_iterator requirements are met.)
+ typedef wstring::iterator iter_type;
+ typedef char_traits<wchar_t> traits;
+ typedef num_put<wchar_t, iter_type> num_put_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ const locale loc_c = locale::classic();
+ const wstring str(L"1798 Lady Elgin");
+ const wstring str2(L"0 true 0xbffff74c Mary Nisbet");
+ const wstring x(15, L'x'); // have to have allocated wstring!
+ wstring res;
+
+ wostringstream oss;
+ oss.imbue(locale(loc_c, new num_put_type));
+
+ // Iterator advanced, state, output.
+ const num_put_type& tp = use_facet<num_put_type>(oss.getloc());
+
+ // 01 put(long)
+ // 02 put(long double)
+ // 03 put(bool)
+ // 04 put(void*)
+
+ // 01 put(long)
+ const long l = 1798;
+ res = x;
+ iter_type ret1 = tp.put(res.begin(), oss, ' ', l);
+ wstring sanity1(res.begin(), ret1);
+ VERIFY( res == L"1798xxxxxxxxxxx" );
+ VERIFY( sanity1 == L"1798" );
+
+ // 02 put(long double)
+ const long double ld = 1798.0;
+ res = x;
+ iter_type ret2 = tp.put(res.begin(), oss, ' ', ld);
+ wstring sanity2(res.begin(), ret2);
+ VERIFY( res == L"1798xxxxxxxxxxx" );
+ VERIFY( sanity2 == L"1798" );
+
+ // 03 put(bool)
+ bool b = 1;
+ res = x;
+ iter_type ret3 = tp.put(res.begin(), oss, ' ', b);
+ wstring sanity3(res.begin(), ret3);
+ VERIFY( res == L"1xxxxxxxxxxxxxx" );
+ VERIFY( sanity3 == L"1" );
+
+ b = 0;
+ res = x;
+ oss.setf(ios_base::boolalpha);
+ iter_type ret4 = tp.put(res.begin(), oss, ' ', b);
+ wstring sanity4(res.begin(), ret4);
+ VERIFY( res == L"falsexxxxxxxxxx" );
+ VERIFY( sanity4 == L"false" );
+
+ // 04 put(void*)
+ oss.clear();
+ const void* cv = &ld;
+ res = x;
+ oss.setf(ios_base::fixed, ios_base::floatfield);
+ iter_type ret5 = tp.put(res.begin(), oss, ' ', cv);
+ wstring sanity5(res.begin(), ret5);
+ VERIFY( sanity5.size() );
+ VERIFY( sanity5[1] == 'x' );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/5.cc
new file mode 100644
index 00000000000..18ea8edc600
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/5.cc
@@ -0,0 +1,70 @@
+// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.2.1 num_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// Make sure that, in a locale that expects grouping, when showbase
+// is true, an hexadecimal or octal zero is correctly output (the case
+// of zero is special since there is no 0x, 0 respectively, prefix)
+void test05()
+{
+ using namespace std;
+ bool test = true;
+
+ // A locale that expects grouping.
+ locale loc_de("de_DE");
+
+ const wstring empty;
+ wstring result;
+
+ wostringstream oss;
+ oss.imbue(loc_de);
+ const num_put<wchar_t>& np = use_facet<num_put<wchar_t> >(oss.getloc());
+
+ long l = 0;
+
+ oss.str(empty);
+ oss.clear();
+ oss.setf(ios::showbase);
+ oss.setf(ios::hex, ios::basefield);
+ np.put(oss.rdbuf(), oss, '+', l);
+ result = oss.str();
+ VERIFY( result == L"0" );
+
+ oss.str(empty);
+ oss.clear();
+ oss.setf(ios::showbase);
+ oss.setf(ios::oct, ios::basefield);
+ np.put(oss.rdbuf(), oss, '+', l);
+ result = oss.str();
+ VERIFY( result == L"0" );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..2baa3a44950
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/wrapped_env.cc
@@ -0,0 +1,56 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..63e7a470160
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/wrapped_locale.cc
@@ -0,0 +1,56 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/num_put_members_char.cc b/libstdc++-v3/testsuite/22_locale/num_put_members_char.cc
deleted file mode 100644
index 448119682cf..00000000000
--- a/libstdc++-v3/testsuite/22_locale/num_put_members_char.cc
+++ /dev/null
@@ -1,376 +0,0 @@
-// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2001, 2002 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This 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 General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.2.2.1 num_put members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-void test01()
-{
- using namespace std;
- typedef ostreambuf_iterator<char> iterator_type;
-
- bool test = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE");
- VERIFY( loc_c != loc_de );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the numpunct facets
- const numpunct<char>& numpunct_c = use_facet<numpunct<char> >(loc_c);
- const numpunct<char>& numpunct_de = use_facet<numpunct<char> >(loc_de);
- const numpunct<char>& numpunct_hk = use_facet<numpunct<char> >(loc_hk);
-
- // sanity check the data is correct.
- const string empty;
- string result1;
- string result2;
- char c;
-
- bool b1 = true;
- bool b0 = false;
- long l1 = 2147483647;
- long l2 = -2147483647;
- unsigned long ul1 = 1294967294;
- unsigned long ul2 = 0;
- double d1 = 1.7976931348623157e+308;
- double d2 = 2.2250738585072014e-308;
- long double ld1 = 1.7976931348623157e+308;
- long double ld2 = 2.2250738585072014e-308;
- const void* cv = &ld1;
-
- // cache the num_put facet
- ostringstream oss;
- oss.imbue(loc_de);
- const num_put<char>& np = use_facet<num_put<char> >(oss.getloc());
-
- // bool, simple
- iterator_type os_it00 = oss.rdbuf();
- iterator_type os_it01 = np.put(os_it00, oss, '+', b1);
- result1 = oss.str();
- VERIFY( result1 == "1" );
- // VERIFY( os_it00 != os_it01 );
-
- oss.str(empty);
- np.put(oss.rdbuf(), oss, '+', b0);
- result2 = oss.str();
- VERIFY( result2 == "0" );
-
- // bool, more twisted examples
- oss.imbue(loc_c);
- oss.str(empty);
- oss.width(20);
- oss.setf(ios_base::right, ios_base::adjustfield);
- np.put(oss.rdbuf(), oss, '+', b0);
- result1 = oss.str();
- VERIFY( result1 == "+++++++++++++++++++0" );
-
- oss.str(empty);
- oss.width(20);
- oss.setf(ios_base::left, ios_base::adjustfield);
- oss.setf(ios_base::boolalpha);
- np.put(oss.rdbuf(), oss, '+', b1);
- result2 = oss.str();
- VERIFY( result2 == "true++++++++++++++++" );
-
- // long, in a locale that expects grouping
- oss.imbue(loc_hk);
- oss.str(empty);
- oss.clear();
- np.put(oss.rdbuf(), oss, '+', l1);
- result1 = oss.str();
- VERIFY( result1 == "2,147,483,647" );
-
- oss.str(empty);
- oss.clear();
- oss.width(20);
- oss.setf(ios_base::left, ios_base::adjustfield);
- np.put(oss.rdbuf(), oss, '+', l2);
- result1 = oss.str();
- VERIFY( result1 == "-2,147,483,647++++++" );
-
- // unsigned long, in a locale that does not group
- oss.imbue(loc_c);
- oss.str(empty);
- oss.clear();
- np.put(oss.rdbuf(), oss, '+', ul1);
- result1 = oss.str();
- VERIFY( result1 == "1294967294" );
-
- oss.str(empty);
- oss.clear();
- oss.width(20);
- oss.setf(ios_base::left, ios_base::adjustfield);
- np.put(oss.rdbuf(), oss, '+', ul2);
- result1 = oss.str();
- VERIFY( result1 == "0+++++++++++++++++++" );
-
- // ... and one that does
- oss.imbue(loc_de);
- oss.str(empty);
- oss.clear();
- oss.width(20);
- oss.setf(ios_base::left, ios_base::adjustfield);
- np.put(oss.rdbuf(), oss, '+', ul1);
- result1 = oss.str();
- VERIFY( result1 == "1.294.967.294+++++++" );
-
- // double
- oss.str(empty);
- oss.clear();
- oss.width(20);
- oss.setf(ios_base::left, ios_base::adjustfield);
- np.put(oss.rdbuf(), oss, '+', d1);
- result1 = oss.str();
- VERIFY( result1 == "1,79769e+308++++++++" );
-
- oss.str(empty);
- oss.clear();
- oss.width(20);
- oss.setf(ios_base::right, ios_base::adjustfield);
- np.put(oss.rdbuf(), oss, '+', d2);
- result1 = oss.str();
- VERIFY( result1 == "++++++++2,22507e-308" );
-
- oss.str(empty);
- oss.clear();
- oss.width(20);
- oss.setf(ios_base::right, ios_base::adjustfield);
- oss.setf(ios_base::scientific, ios_base::floatfield);
- np.put(oss.rdbuf(), oss, '+', d2);
- result2 = oss.str();
- VERIFY( result2 == "+++++++2,225074e-308" );
-
- oss.str(empty);
- oss.clear();
- oss.width(20);
- oss.precision(10);
- oss.setf(ios_base::right, ios_base::adjustfield);
- oss.setf(ios_base::scientific, ios_base::floatfield);
- oss.setf(ios_base::uppercase);
- np.put(oss.rdbuf(), oss, '+', d2);
- result1 = oss.str();
- VERIFY( result1 == "+++2,2250738585E-308" );
-
- // long double
- oss.str(empty);
- oss.clear();
- np.put(oss.rdbuf(), oss, '+', ld1);
- result1 = oss.str();
- VERIFY( result1 == "1,7976931349E+308" );
-
- oss.str(empty);
- oss.clear();
- oss.precision(0);
- oss.setf(ios_base::fixed, ios_base::floatfield);
- np.put(oss.rdbuf(), oss, '+', ld2);
- result1 = oss.str();
- VERIFY( result1 == "0" );
-
- // const void
- oss.str(empty);
- oss.clear();
- np.put(oss.rdbuf(), oss, '+', cv);
- result1 = oss.str();
- // No grouping characters.
- VERIFY( !char_traits<char>::find(result1.c_str(),
- result1.size(),
- numpunct_de.decimal_point()) );
- // Should contain an 'x'.
- VERIFY( result1.find('x') == 1 );
-
-#ifdef _GLIBCPP_USE_LONG_LONG
- long long ll1 = 9223372036854775807LL;
- long long ll2 = -9223372036854775807LL;
-
- oss.str(empty);
- oss.clear();
- np.put(oss.rdbuf(), oss, '+', ll1);
- result1 = oss.str();
- VERIFY( result1 == "9.223.372.036.854.775.807" );
-#endif
-}
-
-void test02()
-{
- using namespace std;
- bool test = true;
-
- // Check num_put works with other iterators besides streambuf
- // output iterators. (As long as output_iterator requirements are met.)
- typedef string::iterator iter_type;
- typedef char_traits<char> traits;
- typedef num_put<char, iter_type> num_put_type;
- const ios_base::iostate goodbit = ios_base::goodbit;
- const ios_base::iostate eofbit = ios_base::eofbit;
- const locale loc_c = locale::classic();
- const string str("1798 Lady Elgin");
- const string str2("0 true 0xbffff74c Mary Nisbet");
- const string x(15, 'x'); // have to have allocated string!
- string res;
-
- ostringstream oss;
- oss.imbue(locale(loc_c, new num_put_type));
-
- // Iterator advanced, state, output.
- const num_put_type& tp = use_facet<num_put_type>(oss.getloc());
-
- // 01 put(long)
- // 02 put(long double)
- // 03 put(bool)
- // 04 put(void*)
-
- // 01 put(long)
- const long l = 1798;
- res = x;
- iter_type ret1 = tp.put(res.begin(), oss, ' ', l);
- string sanity1(res.begin(), ret1);
- VERIFY( res == "1798xxxxxxxxxxx" );
- VERIFY( sanity1 == "1798" );
-
- // 02 put(long double)
- const long double ld = 1798.0;
- res = x;
- iter_type ret2 = tp.put(res.begin(), oss, ' ', ld);
- string sanity2(res.begin(), ret2);
- VERIFY( res == "1798xxxxxxxxxxx" );
- VERIFY( sanity2 == "1798" );
-
- // 03 put(bool)
- bool b = 1;
- res = x;
- iter_type ret3 = tp.put(res.begin(), oss, ' ', b);
- string sanity3(res.begin(), ret3);
- VERIFY( res == "1xxxxxxxxxxxxxx" );
- VERIFY( sanity3 == "1" );
-
- b = 0;
- res = x;
- oss.setf(ios_base::boolalpha);
- iter_type ret4 = tp.put(res.begin(), oss, ' ', b);
- string sanity4(res.begin(), ret4);
- VERIFY( res == "falsexxxxxxxxxx" );
- VERIFY( sanity4 == "false" );
-
- // 04 put(void*)
- oss.clear();
- const void* cv = &ld;
- res = x;
- oss.setf(ios_base::fixed, ios_base::floatfield);
- iter_type ret5 = tp.put(res.begin(), oss, ' ', cv);
- string sanity5(res.begin(), ret5);
- VERIFY( sanity5.size() );
- VERIFY( sanity5[1] == 'x' );
-}
-
-// libstdc++/5280
-void test03()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- test02();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test04()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- test02();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-
-// Make sure that, in a locale that expects grouping, when showbase
-// is true, an hexadecimal or octal zero is correctly output (the case
-// of zero is special since there is no 0x, 0 respectively, prefix)
-void test05()
-{
- using namespace std;
- bool test = true;
-
- // A locale that expects grouping.
- locale loc_de("de_DE");
-
- const string empty;
- string result;
-
- ostringstream oss;
- oss.imbue(loc_de);
- const num_put<char>& np = use_facet<num_put<char> >(oss.getloc());
-
- long l = 0;
-
- oss.str(empty);
- oss.clear();
- oss.setf(ios::showbase);
- oss.setf(ios::hex, ios::basefield);
- np.put(oss.rdbuf(), oss, '+', l);
- result = oss.str();
- VERIFY( result == "0" );
-
- oss.str(empty);
- oss.clear();
- oss.setf(ios::showbase);
- oss.setf(ios::oct, ios::basefield);
- np.put(oss.rdbuf(), oss, '+', l);
- result = oss.str();
- VERIFY( result == "0" );
-}
-
-int main()
-{
- test01();
- test02();
- test03();
- test04();
- test05();
- return 0;
-}
-
-
diff --git a/libstdc++-v3/testsuite/22_locale/num_put_members_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/num_put_members_wchar_t.cc
deleted file mode 100644
index d3060dd8194..00000000000
--- a/libstdc++-v3/testsuite/22_locale/num_put_members_wchar_t.cc
+++ /dev/null
@@ -1,382 +0,0 @@
-// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2001, 2002 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This 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 General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.2.2.1 num_put members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-void test01()
-{
- using namespace std;
- typedef ostreambuf_iterator<wchar_t> iterator_type;
-
- bool test = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE");
- VERIFY( loc_c != loc_de );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the numpunct facets
- const numpunct<wchar_t>& numpunct_c = use_facet<numpunct<wchar_t> >(loc_c);
- const numpunct<wchar_t>& numpunct_de = use_facet<numpunct<wchar_t> >(loc_de);
- const numpunct<wchar_t>& numpunct_hk = use_facet<numpunct<wchar_t> >(loc_hk);
-
- // sanity check the data is correct.
- const wstring empty;
- wstring result1;
- wstring result2;
- wchar_t c;
-
- bool b1 = true;
- bool b0 = false;
- long l1 = 2147483647;
- long l2 = -2147483647;
- unsigned long ul1 = 1294967294;
- unsigned long ul2 = 0;
- double d1 = 1.7976931348623157e+308;
- double d2 = 2.2250738585072014e-308;
- long double ld1 = 1.7976931348623157e+308;
- long double ld2 = 2.2250738585072014e-308;
- const void* cv = &ld1;
-
- // cache the num_put facet
- wostringstream oss;
- oss.imbue(loc_de);
- const num_put<wchar_t>& np = use_facet<num_put<wchar_t> >(oss.getloc());
-
- // bool, simple
- iterator_type os_it00 = oss.rdbuf();
- iterator_type os_it01 = np.put(os_it00, oss, '+', b1);
- result1 = oss.str();
- VERIFY( result1 == L"1" );
- // VERIFY( os_it00 != os_it01 );
-
- oss.str(empty);
- np.put(oss.rdbuf(), oss, L'+', b0);
- result2 = oss.str();
- VERIFY( result2 == L"0" );
-
- // bool, more twisted examples
- oss.imbue(loc_c);
- oss.str(empty);
- oss.width(20);
- oss.setf(ios_base::right, ios_base::adjustfield);
- np.put(oss.rdbuf(), oss, L'+', b0);
- result1 = oss.str();
- VERIFY( result1 == L"+++++++++++++++++++0" );
-
- oss.str(empty);
- oss.width(20);
- oss.setf(ios_base::left, ios_base::adjustfield);
- oss.setf(ios_base::boolalpha);
- np.put(oss.rdbuf(), oss, L'+', b1);
- result2 = oss.str();
- VERIFY( result2 == L"true++++++++++++++++" );
-
- // long, in a locale that expects grouping
- oss.imbue(loc_hk);
- oss.str(empty);
- oss.clear();
- np.put(oss.rdbuf(), oss, L'+', l1);
- result1 = oss.str();
- VERIFY( result1 == L"2,147,483,647" );
-
- oss.str(empty);
- oss.clear();
- oss.width(20);
- oss.setf(ios_base::left, ios_base::adjustfield);
- np.put(oss.rdbuf(), oss, L'+', l2);
- result1 = oss.str();
- VERIFY( result1 == L"-2,147,483,647++++++" );
-
- // unsigned long, in a locale that does not group
- oss.imbue(loc_c);
- oss.str(empty);
- oss.clear();
- np.put(oss.rdbuf(), oss, L'+', ul1);
- result1 = oss.str();
- VERIFY( result1 == L"1294967294" );
-
- oss.str(empty);
- oss.clear();
- oss.width(20);
- oss.setf(ios_base::left, ios_base::adjustfield);
- np.put(oss.rdbuf(), oss, L'+', ul2);
- result1 = oss.str();
- VERIFY( result1 == L"0+++++++++++++++++++" );
-
- // ... and one that does
- oss.imbue(loc_de);
- oss.str(empty);
- oss.clear();
- oss.width(20);
- oss.setf(ios_base::left, ios_base::adjustfield);
- np.put(oss.rdbuf(), oss, L'+', ul1);
- result1 = oss.str();
- VERIFY( result1 == L"1.294.967.294+++++++" );
-
- // double
- oss.str(empty);
- oss.clear();
- oss.width(20);
- oss.setf(ios_base::left, ios_base::adjustfield);
- np.put(oss.rdbuf(), oss, L'+', d1);
- result1 = oss.str();
- VERIFY( result1 == L"1,79769e+308++++++++" );
-
- oss.str(empty);
- oss.clear();
- oss.width(20);
- oss.setf(ios_base::right, ios_base::adjustfield);
- np.put(oss.rdbuf(), oss, L'+', d2);
- result1 = oss.str();
- VERIFY( result1 == L"++++++++2,22507e-308" );
-
- oss.str(empty);
- oss.clear();
- oss.width(20);
- oss.setf(ios_base::right, ios_base::adjustfield);
- oss.setf(ios_base::scientific, ios_base::floatfield);
- np.put(oss.rdbuf(), oss, L'+', d2);
- result2 = oss.str();
- VERIFY( result2 == L"+++++++2,225074e-308" );
-
- oss.str(empty);
- oss.clear();
- oss.width(20);
- oss.precision(10);
- oss.setf(ios_base::right, ios_base::adjustfield);
- oss.setf(ios_base::scientific, ios_base::floatfield);
- oss.setf(ios_base::uppercase);
- np.put(oss.rdbuf(), oss, L'+', d2);
- result1 = oss.str();
- VERIFY( result1 == L"+++2,2250738585E-308" );
-
- // long double
- oss.str(empty);
- oss.clear();
- np.put(oss.rdbuf(), oss, L'+', ld1);
- result1 = oss.str();
- VERIFY( result1 == L"1,7976931349E+308" );
-
- oss.str(empty);
- oss.clear();
- oss.precision(0);
- oss.setf(ios_base::fixed, ios_base::floatfield);
- np.put(oss.rdbuf(), oss, L'+', ld2);
- result1 = oss.str();
- VERIFY( result1 == L"0" );
-
- // const void
- oss.str(empty);
- oss.clear();
- np.put(oss.rdbuf(), oss, L'+', cv);
- result1 = oss.str();
- // No grouping characters.
- VERIFY( !char_traits<wchar_t>::find(result1.c_str(),
- result1.size(),
- numpunct_de.decimal_point()) );
- // Should contain an 'x'.
- VERIFY( result1.find(L'x') == 1 );
-
-#ifdef _GLIBCPP_USE_LONG_LONG
- long long ll1 = 9223372036854775807LL;
- long long ll2 = -9223372036854775807LL;
-
- oss.str(empty);
- oss.clear();
- np.put(oss.rdbuf(), oss, '+', ll1);
- result1 = oss.str();
- VERIFY( result1 == L"9.223.372.036.854.775.807" );
-#endif
-}
-void test02()
-{
- using namespace std;
- bool test = true;
-
- // Check num_put works with other iterators besides streambuf
- // output iterators. (As long as output_iterator requirements are met.)
- typedef wstring::iterator iter_type;
- typedef char_traits<wchar_t> traits;
- typedef num_put<wchar_t, iter_type> num_put_type;
- const ios_base::iostate goodbit = ios_base::goodbit;
- const ios_base::iostate eofbit = ios_base::eofbit;
- const locale loc_c = locale::classic();
- const wstring str(L"1798 Lady Elgin");
- const wstring str2(L"0 true 0xbffff74c Mary Nisbet");
- const wstring x(15, L'x'); // have to have allocated string!
- wstring res;
-
- wostringstream oss;
- oss.imbue(locale(loc_c, new num_put_type));
-
- // Iterator advanced, state, output.
- const num_put_type& tp = use_facet<num_put_type>(oss.getloc());
-
- // 01 put(long)
- // 02 put(long double)
- // 03 put(bool)
- // 04 put(void*)
-
- // 01 put(long)
- const long l = 1798;
- res = x;
- iter_type ret1 = tp.put(res.begin(), oss, L' ', l);
- wstring sanity1(res.begin(), ret1);
- VERIFY( res == L"1798xxxxxxxxxxx" );
- VERIFY( sanity1 == L"1798" );
-
- // 02 put(long double)
- const long double ld = 1798.0;
- res = x;
- iter_type ret2 = tp.put(res.begin(), oss, L' ', ld);
- wstring sanity2(res.begin(), ret2);
- VERIFY( res == L"1798xxxxxxxxxxx" );
- VERIFY( sanity2 == L"1798" );
-
- // 03 put(bool)
- bool b = 1;
- res = x;
- iter_type ret3 = tp.put(res.begin(), oss, L' ', b);
- wstring sanity3(res.begin(), ret3);
- VERIFY( res == L"1xxxxxxxxxxxxxx" );
- VERIFY( sanity3 == L"1" );
-
- b = 0;
- res = x;
- oss.setf(ios_base::boolalpha);
- iter_type ret4 = tp.put(res.begin(), oss, L' ', b);
- wstring sanity4(res.begin(), ret4);
- VERIFY( res == L"falsexxxxxxxxxx" );
- VERIFY( sanity4 == L"false" );
-
- // 04 put(void*)
- oss.clear();
- const void* cv = &ld;
- res = x;
- oss.setf(ios_base::fixed, ios_base::floatfield);
- iter_type ret5 = tp.put(res.begin(), oss, L' ', cv);
- wstring sanity5(res.begin(), ret5);
- VERIFY( sanity5.size() );
- VERIFY( sanity5[1] == L'x' );
-}
-
-// libstdc++/5280
-void test03()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- test02();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test04()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- test02();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-
-// Make sure that, in a locale that expects grouping, when showbase
-// is true, an hexadecimal or octal zero is correctly output (the case
-// of zero is special since there is no 0x, 0 respectively, prefix)
-void test05()
-{
- using namespace std;
- bool test = true;
-
- // A locale that expects grouping.
- locale loc_de("de_DE");
-
- const wstring empty;
- wstring result;
-
- wostringstream oss;
- oss.imbue(loc_de);
- const num_put<wchar_t>& np = use_facet<num_put<wchar_t> >(oss.getloc());
-
- long l = 0;
-
- oss.str(empty);
- oss.clear();
- oss.setf(ios::showbase);
- oss.setf(ios::hex, ios::basefield);
- np.put(oss.rdbuf(), oss, L'+', l);
- result = oss.str();
- VERIFY( result == L"0" );
-
- oss.str(empty);
- oss.clear();
- oss.setf(ios::showbase);
- oss.setf(ios::oct, ios::basefield);
- np.put(oss.rdbuf(), oss, L'+', l);
- result = oss.str();
- VERIFY( result == L"0" );
-}
-#endif
-
-int main()
-{
-#ifdef _GLIBCPP_USE_WCHAR_T
- test01();
- test02();
- test03();
- test04();
- test05();
-#endif
- return 0;
-}
-
-
-// Diana D. Brooks, former chief executive of Sotheby's
-// art-thief extraordinaire
-
diff --git a/libstdc++-v3/testsuite/22_locale/numpunct.cc b/libstdc++-v3/testsuite/22_locale/numpunct/1.cc
index 4c71f10d5f7..f2f94273b9f 100644
--- a/libstdc++-v3/testsuite/22_locale/numpunct.cc
+++ b/libstdc++-v3/testsuite/22_locale/numpunct/1.cc
@@ -1,6 +1,7 @@
+// { dg-do compile }
// 2001-01-23 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001 Free Software Foundation
+// Copyright (C) 2001, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -20,8 +21,6 @@
// 22.2.3 The numeric punctuation facet
-// { dg-do compile }
-
#include <locale>
void test01()
@@ -33,18 +32,8 @@ void test01()
const base_type* base = &obj;
}
-// Should be able to instantiate this for other types besides char, wchar_t
-class gnu_numpunct: public std::numpunct<unsigned char>
-{ };
-
-void test02()
-{
- gnu_numpunct facet01;
-}
-
int main()
{
test01();
- test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/2.cc b/libstdc++-v3/testsuite/22_locale/numpunct/2.cc
new file mode 100644
index 00000000000..0df50fa5e34
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/numpunct/2.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+// 2001-01-23 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.3 The numeric punctuation facet
+
+#include <locale>
+
+// Should be able to instantiate this for other types besides char, wchar_t
+class gnu_numpunct: public std::numpunct<unsigned char>
+{ };
+
+void test02()
+{
+ gnu_numpunct facet01;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/members/char/1.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/char/1.cc
new file mode 100644
index 00000000000..9babb9946cb
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/numpunct/members/char/1.cc
@@ -0,0 +1,65 @@
+// 2001-01-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.3.1.1 nunpunct members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_us("en_US");
+ locale loc_fr("fr_FR");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_us != loc_fr );
+ VERIFY( loc_us != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the numpunct facets
+ const numpunct<char>& nump_c = use_facet<numpunct<char> >(loc_c);
+ const numpunct<char>& nump_us = use_facet<numpunct<char> >(loc_us);
+ const numpunct<char>& nump_fr = use_facet<numpunct<char> >(loc_fr);
+ const numpunct<char>& nump_de = use_facet<numpunct<char> >(loc_de);
+
+ // sanity check the data is correct.
+ char dp1 = nump_c.decimal_point();
+ char th1 = nump_c.thousands_sep();
+ string g1 = nump_c.grouping();
+ string t1 = nump_c.truename();
+ string f1 = nump_c.falsename();
+ VERIFY ( dp1 == '.' );
+ VERIFY ( th1 == ',' );
+ VERIFY ( g1 == "" );
+ VERIFY ( t1 == "true" );
+ VERIFY ( f1 == "false" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/numpunct_members_char.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/char/2.cc
index 926501c93b2..bb4eff5f70a 100644
--- a/libstdc++-v3/testsuite/22_locale/numpunct_members_char.cc
+++ b/libstdc++-v3/testsuite/22_locale/numpunct/members/char/2.cc
@@ -1,6 +1,6 @@
// 2001-01-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -23,10 +23,7 @@
#include <locale>
#include <testsuite_hooks.h>
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-void test01()
+void test02()
{
using namespace std;
@@ -83,43 +80,8 @@ void test01()
// VERIFY( f2 != f3 );
}
-// libstdc++/5280
-void test02()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test03()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-
int main()
{
- test01();
test02();
- test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/members/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/char/wrapped_env.cc
new file mode 100644
index 00000000000..4f1d5e3f6a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/numpunct/members/char/wrapped_env.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/members/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/char/wrapped_locale.cc
new file mode 100644
index 00000000000..8d7871815db
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/numpunct/members/char/wrapped_locale.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/1.cc
new file mode 100644
index 00000000000..ac4e8201dbe
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/1.cc
@@ -0,0 +1,65 @@
+// 2001-01-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.3.1.1 nunpunct members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_us("en_US");
+ locale loc_fr("fr_FR");
+ locale loc_de("de_DE");
+ VERIFY( loc_c != loc_de );
+ VERIFY( loc_us != loc_fr );
+ VERIFY( loc_us != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the numpunct facets
+ const numpunct<wchar_t>& nump_c = use_facet<numpunct<wchar_t> >(loc_c);
+ const numpunct<wchar_t>& nump_us = use_facet<numpunct<wchar_t> >(loc_us);
+ const numpunct<wchar_t>& nump_fr = use_facet<numpunct<wchar_t> >(loc_fr);
+ const numpunct<wchar_t>& nump_de = use_facet<numpunct<wchar_t> >(loc_de);
+
+ // sanity check the data is correct.
+ wchar_t dp1 = nump_c.decimal_point();
+ wchar_t th1 = nump_c.thousands_sep();
+ string g1 = nump_c.grouping();
+ wstring t1 = nump_c.truename();
+ wstring f1 = nump_c.falsename();
+ VERIFY ( dp1 == L'.' );
+ VERIFY ( th1 == L',' );
+ VERIFY ( g1 == "" );
+ VERIFY ( t1 == L"true" );
+ VERIFY ( f1 == L"false" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/numpunct_members_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/2.cc
index 14e9321ecf0..c544b29cce6 100644
--- a/libstdc++-v3/testsuite/22_locale/numpunct_members_wchar_t.cc
+++ b/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/2.cc
@@ -1,6 +1,6 @@
-// 2001-11-20 Benjamin Kosnik <bkoz@redhat.com>
+// 2001-01-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -23,11 +23,7 @@
#include <locale>
#include <testsuite_hooks.h>
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-void test01()
+void test02()
{
using namespace std;
@@ -79,48 +75,13 @@ void test01()
VERIFY( dp2 != dp4 );
VERIFY( th2 != th4 );
+ // XXX This isn't actually supported right now.
+ // VERIFY( t2 != t3 );
+ // VERIFY( f2 != f3 );
}
-// libstdc++/5280
-void test02()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test03()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-#endif
-
int main()
{
-#ifdef _GLIBCPP_USE_WCHAR_T
- test01();
test02();
- test03();
-#endif
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..4f1d5e3f6a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/wrapped_env.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..8d7871815db
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/wrapped_locale.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/numpunct_byname.cc b/libstdc++-v3/testsuite/22_locale/numpunct_byname/1.cc
index 4c69b291a0a..4c99ddaad70 100644
--- a/libstdc++-v3/testsuite/22_locale/numpunct_byname.cc
+++ b/libstdc++-v3/testsuite/22_locale/numpunct_byname/1.cc
@@ -1,6 +1,6 @@
// 2001-01-24 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001 Free Software Foundation
+// Copyright (C) 2001, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -23,9 +23,6 @@
#include <locale>
#include <testsuite_hooks.h>
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
void test01()
{
using namespace std;
@@ -72,26 +69,8 @@ void test01()
VERIFY( dp1 != dp3 );
}
-void test02()
-{
- using namespace std;
-
- bool test = true;
-
- locale loc_it("it_IT");
-
- const numpunct<char>& nump_it = use_facet<numpunct<char> >(loc_it);
-
- string g = nump_it.grouping();
-
- VERIFY( g == "" );
-}
-
-
int main()
{
test01();
- test02();
-
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/numpunct_byname/2.cc b/libstdc++-v3/testsuite/22_locale/numpunct_byname/2.cc
new file mode 100644
index 00000000000..133607dd5b9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/numpunct_byname/2.cc
@@ -0,0 +1,45 @@
+// 2001-01-24 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.3.2 Template class numpunct_byname
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+
+ bool test = true;
+
+ locale loc_it("it_IT");
+
+ const numpunct<char>& nump_it = use_facet<numpunct<char> >(loc_it);
+
+ string g = nump_it.grouping();
+
+ VERIFY( g == "" );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get.cc b/libstdc++-v3/testsuite/22_locale/time_get/1.cc
index 0aa4fd3ba06..04d4aa84ce0 100644
--- a/libstdc++-v3/testsuite/22_locale/time_get.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_get/1.cc
@@ -1,6 +1,7 @@
+// { dg-do compile }
// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001 Free Software Foundation
+// Copyright (C) 2001, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -20,8 +21,6 @@
// 22.2.5.1 Template class time_get
-// { dg-do compile }
-
#include <locale>
void test01()
@@ -39,18 +38,8 @@ void test01()
typedef test_type::iter_type iter_type;
}
-// Should be able to instantiate this for other types besides char, wchar_t
-class gnu_time_get: public std::time_get<unsigned char>
-{ };
-
-void test02()
-{
- gnu_time_get facet01;
-}
-
int main()
{
test01();
- test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/2.cc
new file mode 100644
index 00000000000..87e8533d316
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/2.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1 Template class time_get
+
+#include <locale>
+
+// Should be able to instantiate this for other types besides char, wchar_t
+class gnu_time_get: public std::time_get<unsigned char>
+{ };
+
+void test02()
+{
+ gnu_time_get facet01;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/1.cc
new file mode 100644
index 00000000000..5b3a3236eef
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/1.cc
@@ -0,0 +1,69 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ bool test = true;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ const string empty;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+ istringstream iss;
+ iss.imbue(loc_c);
+ const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
+
+ // 1
+ // dateorder date_order() const
+ dateorder do1 = tim_get.date_order();
+ // VERIFY( do1 == time_base::mdy );
+ VERIFY( do1 == time_base::no_order );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/1.cc
new file mode 100644
index 00000000000..9baf0216bc2
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/1.cc
@@ -0,0 +1,70 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ bool test = true;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ const string empty;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+ istringstream iss;
+ iss.imbue(loc_c);
+ const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc());
+
+ // 1
+ // dateorder date_order() const
+ iss.imbue(loc_c);
+ dateorder do1 = tim_get.date_order();
+ // VERIFY( do1 == time_base::mdy );
+ VERIFY( do1 == time_base::no_order );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..b3d040edc7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/wrapped_env.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..17d4d5dcb82
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/wrapped_locale.cc
@@ -0,0 +1,36 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/1.cc
new file mode 100644
index 00000000000..659086ab26f
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/1.cc
@@ -0,0 +1,112 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ const string empty;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ istringstream iss;
+ iss.imbue(loc_c);
+ const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // create "C" time objects
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+ const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ "%w %W %x %X %y %Y %Z %%";
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+ // iter_type
+ // get_date(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
+
+ // sanity checks for "C" locale
+ iss.str("04/04/71");
+ iterator_type is_it01(iss);
+ tm time01;
+ errorstate = good;
+ tim_get.get_date(is_it01, end, iss, errorstate, &time01);
+ VERIFY( time01.tm_year == time_bday.tm_year );
+ VERIFY( time01.tm_mon == time_bday.tm_mon );
+ VERIFY( time01.tm_mday == time_bday.tm_mday );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str("04/04/71 ");
+ iterator_type is_it02(iss);
+ tm time02;
+ errorstate = good;
+ tim_get.get_date(is_it02, end, iss, errorstate, &time02);
+ VERIFY( time02.tm_year == time_bday.tm_year );
+ VERIFY( time02.tm_mon == time_bday.tm_mon );
+ VERIFY( time02.tm_mday == time_bday.tm_mday );
+ VERIFY( errorstate == good );
+ VERIFY( *is_it02 == ' ');
+
+ iss.str("04/04d/71 ");
+ iterator_type is_it03(iss);
+ tm time03;
+ time03.tm_year = 3;
+ errorstate = good;
+ tim_get.get_date(is_it03, end, iss, errorstate, &time03);
+ VERIFY( time03.tm_year == 3 );
+ VERIFY( time03.tm_mon == time_bday.tm_mon );
+ VERIFY( time03.tm_mday == time_bday.tm_mday );
+ VERIFY( errorstate == ios_base::failbit );
+ VERIFY( *is_it03 == 'd');
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/2.cc
new file mode 100644
index 00000000000..434695c703a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/2.cc
@@ -0,0 +1,108 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ const string empty;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ istringstream iss;
+ const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // create "C" time objects
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+ const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ "%w %W %x %X %y %Y %Z %%";
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+ // iter_type
+ // get_date(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
+
+ // sanity checks for "C" locale
+ iss.imbue(loc_c);
+ iss.str("04/04/71");
+ iterator_type is_it01(iss);
+ tm time01;
+ errorstate = good;
+
+ // inspection of named locales, de_DE
+ iss.imbue(loc_de);
+ iss.str("04.04.1971");
+ iterator_type is_it10(iss);
+ tm time10;
+ errorstate = good;
+ tim_get.get_date(is_it10, end, iss, errorstate, &time10);
+ VERIFY( time10.tm_mon == time_bday.tm_mon );
+ VERIFY( time10.tm_mday == time_bday.tm_mday );
+ VERIFY( time10.tm_year == time_bday.tm_year );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ // inspection of named locales, en_HK
+ iss.imbue(loc_hk);
+ iss.str("Sunday, April 04, 1971");
+ iterator_type is_it20(iss);
+ tm time20;
+ errorstate = good;
+ tim_get.get_date(is_it20, end, iss, errorstate, &time20);
+ VERIFY( time20.tm_mon == time_bday.tm_mon );
+ VERIFY( time20.tm_mday == time_bday.tm_mday );
+ VERIFY( time20.tm_year == time_bday.tm_year );
+ VERIFY( errorstate == ios_base::eofbit );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/3.cc
new file mode 100644
index 00000000000..249b5e8001f
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/3.cc
@@ -0,0 +1,72 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check time_get works with other iterators besides streambuf
+ // input iterators.
+ typedef string::const_iterator iter_type;
+ typedef time_get<char, iter_type> time_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+
+ // Create "C" time objects
+ const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
+ tm tm1;
+
+ istringstream iss;
+ iss.imbue(locale(loc_c, new time_get_type));
+
+ // Iterator advanced, state, output.
+ const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
+
+ // Cindy Sherman's Untitled Film Stills
+ // June 26-September 2, 1997
+ const string str = "06/26/97 Tuesday September 1997 Cindy Sherman";
+
+ // 02 get_date
+ string res2;
+ err = goodbit;
+ // White space is not eaten, so manually increment past it.
+ iter_type end2 = tg.get_date(str.begin(), str.end(), iss, err, &tm1);
+ string rem2(end2, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( tm1.tm_year == time_sanity.tm_year );
+ VERIFY( tm1.tm_mon == time_sanity.tm_mon );
+ VERIFY( tm1.tm_mday == time_sanity.tm_mday );
+ VERIFY( rem2 == " Tuesday September 1997 Cindy Sherman" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/wrapped_env.cc
new file mode 100644
index 00000000000..3f042d9ec42
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/wrapped_env.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/wrapped_locale.cc
new file mode 100644
index 00000000000..61086ad6da8
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/wrapped_locale.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/1.cc
new file mode 100644
index 00000000000..965493d316f
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/1.cc
@@ -0,0 +1,112 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ const wstring empty;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ wistringstream iss;
+ iss.imbue(loc_c);
+ const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // create "C" time objects
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+ const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ L"%w %W %x %X %y %Y %Z %%";
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // iter_type
+ // get_date(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
+
+ // sanity checks for "C" locale
+ iss.str(L"04/04/71");
+ iterator_type is_it01(iss);
+ tm time01;
+ errorstate = good;
+ tim_get.get_date(is_it01, end, iss, errorstate, &time01);
+ VERIFY( time01.tm_year == time_bday.tm_year );
+ VERIFY( time01.tm_mon == time_bday.tm_mon );
+ VERIFY( time01.tm_mday == time_bday.tm_mday );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str(L"04/04/71 ");
+ iterator_type is_it02(iss);
+ tm time02;
+ errorstate = good;
+ tim_get.get_date(is_it02, end, iss, errorstate, &time02);
+ VERIFY( time02.tm_year == time_bday.tm_year );
+ VERIFY( time02.tm_mon == time_bday.tm_mon );
+ VERIFY( time02.tm_mday == time_bday.tm_mday );
+ VERIFY( errorstate == good );
+ VERIFY( *is_it02 == ' ');
+
+ iss.str(L"04/04d/71 ");
+ iterator_type is_it03(iss);
+ tm time03;
+ time03.tm_year = 3;
+ errorstate = good;
+ tim_get.get_date(is_it03, end, iss, errorstate, &time03);
+ VERIFY( time03.tm_year == 3 );
+ VERIFY( time03.tm_mon == time_bday.tm_mon );
+ VERIFY( time03.tm_mday == time_bday.tm_mday );
+ VERIFY( errorstate == ios_base::failbit );
+ VERIFY( *is_it03 == 'd');
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/2.cc
new file mode 100644
index 00000000000..1e4d57afb44
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/2.cc
@@ -0,0 +1,108 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ const wstring empty;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ wistringstream iss;
+ const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // create "C" time objects
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+ const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ L"%w %W %x %X %y %Y %Z %%";
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // iter_type
+ // get_date(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
+
+ // sanity checks for "C" locale
+ iss.imbue(loc_c);
+ iss.str(L"04/04/71");
+ iterator_type is_it01(iss);
+ tm time01;
+ errorstate = good;
+
+ // inspection of named locales, de_DE
+ iss.imbue(loc_de);
+ iss.str(L"04.04.1971");
+ iterator_type is_it10(iss);
+ tm time10;
+ errorstate = good;
+ tim_get.get_date(is_it10, end, iss, errorstate, &time10);
+ VERIFY( time10.tm_mon == time_bday.tm_mon );
+ VERIFY( time10.tm_mday == time_bday.tm_mday );
+ VERIFY( time10.tm_year == time_bday.tm_year );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ // inspection of named locales, en_HK
+ iss.imbue(loc_hk);
+ iss.str(L"Sunday, April 04, 1971");
+ iterator_type is_it20(iss);
+ tm time20;
+ errorstate = good;
+ tim_get.get_date(is_it20, end, iss, errorstate, &time20);
+ VERIFY( time20.tm_mon == time_bday.tm_mon );
+ VERIFY( time20.tm_mday == time_bday.tm_mday );
+ VERIFY( time20.tm_year == time_bday.tm_year );
+ VERIFY( errorstate == ios_base::eofbit );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/3.cc
new file mode 100644
index 00000000000..b02049fcb46
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/3.cc
@@ -0,0 +1,72 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check time_get works with other iterators besides streambuf
+ // input iterators.
+ typedef wstring::const_iterator iter_type;
+ typedef time_get<wchar_t, iter_type> time_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+
+ // Create "C" time objects
+ const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
+ tm tm1;
+
+ istringstream iss;
+ iss.imbue(locale(loc_c, new time_get_type));
+
+ // Iterator advanced, state, output.
+ const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
+
+ // Cindy Sherman's Untitled Film Stills
+ // June 26-September 2, 1997
+ const wstring str = L"06/26/97 Tuesday September 1997 Cindy Sherman";
+
+ // 02 get_date
+ string res2;
+ err = goodbit;
+ // White space is not eaten, so manually increment past it.
+ iter_type end2 = tg.get_date(str.begin(), str.end(), iss, err, &tm1);
+ string rem2(end2, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( tm1.tm_year == time_sanity.tm_year );
+ VERIFY( tm1.tm_mon == time_sanity.tm_mon );
+ VERIFY( tm1.tm_mday == time_sanity.tm_mday );
+ VERIFY( rem2 == " Tuesday September 1997 Cindy Sherman" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..3f042d9ec42
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/wrapped_env.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..61086ad6da8
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/wrapped_locale.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/1.cc
new file mode 100644
index 00000000000..8984069e59a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/1.cc
@@ -0,0 +1,126 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ bool test = true;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ // create "C" time objects
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+
+ // iter_type
+ // get_monthname(iter_type, iter_type, ios_base&,
+ // ios_base::iostate&, tm*) const
+
+ // sanity checks for "C" locale
+ iterator_type end;
+ istringstream iss;
+ iss.imbue(loc_c);
+ const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
+
+ iss.str("April");
+ iterator_type is_it01(iss);
+ tm time01;
+ errorstate = good;
+ tim_get.get_monthname(is_it01, end, iss, errorstate, &time01);
+ VERIFY( time01.tm_mon == time_bday.tm_mon );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str("Apr");
+ iterator_type is_it02(iss);
+ tm time02;
+ errorstate = good;
+ tim_get.get_monthname(is_it02, end, iss, errorstate, &time02);
+ VERIFY( time02.tm_mon == time_bday.tm_mon );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str("Apr ");
+ iterator_type is_it03(iss);
+ tm time03;
+ errorstate = good;
+ tim_get.get_monthname(is_it03, end, iss, errorstate, &time03);
+ VERIFY( time03.tm_mon == time_bday.tm_mon );
+ VERIFY( errorstate == good );
+ VERIFY( *is_it03 == ' ');
+
+ iss.str("Aar");
+ iterator_type is_it04(iss);
+ tm time04;
+ time04.tm_mon = 5;
+ errorstate = good;
+ tim_get.get_monthname(is_it04, end, iss, errorstate, &time04);
+ VERIFY( time04.tm_mon == 5 );
+ VERIFY( *is_it04 == 'a');
+ VERIFY( errorstate == ios_base::failbit );
+
+ iss.str("December ");
+ iterator_type is_it05(iss);
+ tm time05;
+ errorstate = good;
+ tim_get.get_monthname(is_it05, end, iss, errorstate, &time05);
+ VERIFY( time05.tm_mon == 11 );
+ VERIFY( errorstate == good );
+ VERIFY( *is_it05 == ' ');
+
+ iss.str("Decelember ");
+ iterator_type is_it06(iss);
+ tm time06;
+ time06.tm_mon = 4;
+ errorstate = good;
+ tim_get.get_monthname(is_it06, end, iss, errorstate, &time06);
+ VERIFY( time06.tm_mon == 4 );
+ VERIFY( errorstate == ios_base::failbit );
+ VERIFY( *is_it05 == 'l');
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/2.cc
new file mode 100644
index 00000000000..66ad029c1a5
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/2.cc
@@ -0,0 +1,90 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+
+ const string empty;
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ istringstream iss;
+ iss.imbue(loc_de);
+ const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
+
+ // inspection of named locales, de_DE
+ iss.str("April");
+ iterator_type is_it10(iss);
+ tm time10;
+ errorstate = good;
+ tim_get.get_monthname(is_it10, end, iss, errorstate, &time10);
+ VERIFY( time10.tm_mon == time_bday.tm_mon );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ // inspection of named locales, en_HK
+ iss.imbue(loc_hk);
+ const time_get<char>& tim_get2 = use_facet<time_get<char> >(iss.getloc());
+ iss.str("April");
+ iterator_type is_it20(iss);
+ tm time20;
+ errorstate = good;
+ tim_get2.get_monthname(is_it20, end, iss, errorstate, &time20);
+ VERIFY( time20.tm_mon == time_bday.tm_mon );
+ VERIFY( errorstate == ios_base::eofbit );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/3.cc
new file mode 100644
index 00000000000..c876f5c364b
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/3.cc
@@ -0,0 +1,70 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check time_get works with other iterators besides streambuf
+ // input iterators.
+ typedef string::const_iterator iter_type;
+ typedef time_get<char, iter_type> time_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+
+ // Create "C" time objects
+ const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
+ tm tm1;
+
+ istringstream iss;
+ iss.imbue(locale(loc_c, new time_get_type));
+
+ // Iterator advanced, state, output.
+ const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
+
+ // Cindy Sherman's Untitled Film Stills
+ // June 26-September 2, 1997
+ const string str = "September 1997 Cindy Sherman";
+
+ // 04 get_monthname
+ string res4;
+ err = goodbit;
+ // White space is not eaten, so manually increment past it.
+ iter_type end4 = tg.get_monthname(str.begin(), str.end(), iss, err, &tm1);
+ string rem4(end4, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( tm1.tm_mon == 8 );
+ VERIFY( rem4 == " 1997 Cindy Sherman" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/wrapped_env.cc
new file mode 100644
index 00000000000..3f042d9ec42
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/wrapped_env.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/wrapped_locale.cc
new file mode 100644
index 00000000000..61086ad6da8
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/wrapped_locale.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/1.cc
new file mode 100644
index 00000000000..8ba9d5df074
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/1.cc
@@ -0,0 +1,126 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ bool test = true;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ // create "C" time objects
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+
+ // iter_type
+ // get_monthname(iter_type, iter_type, ios_base&,
+ // ios_base::iostate&, tm*) const
+
+ // sanity checks for "C" locale
+ iterator_type end;
+ wistringstream iss;
+ iss.imbue(loc_c);
+ const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc());
+
+ iss.str(L"April");
+ iterator_type is_it01(iss);
+ tm time01;
+ errorstate = good;
+ tim_get.get_monthname(is_it01, end, iss, errorstate, &time01);
+ VERIFY( time01.tm_mon == time_bday.tm_mon );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str(L"Apr");
+ iterator_type is_it02(iss);
+ tm time02;
+ errorstate = good;
+ tim_get.get_monthname(is_it02, end, iss, errorstate, &time02);
+ VERIFY( time02.tm_mon == time_bday.tm_mon );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str(L"Apr ");
+ iterator_type is_it03(iss);
+ tm time03;
+ errorstate = good;
+ tim_get.get_monthname(is_it03, end, iss, errorstate, &time03);
+ VERIFY( time03.tm_mon == time_bday.tm_mon );
+ VERIFY( errorstate == good );
+ VERIFY( *is_it03 == ' ');
+
+ iss.str(L"Aar");
+ iterator_type is_it04(iss);
+ tm time04;
+ time04.tm_mon = 5;
+ errorstate = good;
+ tim_get.get_monthname(is_it04, end, iss, errorstate, &time04);
+ VERIFY( time04.tm_mon == 5 );
+ VERIFY( *is_it04 == 'a');
+ VERIFY( errorstate == ios_base::failbit );
+
+ iss.str(L"December ");
+ iterator_type is_it05(iss);
+ tm time05;
+ errorstate = good;
+ tim_get.get_monthname(is_it05, end, iss, errorstate, &time05);
+ VERIFY( time05.tm_mon == 11 );
+ VERIFY( errorstate == good );
+ VERIFY( *is_it05 == ' ');
+
+ iss.str(L"Decelember ");
+ iterator_type is_it06(iss);
+ tm time06;
+ time06.tm_mon = 4;
+ errorstate = good;
+ tim_get.get_monthname(is_it06, end, iss, errorstate, &time06);
+ VERIFY( time06.tm_mon == 4 );
+ VERIFY( errorstate == ios_base::failbit );
+ VERIFY( *is_it05 == 'l');
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/2.cc
new file mode 100644
index 00000000000..80fe2dfda41
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/2.cc
@@ -0,0 +1,90 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+
+ const wstring empty;
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ wistringstream iss;
+ iss.imbue(loc_de);
+ const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc());
+
+ // inspection of named locales, de_DE
+ iss.str(L"April");
+ iterator_type is_it10(iss);
+ tm time10;
+ errorstate = good;
+ tim_get.get_monthname(is_it10, end, iss, errorstate, &time10);
+ VERIFY( time10.tm_mon == time_bday.tm_mon );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ // inspection of named locales, en_HK
+ iss.imbue(loc_hk);
+ const time_get<wchar_t>& tim_get2 = use_facet<time_get<wchar_t> >(iss.getloc());
+ iss.str(L"April");
+ iterator_type is_it20(iss);
+ tm time20;
+ errorstate = good;
+ tim_get2.get_monthname(is_it20, end, iss, errorstate, &time20);
+ VERIFY( time20.tm_mon == time_bday.tm_mon );
+ VERIFY( errorstate == ios_base::eofbit );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/3.cc
new file mode 100644
index 00000000000..5cb2b651a9c
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/3.cc
@@ -0,0 +1,70 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check time_get works with other iterators besides streambuf
+ // input iterators.
+ typedef wstring::const_iterator iter_type;
+ typedef time_get<wchar_t, iter_type> time_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+
+ // Create "C" time objects
+ const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
+ tm tm1;
+
+ istringstream iss;
+ iss.imbue(locale(loc_c, new time_get_type));
+
+ // Iterator advanced, state, output.
+ const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
+
+ // Cindy Sherman's Untitled Film Stills
+ // June 26-September 2, 1997
+ const wstring str = L"September 1997 Cindy Sherman";
+
+ // 04 get_monthname
+ wstring res4;
+ err = goodbit;
+ // White space is not eaten, so manually increment past it.
+ iter_type end4 = tg.get_monthname(str.begin(), str.end(), iss, err, &tm1);
+ wstring rem4(end4, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( tm1.tm_mon == 8 );
+ VERIFY( rem4 == L" 1997 Cindy Sherman" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..3f042d9ec42
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/wrapped_env.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..61086ad6da8
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/wrapped_locale.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/1.cc
new file mode 100644
index 00000000000..ef9c2bbbeb9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/1.cc
@@ -0,0 +1,127 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ bool test = true;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ const string empty;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+ istringstream iss;
+ iss.imbue(loc_c);
+ const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // create "C" time objects
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+ const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ "%w %W %x %X %y %Y %Z %%";
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+ // 2
+ // iter_type
+ // get_time(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
+
+ // sanity checks for "C" locale
+ iss.str("12:00:00");
+ iterator_type is_it01(iss);
+ tm time01;
+ errorstate = good;
+ tim_get.get_time(is_it01, end, iss, errorstate, &time01);
+ VERIFY( time01.tm_sec == time_bday.tm_sec );
+ VERIFY( time01.tm_min == time_bday.tm_min );
+ VERIFY( time01.tm_hour == time_bday.tm_hour );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str("12:00:00 ");
+ iterator_type is_it02(iss);
+ tm time02;
+ errorstate = good;
+ tim_get.get_time(is_it02, end, iss, errorstate, &time02);
+ VERIFY( time01.tm_sec == time_bday.tm_sec );
+ VERIFY( time01.tm_min == time_bday.tm_min );
+ VERIFY( time01.tm_hour == time_bday.tm_hour );
+ VERIFY( errorstate == good );
+
+ iss.str("12:61:00 ");
+ iterator_type is_it03(iss);
+ tm time03;
+ errorstate = good;
+ tim_get.get_time(is_it03, end, iss, errorstate, &time03);
+ VERIFY( time01.tm_hour == time_bday.tm_hour );
+ VERIFY( errorstate == ios_base::failbit );
+
+ iss.str("12:a:00 ");
+ iterator_type is_it04(iss);
+ tm time04;
+ errorstate = good;
+ tim_get.get_time(is_it04, end, iss, errorstate, &time04);
+ VERIFY( time01.tm_hour == time_bday.tm_hour );
+ VERIFY( *is_it04 == 'a');
+ VERIFY( errorstate == ios_base::failbit );
+
+ // inspection of named locales, de_DE
+ iss.imbue(loc_de);
+ iss.str("12:00:00");
+ iterator_type is_it10(iss);
+ tm time10;
+ errorstate = good;
+ tim_get.get_time(is_it10, end, iss, errorstate, &time10);
+ VERIFY( time10.tm_sec == time_bday.tm_sec );
+ VERIFY( time10.tm_min == time_bday.tm_min );
+ VERIFY( time10.tm_hour == time_bday.tm_hour );
+ VERIFY( errorstate == ios_base::eofbit );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/2.cc
new file mode 100644
index 00000000000..9adb288ed74
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/2.cc
@@ -0,0 +1,80 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ bool test = true;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ const string empty;
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+ istringstream iss;
+ const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // inspection of named locales, en_HK
+ iss.imbue(loc_hk);
+ iss.str("12:00:00 PST");
+ // Hong Kong in California! Well, they have Paris in Vegas... this
+ // is all a little disney-esque anyway. Besides, you can get decent
+ // Dim Sum in San Francisco.
+ iterator_type is_it20(iss);
+ tm time20;
+ errorstate = good;
+ tim_get.get_time(is_it20, end, iss, errorstate, &time20);
+ VERIFY( time20.tm_sec == time_bday.tm_sec );
+ VERIFY( time20.tm_min == time_bday.tm_min );
+ VERIFY( time20.tm_hour == time_bday.tm_hour );
+ VERIFY( errorstate == ios_base::eofbit );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/3.cc
new file mode 100644
index 00000000000..01a06cacc28
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/3.cc
@@ -0,0 +1,71 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check time_get works with other iterators besides streambuf
+ // input iterators.
+ typedef string::const_iterator iter_type;
+ typedef time_get<char, iter_type> time_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+
+ // Create "C" time objects
+ const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
+ tm tm1;
+
+ istringstream iss;
+ iss.imbue(locale(loc_c, new time_get_type));
+
+ // Iterator advanced, state, output.
+ const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
+
+ // Cindy Sherman's Untitled Film Stills
+ // June 26-September 2, 1997
+ const string str = "12:00:00 06/26/97 Tuesday September 1997 Cindy Sherman";
+
+ // 01 get_time
+ string res1;
+ err = goodbit;
+ iter_type end1 = tg.get_time(str.begin(), str.end(), iss, err, &tm1);
+ string rem1(end1, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( tm1.tm_sec == time_sanity.tm_sec );
+ VERIFY( tm1.tm_min == time_sanity.tm_min );
+ VERIFY( tm1.tm_hour == time_sanity.tm_hour );
+ VERIFY( rem1 == " 06/26/97 Tuesday September 1997 Cindy Sherman" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/wrapped_env.cc
new file mode 100644
index 00000000000..3f042d9ec42
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/wrapped_env.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/wrapped_locale.cc
new file mode 100644
index 00000000000..61086ad6da8
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/wrapped_locale.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/1.cc
new file mode 100644
index 00000000000..5d64670f3bd
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/1.cc
@@ -0,0 +1,127 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ bool test = true;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ const wstring empty;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+ wistringstream iss;
+ iss.imbue(loc_c);
+ const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // create "C" time objects
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+ const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ L"%w %W %x %X %y %Y %Z %%";
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // 2
+ // iter_type
+ // get_time(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
+
+ // sanity checks for "C" locale
+ iss.str(L"12:00:00");
+ iterator_type is_it01(iss);
+ tm time01;
+ errorstate = good;
+ tim_get.get_time(is_it01, end, iss, errorstate, &time01);
+ VERIFY( time01.tm_sec == time_bday.tm_sec );
+ VERIFY( time01.tm_min == time_bday.tm_min );
+ VERIFY( time01.tm_hour == time_bday.tm_hour );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str(L"12:00:00 ");
+ iterator_type is_it02(iss);
+ tm time02;
+ errorstate = good;
+ tim_get.get_time(is_it02, end, iss, errorstate, &time02);
+ VERIFY( time01.tm_sec == time_bday.tm_sec );
+ VERIFY( time01.tm_min == time_bday.tm_min );
+ VERIFY( time01.tm_hour == time_bday.tm_hour );
+ VERIFY( errorstate == good );
+
+ iss.str(L"12:61:00 ");
+ iterator_type is_it03(iss);
+ tm time03;
+ errorstate = good;
+ tim_get.get_time(is_it03, end, iss, errorstate, &time03);
+ VERIFY( time01.tm_hour == time_bday.tm_hour );
+ VERIFY( errorstate == ios_base::failbit );
+
+ iss.str(L"12:a:00 ");
+ iterator_type is_it04(iss);
+ tm time04;
+ errorstate = good;
+ tim_get.get_time(is_it04, end, iss, errorstate, &time04);
+ VERIFY( time01.tm_hour == time_bday.tm_hour );
+ VERIFY( *is_it04 == 'a');
+ VERIFY( errorstate == ios_base::failbit );
+
+ // inspection of named locales, de_DE
+ iss.imbue(loc_de);
+ iss.str(L"12:00:00");
+ iterator_type is_it10(iss);
+ tm time10;
+ errorstate = good;
+ tim_get.get_time(is_it10, end, iss, errorstate, &time10);
+ VERIFY( time10.tm_sec == time_bday.tm_sec );
+ VERIFY( time10.tm_min == time_bday.tm_min );
+ VERIFY( time10.tm_hour == time_bday.tm_hour );
+ VERIFY( errorstate == ios_base::eofbit );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/2.cc
new file mode 100644
index 00000000000..5b7293848cc
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/2.cc
@@ -0,0 +1,80 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ bool test = true;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ const wstring empty;
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+ wistringstream iss;
+ const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc());
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // inspection of named locales, en_HK
+ iss.imbue(loc_hk);
+ iss.str(L"12:00:00 PST");
+ // Hong Kong in California! Well, they have Paris in Vegas... this
+ // is all a little disney-esque anyway. Besides, you can get decent
+ // Dim Sum in San Francisco.
+ iterator_type is_it20(iss);
+ tm time20;
+ errorstate = good;
+ tim_get.get_time(is_it20, end, iss, errorstate, &time20);
+ VERIFY( time20.tm_sec == time_bday.tm_sec );
+ VERIFY( time20.tm_min == time_bday.tm_min );
+ VERIFY( time20.tm_hour == time_bday.tm_hour );
+ VERIFY( errorstate == ios_base::eofbit );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/3.cc
new file mode 100644
index 00000000000..bb9c2e0b46f
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/3.cc
@@ -0,0 +1,71 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check time_get works with other iterators besides streambuf
+ // input iterators.
+ typedef wstring::const_iterator iter_type;
+ typedef time_get<wchar_t, iter_type> time_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+
+ // Create "C" time objects
+ const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
+ tm tm1;
+
+ wistringstream iss;
+ iss.imbue(locale(loc_c, new time_get_type));
+
+ // Iterator advanced, state, output.
+ const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
+
+ // Cindy Sherman's Untitled Film Stills
+ // June 26-September 2, 1997
+ const wstring str = L"12:00:00 06/26/97 Tuesday September 1997 Cindy Sherman";
+
+ // 01 get_time
+ wstring res1;
+ err = goodbit;
+ iter_type end1 = tg.get_time(str.begin(), str.end(), iss, err, &tm1);
+ wstring rem1(end1, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( tm1.tm_sec == time_sanity.tm_sec );
+ VERIFY( tm1.tm_min == time_sanity.tm_min );
+ VERIFY( tm1.tm_hour == time_sanity.tm_hour );
+ VERIFY( rem1 == L" 06/26/97 Tuesday September 1997 Cindy Sherman" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..3f042d9ec42
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/wrapped_env.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..61086ad6da8
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/wrapped_locale.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/1.cc
new file mode 100644
index 00000000000..4fad9019abf
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/1.cc
@@ -0,0 +1,134 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ const string empty;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ istringstream iss;
+ iss.imbue(loc_c);
+ const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // create "C" time objects
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+ const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ "%w %W %x %X %y %Y %Z %%";
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+ // iter_type
+ // get_weekday(iter_type, iter_type, ios_base&,
+ // ios_base::iostate&, tm*) const
+
+ // sanity checks for "C" locale
+ iss.str("Sunday");
+ iterator_type is_it01(iss);
+ tm time01;
+ errorstate = good;
+ tim_get.get_weekday(is_it01, end, iss, errorstate, &time01);
+ VERIFY( time01.tm_wday == time_bday.tm_wday );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str("Sun");
+ iterator_type is_it02(iss);
+ tm time02;
+ errorstate = good;
+ tim_get.get_weekday(is_it02, end, iss, errorstate, &time02);
+ VERIFY( time02.tm_wday == time_bday.tm_wday );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str("Sun ");
+ iterator_type is_it03(iss);
+ tm time03;
+ errorstate = good;
+ tim_get.get_weekday(is_it03, end, iss, errorstate, &time03);
+ VERIFY( time03.tm_wday == time_bday.tm_wday );
+ VERIFY( errorstate == good );
+ VERIFY( *is_it03 == ' ');
+
+ iss.str("San");
+ iterator_type is_it04(iss);
+ tm time04;
+ time04.tm_wday = 4;
+ errorstate = good;
+ tim_get.get_weekday(is_it04, end, iss, errorstate, &time04);
+ VERIFY( time04.tm_wday == 4 );
+ VERIFY( *is_it04 == 'n');
+ VERIFY( errorstate == ios_base::failbit );
+
+ iss.str("Tuesday ");
+ iterator_type is_it05(iss);
+ tm time05;
+ errorstate = good;
+ tim_get.get_weekday(is_it05, end, iss, errorstate, &time05);
+ VERIFY( time05.tm_wday == 2 );
+ VERIFY( errorstate == good );
+ VERIFY( *is_it05 == ' ');
+
+ iss.str("Tuesducky "); // Kind of like Fryday, without the swirls.
+ iterator_type is_it06(iss);
+ tm time06;
+ time06.tm_wday = 4;
+ errorstate = good;
+ tim_get.get_weekday(is_it06, end, iss, errorstate, &time06);
+ VERIFY( time06.tm_wday == 4 );
+ VERIFY( errorstate == ios_base::failbit );
+ VERIFY( *is_it05 == 'u');
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/2.cc
new file mode 100644
index 00000000000..5f6e1490d42
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/2.cc
@@ -0,0 +1,90 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ const string empty;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ istringstream iss;
+ const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // create "C" time objects
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+
+ // inspection of named locales, de_DE
+ iss.imbue(loc_de);
+ iss.str("Sonntag");
+ iterator_type is_it10(iss);
+ tm time10;
+ errorstate = good;
+ tim_get.get_weekday(is_it10, end, iss, errorstate, &time10);
+ VERIFY( time10.tm_wday == time_bday.tm_wday );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ // inspection of named locales, en_HK
+ iss.imbue(loc_hk);
+ iss.str("Sunday");
+ iterator_type is_it20(iss);
+ tm time20;
+ errorstate = good;
+ tim_get.get_weekday(is_it20, end, iss, errorstate, &time20);
+ VERIFY( time20.tm_wday == time_bday.tm_wday );
+ VERIFY( errorstate == ios_base::eofbit );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/3.cc
new file mode 100644
index 00000000000..59dde862a35
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/3.cc
@@ -0,0 +1,70 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check time_get works with other iterators besides streambuf
+ // input iterators.
+ typedef string::const_iterator iter_type;
+ typedef time_get<char, iter_type> time_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+
+ // Create "C" time objects
+ const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
+ tm tm1;
+
+ istringstream iss;
+ iss.imbue(locale(loc_c, new time_get_type));
+
+ // Iterator advanced, state, output.
+ const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
+
+ // Cindy Sherman's Untitled Film Stills
+ // June 26-September 2, 1997
+ const string str = "Tuesday September 1997 Cindy Sherman";
+
+ // 03 get_weekday
+ string res3;
+ err = goodbit;
+ // White space is not eaten, so manually increment past it.
+ iter_type end3 = tg.get_weekday(str.begin(), str.end(), iss, err, &tm1);
+ string rem3(end3, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( tm1.tm_wday == time_sanity.tm_wday );
+ VERIFY( rem3 == " September 1997 Cindy Sherman" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_env.cc
new file mode 100644
index 00000000000..3f042d9ec42
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_env.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_locale.cc
new file mode 100644
index 00000000000..61086ad6da8
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_locale.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/1.cc
new file mode 100644
index 00000000000..a865c2eff1d
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/1.cc
@@ -0,0 +1,134 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ const wstring empty;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ wistringstream iss;
+ iss.imbue(loc_c);
+ const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // create "C" time objects
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+ const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ L"%w %W %x %X %y %Y %Z %%";
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // iter_type
+ // get_weekday(iter_type, iter_type, ios_base&,
+ // ios_base::iostate&, tm*) const
+
+ // sanity checks for "C" locale
+ iss.str(L"Sunday");
+ iterator_type is_it01(iss);
+ tm time01;
+ errorstate = good;
+ tim_get.get_weekday(is_it01, end, iss, errorstate, &time01);
+ VERIFY( time01.tm_wday == time_bday.tm_wday );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str(L"Sun");
+ iterator_type is_it02(iss);
+ tm time02;
+ errorstate = good;
+ tim_get.get_weekday(is_it02, end, iss, errorstate, &time02);
+ VERIFY( time02.tm_wday == time_bday.tm_wday );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str(L"Sun ");
+ iterator_type is_it03(iss);
+ tm time03;
+ errorstate = good;
+ tim_get.get_weekday(is_it03, end, iss, errorstate, &time03);
+ VERIFY( time03.tm_wday == time_bday.tm_wday );
+ VERIFY( errorstate == good );
+ VERIFY( *is_it03 == ' ');
+
+ iss.str(L"San");
+ iterator_type is_it04(iss);
+ tm time04;
+ time04.tm_wday = 4;
+ errorstate = good;
+ tim_get.get_weekday(is_it04, end, iss, errorstate, &time04);
+ VERIFY( time04.tm_wday == 4 );
+ VERIFY( *is_it04 == 'n');
+ VERIFY( errorstate == ios_base::failbit );
+
+ iss.str(L"Tuesday ");
+ iterator_type is_it05(iss);
+ tm time05;
+ errorstate = good;
+ tim_get.get_weekday(is_it05, end, iss, errorstate, &time05);
+ VERIFY( time05.tm_wday == 2 );
+ VERIFY( errorstate == good );
+ VERIFY( *is_it05 == ' ');
+
+ iss.str(L"Tuesducky "); // Kind of like Fryday, without the swirls.
+ iterator_type is_it06(iss);
+ tm time06;
+ time06.tm_wday = 4;
+ errorstate = good;
+ tim_get.get_weekday(is_it06, end, iss, errorstate, &time06);
+ VERIFY( time06.tm_wday == 4 );
+ VERIFY( errorstate == ios_base::failbit );
+ VERIFY( *is_it05 == 'u');
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/2.cc
new file mode 100644
index 00000000000..299f2ef0525
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/2.cc
@@ -0,0 +1,90 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ const wstring empty;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ wistringstream iss;
+ const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // create "C" time objects
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+
+ // inspection of named locales, de_DE
+ iss.imbue(loc_de);
+ iss.str(L"Sonntag");
+ iterator_type is_it10(iss);
+ tm time10;
+ errorstate = good;
+ tim_get.get_weekday(is_it10, end, iss, errorstate, &time10);
+ VERIFY( time10.tm_wday == time_bday.tm_wday );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ // inspection of named locales, en_HK
+ iss.imbue(loc_hk);
+ iss.str(L"Sunday");
+ iterator_type is_it20(iss);
+ tm time20;
+ errorstate = good;
+ tim_get.get_weekday(is_it20, end, iss, errorstate, &time20);
+ VERIFY( time20.tm_wday == time_bday.tm_wday );
+ VERIFY( errorstate == ios_base::eofbit );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/3.cc
new file mode 100644
index 00000000000..eab0343be37
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/3.cc
@@ -0,0 +1,70 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check time_get works with other iterators besides streambuf
+ // input iterators.
+ typedef wstring::const_iterator iter_type;
+ typedef time_get<wchar_t, iter_type> time_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+
+ // Create "C" time objects
+ const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
+ tm tm1;
+
+ wistringstream iss;
+ iss.imbue(locale(loc_c, new time_get_type));
+
+ // Iterator advanced, state, output.
+ const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
+
+ // Cindy Sherman's Untitled Film Stills
+ // June 26-September 2, 1997
+ const wstring str = L"Tuesday September 1997 Cindy Sherman";
+
+ // 03 get_weekday
+ wstring res3;
+ err = goodbit;
+ // White space is not eaten, so manually increment past it.
+ iter_type end3 = tg.get_weekday(str.begin(), str.end(), iss, err, &tm1);
+ wstring rem3(end3, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( tm1.tm_wday == time_sanity.tm_wday );
+ VERIFY( rem3 == L" September 1997 Cindy Sherman" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..3f042d9ec42
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/wrapped_env.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..61086ad6da8
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/wrapped_locale.cc
@@ -0,0 +1,46 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/1.cc
new file mode 100644
index 00000000000..62f393b3c1f
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/1.cc
@@ -0,0 +1,123 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ const string empty;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ istringstream iss;
+ iss.imbue(loc_c);
+ const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // create "C" time objects
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+ const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ "%w %W %x %X %y %Y %Z %%";
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+ // iter_type
+ // get_year(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
+
+ // sanity checks for "C" locale
+ iss.str("1971");
+ iterator_type is_it01(iss);
+ tm time01;
+ errorstate = good;
+ tim_get.get_year(is_it01, end, iss, errorstate, &time01);
+ VERIFY( time01.tm_year == time_bday.tm_year );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str("1971 ");
+ iterator_type is_it02(iss);
+ tm time02;
+ errorstate = good;
+ tim_get.get_year(is_it02, end, iss, errorstate, &time02);
+ VERIFY( time02.tm_year == time_bday.tm_year );
+ VERIFY( errorstate == good );
+ VERIFY( *is_it02 == ' ');
+
+ iss.str("197d1 ");
+ iterator_type is_it03(iss);
+ tm time03;
+ time03.tm_year = 3;
+ errorstate = good;
+ tim_get.get_year(is_it03, end, iss, errorstate, &time03);
+ VERIFY( time03.tm_year == 3 );
+ VERIFY( errorstate == ios_base::failbit );
+ VERIFY( *is_it03 == 'd');
+
+ iss.str("71d71");
+ iterator_type is_it04(iss);
+ tm time04;
+ errorstate = good;
+ tim_get.get_year(is_it04, end, iss, errorstate, &time04);
+ VERIFY( time04.tm_year == time_bday.tm_year );
+ VERIFY( errorstate == good );
+ VERIFY( *is_it03 == 'd');
+
+ iss.str("71");
+ iterator_type is_it05(iss);
+ tm time05;
+ errorstate = good;
+ tim_get.get_year(is_it05, end, iss, errorstate, &time05);
+ VERIFY( time05.tm_year == time_bday.tm_year );
+ VERIFY( errorstate == ios_base::eofbit );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/3.cc
new file mode 100644
index 00000000000..1c38fcb3884
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/3.cc
@@ -0,0 +1,70 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check time_get works with other iterators besides streambuf
+ // input iterators.
+ typedef string::const_iterator iter_type;
+ typedef time_get<char, iter_type> time_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+
+ // Create "C" time objects
+ const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
+ tm tm1;
+
+ istringstream iss;
+ iss.imbue(locale(loc_c, new time_get_type));
+
+ // Iterator advanced, state, output.
+ const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
+
+ // Cindy Sherman's Untitled Film Stills
+ // June 26-September 2, 1997
+ const string str = "1997 Cindy Sherman";
+
+ // 05 get_year
+ string res5;
+ err = goodbit;
+ // White space is not eaten, so manually increment past it.
+ iter_type end5 = tg.get_year(str.begin(), str.end(), iss, err, &tm1);
+ string rem5(end5, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( tm1.tm_year == time_sanity.tm_year );
+ VERIFY( rem5 == " Cindy Sherman" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/wrapped_env.cc
new file mode 100644
index 00000000000..206130ac140
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/wrapped_env.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test03);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/wrapped_locale.cc
new file mode 100644
index 00000000000..b805c3c43cf
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/wrapped_locale.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test03);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/1.cc
new file mode 100644
index 00000000000..c117311c731
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/1.cc
@@ -0,0 +1,123 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef time_base::dateorder dateorder;
+ typedef istreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ const wstring empty;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ wistringstream iss;
+ iss.imbue(loc_c);
+ const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // create "C" time objects
+ const tm time_bday = { 0, 0, 12, 4, 3, 71 };
+ const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ L"%w %W %x %X %y %Y %Z %%";
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // iter_type
+ // get_year(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
+
+ // sanity checks for "C" locale
+ iss.str(L"1971");
+ iterator_type is_it01(iss);
+ tm time01;
+ errorstate = good;
+ tim_get.get_year(is_it01, end, iss, errorstate, &time01);
+ VERIFY( time01.tm_year == time_bday.tm_year );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str(L"1971 ");
+ iterator_type is_it02(iss);
+ tm time02;
+ errorstate = good;
+ tim_get.get_year(is_it02, end, iss, errorstate, &time02);
+ VERIFY( time02.tm_year == time_bday.tm_year );
+ VERIFY( errorstate == good );
+ VERIFY( *is_it02 == ' ');
+
+ iss.str(L"197d1 ");
+ iterator_type is_it03(iss);
+ tm time03;
+ time03.tm_year = 3;
+ errorstate = good;
+ tim_get.get_year(is_it03, end, iss, errorstate, &time03);
+ VERIFY( time03.tm_year == 3 );
+ VERIFY( errorstate == ios_base::failbit );
+ VERIFY( *is_it03 == 'd');
+
+ iss.str(L"71d71");
+ iterator_type is_it04(iss);
+ tm time04;
+ errorstate = good;
+ tim_get.get_year(is_it04, end, iss, errorstate, &time04);
+ VERIFY( time04.tm_year == time_bday.tm_year );
+ VERIFY( errorstate == good );
+ VERIFY( *is_it03 == 'd');
+
+ iss.str(L"71");
+ iterator_type is_it05(iss);
+ tm time05;
+ errorstate = good;
+ tim_get.get_year(is_it05, end, iss, errorstate, &time05);
+ VERIFY( time05.tm_year == time_bday.tm_year );
+ VERIFY( errorstate == ios_base::eofbit );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/3.cc
new file mode 100644
index 00000000000..0f61392df09
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/3.cc
@@ -0,0 +1,70 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check time_get works with other iterators besides streambuf
+ // input iterators.
+ typedef wstring::const_iterator iter_type;
+ typedef time_get<wchar_t, iter_type> time_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+
+ // Create "C" time objects
+ const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
+ tm tm1;
+
+ istringstream iss;
+ iss.imbue(locale(loc_c, new time_get_type));
+
+ // Iterator advanced, state, output.
+ const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
+
+ // Cindy Sherman's Untitled Film Stills
+ // June 26-September 2, 1997
+ const wstring str = L"1997 Cindy Sherman";
+
+ // 05 get_year
+ wstring res5;
+ err = goodbit;
+ // White space is not eaten, so manually increment past it.
+ iter_type end5 = tg.get_year(str.begin(), str.end(), iss, err, &tm1);
+ wstring rem5(end5, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( tm1.tm_year == time_sanity.tm_year );
+ VERIFY( rem5 == L" Cindy Sherman" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..206130ac140
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/wrapped_env.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test03);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..b805c3c43cf
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/wrapped_locale.cc
@@ -0,0 +1,41 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test03);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get_members_char.cc b/libstdc++-v3/testsuite/22_locale/time_get_members_char.cc
deleted file mode 100644
index b5c8f098031..00000000000
--- a/libstdc++-v3/testsuite/22_locale/time_get_members_char.cc
+++ /dev/null
@@ -1,735 +0,0 @@
-// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2001, 2002 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This 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 General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.5.1.1 time_get members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-void test01()
-{
- using namespace std;
- typedef time_base::dateorder dateorder;
- typedef istreambuf_iterator<char> iterator_type;
-
- bool test = true;
-
- // basic construction and sanity checks.
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE");
- VERIFY( loc_hk != loc_c );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the __timepunct facets, for quicker gdb inspection
- const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
- const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
- const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
- const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
-
- const string empty;
-
- // create an ostream-derived object, cache the time_get facet
- iterator_type end;
-
- istringstream iss;
- const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
-
- const ios_base::iostate good = ios_base::goodbit;
- ios_base::iostate errorstate = good;
-
- // create "C" time objects
- const tm time_bday = { 0, 0, 12, 4, 3, 71 };
- const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
- "%w %W %x %X %y %Y %Z %%";
- const char* date = "%A, the second of %B";
- const char* date_ex = "%Ex";
-
- // 1
- // dateorder date_order() const
- iss.imbue(loc_c);
- dateorder do1 = tim_get.date_order();
- // VERIFY( do1 == time_base::mdy );
- VERIFY( do1 == time_base::no_order );
-
- // 2
- // iter_type
- // get_time(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
-
- // sanity checks for "C" locale
- iss.str("12:00:00");
- iterator_type is_it01(iss);
- tm time01;
- errorstate = good;
- tim_get.get_time(is_it01, end, iss, errorstate, &time01);
- VERIFY( time01.tm_sec == time_bday.tm_sec );
- VERIFY( time01.tm_min == time_bday.tm_min );
- VERIFY( time01.tm_hour == time_bday.tm_hour );
- VERIFY( errorstate == ios_base::eofbit );
-
- iss.str("12:00:00 ");
- iterator_type is_it02(iss);
- tm time02;
- errorstate = good;
- tim_get.get_time(is_it02, end, iss, errorstate, &time02);
- VERIFY( time01.tm_sec == time_bday.tm_sec );
- VERIFY( time01.tm_min == time_bday.tm_min );
- VERIFY( time01.tm_hour == time_bday.tm_hour );
- VERIFY( errorstate == good );
-
- iss.str("12:61:00 ");
- iterator_type is_it03(iss);
- tm time03;
- errorstate = good;
- tim_get.get_time(is_it03, end, iss, errorstate, &time03);
- VERIFY( time01.tm_hour == time_bday.tm_hour );
- VERIFY( errorstate == ios_base::failbit );
-
- iss.str("12:a:00 ");
- iterator_type is_it04(iss);
- tm time04;
- errorstate = good;
- tim_get.get_time(is_it04, end, iss, errorstate, &time04);
- VERIFY( time01.tm_hour == time_bday.tm_hour );
- VERIFY( *is_it04 == 'a');
- VERIFY( errorstate == ios_base::failbit );
-
- // inspection of named locales, de_DE
- iss.imbue(loc_de);
- iss.str("12:00:00");
- iterator_type is_it10(iss);
- tm time10;
- errorstate = good;
- tim_get.get_time(is_it10, end, iss, errorstate, &time10);
- VERIFY( time10.tm_sec == time_bday.tm_sec );
- VERIFY( time10.tm_min == time_bday.tm_min );
- VERIFY( time10.tm_hour == time_bday.tm_hour );
- VERIFY( errorstate == ios_base::eofbit );
-
- // inspection of named locales, en_HK
- iss.imbue(loc_hk);
- iss.str("12:00:00 PST");
- // Hong Kong in California! Well, they have Paris in Vegas... this
- // is all a little disney-esque anyway. Besides, you can get decent
- // Dim Sum in San Francisco.
- iterator_type is_it20(iss);
- tm time20;
- errorstate = good;
- tim_get.get_time(is_it20, end, iss, errorstate, &time20);
- VERIFY( time10.tm_sec == time_bday.tm_sec );
- VERIFY( time10.tm_min == time_bday.tm_min );
- VERIFY( time10.tm_hour == time_bday.tm_hour );
- VERIFY( errorstate == ios_base::eofbit );
-}
-
-void test02()
-{
- using namespace std;
- typedef time_base::dateorder dateorder;
- typedef istreambuf_iterator<char> iterator_type;
-
- bool test = true;
-
- // basic construction and sanity checks.
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE");
- VERIFY( loc_hk != loc_c );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the __timepunct facets, for quicker gdb inspection
- const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
- const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
- const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
- const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
-
- const string empty;
-
- // create an ostream-derived object, cache the time_get facet
- iterator_type end;
-
- istringstream iss;
- const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
-
- const ios_base::iostate good = ios_base::goodbit;
- ios_base::iostate errorstate = good;
-
- // create "C" time objects
- const tm time_bday = { 0, 0, 12, 4, 3, 71 };
- const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
- "%w %W %x %X %y %Y %Z %%";
- const char* date = "%A, the second of %B";
- const char* date_ex = "%Ex";
-
- // iter_type
- // get_weekday(iter_type, iter_type, ios_base&,
- // ios_base::iostate&, tm*) const
-
- // sanity checks for "C" locale
- iss.imbue(loc_c);
- iss.str("Sunday");
- iterator_type is_it01(iss);
- tm time01;
- errorstate = good;
- tim_get.get_weekday(is_it01, end, iss, errorstate, &time01);
- VERIFY( time01.tm_wday == time_bday.tm_wday );
- VERIFY( errorstate == ios_base::eofbit );
-
- iss.str("Sun");
- iterator_type is_it02(iss);
- tm time02;
- errorstate = good;
- tim_get.get_weekday(is_it02, end, iss, errorstate, &time02);
- VERIFY( time02.tm_wday == time_bday.tm_wday );
- VERIFY( errorstate == ios_base::eofbit );
-
- iss.str("Sun ");
- iterator_type is_it03(iss);
- tm time03;
- errorstate = good;
- tim_get.get_weekday(is_it03, end, iss, errorstate, &time03);
- VERIFY( time03.tm_wday == time_bday.tm_wday );
- VERIFY( errorstate == good );
- VERIFY( *is_it03 == ' ');
-
- iss.str("San");
- iterator_type is_it04(iss);
- tm time04;
- time04.tm_wday = 4;
- errorstate = good;
- tim_get.get_weekday(is_it04, end, iss, errorstate, &time04);
- VERIFY( time04.tm_wday == 4 );
- VERIFY( *is_it04 == 'n');
- VERIFY( errorstate == ios_base::failbit );
-
- iss.str("Tuesday ");
- iterator_type is_it05(iss);
- tm time05;
- errorstate = good;
- tim_get.get_weekday(is_it05, end, iss, errorstate, &time05);
- VERIFY( time05.tm_wday == 2 );
- VERIFY( errorstate == good );
- VERIFY( *is_it05 == ' ');
-
- iss.str("Tuesducky "); // Kind of like Fryday, without the swirls.
- iterator_type is_it06(iss);
- tm time06;
- time06.tm_wday = 4;
- errorstate = good;
- tim_get.get_weekday(is_it06, end, iss, errorstate, &time06);
- VERIFY( time06.tm_wday == 4 );
- VERIFY( errorstate == ios_base::failbit );
- VERIFY( *is_it05 == 'u');
-
- // inspection of named locales, de_DE
- iss.imbue(loc_de);
- iss.str("Sonntag");
- iterator_type is_it10(iss);
- tm time10;
- errorstate = good;
- tim_get.get_weekday(is_it10, end, iss, errorstate, &time10);
- VERIFY( time10.tm_wday == time_bday.tm_wday );
- VERIFY( errorstate == ios_base::eofbit );
-
- // inspection of named locales, en_HK
- iss.imbue(loc_hk);
- iss.str("Sunday");
- iterator_type is_it20(iss);
- tm time20;
- errorstate = good;
- tim_get.get_weekday(is_it20, end, iss, errorstate, &time20);
- VERIFY( time20.tm_wday == time_bday.tm_wday );
- VERIFY( errorstate == ios_base::eofbit );
-}
-
-void test03()
-{
- using namespace std;
- typedef time_base::dateorder dateorder;
- typedef istreambuf_iterator<char> iterator_type;
-
- bool test = true;
-
- // basic construction and sanity checks.
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE");
- VERIFY( loc_hk != loc_c );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the __timepunct facets, for quicker gdb inspection
- const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
- const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
- const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
- const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
-
- const string empty;
-
- // create an ostream-derived object, cache the time_get facet
- iterator_type end;
-
- istringstream iss;
- const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
-
- const ios_base::iostate good = ios_base::goodbit;
- ios_base::iostate errorstate = good;
-
- // create "C" time objects
- const tm time_bday = { 0, 0, 12, 4, 3, 71 };
- const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
- "%w %W %x %X %y %Y %Z %%";
- const char* date = "%A, the second of %B";
- const char* date_ex = "%Ex";
-
- // iter_type
- // get_monthname(iter_type, iter_type, ios_base&,
- // ios_base::iostate&, tm*) const
-
- // sanity checks for "C" locale
- iss.imbue(loc_c);
- iss.str("April");
- iterator_type is_it01(iss);
- tm time01;
- errorstate = good;
- tim_get.get_monthname(is_it01, end, iss, errorstate, &time01);
- VERIFY( time01.tm_wday == time_bday.tm_wday );
- VERIFY( errorstate == ios_base::eofbit );
-
- iss.str("Apr");
- iterator_type is_it02(iss);
- tm time02;
- errorstate = good;
- tim_get.get_monthname(is_it02, end, iss, errorstate, &time02);
- VERIFY( time02.tm_mon == time_bday.tm_mon );
- VERIFY( errorstate == ios_base::eofbit );
-
- iss.str("Apr ");
- iterator_type is_it03(iss);
- tm time03;
- errorstate = good;
- tim_get.get_monthname(is_it03, end, iss, errorstate, &time03);
- VERIFY( time03.tm_mon == time_bday.tm_mon );
- VERIFY( errorstate == good );
- VERIFY( *is_it03 == ' ');
-
- iss.str("Aar");
- iterator_type is_it04(iss);
- tm time04;
- time04.tm_mon = 5;
- errorstate = good;
- tim_get.get_monthname(is_it04, end, iss, errorstate, &time04);
- VERIFY( time04.tm_mon == 5 );
- VERIFY( *is_it04 == 'a');
- VERIFY( errorstate == ios_base::failbit );
-
- iss.str("December ");
- iterator_type is_it05(iss);
- tm time05;
- errorstate = good;
- tim_get.get_monthname(is_it05, end, iss, errorstate, &time05);
- VERIFY( time05.tm_mon == 11 );
- VERIFY( errorstate == good );
- VERIFY( *is_it05 == ' ');
-
- iss.str("Decelember ");
- iterator_type is_it06(iss);
- tm time06;
- time06.tm_mon = 4;
- errorstate = good;
- tim_get.get_monthname(is_it06, end, iss, errorstate, &time06);
- VERIFY( time06.tm_mon == 4 );
- VERIFY( errorstate == ios_base::failbit );
- VERIFY( *is_it05 == 'l');
-
- // inspection of named locales, de_DE
- iss.imbue(loc_de);
- iss.str("April");
- iterator_type is_it10(iss);
- tm time10;
- errorstate = good;
- tim_get.get_monthname(is_it10, end, iss, errorstate, &time10);
- VERIFY( time10.tm_mon == time_bday.tm_mon );
- VERIFY( errorstate == ios_base::eofbit );
-
- // inspection of named locales, en_HK
- iss.imbue(loc_hk);
- iss.str("April");
- iterator_type is_it20(iss);
- tm time20;
- errorstate = good;
- tim_get.get_monthname(is_it20, end, iss, errorstate, &time20);
- VERIFY( time20.tm_mon == time_bday.tm_mon );
- VERIFY( errorstate == ios_base::eofbit );
-}
-
-void test04()
-{
- using namespace std;
- typedef time_base::dateorder dateorder;
- typedef istreambuf_iterator<char> iterator_type;
-
- bool test = true;
-
- // basic construction and sanity checks.
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE");
- VERIFY( loc_hk != loc_c );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the __timepunct facets, for quicker gdb inspection
- const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
- const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
- const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
- const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
-
- const string empty;
-
- // create an ostream-derived object, cache the time_get facet
- iterator_type end;
-
- istringstream iss;
- const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
-
- const ios_base::iostate good = ios_base::goodbit;
- ios_base::iostate errorstate = good;
-
- // create "C" time objects
- const tm time_bday = { 0, 0, 12, 4, 3, 71 };
- const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
- "%w %W %x %X %y %Y %Z %%";
- const char* date = "%A, the second of %B";
- const char* date_ex = "%Ex";
-
- // iter_type
- // get_year(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
-
- // sanity checks for "C" locale
- iss.imbue(loc_c);
- iss.str("1971");
- iterator_type is_it01(iss);
- tm time01;
- errorstate = good;
- tim_get.get_year(is_it01, end, iss, errorstate, &time01);
- VERIFY( time01.tm_year == time_bday.tm_year );
- VERIFY( errorstate == ios_base::eofbit );
-
- iss.str("1971 ");
- iterator_type is_it02(iss);
- tm time02;
- errorstate = good;
- tim_get.get_year(is_it02, end, iss, errorstate, &time02);
- VERIFY( time02.tm_year == time_bday.tm_year );
- VERIFY( errorstate == good );
- VERIFY( *is_it02 == ' ');
-
- iss.str("197d1 ");
- iterator_type is_it03(iss);
- tm time03;
- time03.tm_year = 3;
- errorstate = good;
- tim_get.get_year(is_it03, end, iss, errorstate, &time03);
- VERIFY( time03.tm_year == 3 );
- VERIFY( errorstate == ios_base::failbit );
- VERIFY( *is_it03 == 'd');
-
- iss.str("71d71");
- iterator_type is_it04(iss);
- tm time04;
- errorstate = good;
- tim_get.get_year(is_it04, end, iss, errorstate, &time04);
- VERIFY( time04.tm_year == time_bday.tm_year );
- VERIFY( errorstate == good );
- VERIFY( *is_it03 == 'd');
-
- iss.str("71");
- iterator_type is_it05(iss);
- tm time05;
- errorstate = good;
- tim_get.get_year(is_it05, end, iss, errorstate, &time05);
- VERIFY( time05.tm_year == time_bday.tm_year );
- VERIFY( errorstate == ios_base::eofbit );
-}
-
-void test05()
-{
- using namespace std;
- typedef time_base::dateorder dateorder;
- typedef istreambuf_iterator<char> iterator_type;
-
- bool test = true;
-
- // basic construction and sanity checks.
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE");
- VERIFY( loc_hk != loc_c );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the __timepunct facets, for quicker gdb inspection
- const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
- const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
- const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
- const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
-
- const string empty;
-
- // create an ostream-derived object, cache the time_get facet
- iterator_type end;
-
- istringstream iss;
- const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
-
- const ios_base::iostate good = ios_base::goodbit;
- ios_base::iostate errorstate = good;
-
- // create "C" time objects
- const tm time_bday = { 0, 0, 12, 4, 3, 71 };
- const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
- "%w %W %x %X %y %Y %Z %%";
- const char* date = "%A, the second of %B";
- const char* date_ex = "%Ex";
-
- // iter_type
- // get_date(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
-
- // sanity checks for "C" locale
- iss.imbue(loc_c);
- iss.str("04/04/71");
- iterator_type is_it01(iss);
- tm time01;
- errorstate = good;
- tim_get.get_date(is_it01, end, iss, errorstate, &time01);
- VERIFY( time01.tm_year == time_bday.tm_year );
- VERIFY( time01.tm_mon == time_bday.tm_mon );
- VERIFY( time01.tm_mday == time_bday.tm_mday );
- VERIFY( errorstate == ios_base::eofbit );
-
- iss.str("04/04/71 ");
- iterator_type is_it02(iss);
- tm time02;
- errorstate = good;
- tim_get.get_date(is_it02, end, iss, errorstate, &time02);
- VERIFY( time02.tm_year == time_bday.tm_year );
- VERIFY( time02.tm_mon == time_bday.tm_mon );
- VERIFY( time02.tm_mday == time_bday.tm_mday );
- VERIFY( errorstate == good );
- VERIFY( *is_it02 == ' ');
-
- iss.str("04/04d/71 ");
- iterator_type is_it03(iss);
- tm time03;
- time03.tm_year = 3;
- errorstate = good;
- tim_get.get_date(is_it03, end, iss, errorstate, &time03);
- VERIFY( time03.tm_year == 3 );
- VERIFY( time03.tm_mon == time_bday.tm_mon );
- VERIFY( time03.tm_mday == time_bday.tm_mday );
- VERIFY( errorstate == ios_base::failbit );
- VERIFY( *is_it03 == 'd');
-
- // inspection of named locales, de_DE
- iss.imbue(loc_de);
- iss.str("04.04.1971");
- iterator_type is_it10(iss);
- tm time10;
- errorstate = good;
- tim_get.get_date(is_it10, end, iss, errorstate, &time10);
- VERIFY( time10.tm_mon == time_bday.tm_mon );
- VERIFY( time10.tm_mday == time_bday.tm_mday );
- VERIFY( time10.tm_year == time_bday.tm_year );
- VERIFY( errorstate == ios_base::eofbit );
-
- // inspection of named locales, en_HK
- iss.imbue(loc_hk);
- iss.str("Sunday, April 04, 1971");
- iterator_type is_it20(iss);
- tm time20;
- errorstate = good;
- tim_get.get_date(is_it20, end, iss, errorstate, &time20);
- VERIFY( time20.tm_mon == time_bday.tm_mon );
- VERIFY( time20.tm_mday == time_bday.tm_mday );
- VERIFY( time20.tm_year == time_bday.tm_year );
- VERIFY( errorstate == ios_base::eofbit );
-}
-
-void test06()
-{
- using namespace std;
- bool test = true;
-
- // Check time_get works with other iterators besides streambuf
- // input iterators.
- typedef string::const_iterator iter_type;
- typedef time_get<char, iter_type> time_get_type;
- const ios_base::iostate goodbit = ios_base::goodbit;
- const ios_base::iostate eofbit = ios_base::eofbit;
- ios_base::iostate err = goodbit;
- const locale loc_c = locale::classic();
- // Cindy Sherman's Untitled Film Stills
- // June 26-September 2, 1997
- const string str = "12:00:00 06/26/97 Tuesday September 1997 Cindy Sherman";
-
- // Create "C" time objects
- const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
- tm tm1;
-
- istringstream iss;
- iss.imbue(locale(loc_c, new time_get_type));
-
- // Iterator advanced, state, output.
- const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
-
- // 01 get_time
- // 02 get_date
- // 03 get_weekday
- // 04 get_monthname
- // 05 get_year
-
- // 01 get_time
- string res1;
- err = goodbit;
- iter_type end1 = tg.get_time(str.begin(), str.end(), iss, err, &tm1);
- string rem1(end1, str.end());
- VERIFY( err == goodbit );
- VERIFY( tm1.tm_sec == time_sanity.tm_sec );
- VERIFY( tm1.tm_min == time_sanity.tm_min );
- VERIFY( tm1.tm_hour == time_sanity.tm_hour );
- VERIFY( rem1 == " 06/26/97 Tuesday September 1997 Cindy Sherman" );
-
- // 02 get_date
- string res2;
- err = goodbit;
- // White space is not eaten, so manually increment past it.
- iter_type end2 = tg.get_date(++end1, str.end(), iss, err, &tm1);
- string rem2(end2, str.end());
- VERIFY( err == goodbit );
- VERIFY( tm1.tm_year == time_sanity.tm_year );
- VERIFY( tm1.tm_mon == time_sanity.tm_mon );
- VERIFY( tm1.tm_mday == time_sanity.tm_mday );
- VERIFY( rem2 == " Tuesday September 1997 Cindy Sherman" );
-
- // 03 get_weekday
- string res3;
- err = goodbit;
- // White space is not eaten, so manually increment past it.
- iter_type end3 = tg.get_weekday(++end2, str.end(), iss, err, &tm1);
- string rem3(end3, str.end());
- VERIFY( err == goodbit );
- VERIFY( tm1.tm_wday == time_sanity.tm_wday );
- VERIFY( rem3 == " September 1997 Cindy Sherman" );
-
- // 04 get_monthname
- string res4;
- err = goodbit;
- // White space is not eaten, so manually increment past it.
- iter_type end4 = tg.get_monthname(++end3, str.end(), iss, err, &tm1);
- string rem4(end4, str.end());
- VERIFY( err == goodbit );
- VERIFY( tm1.tm_mon == 8 );
- VERIFY( rem4 == " 1997 Cindy Sherman" );
-
- // 05 get_year
- string res5;
- err = goodbit;
- // White space is not eaten, so manually increment past it.
- iter_type end5 = tg.get_year(++end4, str.end(), iss, err, &tm1);
- string rem5(end5, str.end());
- VERIFY( err == goodbit );
- VERIFY( tm1.tm_year == time_sanity.tm_year );
- VERIFY( rem5 == " Cindy Sherman" );
-}
-
-// libstdc++/5280
-void test07()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- test02();
- test03();
- test04();
- test05();
- test06();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test08()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- test02();
- test03();
- test04();
- test05();
- test06();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-
-int main()
-{
- test01();
- test02();
- test03();
- test04();
- test05();
-
- test06();
-
- test07();
- test08();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get_members_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/time_get_members_wchar_t.cc
deleted file mode 100644
index 89efdb9fea5..00000000000
--- a/libstdc++-v3/testsuite/22_locale/time_get_members_wchar_t.cc
+++ /dev/null
@@ -1,738 +0,0 @@
-// 2001-10-02 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2001, 2002 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This 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 General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.5.1.1 time_get members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-void test01()
-{
- using namespace std;
- typedef time_base::dateorder dateorder;
- typedef istreambuf_iterator<wchar_t> iterator_type;
-
- bool test = true;
-
- // basic construction and sanity checks.
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE");
- VERIFY( loc_hk != loc_c );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
- // cache the __timepunct facets, for quicker gdb inspection
- const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
- const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
- const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
- const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
-
- const wstring empty;
-
- // create an ostream-derived object, cache the time_get facet
- iterator_type end;
-
- wistringstream iss;
- const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc());
-
- const ios_base::iostate good = ios_base::goodbit;
- ios_base::iostate errorstate = good;
-
- // create "C" time objects
- const tm time_bday = { 0, 0, 12, 4, 3, 71 };
- const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
- L"%w %W %x %X %y %Y %Z %%";
- const wchar_t* date = L"%A, the second of %B";
- const wchar_t* date_ex = L"%Ex";
-
- // 1
- // dateorder date_order() const
- iss.imbue(loc_c);
- dateorder do1 = tim_get.date_order();
- // VERIFY( do1 == time_base::mdy );
- VERIFY( do1 == time_base::no_order );
-
- // 2
- // iter_type
- // get_time(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
-
- // sanity checks for "C" locale
- iss.str(L"12:00:00");
- iterator_type is_it01(iss);
- tm time01;
- errorstate = good;
- tim_get.get_time(is_it01, end, iss, errorstate, &time01);
- VERIFY( time01.tm_sec == time_bday.tm_sec );
- VERIFY( time01.tm_min == time_bday.tm_min );
- VERIFY( time01.tm_hour == time_bday.tm_hour );
- VERIFY( errorstate == ios_base::eofbit );
-
- iss.str(L"12:00:00 ");
- iterator_type is_it02(iss);
- tm time02;
- errorstate = good;
- tim_get.get_time(is_it02, end, iss, errorstate, &time02);
- VERIFY( time01.tm_sec == time_bday.tm_sec );
- VERIFY( time01.tm_min == time_bday.tm_min );
- VERIFY( time01.tm_hour == time_bday.tm_hour );
- VERIFY( errorstate == good );
-
- iss.str(L"12:61:00 ");
- iterator_type is_it03(iss);
- tm time03;
- errorstate = good;
- tim_get.get_time(is_it03, end, iss, errorstate, &time03);
- VERIFY( time01.tm_hour == time_bday.tm_hour );
- VERIFY( errorstate == ios_base::failbit );
-
- iss.str(L"12:a:00 ");
- iterator_type is_it04(iss);
- tm time04;
- errorstate = good;
- tim_get.get_time(is_it04, end, iss, errorstate, &time04);
- VERIFY( time01.tm_hour == time_bday.tm_hour );
- VERIFY( *is_it04 == 'a');
- VERIFY( errorstate == ios_base::failbit );
-
- // inspection of named locales, de_DE
- iss.imbue(loc_de);
- iss.str(L"12:00:00");
- iterator_type is_it10(iss);
- tm time10;
- errorstate = good;
- tim_get.get_time(is_it10, end, iss, errorstate, &time10);
- VERIFY( time10.tm_sec == time_bday.tm_sec );
- VERIFY( time10.tm_min == time_bday.tm_min );
- VERIFY( time10.tm_hour == time_bday.tm_hour );
- VERIFY( errorstate == ios_base::eofbit );
-
- // inspection of named locales, en_HK
- iss.imbue(loc_hk);
- iss.str(L"12:00:00 PST");
- // Hong Kong in California! Well, they have Paris in Vegas... this
- // is all a little disney-esque anyway. Besides, you can get decent
- // Dim Sum in San Francisco.
- iterator_type is_it20(iss);
- tm time20;
- errorstate = good;
- tim_get.get_time(is_it20, end, iss, errorstate, &time20);
- VERIFY( time10.tm_sec == time_bday.tm_sec );
- VERIFY( time10.tm_min == time_bday.tm_min );
- VERIFY( time10.tm_hour == time_bday.tm_hour );
- VERIFY( errorstate == ios_base::eofbit );
-}
-
-void test02()
-{
- using namespace std;
- typedef time_base::dateorder dateorder;
- typedef istreambuf_iterator<wchar_t> iterator_type;
-
- bool test = true;
-
- // basic construction and sanity checks.
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE");
- VERIFY( loc_hk != loc_c );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the __timepunct facets, for quicker gdb inspection
- const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
- const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
- const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
- const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
-
- const wstring empty;
-
- // create an ostream-derived object, cache the time_get facet
- iterator_type end;
-
- wistringstream iss;
- const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc());
-
- const ios_base::iostate good = ios_base::goodbit;
- ios_base::iostate errorstate = good;
-
- // create "C" time objects
- const tm time_bday = { 0, 0, 12, 4, 3, 71 };
- const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
- L"%w %W %x %X %y %Y %Z %%";
- const wchar_t* date = L"%A, the second of %B";
- const wchar_t* date_ex = L"%Ex";
-
- // iter_type
- // get_weekday(iter_type, iter_type, ios_base&,
- // ios_base::iostate&, tm*) const
-
- // sanity checks for "C" locale
- iss.imbue(loc_c);
- iss.str(L"Sunday");
- iterator_type is_it01(iss);
- tm time01;
- errorstate = good;
- tim_get.get_weekday(is_it01, end, iss, errorstate, &time01);
- VERIFY( time01.tm_wday == time_bday.tm_wday );
- VERIFY( errorstate == ios_base::eofbit );
-
- iss.str(L"Sun");
- iterator_type is_it02(iss);
- tm time02;
- errorstate = good;
- tim_get.get_weekday(is_it02, end, iss, errorstate, &time02);
- VERIFY( time02.tm_wday == time_bday.tm_wday );
- VERIFY( errorstate == ios_base::eofbit );
-
- iss.str(L"Sun ");
- iterator_type is_it03(iss);
- tm time03;
- errorstate = good;
- tim_get.get_weekday(is_it03, end, iss, errorstate, &time03);
- VERIFY( time03.tm_wday == time_bday.tm_wday );
- VERIFY( errorstate == good );
- VERIFY( *is_it03 == ' ');
-
- iss.str(L"San");
- iterator_type is_it04(iss);
- tm time04;
- time04.tm_wday = 4;
- errorstate = good;
- tim_get.get_weekday(is_it04, end, iss, errorstate, &time04);
- VERIFY( time04.tm_wday == 4 );
- VERIFY( *is_it04 == 'n');
- VERIFY( errorstate == ios_base::failbit );
-
- iss.str(L"Tuesday ");
- iterator_type is_it05(iss);
- tm time05;
- errorstate = good;
- tim_get.get_weekday(is_it05, end, iss, errorstate, &time05);
- VERIFY( time05.tm_wday == 2 );
- VERIFY( errorstate == good );
- VERIFY( *is_it05 == ' ');
-
- iss.str(L"Tuesducky "); // Kind of like Fryday, without the swirls.
- iterator_type is_it06(iss);
- tm time06;
- time06.tm_wday = 4;
- errorstate = good;
- tim_get.get_weekday(is_it06, end, iss, errorstate, &time06);
- VERIFY( time06.tm_wday == 4 );
- VERIFY( errorstate == ios_base::failbit );
- VERIFY( *is_it05 == 'u');
-
- // inspection of named locales, de_DE
- iss.imbue(loc_de);
- iss.str(L"Sonntag");
- iterator_type is_it10(iss);
- tm time10;
- errorstate = good;
- tim_get.get_weekday(is_it10, end, iss, errorstate, &time10);
- VERIFY( time10.tm_wday == time_bday.tm_wday );
- VERIFY( errorstate == ios_base::eofbit );
-
- // inspection of named locales, en_HK
- iss.imbue(loc_hk);
- iss.str(L"Sunday");
- iterator_type is_it20(iss);
- tm time20;
- errorstate = good;
- tim_get.get_weekday(is_it20, end, iss, errorstate, &time20);
- VERIFY( time20.tm_wday == time_bday.tm_wday );
- VERIFY( errorstate == ios_base::eofbit );
-}
-
-void test03()
-{
- using namespace std;
- typedef time_base::dateorder dateorder;
- typedef istreambuf_iterator<wchar_t> iterator_type;
-
- bool test = true;
-
- // basic construction and sanity checks.
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE");
- VERIFY( loc_hk != loc_c );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the __timepunct facets, for quicker gdb inspection
- const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
- const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
- const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
- const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
-
- const wstring empty;
-
- // create an ostream-derived object, cache the time_get facet
- iterator_type end;
-
- wistringstream iss;
- const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc());
-
- const ios_base::iostate good = ios_base::goodbit;
- ios_base::iostate errorstate = good;
-
- // create "C" time objects
- const tm time_bday = { 0, 0, 12, 4, 3, 71 };
- const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
- L"%w %W %x %X %y %Y %Z %%";
- const wchar_t* date = L"%A, the second of %B";
- const wchar_t* date_ex = L"%Ex";
-
- // iter_type
- // get_monthname(iter_type, iter_type, ios_base&,
- // ios_base::iostate&, tm*) const
-
- // sanity checks for "C" locale
- iss.imbue(loc_c);
- iss.str(L"April");
- iterator_type is_it01(iss);
- tm time01;
- errorstate = good;
- tim_get.get_monthname(is_it01, end, iss, errorstate, &time01);
- VERIFY( time01.tm_wday == time_bday.tm_wday );
- VERIFY( errorstate == ios_base::eofbit );
-
- iss.str(L"Apr");
- iterator_type is_it02(iss);
- tm time02;
- errorstate = good;
- tim_get.get_monthname(is_it02, end, iss, errorstate, &time02);
- VERIFY( time02.tm_mon == time_bday.tm_mon );
- VERIFY( errorstate == ios_base::eofbit );
-
- iss.str(L"Apr ");
- iterator_type is_it03(iss);
- tm time03;
- errorstate = good;
- tim_get.get_monthname(is_it03, end, iss, errorstate, &time03);
- VERIFY( time03.tm_mon == time_bday.tm_mon );
- VERIFY( errorstate == good );
- VERIFY( *is_it03 == ' ');
-
- iss.str(L"Aar");
- iterator_type is_it04(iss);
- tm time04;
- time04.tm_mon = 5;
- errorstate = good;
- tim_get.get_monthname(is_it04, end, iss, errorstate, &time04);
- VERIFY( time04.tm_mon == 5 );
- VERIFY( *is_it04 == 'a');
- VERIFY( errorstate == ios_base::failbit );
-
- iss.str(L"December ");
- iterator_type is_it05(iss);
- tm time05;
- errorstate = good;
- tim_get.get_monthname(is_it05, end, iss, errorstate, &time05);
- VERIFY( time05.tm_mon == 11 );
- VERIFY( errorstate == good );
- VERIFY( *is_it05 == ' ');
-
- iss.str(L"Decelember ");
- iterator_type is_it06(iss);
- tm time06;
- time06.tm_mon = 4;
- errorstate = good;
- tim_get.get_monthname(is_it06, end, iss, errorstate, &time06);
- VERIFY( time06.tm_mon == 4 );
- VERIFY( errorstate == ios_base::failbit );
- VERIFY( *is_it05 == 'l');
-
- // inspection of named locales, de_DE
- iss.imbue(loc_de);
- iss.str(L"April");
- iterator_type is_it10(iss);
- tm time10;
- errorstate = good;
- tim_get.get_monthname(is_it10, end, iss, errorstate, &time10);
- VERIFY( time10.tm_mon == time_bday.tm_mon );
- VERIFY( errorstate == ios_base::eofbit );
-
- // inspection of named locales, en_HK
- iss.imbue(loc_hk);
- iss.str(L"April");
- iterator_type is_it20(iss);
- tm time20;
- errorstate = good;
- tim_get.get_monthname(is_it20, end, iss, errorstate, &time20);
- VERIFY( time20.tm_mon == time_bday.tm_mon );
- VERIFY( errorstate == ios_base::eofbit );
-}
-
-void test04()
-{
- using namespace std;
- typedef time_base::dateorder dateorder;
- typedef istreambuf_iterator<wchar_t> iterator_type;
-
- bool test = true;
-
- // basic construction and sanity checks.
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE");
- VERIFY( loc_hk != loc_c );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the __timepunct facets, for quicker gdb inspection
- const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
- const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
- const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
- const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
-
- const wstring empty;
-
- // create an ostream-derived object, cache the time_get facet
- iterator_type end;
-
- wistringstream iss;
- const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc());
-
- const ios_base::iostate good = ios_base::goodbit;
- ios_base::iostate errorstate = good;
-
- // create "C" time objects
- const tm time_bday = { 0, 0, 12, 4, 3, 71 };
- const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
- L"%w %W %x %X %y %Y %Z %%";
- const wchar_t* date = L"%A, the second of %B";
- const wchar_t* date_ex = L"%Ex";
-
- // iter_type
- // get_year(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
-
- // sanity checks for "C" locale
- iss.imbue(loc_c);
- iss.str(L"1971");
- iterator_type is_it01(iss);
- tm time01;
- errorstate = good;
- tim_get.get_year(is_it01, end, iss, errorstate, &time01);
- VERIFY( time01.tm_year == time_bday.tm_year );
- VERIFY( errorstate == ios_base::eofbit );
-
- iss.str(L"1971 ");
- iterator_type is_it02(iss);
- tm time02;
- errorstate = good;
- tim_get.get_year(is_it02, end, iss, errorstate, &time02);
- VERIFY( time02.tm_year == time_bday.tm_year );
- VERIFY( errorstate == good );
- VERIFY( *is_it02 == ' ');
-
- iss.str(L"197d1 ");
- iterator_type is_it03(iss);
- tm time03;
- time03.tm_year = 3;
- errorstate = good;
- tim_get.get_year(is_it03, end, iss, errorstate, &time03);
- VERIFY( time03.tm_year == 3 );
- VERIFY( errorstate == ios_base::failbit );
- VERIFY( *is_it03 == 'd');
-
- iss.str(L"71d71");
- iterator_type is_it04(iss);
- tm time04;
- errorstate = good;
- tim_get.get_year(is_it04, end, iss, errorstate, &time04);
- VERIFY( time04.tm_year == time_bday.tm_year );
- VERIFY( errorstate == good );
- VERIFY( *is_it03 == 'd');
-
- iss.str(L"71");
- iterator_type is_it05(iss);
- tm time05;
- errorstate = good;
- tim_get.get_year(is_it05, end, iss, errorstate, &time05);
- VERIFY( time05.tm_year == time_bday.tm_year );
- VERIFY( errorstate == ios_base::eofbit );
-}
-
-void test05()
-{
- using namespace std;
- typedef time_base::dateorder dateorder;
- typedef istreambuf_iterator<wchar_t> iterator_type;
-
- bool test = true;
-
- // basic construction and sanity checks.
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE");
- VERIFY( loc_hk != loc_c );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the __timepunct facets, for quicker gdb inspection
- const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
- const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
- const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
- const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
-
- const wstring empty;
-
- // create an ostream-derived object, cache the time_get facet
- iterator_type end;
-
- wistringstream iss;
- const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc());
-
- const ios_base::iostate good = ios_base::goodbit;
- ios_base::iostate errorstate = good;
-
- // create "C" time objects
- const tm time_bday = { 0, 0, 12, 4, 3, 71 };
- const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
- L"%w %W %x %X %y %Y %Z %%";
- const wchar_t* date = L"%A, the second of %B";
- const wchar_t* date_ex = L"%Ex";
-
- // iter_type
- // get_date(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
-
- // sanity checks for "C" locale
- iss.imbue(loc_c);
- iss.str(L"04/04/71");
- iterator_type is_it01(iss);
- tm time01;
- errorstate = good;
- tim_get.get_date(is_it01, end, iss, errorstate, &time01);
- VERIFY( time01.tm_year == time_bday.tm_year );
- VERIFY( time01.tm_mon == time_bday.tm_mon );
- VERIFY( time01.tm_mday == time_bday.tm_mday );
- VERIFY( errorstate == ios_base::eofbit );
-
- iss.str(L"04/04/71 ");
- iterator_type is_it02(iss);
- tm time02;
- errorstate = good;
- tim_get.get_date(is_it02, end, iss, errorstate, &time02);
- VERIFY( time02.tm_year == time_bday.tm_year );
- VERIFY( time02.tm_mon == time_bday.tm_mon );
- VERIFY( time02.tm_mday == time_bday.tm_mday );
- VERIFY( errorstate == good );
- VERIFY( *is_it02 == ' ');
-
- iss.str(L"04/04d/71 ");
- iterator_type is_it03(iss);
- tm time03;
- time03.tm_year = 3;
- errorstate = good;
- tim_get.get_date(is_it03, end, iss, errorstate, &time03);
- VERIFY( time03.tm_year == 3 );
- VERIFY( time03.tm_mon == time_bday.tm_mon );
- VERIFY( time03.tm_mday == time_bday.tm_mday );
- VERIFY( errorstate == ios_base::failbit );
- VERIFY( *is_it03 == 'd');
-
- // inspection of named locales, de_DE
- iss.imbue(loc_de);
- iss.str(L"04.04.1971");
- iterator_type is_it10(iss);
- tm time10;
- errorstate = good;
- tim_get.get_date(is_it10, end, iss, errorstate, &time10);
- VERIFY( time10.tm_mon == time_bday.tm_mon );
- VERIFY( time10.tm_mday == time_bday.tm_mday );
- VERIFY( time10.tm_year == time_bday.tm_year );
- VERIFY( errorstate == ios_base::eofbit );
-
- // inspection of named locales, en_HK
- iss.imbue(loc_hk);
- iss.str(L"Sunday, April 04, 1971");
- iterator_type is_it20(iss);
- tm time20;
- errorstate = good;
- tim_get.get_date(is_it20, end, iss, errorstate, &time20);
- VERIFY( time20.tm_mon == time_bday.tm_mon );
- VERIFY( time20.tm_mday == time_bday.tm_mday );
- VERIFY( time20.tm_year == time_bday.tm_year );
- VERIFY( errorstate == ios_base::eofbit );
-}
-
-void test06()
-{
- using namespace std;
- bool test = true;
-
- // Check time_get works with other iterators besides streambuf
- // input iterators.
- typedef wstring::const_iterator iter_type;
- typedef time_get<wchar_t, iter_type> time_get_type;
- const ios_base::iostate goodbit = ios_base::goodbit;
- const ios_base::iostate eofbit = ios_base::eofbit;
- ios_base::iostate err = goodbit;
- const locale loc_c = locale::classic();
- // Cindy Sherman's Untitled Film Stills
- // June 26-September 2, 1997
- const wstring str = L"12:00:00 06/26/97 Tuesday September 1997 Cindy Sherman";
-
- // Create "C" time objects
- const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
- tm tm1;
-
- wistringstream iss;
- iss.imbue(locale(loc_c, new time_get_type));
-
- // Iterator advanced, state, output.
- const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
-
- // 01 get_time
- // 02 get_date
- // 03 get_weekday
- // 04 get_monthname
- // 05 get_year
-
- // 01 get_time
- wstring res1;
- err = goodbit;
- iter_type end1 = tg.get_time(str.begin(), str.end(), iss, err, &tm1);
- wstring rem1(end1, str.end());
- VERIFY( err == goodbit );
- VERIFY( tm1.tm_sec == time_sanity.tm_sec );
- VERIFY( tm1.tm_min == time_sanity.tm_min );
- VERIFY( tm1.tm_hour == time_sanity.tm_hour );
- VERIFY( rem1 == L" 06/26/97 Tuesday September 1997 Cindy Sherman" );
-
- // 02 get_date
- wstring res2;
- err = goodbit;
- // White space is not eaten, so manually increment past it.
- iter_type end2 = tg.get_date(++end1, str.end(), iss, err, &tm1);
- wstring rem2(end2, str.end());
- VERIFY( err == goodbit );
- VERIFY( tm1.tm_year == time_sanity.tm_year );
- VERIFY( tm1.tm_mon == time_sanity.tm_mon );
- VERIFY( tm1.tm_mday == time_sanity.tm_mday );
- VERIFY( rem2 == L" Tuesday September 1997 Cindy Sherman" );
-
- // 03 get_weekday
- wstring res3;
- err = goodbit;
- // White space is not eaten, so manually increment past it.
- iter_type end3 = tg.get_weekday(++end2, str.end(), iss, err, &tm1);
- wstring rem3(end3, str.end());
- VERIFY( err == goodbit );
- VERIFY( tm1.tm_wday == time_sanity.tm_wday );
- VERIFY( rem3 == L" September 1997 Cindy Sherman" );
-
- // 04 get_monthname
- wstring res4;
- err = goodbit;
- // White space is not eaten, so manually increment past it.
- iter_type end4 = tg.get_monthname(++end3, str.end(), iss, err, &tm1);
- wstring rem4(end4, str.end());
- VERIFY( err == goodbit );
- VERIFY( tm1.tm_mon == 8 );
- VERIFY( rem4 == L" 1997 Cindy Sherman" );
-
- // 05 get_year
- wstring res5;
- err = goodbit;
- // White space is not eaten, so manually increment past it.
- iter_type end5 = tg.get_year(++end4, str.end(), iss, err, &tm1);
- wstring rem5(end5, str.end());
- VERIFY( err == goodbit );
- VERIFY( tm1.tm_year == time_sanity.tm_year );
- VERIFY( rem5 == L" Cindy Sherman" );
-}
-
-// libstdc++/5280
-void test07()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- test02();
- test03();
- test04();
- test05();
- test06();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test08()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- test02();
- test03();
- test04();
- test05();
- test06();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-#endif
-
-int main()
-{
-#ifdef _GLIBCPP_USE_WCHAR_T
- test01();
- test02();
- test03();
- test04();
- test05();
-
- test06();
-
- test07();
- test08();
-#endif
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put.cc b/libstdc++-v3/testsuite/22_locale/time_put/1.cc
index 8ca284afdf0..a1ce9ac60fa 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/1.cc
@@ -1,6 +1,7 @@
+// { dg-do compile }
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001 Free Software Foundation
+// Copyright (C) 2001, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -20,8 +21,6 @@
// 22.2.5.3 Template class time_put
-// { dg-do compile }
-
#include <locale>
void test01()
@@ -37,18 +36,8 @@ void test01()
typedef test_type::iter_type iter_type;
}
-// Should be able to instantiate this for other types besides char, wchar_t
-class gnu_time_put: public std::time_put<unsigned char>
-{ };
-
-void test02()
-{
- gnu_time_put facet01;
-}
-
int main()
{
test01();
- test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/2.cc b/libstdc++-v3/testsuite/22_locale/time_put/2.cc
new file mode 100644
index 00000000000..84761bf2090
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/2.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3 Template class time_put
+
+#include <locale>
+
+// Should be able to instantiate this for other types besides char, wchar_t
+class gnu_time_put: public std::time_put<unsigned char>
+{ };
+
+void test02()
+{
+ gnu_time_put facet01;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc
new file mode 100644
index 00000000000..e384319299a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc
@@ -0,0 +1,90 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // create "C" time objects
+ tm time1 = { 0, 0, 12, 4, 3, 71 };
+ const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ "%w %W %x %X %y %Y %Z %%";
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ // create an ostream-derived object, cache the time_put facet
+ const string empty;
+ ostringstream oss;
+ oss.imbue(loc_c);
+ const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
+
+ // 1
+ // iter_type
+ // put(iter_type s, ios_base& str, char_type fill, const tm* t,
+ // char format, char modifier = 0) const;
+ oss.str(empty);
+ iterator_type os_it01 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
+ string result1 = oss.str();
+ VERIFY( result1 == "Sun" );
+
+ oss.str(empty);
+ iterator_type os_it21 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
+ string result21 = oss.str(); // "04/04/71"
+ oss.str(empty);
+ iterator_type os_it22 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
+ string result22 = oss.str(); // "12:00:00"
+ oss.str(empty);
+ iterator_type os_it31 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
+ string result31 = oss.str(); // "04/04/71"
+ oss.str(empty);
+ iterator_type os_it32 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
+ string result32 = oss.str(); // "12:00:00"
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/10.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/10.cc
new file mode 100644
index 00000000000..82d00538ed8
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/10.cc
@@ -0,0 +1,63 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test10()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check time_put works with other iterators besides streambuf
+ // output iterators. (As long as output_iterator requirements are met.)
+ typedef string::iterator iter_type;
+ typedef char_traits<char> traits;
+ typedef time_put<char, iter_type> time_put_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+ const string x(50, 'x'); // have to have allocated string!
+ string res;
+ const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
+ const char* date = "%X, %A, the second of %B, %Y";
+
+ ostringstream oss;
+ oss.imbue(locale(loc_c, new time_put_type));
+ const time_put_type& tp = use_facet<time_put_type>(oss.getloc());
+
+ // 02 char format
+ res = x;
+ iter_type ret2 = tp.put(res.begin(), oss, ' ', &time_sanity, 'A');
+ string sanity2(res.begin(), ret2);
+ VERIFY( err == goodbit );
+ VERIFY( res == "Tuesdayxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" );
+ VERIFY( sanity2 == "Tuesday" );
+}
+
+int main()
+{
+ test10();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/2.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/2.cc
new file mode 100644
index 00000000000..e3a88b55ece
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/2.cc
@@ -0,0 +1,85 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // create "C" time objects
+ tm time1 = { 0, 0, 12, 4, 3, 71 };
+ const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ "%w %W %x %X %y %Y %Z %%";
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ // create an ostream-derived object, cache the time_put facet
+ const string empty;
+ ostringstream oss;
+ oss.imbue(loc_de);
+ const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
+
+ iterator_type os_it02 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
+ string result2 = oss.str();
+ VERIFY( result2 == "Son" );
+
+ oss.str(empty); // "%d.%m.%Y"
+ iterator_type os_it23 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
+ string result23 = oss.str(); // "04.04.1971"
+ oss.str(empty); // "%T"
+ iterator_type os_it24 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
+ string result24 = oss.str(); // "12:00:00"
+ oss.str(empty);
+ iterator_type os_it33 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
+ string result33 = oss.str(); // "04.04.1971"
+ oss.str(empty);
+ iterator_type os_it34 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
+ string result34 = oss.str(); // "12:00:00"
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/3.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/3.cc
new file mode 100644
index 00000000000..8354897e6c9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/3.cc
@@ -0,0 +1,85 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // create "C" time objects
+ tm time1 = { 0, 0, 12, 4, 3, 71 };
+ const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ "%w %W %x %X %y %Y %Z %%";
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ // create an ostream-derived object, cache the time_put facet
+ const string empty;
+ ostringstream oss;
+ oss.imbue(loc_hk);
+ const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
+
+ iterator_type os_it03 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
+ string result3 = oss.str();
+ VERIFY( result3 == "Sun" );
+
+ oss.str(empty); // "%A, %B %d, %Y"
+ iterator_type os_it25 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
+ string result25 = oss.str(); // "Sunday, April 04, 1971"
+ oss.str(empty); // "%I:%M:%S %Z"
+ iterator_type os_it26 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
+ string result26 = oss.str(); // "12:00:00 PST"
+ oss.str(empty);
+ iterator_type os_it35 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
+ string result35 = oss.str(); // "Sunday, April 04, 1971"
+ oss.str(empty);
+ iterator_type os_it36 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
+ string result36 = oss.str(); // "12:00:00 PST"
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/4.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/4.cc
new file mode 100644
index 00000000000..ef59dc2679d
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/4.cc
@@ -0,0 +1,84 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test04()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+
+ bool test = true;
+
+ // create "C" time objects
+ tm time1 = { 0, 0, 12, 4, 3, 71 };
+ const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ "%w %W %x %X %y %Y %Z %%";
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ // create an ostream-derived object, cache the time_put facet
+ const string empty;
+ ostringstream oss;
+ oss.imbue(loc_fr);
+ const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
+ iterator_type os_it04 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
+ string result4 = oss.str();
+ VERIFY( result4 == "dim" );
+
+ oss.str(empty); // "%d.%m.%Y"
+ iterator_type os_it27 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
+ string result27 = oss.str(); // "04.04.1971"
+ oss.str(empty); // "%T"
+ iterator_type os_it28 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
+ string result28 = oss.str(); // "12:00:00"
+ oss.str(empty);
+ iterator_type os_it37 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
+ string result37 = oss.str(); // "04.04.1971"
+ oss.str(empty);
+ iterator_type os_it38 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
+ string result38 = oss.str(); // "12:00:00"
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc
new file mode 100644
index 00000000000..dde913f58bf
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc
@@ -0,0 +1,80 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test05()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+ typedef char_traits<char> traits;
+
+ bool test = true;
+
+ // create "C" time objects
+ tm time1 = { 0, 0, 12, 4, 3, 71 };
+ const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ "%w %W %x %X %y %Y %Z %%";
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ // create an ostream-derived object, cache the time_put facet
+ const string empty;
+ ostringstream oss;
+ oss.imbue(loc_c);
+ const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
+
+ // 2
+ oss.str(empty);
+ iterator_type os_it05 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date, date + traits::length(date));
+ string result5 = oss.str();
+ VERIFY( result5 == "Sunday, the second of April");
+ iterator_type os_it06 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date_ex, date_ex + traits::length(date));
+ string result6 = oss.str();
+ VERIFY( result6 != result5 );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc
new file mode 100644
index 00000000000..1cec95f0bab
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc
@@ -0,0 +1,78 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test06()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+ typedef char_traits<char> traits;
+
+ bool test = true;
+
+ // create "C" time objects
+ tm time1 = { 0, 0, 12, 4, 3, 71 };
+ const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ "%w %W %x %X %y %Y %Z %%";
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ // create an ostream-derived object, cache the time_put facet
+ const string empty;
+ ostringstream oss;
+ oss.imbue(loc_de);
+ const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
+
+ iterator_type os_it07 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date, date + traits::length(date));
+ string result7 = oss.str();
+ VERIFY( result7 == "Sonntag, the second of April");
+ iterator_type os_it08 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date_ex, date_ex + traits::length(date));
+ string result8 = oss.str();
+ VERIFY( result8 != result7 );
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc
new file mode 100644
index 00000000000..931c6e060a8
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc
@@ -0,0 +1,79 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test07()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+ typedef char_traits<char> traits;
+
+ bool test = true;
+
+ // create "C" time objects
+ tm time1 = { 0, 0, 12, 4, 3, 71 };
+ const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ "%w %W %x %X %y %Y %Z %%";
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ // create an ostream-derived object, cache the time_put facet
+ const string empty;
+ ostringstream oss;
+ oss.imbue(loc_hk);
+ const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
+
+ iterator_type os_it09 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date, date + traits::length(date));
+ string result9 = oss.str();
+ VERIFY( result9 == "Sunday, the second of April");
+ iterator_type os_it10 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date_ex, date_ex + traits::length(date));
+ string result10 = oss.str();
+ VERIFY( result10 != result9 );
+}
+
+int main()
+{
+ test07();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc
new file mode 100644
index 00000000000..4d801f38b72
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc
@@ -0,0 +1,77 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test08()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+ typedef char_traits<char> traits;
+
+ bool test = true;
+
+ // create "C" time objects
+ tm time1 = { 0, 0, 12, 4, 3, 71 };
+ const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ "%w %W %x %X %y %Y %Z %%";
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
+ const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
+ const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
+ const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
+
+ // create an ostream-derived object, cache the time_put facet
+ const string empty;
+ ostringstream oss;
+ oss.imbue(loc_fr);
+ const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
+ iterator_type os_it11 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date, date + traits::length(date));
+ string result11 = oss.str();
+ VERIFY( result11 == "dimanche, the second of avril");
+ iterator_type os_it12 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date_ex, date_ex + traits::length(date));
+ string result12 = oss.str();
+ VERIFY( result12 != result11 );
+}
+
+int main()
+{
+ test08();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/9.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/9.cc
new file mode 100644
index 00000000000..42cfb34b053
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/9.cc
@@ -0,0 +1,64 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test09()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check time_put works with other iterators besides streambuf
+ // output iterators. (As long as output_iterator requirements are met.)
+ typedef string::iterator iter_type;
+ typedef char_traits<char> traits;
+ typedef time_put<char, iter_type> time_put_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+ const string x(50, 'x'); // have to have allocated string!
+ string res;
+ const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
+ const char* date = "%X, %A, the second of %B, %Y";
+
+ ostringstream oss;
+ oss.imbue(locale(loc_c, new time_put_type));
+ const time_put_type& tp = use_facet<time_put_type>(oss.getloc());
+
+ // 01 date format
+ res = x;
+ iter_type ret1 = tp.put(res.begin(), oss, ' ', &time_sanity,
+ date, date + traits::length(date));
+ string sanity1(res.begin(), ret1);
+ VERIFY( err == goodbit );
+ VERIFY( res == "12:00:00, Tuesday, the second of June, 1997xxxxxxx" );
+ VERIFY( sanity1 == "12:00:00, Tuesday, the second of June, 1997" );
+}
+
+int main()
+{
+ test09();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_env.cc
new file mode 100644
index 00000000000..bcf68e986ba
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_env.cc
@@ -0,0 +1,81 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+#define main discard_main_7
+#include "7.cc"
+#undef main
+
+#define main discard_main_8
+#include "8.cc"
+#undef main
+
+#define main discard_main_9
+#include "9.cc"
+#undef main
+
+#define main discard_main_10
+#include "10.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ two.push_back(&test07);
+ two.push_back(&test08);
+ two.push_back(&test09);
+ two.push_back(&test10);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_locale.cc
new file mode 100644
index 00000000000..465af45016e
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_locale.cc
@@ -0,0 +1,81 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+#define main discard_main_7
+#include "7.cc"
+#undef main
+
+#define main discard_main_8
+#include "8.cc"
+#undef main
+
+#define main discard_main_9
+#include "9.cc"
+#undef main
+
+#define main discard_main_10
+#include "10.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ two.push_back(&test07);
+ two.push_back(&test08);
+ two.push_back(&test09);
+ two.push_back(&test10);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/1.cc
new file mode 100644
index 00000000000..914b187d46b
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/1.cc
@@ -0,0 +1,90 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // create "C" time objects
+ tm time1 = { 0, 0, 12, 4, 3, 71 };
+ const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ L"%w %W %x %X %y %Y %Z %%";
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ // create an ostream-derived object, cache the time_put facet
+ const wstring empty;
+ wostringstream oss;
+ oss.imbue(loc_c);
+ const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
+
+ // 1
+ // iter_type
+ // put(iter_type s, ios_base& str, char_type fill, const tm* t,
+ // char format, char modifier = 0) const;
+ oss.str(empty);
+ iterator_type os_it01 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
+ wstring result1 = oss.str();
+ VERIFY( result1 == L"Sun" );
+
+ oss.str(empty);
+ iterator_type os_it21 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
+ wstring result21 = oss.str(); // "04/04/71"
+ oss.str(empty);
+ iterator_type os_it22 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
+ wstring result22 = oss.str(); // "12:00:00"
+ oss.str(empty);
+ iterator_type os_it31 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
+ wstring result31 = oss.str(); // "04/04/71"
+ oss.str(empty);
+ iterator_type os_it32 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
+ wstring result32 = oss.str(); // "12:00:00"
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/10.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/10.cc
new file mode 100644
index 00000000000..9cd5db73a5f
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/10.cc
@@ -0,0 +1,63 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test10()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check time_put works with other iterators besides streambuf
+ // output iterators. (As long as output_iterator requirements are met.)
+ typedef wstring::iterator iter_type;
+ typedef char_traits<wchar_t> traits;
+ typedef time_put<wchar_t, iter_type> time_put_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+ const wstring x(50, 'x'); // have to have allocated wstring!
+ wstring res;
+ const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
+ const wchar_t* date = L"%X, %A, the second of %B, %Y";
+
+ wostringstream oss;
+ oss.imbue(locale(loc_c, new time_put_type));
+ const time_put_type& tp = use_facet<time_put_type>(oss.getloc());
+
+ // 02 char format
+ res = x;
+ iter_type ret2 = tp.put(res.begin(), oss, ' ', &time_sanity, 'A');
+ wstring sanity2(res.begin(), ret2);
+ VERIFY( err == goodbit );
+ VERIFY( res == L"Tuesdayxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" );
+ VERIFY( sanity2 == L"Tuesday" );
+}
+
+int main()
+{
+ test10();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/2.cc
new file mode 100644
index 00000000000..bddb23f52d8
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/2.cc
@@ -0,0 +1,85 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // create "C" time objects
+ tm time1 = { 0, 0, 12, 4, 3, 71 };
+ const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ L"%w %W %x %X %y %Y %Z %%";
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ // create an ostream-derived object, cache the time_put facet
+ const wstring empty;
+ wostringstream oss;
+ oss.imbue(loc_de);
+ const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
+
+ iterator_type os_it02 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
+ wstring result2 = oss.str();
+ VERIFY( result2 == L"Son" );
+
+ oss.str(empty); // "%d.%m.%Y"
+ iterator_type os_it23 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
+ wstring result23 = oss.str(); // "04.04.1971"
+ oss.str(empty); // "%T"
+ iterator_type os_it24 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
+ wstring result24 = oss.str(); // "12:00:00"
+ oss.str(empty);
+ iterator_type os_it33 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
+ wstring result33 = oss.str(); // "04.04.1971"
+ oss.str(empty);
+ iterator_type os_it34 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
+ wstring result34 = oss.str(); // "12:00:00"
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/3.cc
new file mode 100644
index 00000000000..566a3a57ca4
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/3.cc
@@ -0,0 +1,85 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // create "C" time objects
+ tm time1 = { 0, 0, 12, 4, 3, 71 };
+ const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ L"%w %W %x %X %y %Y %Z %%";
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ // create an ostream-derived object, cache the time_put facet
+ const wstring empty;
+ wostringstream oss;
+ oss.imbue(loc_hk);
+ const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
+
+ iterator_type os_it03 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
+ wstring result3 = oss.str();
+ VERIFY( result3 == L"Sun" );
+
+ oss.str(empty); // "%A, %B %d, %Y"
+ iterator_type os_it25 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
+ wstring result25 = oss.str(); // "Sunday, April 04, 1971"
+ oss.str(empty); // "%I:%M:%S %Z"
+ iterator_type os_it26 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
+ wstring result26 = oss.str(); // "12:00:00 PST"
+ oss.str(empty);
+ iterator_type os_it35 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
+ wstring result35 = oss.str(); // "Sunday, April 04, 1971"
+ oss.str(empty);
+ iterator_type os_it36 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
+ wstring result36 = oss.str(); // "12:00:00 PST"
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/4.cc
new file mode 100644
index 00000000000..88d3b04239f
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/4.cc
@@ -0,0 +1,84 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test04()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+
+ bool test = true;
+
+ // create "C" time objects
+ tm time1 = { 0, 0, 12, 4, 3, 71 };
+ const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ L"%w %W %x %X %y %Y %Z %%";
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ // create an ostream-derived object, cache the time_put facet
+ const wstring empty;
+ wostringstream oss;
+ oss.imbue(loc_fr);
+ const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
+ iterator_type os_it04 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
+ wstring result4 = oss.str();
+ VERIFY( result4 == L"dim" );
+
+ oss.str(empty); // "%d.%m.%Y"
+ iterator_type os_it27 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
+ wstring result27 = oss.str(); // "04.04.1971"
+ oss.str(empty); // "%T"
+ iterator_type os_it28 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
+ wstring result28 = oss.str(); // "12:00:00"
+ oss.str(empty);
+ iterator_type os_it37 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
+ wstring result37 = oss.str(); // "04.04.1971"
+ oss.str(empty);
+ iterator_type os_it38 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
+ wstring result38 = oss.str(); // "12:00:00"
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc
new file mode 100644
index 00000000000..ac53243b339
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc
@@ -0,0 +1,80 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test05()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+ typedef char_traits<wchar_t> traits;
+
+ bool test = true;
+
+ // create "C" time objects
+ tm time1 = { 0, 0, 12, 4, 3, 71 };
+ const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ L"%w %W %x %X %y %Y %Z %%";
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ // create an ostream-derived object, cache the time_put facet
+ const wstring empty;
+ wostringstream oss;
+ oss.imbue(loc_c);
+ const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
+
+ // 2
+ oss.str(empty);
+ iterator_type os_it05 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date, date + traits::length(date));
+ wstring result5 = oss.str();
+ VERIFY( result5 == L"Sunday, the second of April");
+ iterator_type os_it06 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date_ex, date_ex + traits::length(date));
+ wstring result6 = oss.str();
+ VERIFY( result6 != result5 );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/6.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/6.cc
new file mode 100644
index 00000000000..0f5855510a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/6.cc
@@ -0,0 +1,78 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test06()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+ typedef char_traits<wchar_t> traits;
+
+ bool test = true;
+
+ // create "C" time objects
+ tm time1 = { 0, 0, 12, 4, 3, 71 };
+ const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ L"%w %W %x %X %y %Y %Z %%";
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ // create an ostream-derived object, cache the time_put facet
+ const wstring empty;
+ wostringstream oss;
+ oss.imbue(loc_de);
+ const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
+
+ iterator_type os_it07 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date, date + traits::length(date));
+ wstring result7 = oss.str();
+ VERIFY( result7 == L"Sonntag, the second of April");
+ iterator_type os_it08 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date_ex, date_ex + traits::length(date));
+ wstring result8 = oss.str();
+ VERIFY( result8 != result7 );
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/7.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/7.cc
new file mode 100644
index 00000000000..44a86ac80c8
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/7.cc
@@ -0,0 +1,78 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test07()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+ typedef char_traits<wchar_t> traits;
+
+ bool test = true;
+
+ // create "C" time objects
+ tm time1 = { 0, 0, 12, 4, 3, 71 };
+ const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ L"%w %W %x %X %y %Y %Z %%";
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ // create an ostream-derived object, cache the time_put facet
+ const wstring empty;
+ wostringstream oss;
+ oss.imbue(loc_hk);
+ const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
+
+ iterator_type os_it09 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date, date + traits::length(date));
+ wstring result9 = oss.str();
+ VERIFY( result9 == L"Sunday, the second of April");
+ iterator_type os_it10 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date_ex, date_ex + traits::length(date));
+ wstring result10 = oss.str();
+ VERIFY( result10 != result9 );
+}
+
+int main()
+{
+ test07();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/8.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/8.cc
new file mode 100644
index 00000000000..900dc1328e6
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/8.cc
@@ -0,0 +1,77 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test08()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+ typedef char_traits<wchar_t> traits;
+
+ bool test = true;
+
+ // create "C" time objects
+ tm time1 = { 0, 0, 12, 4, 3, 71 };
+ const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
+ L"%w %W %x %X %y %Y %Z %%";
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk("en_HK");
+ locale loc_fr("fr_FR@euro");
+ locale loc_de("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_fr );
+ VERIFY( loc_hk != loc_de );
+ VERIFY( loc_de != loc_fr );
+
+ // cache the __timepunct facets, for quicker gdb inspection
+ const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
+ const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
+ const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
+ const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
+
+ // create an ostream-derived object, cache the time_put facet
+ const wstring empty;
+ wostringstream oss;
+ oss.imbue(loc_fr);
+ const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
+ iterator_type os_it11 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date, date + traits::length(date));
+ wstring result11 = oss.str();
+ VERIFY( result11 == L"dimanche, the second of avril");
+ iterator_type os_it12 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date_ex, date_ex + traits::length(date));
+ wstring result12 = oss.str();
+ VERIFY( result12 != result11 );
+}
+
+int main()
+{
+ test08();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/9.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/9.cc
new file mode 100644
index 00000000000..072e4c38e02
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/9.cc
@@ -0,0 +1,64 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test09()
+{
+ using namespace std;
+ bool test = true;
+
+ // Check time_put works with other iterators besides streambuf
+ // output iterators. (As long as output_iterator requirements are met.)
+ typedef wstring::iterator iter_type;
+ typedef char_traits<wchar_t> traits;
+ typedef time_put<wchar_t, iter_type> time_put_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+ const wstring x(50, L'x'); // have to have allocated wstring!
+ wstring res;
+ const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
+ const wchar_t* date = L"%X, %A, the second of %B, %Y";
+
+ wostringstream oss;
+ oss.imbue(locale(loc_c, new time_put_type));
+ const time_put_type& tp = use_facet<time_put_type>(oss.getloc());
+
+ // 01 date format
+ res = x;
+ iter_type ret1 = tp.put(res.begin(), oss, L' ', &time_sanity,
+ date, date + traits::length(date));
+ wstring sanity1(res.begin(), ret1);
+ VERIFY( err == goodbit );
+ VERIFY( res == L"12:00:00, Tuesday, the second of June, 1997xxxxxxx" );
+ VERIFY( sanity1 == L"12:00:00, Tuesday, the second of June, 1997" );
+}
+
+int main()
+{
+ test09();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_env.cc
new file mode 100644
index 00000000000..bcf68e986ba
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_env.cc
@@ -0,0 +1,81 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+#define main discard_main_7
+#include "7.cc"
+#undef main
+
+#define main discard_main_8
+#include "8.cc"
+#undef main
+
+#define main discard_main_9
+#include "9.cc"
+#undef main
+
+#define main discard_main_10
+#include "10.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ two.push_back(&test07);
+ two.push_back(&test08);
+ two.push_back(&test09);
+ two.push_back(&test10);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_locale.cc
new file mode 100644
index 00000000000..465af45016e
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_locale.cc
@@ -0,0 +1,81 @@
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+#define main discard_main_7
+#include "7.cc"
+#undef main
+
+#define main discard_main_8
+#include "8.cc"
+#undef main
+
+#define main discard_main_9
+#include "9.cc"
+#undef main
+
+#define main discard_main_10
+#include "10.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_cxx_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ two.push_back(&test07);
+ two.push_back(&test08);
+ two.push_back(&test09);
+ two.push_back(&test10);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put_members_char.cc b/libstdc++-v3/testsuite/22_locale/time_put_members_char.cc
deleted file mode 100644
index c657706f714..00000000000
--- a/libstdc++-v3/testsuite/22_locale/time_put_members_char.cc
+++ /dev/null
@@ -1,276 +0,0 @@
-// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2001, 2002 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This 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 General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.5.3.1 time_put members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-void test01()
-{
- using namespace std;
- typedef ostreambuf_iterator<char> iterator_type;
-
- bool test = true;
-
- // basic construction and sanity checks.
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE");
- VERIFY( loc_hk != loc_c );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the __timepunct facets, for quicker gdb inspection
- const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
- const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
- const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
- const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
-
- // create an ostream-derived object, cache the time_put facet
- const string empty;
- ostringstream oss;
- const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
-
- // create "C" time objects
- tm time1 = { 0, 0, 12, 4, 3, 71 };
- const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
- "%w %W %x %X %y %Y %Z %%";
- const char* date = "%A, the second of %B";
- const char* date_ex = "%Ex";
-
- // 1
- // iter_type
- // put(iter_type s, ios_base& str, char_type fill, const tm* t,
- // char format, char modifier = 0) const;
- oss.str(empty);
- oss.imbue(loc_c);
- iterator_type os_it01 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
- string result1 = oss.str();
- VERIFY( result1 == "Sun" );
-
- oss.str(empty);
- iterator_type os_it21 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
- string result21 = oss.str(); // "04/04/71"
- oss.str(empty);
- iterator_type os_it22 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
- string result22 = oss.str(); // "12:00:00"
- oss.str(empty);
- iterator_type os_it31 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
- string result31 = oss.str(); // "04/04/71"
- oss.str(empty);
- iterator_type os_it32 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
- string result32 = oss.str(); // "12:00:00"
-
- oss.str(empty);
- oss.imbue(loc_de);
- iterator_type os_it02 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
- string result2 = oss.str();
- VERIFY( result2 == "Son" );
-
- oss.str(empty); // "%d.%m.%Y"
- iterator_type os_it23 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
- string result23 = oss.str(); // "04.04.1971"
- oss.str(empty); // "%T"
- iterator_type os_it24 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
- string result24 = oss.str(); // "12:00:00"
- oss.str(empty);
- iterator_type os_it33 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
- string result33 = oss.str(); // "04.04.1971"
- oss.str(empty);
- iterator_type os_it34 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
- string result34 = oss.str(); // "12:00:00"
-
- oss.str(empty);
- oss.imbue(loc_hk);
- iterator_type os_it03 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
- string result3 = oss.str();
- VERIFY( result3 == "Sun" );
-
- oss.str(empty); // "%A, %B %d, %Y"
- iterator_type os_it25 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
- string result25 = oss.str(); // "Sunday, April 04, 1971"
- oss.str(empty); // "%I:%M:%S %Z"
- iterator_type os_it26 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
- string result26 = oss.str(); // "12:00:00 PST"
- oss.str(empty);
- iterator_type os_it35 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
- string result35 = oss.str(); // "Sunday, April 04, 1971"
- oss.str(empty);
- iterator_type os_it36 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
- string result36 = oss.str(); // "12:00:00 PST"
-
- oss.str(empty);
- oss.imbue(loc_fr);
- iterator_type os_it04 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
- string result4 = oss.str();
- VERIFY( result4 == "dim" );
-
- oss.str(empty); // "%d.%m.%Y"
- iterator_type os_it27 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
- string result27 = oss.str(); // "04.04.1971"
- oss.str(empty); // "%T"
- iterator_type os_it28 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
- string result28 = oss.str(); // "12:00:00"
- oss.str(empty);
- iterator_type os_it37 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
- string result37 = oss.str(); // "04.04.1971"
- oss.str(empty);
- iterator_type os_it38 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
- string result38 = oss.str(); // "12:00:00"
-
- // 2
- oss.str(empty);
- oss.imbue(loc_c);
- iterator_type os_it05 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date, date + strlen(date));
- string result5 = oss.str();
- VERIFY( result5 == "Sunday, the second of April");
- iterator_type os_it06 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date_ex, date_ex + strlen(date));
- string result6 = oss.str();
- VERIFY( result6 != result5 );
-
- oss.str(empty);
- oss.imbue(loc_de);
- iterator_type os_it07 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date, date + strlen(date));
- string result7 = oss.str();
- VERIFY( result7 == "Sonntag, the second of April");
- iterator_type os_it08 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date_ex, date_ex + strlen(date));
- string result8 = oss.str();
- VERIFY( result8 != result7 );
-
- oss.str(empty);
- oss.imbue(loc_hk);
- iterator_type os_it09 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date, date + strlen(date));
- string result9 = oss.str();
- VERIFY( result9 == "Sunday, the second of April");
- iterator_type os_it10 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date_ex, date_ex + strlen(date));
- string result10 = oss.str();
- VERIFY( result10 != result9 );
-
- oss.str(empty);
- oss.imbue(loc_fr);
- iterator_type os_it11 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date, date + strlen(date));
- string result11 = oss.str();
- VERIFY( result11 == "dimanche, the second of avril");
- iterator_type os_it12 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date_ex, date_ex + strlen(date));
- string result12 = oss.str();
- VERIFY( result12 != result11 );
-}
-
-void test02()
-{
- using namespace std;
- bool test = true;
-
- // Check time_put works with other iterators besides streambuf
- // output iterators. (As long as output_iterator requirements are met.)
- typedef string::iterator iter_type;
- typedef char_traits<char> traits;
- typedef time_put<char, iter_type> time_put_type;
- const ios_base::iostate goodbit = ios_base::goodbit;
- const ios_base::iostate eofbit = ios_base::eofbit;
- ios_base::iostate err = goodbit;
- const locale loc_c = locale::classic();
- const string x(50, 'x'); // have to have allocated string!
- string res;
- const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
- const char* date = "%X, %A, the second of %B, %Y";
-
- ostringstream oss;
- oss.imbue(locale(loc_c, new time_put_type));
-
- // Iterator advanced, state, output.
- const time_put_type& tp = use_facet<time_put_type>(oss.getloc());
-
- // 01 date format
- res = x;
- iter_type ret1 = tp.put(res.begin(), oss, ' ', &time_sanity,
- date, date + traits::length(date));
- string sanity1(res.begin(), ret1);
- VERIFY( err == goodbit );
- VERIFY( res == "12:00:00, Tuesday, the second of June, 1997xxxxxxx" );
- VERIFY( sanity1 == "12:00:00, Tuesday, the second of June, 1997" );
-
- // 02 char format
- res = x;
- iter_type ret2 = tp.put(res.begin(), oss, ' ', &time_sanity, 'A');
- string sanity2(res.begin(), ret2);
- VERIFY( err == goodbit );
- VERIFY( res == "Tuesdayxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" );
- VERIFY( sanity2 == "Tuesday" );
-}
-
-// libstdc++/5280
-void test03()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- test02();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test04()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- test02();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-
-int main()
-{
- test01();
- test02();
- test03();
- test04();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put_members_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/time_put_members_wchar_t.cc
deleted file mode 100644
index 347f41f526e..00000000000
--- a/libstdc++-v3/testsuite/22_locale/time_put_members_wchar_t.cc
+++ /dev/null
@@ -1,281 +0,0 @@
-// 2001-10-02 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2001, 2002 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This 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 General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.5.3.1 time_put members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-// XXX This test is not working for non-glibc locale models.
-// { dg-do run { xfail *-*-* } }
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-void test01()
-{
- using namespace std;
- typedef ostreambuf_iterator<wchar_t> iterator_type;
- typedef char_traits<wchar_t> traits;
-
- bool test = true;
-
- // basic construction and sanity checks.
- locale loc_c = locale::classic();
- locale loc_hk("en_HK");
- locale loc_fr("fr_FR@euro");
- locale loc_de("de_DE");
- VERIFY( loc_hk != loc_c );
- VERIFY( loc_hk != loc_fr );
- VERIFY( loc_hk != loc_de );
- VERIFY( loc_de != loc_fr );
-
- // cache the __timepunct facets, for quicker gdb inspection
- const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c);
- const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de);
- const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk);
- const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr);
-
- // create an ostream-derived object, cache the time_put facet
- const wstring empty;
- wostringstream oss;
- const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
-
- // create "C" time objects
- tm time1 = { 0, 0, 12, 4, 3, 71 };
- const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
- L"%w %W %x %X %y %Y %Z %%";
- const wchar_t* date = L"%A, the second of %B";
- const wchar_t* date_ex = L"%Ex";
-
- // 1
- // iter_type
- // put(iter_type s, ios_base& str, char_type fill, const tm* t,
- // char format, char modifier = 0) const;
- oss.str(empty);
- oss.imbue(loc_c);
- iterator_type os_it01 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
- wstring result1 = oss.str();
- VERIFY( result1 == L"Sun" );
-
- oss.str(empty);
- iterator_type os_it21 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
- wstring result21 = oss.str(); // "04/04/71"
- oss.str(empty);
- iterator_type os_it22 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
- wstring result22 = oss.str(); // "12:00:00"
- oss.str(empty);
- iterator_type os_it31 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
- wstring result31 = oss.str(); // "04/04/71"
- oss.str(empty);
- iterator_type os_it32 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
- wstring result32 = oss.str(); // "12:00:00"
-
- oss.str(empty);
- oss.imbue(loc_de);
- iterator_type os_it02 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
- wstring result2 = oss.str();
- VERIFY( result2 == L"Son" );
-
- oss.str(empty); // "%d.%m.%Y"
- iterator_type os_it23 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
- wstring result23 = oss.str(); // "04.04.1971"
- oss.str(empty); // "%T"
- iterator_type os_it24 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
- wstring result24 = oss.str(); // "12:00:00"
- oss.str(empty);
- iterator_type os_it33 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
- wstring result33 = oss.str(); // "04.04.1971"
- oss.str(empty);
- iterator_type os_it34 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
- wstring result34 = oss.str(); // "12:00:00"
-
- oss.str(empty);
- oss.imbue(loc_hk);
- iterator_type os_it03 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
- wstring result3 = oss.str();
- VERIFY( result3 == L"Sun" );
-
- oss.str(empty); // "%A, %B %d, %Y"
- iterator_type os_it25 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
- wstring result25 = oss.str(); // "Sunday, April 04, 1971"
- oss.str(empty); // "%I:%M:%S %Z"
- iterator_type os_it26 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
- wstring result26 = oss.str(); // "12:00:00 PST"
- oss.str(empty);
- iterator_type os_it35 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
- wstring result35 = oss.str(); // "Sunday, April 04, 1971"
- oss.str(empty);
- iterator_type os_it36 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
- wstring result36 = oss.str(); // "12:00:00 PST"
-
- oss.str(empty);
- oss.imbue(loc_fr);
- iterator_type os_it04 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
- wstring result4 = oss.str();
- VERIFY( result4 == L"dim" );
-
- oss.str(empty); // "%d.%m.%Y"
- iterator_type os_it27 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
- wstring result27 = oss.str(); // "04.04.1971"
- oss.str(empty); // "%T"
- iterator_type os_it28 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
- wstring result28 = oss.str(); // "12:00:00"
- oss.str(empty);
- iterator_type os_it37 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
- wstring result37 = oss.str(); // "04.04.1971"
- oss.str(empty);
- iterator_type os_it38 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
- wstring result38 = oss.str(); // "12:00:00"
-
- // 2
- oss.str(empty);
- oss.imbue(loc_c);
- iterator_type os_it05 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date, date + traits::length(date));
- wstring result5 = oss.str();
- VERIFY( result5 == L"Sunday, the second of April");
- iterator_type os_it06 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date_ex, date_ex + traits::length(date));
- wstring result6 = oss.str();
- VERIFY( result6 != result5 );
-
- oss.str(empty);
- oss.imbue(loc_de);
- iterator_type os_it07 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date, date + traits::length(date));
- wstring result7 = oss.str();
- VERIFY( result7 == L"Sonntag, the second of April");
- iterator_type os_it08 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date_ex, date_ex + traits::length(date));
- wstring result8 = oss.str();
- VERIFY( result8 != result7 );
-
- oss.str(empty);
- oss.imbue(loc_hk);
- iterator_type os_it09 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date, date + traits::length(date));
- wstring result9 = oss.str();
- VERIFY( result9 == L"Sunday, the second of April");
- iterator_type os_it10 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date_ex, date_ex + traits::length(date));
- wstring result10 = oss.str();
- VERIFY( result10 != result9 );
-
- oss.str(empty);
- oss.imbue(loc_fr);
- iterator_type os_it11 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date, date + traits::length(date));
- wstring result11 = oss.str();
- VERIFY( result11 == L"dimanche, the second of avril");
- iterator_type os_it12 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date_ex, date_ex + traits::length(date));
- wstring result12 = oss.str();
- VERIFY( result12 != result11 );
-}
-
-void test02()
-{
- using namespace std;
- bool test = true;
-
- // Check time_put works with other iterators besides streambuf
- // output iterators. (As long as output_iterator requirements are met.)
- typedef wstring::iterator iter_type;
- typedef char_traits<wchar_t> traits;
- typedef time_put<wchar_t, iter_type> time_put_type;
- const ios_base::iostate goodbit = ios_base::goodbit;
- const ios_base::iostate eofbit = ios_base::eofbit;
- ios_base::iostate err = goodbit;
- const locale loc_c = locale::classic();
- const wstring x(50, L'x'); // have to have allocated string!
- wstring res;
- const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
- const wchar_t* date = L"%X, %A, the second of %B, %Y";
-
- ostringstream oss;
- oss.imbue(locale(loc_c, new time_put_type));
-
- // Iterator advanced, state, output.
- const time_put_type& tp = use_facet<time_put_type>(oss.getloc());
-
- // 01 date format
- res = x;
- iter_type ret1 = tp.put(res.begin(), oss, L' ', &time_sanity,
- date, date + traits::length(date));
- wstring sanity1(res.begin(), ret1);
- VERIFY( err == goodbit );
- VERIFY( res == L"12:00:00, Tuesday, the second of June, 1997xxxxxxx" );
- VERIFY( sanity1 == L"12:00:00, Tuesday, the second of June, 1997" );
-
- // 02 char format
- res = x;
- iter_type ret2 = tp.put(res.begin(), oss, L' ', &time_sanity, 'A');
- wstring sanity2(res.begin(), ret2);
- VERIFY( err == goodbit );
- VERIFY( res == L"Tuesdayxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" );
- VERIFY( sanity2 == L"Tuesday" );
-}
-
-// libstdc++/5280
-void test03()
-{
-#ifdef _GLIBCPP_HAVE_SETENV
- // Set the global locale to non-"C".
- std::locale loc_de("de_DE");
- std::locale::global(loc_de);
-
- // Set LANG environment variable to de_DE.
- const char* oldLANG = getenv("LANG");
- if (!setenv("LANG", "de_DE", 1))
- {
- test01();
- test02();
- setenv("LANG", oldLANG ? oldLANG : "", 1);
- }
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
-void test04()
-{
- bool test = true;
-
- const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
- if (tentLANG != NULL)
- {
- std::string preLANG = tentLANG;
- test01();
- test02();
- std::string postLANG = std::setlocale(LC_ALL, NULL);
- VERIFY( preLANG == postLANG );
- }
-}
-#endif
-
-int main()
-{
-#ifdef _GLIBCPP_USE_WCHAR_T
- test01();
- test02();
- test03();
- test04();
-#endif
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/26_numerics/c99_classification_macros_c.cc b/libstdc++-v3/testsuite/26_numerics/c99_classification_macros_c.cc
index 63a994c6bbb..a8f18f27b36 100644
--- a/libstdc++-v3/testsuite/26_numerics/c99_classification_macros_c.cc
+++ b/libstdc++-v3/testsuite/26_numerics/c99_classification_macros_c.cc
@@ -27,11 +27,12 @@
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
-// { dg-do compile }
+// { dg-do compile { xfail *-*-linux-gnu } }
+// { dg-excess-errors "" }
#include <math.h>
-void fpclassify() { }
+void fpclassify() { } // { dg-error "parse error" "" { xfail *-*-linux-gnu } }
void isfinite() { }