+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
+++ /dev/null
-// 2001-08-27 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.1.5 Template class codecvt
-
-// { dg-do compile }
-
-#include <locale>
-
-void test01()
-{
- // Check for required base class.
- typedef std::codecvt<char, char, mbstate_t> 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::intern_type intern_type;
- typedef test_type::extern_type extern_type;
- 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;
-}
--- /dev/null
+// { 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>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::codecvt<char, char, mbstate_t> 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::intern_type intern_type;
+ typedef test_type::extern_type extern_type;
+ typedef test_type::state_type state_type;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// { 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 2000-08-22 Benjamin Kosnik <bkoz@cygnus.com>
+
+// Copyright (C) 2000, 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.1.5 - Template class codecvt [lib.locale.codecvt]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+
+
+#ifdef _GLIBCPP_USE___ENC_TRAITS
+
+// Need some char_traits specializations for this to work.
+typedef unsigned short unicode_t;
+
+namespace std
+{
+ template<>
+ struct char_traits<unicode_t>
+ {
+ typedef unicode_t char_type;
+ // Unsigned as wint_t is unsigned.
+ typedef unsigned long int_type;
+ typedef streampos pos_type;
+ typedef streamoff off_type;
+ typedef mbstate_t state_type;
+
+ static void
+ assign(char_type& __c1, const char_type& __c2);
+
+ static bool
+ eq(const char_type& __c1, const char_type& __c2);
+
+ static bool
+ lt(const char_type& __c1, const char_type& __c2);
+
+ static int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n)
+ { return memcmp(__s1, __s2, __n); }
+
+ static size_t
+ length(const char_type* __s);
+
+ static const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a);
+
+ static char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n);
+
+ static char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n)
+ { return static_cast<char_type*>(memcpy(__s1, __s2, __n)); }
+
+ static char_type*
+ assign(char_type* __s, size_t __n, char_type __a);
+
+ static char_type
+ to_char_type(const int_type& __c);
+
+ static int_type
+ to_int_type(const char_type& __c);
+
+ static bool
+ eq_int_type(const int_type& __c1, const int_type& __c2);
+
+ static int_type
+ eof();
+
+ static int_type
+ not_eof(const int_type& __c);
+ };
+}
+
+/*
+> how do I check that these conversions are correct?
+Very easy. Since all the characters are from ASCII you simply
+zero-extend the values.
+
+drepper$ echo 'black pearl jasmine tea' | od -t x1
+0000000 62 6c 61 63 6b 20 70 65 61 72 6c 20 6a 61 73 6d
+0000020 69 6e 65 20 74 65 61 0a
+
+So the UCS-2 string is
+
+0x0062, 0x006c, 0x0061, ...
+
+You get the idea. With iconv() you have to take care of the
+byte-order, though. UCS-2 can mean little- or big endian. Looking at
+your result
+
+> $9 = 25856
+
+it shows that the other byte-order is used (25856 == 0x6500).
+*/
+
+
+void
+initialize_state(std::__enc_traits& state)
+{ state._M_init(); }
+
+// Partial specialization using __enc_traits.
+// codecvt<unicode_t, char, __enc_traits>
+// UNICODE - UCS2 (big endian)
+void test01()
+{
+ using namespace std;
+ typedef codecvt_base::result result;
+ typedef unicode_t int_type;
+ typedef char ext_type;
+ typedef __enc_traits enc_type;
+ typedef codecvt<int_type, ext_type, enc_type> unicode_codecvt;
+ typedef char_traits<int_type> int_traits;
+ typedef char_traits<ext_type> ext_traits;
+
+ bool test = true;
+ const ext_type* e_lit = "black pearl jasmine tea";
+ int size = strlen(e_lit);
+
+ char i_lit_base[50] __attribute__((aligned(__alignof__(int_type)))) =
+ {
+ 0x00, 0x62, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x63, 0x00, 0x6b, 0x00, 0x20,
+ 0x00, 0x70, 0x00, 0x65, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6c, 0x00, 0x20,
+ 0x00, 0x6a, 0x00, 0x61, 0x00, 0x73, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e,
+ 0x00, 0x65, 0x00, 0x20, 0x00, 0x74, 0x00, 0x65, 0x00, 0x61, 0x00, 0xa0
+ };
+ const int_type* i_lit = reinterpret_cast<int_type*>(i_lit_base);
+
+ const ext_type* efrom_next;
+ const int_type* ifrom_next;
+ 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;
+
+ // construct a locale object with the specialized facet.
+ locale loc(locale::classic(), new unicode_codecvt);
+ // sanity check the constructed locale has the specialized facet.
+ VERIFY( has_facet<unicode_codecvt>(loc) );
+ const unicode_codecvt& cvt = use_facet<unicode_codecvt>(loc);
+
+ // in
+ unicode_codecvt::state_type state01("UCS-2BE", "ISO-8859-15", 0xfeff, 0);
+ initialize_state(state01);
+ // internal encoding is bigger because of bom
+ result r1 = cvt.in(state01, e_lit, e_lit + size, efrom_next,
+ i_arr, i_arr + size + 1, 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 );
+
+ // out
+ unicode_codecvt::state_type state02("UCS-2BE", "ISO-8859-15", 0xfeff, 0);
+ initialize_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 );
+
+ // unshift
+ ext_traits::copy(e_arr, e_lit, size);
+ unicode_codecvt::state_type state03("UCS-2BE", "ISO-8859-15", 0xfeff, 0);
+ initialize_state(state03);
+ result r3 = cvt.unshift(state03, e_arr, e_arr + size, eto_next);
+ VERIFY( r3 == codecvt_base::noconv );
+ VERIFY( !ext_traits::compare(e_arr, e_lit, size) );
+ VERIFY( eto_next == e_arr );
+
+ int i = cvt.encoding();
+ VERIFY( i == 2 ); // Target-dependent.
+
+ VERIFY( !cvt.always_noconv() );
+
+ unicode_codecvt::state_type state04("UCS-2BE", "ISO-8859-15", 0xfeff, 0);
+ initialize_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;
+}
+
+// Partial specialization using __enc_traits.
+// codecvt<unicode_t, char, __enc_traits>
+// UNICODE - UCS2 (little endian)
+void test02()
+{
+ using namespace std;
+ typedef codecvt_base::result result;
+ typedef unsigned short unicode_t;
+ typedef unicode_t int_type;
+ typedef char ext_type;
+ typedef __enc_traits enc_type;
+ typedef codecvt<int_type, ext_type, enc_type> unicode_codecvt;
+ typedef char_traits<int_type> int_traits;
+ typedef char_traits<ext_type> ext_traits;
+
+ bool test = true;
+ const ext_type* e_lit = "black pearl jasmine tea";
+ int size = strlen(e_lit);
+
+ char i_lit_base[50] __attribute__((aligned(__alignof__(int_type)))) =
+ {
+ 0x62, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x63, 0x00, 0x6b, 0x00, 0x20, 0x00,
+ 0x70, 0x00, 0x65, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6c, 0x00, 0x20, 0x00,
+ 0x6a, 0x00, 0x61, 0x00, 0x73, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e, 0x00,
+ 0x65, 0x00, 0x20, 0x00, 0x74, 0x00, 0x65, 0x00, 0x61, 0x00, 0xa0, 0x00
+ };
+ const int_type* i_lit = reinterpret_cast<int_type*>(i_lit_base);
+
+ const ext_type* efrom_next;
+ const int_type* ifrom_next;
+ 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;
+
+ // construct a locale object with the specialized facet.
+ locale loc(locale::classic(), new unicode_codecvt);
+ // sanity check the constructed locale has the specialized facet.
+ VERIFY( has_facet<unicode_codecvt>(loc) );
+ const unicode_codecvt& cvt = use_facet<unicode_codecvt>(loc);
+
+ // in
+ unicode_codecvt::state_type state01("UCS-2LE", "ISO-8859-15", 0xfeff, 0);
+ initialize_state(state01);
+ // internal encoding is bigger because of bom
+ result r1 = cvt.in(state01, e_lit, e_lit + size, efrom_next,
+ i_arr, i_arr + size + 1, 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 );
+
+ // out
+ unicode_codecvt::state_type state02("UCS-2LE", "ISO-8859-15", 0xfeff, 0);
+ initialize_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 );
+
+ // unshift
+ ext_traits::copy(e_arr, e_lit, size);
+ unicode_codecvt::state_type state03("UCS-2LE", "ISO-8859-15", 0xfeff, 0);
+ initialize_state(state03);
+ result r3 = cvt.unshift(state03, e_arr, e_arr + size, eto_next);
+ VERIFY( r3 == codecvt_base::noconv );
+ VERIFY( !ext_traits::compare(e_arr, e_lit, size) );
+ VERIFY( eto_next == e_arr );
+
+ int i = cvt.encoding();
+ VERIFY( i == 2 ); // Target-dependent.
+
+ VERIFY( !cvt.always_noconv() );
+
+ unicode_codecvt::state_type state04("UCS-2LE", "ISO-8859-15", 0xfeff, 0);
+ initialize_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;
+}
+
+#endif // _GLIBCPP_USE___ENC_TRAITS
+
+int main ()
+{
+#if _GLIBCPP_USE___ENC_TRAITS
+ test01();
+ test02();
+#endif
+
+ return 0;
+}
--- /dev/null
+// 2000-08-23 Benjamin Kosnik <bkoz@cygnus.com>
+
+// Copyright (C) 2000, 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.1.5 - Template class codecvt [lib.locale.codecvt]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+#ifdef _GLIBCPP_USE___ENC_TRAITS
+#ifdef _GLIBCPP_USE_WCHAR_T
+
+// Need some char_traits specializations for this to work.
+typedef unsigned short unicode_t;
+
+namespace std
+{
+ template<>
+ struct char_traits<unicode_t>
+ {
+ typedef unicode_t char_type;
+ // Unsigned as wint_t is unsigned.
+ typedef unsigned long int_type;
+ typedef streampos pos_type;
+ typedef streamoff off_type;
+ typedef mbstate_t state_type;
+
+ static void
+ assign(char_type& __c1, const char_type& __c2);
+
+ static bool
+ eq(const char_type& __c1, const char_type& __c2);
+
+ static bool
+ lt(const char_type& __c1, const char_type& __c2);
+
+ static int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n)
+ { return memcmp(__s1, __s2, __n); }
+
+ static size_t
+ length(const char_type* __s);
+
+ static const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a);
+
+ static char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n);
+
+ static char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n)
+ { return static_cast<char_type*>(memcpy(__s1, __s2, __n)); }
+
+ static char_type*
+ assign(char_type* __s, size_t __n, char_type __a);
+
+ static char_type
+ to_char_type(const int_type& __c);
+
+ static int_type
+ to_int_type(const char_type& __c);
+
+ static bool
+ eq_int_type(const int_type& __c1, const int_type& __c2);
+
+ static int_type
+ eof();
+
+ static int_type
+ not_eof(const int_type& __c);
+ };
+}
+
+void
+initialize_state(std::__enc_traits& state)
+{ state._M_init(); }
+
+// Partial specialization using __enc_traits.
+// codecvt<unicode_t, wchar_t, __enc_traits>
+void test01()
+{
+ using namespace std;
+ typedef codecvt_base::result result;
+ typedef unicode_t int_type;
+ typedef wchar_t ext_type;
+ typedef __enc_traits enc_type;
+ typedef codecvt<int_type, ext_type, enc_type> unicode_codecvt;
+ typedef char_traits<int_type> int_traits;
+ typedef char_traits<ext_type> ext_traits;
+
+ bool test = true;
+ int size = 23;
+ char e_lit_base[96] __attribute__((aligned(__alignof__(ext_type)))) =
+ {
+ 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x61,
+ 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x20,
+ 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x61,
+ 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x20,
+ 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x73,
+ 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x6e,
+ 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x74,
+ 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0xa0
+ };
+ const ext_type* e_lit = reinterpret_cast<ext_type*>(e_lit_base);
+
+ char i_lit_base[48] __attribute__((aligned(__alignof__(int_type)))) =
+ {
+ 0x00, 0x62, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x63, 0x00, 0x6b, 0x00, 0x20,
+ 0x00, 0x70, 0x00, 0x65, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6c, 0x00, 0x20,
+ 0x00, 0x6a, 0x00, 0x61, 0x00, 0x73, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e,
+ 0x00, 0x65, 0x00, 0x20, 0x00, 0x74, 0x00, 0x65, 0x00, 0x61, 0x00, 0xa0
+ };
+ const int_type* i_lit = reinterpret_cast<int_type*>(i_lit_base);
+
+ const ext_type* efrom_next;
+ const int_type* ifrom_next;
+ 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;
+
+ // construct a locale object with the specialized facet.
+ locale loc(locale::classic(), new unicode_codecvt);
+ // sanity check the constructed locale has the specialized facet.
+ VERIFY( has_facet<unicode_codecvt>(loc) );
+ const unicode_codecvt& cvt = use_facet<unicode_codecvt>(loc);
+
+ // in
+ unicode_codecvt::state_type state01("UCS-2BE", "UCS-4BE", 0xfeff, 0);
+ initialize_state(state01);
+ result r1 = cvt.in(state01, e_lit, e_lit + size, efrom_next,
+ i_arr, i_arr + size + 1, 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 );
+
+ // out
+ unicode_codecvt::state_type state02("UCS-2BE", "UCS-4BE", 0xfeff, 0);
+ initialize_state(state02);
+ result r2 = cvt.out(state02, i_lit, i_lit + size, ifrom_next,
+ e_arr, e_arr + size, eto_next);
+ // XXX 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 );
+
+ // unshift
+ ext_traits::copy(e_arr, e_lit, size);
+ unicode_codecvt::state_type state03("UCS-2BE", "UCS-4BE", 0xfeff, 0);
+ initialize_state(state03);
+ result r3 = cvt.unshift(state03, e_arr, e_arr + size, eto_next);
+ VERIFY( r3 == codecvt_base::noconv );
+ VERIFY( !ext_traits::compare(e_arr, e_lit, size) );
+ VERIFY( eto_next == e_arr );
+
+ int i = cvt.encoding();
+ VERIFY( i == 0 );
+
+ VERIFY( !cvt.always_noconv() );
+
+ unicode_codecvt::state_type state04("UCS-2BE", "UCS-4BE", 0xfeff, 0);
+ initialize_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;
+}
+#endif // _GLIBCPP_USE_WCHAR_T
+#endif // _GLIBCPP_USE___ENC_TRAITS
+
+int main ()
+{
+#ifdef _GLIBCPP_USE___ENC_TRAITS
+#ifdef _GLIBCPP_USE_WCHAR_T
+ test01();
+#endif
+#endif
+ return 0;
+}
+
--- /dev/null
+// 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 );
+
+ // 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 );
+
+ // unshift
+ strcpy(c_arr, c_lit);
+ result r3 = cvt->unshift(state, c_arr, c_arr + size, to_next);
+ VERIFY( r3 == codecvt_base::noconv );
+ VERIFY( !strcmp(c_arr, c_lit) );
+ VERIFY( to_next == c_arr );
+
+ delete [] c_arr;
+ delete [] c_ref;
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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 );
+
+ // 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 );
+
+ // unshift
+ strcpy(e_arr, e_lit);
+ w_codecvt::state_type state03;
+ zero_state(state03);
+ result r3 = cvt->unshift(state03, e_arr, e_arr + size, eto_next);
+ VERIFY( r3 == codecvt_base::noconv );
+ VERIFY( !strcmp(e_arr, e_lit) );
+ VERIFY( eto_next == e_arr );
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
+++ /dev/null
-// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com>
-
-// Copyright (C) 2000, 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.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;
- 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 );
-
- // 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 );
-
- // unshift
- strcpy(c_arr, c_lit);
- result r3 = cvt->unshift(state, c_arr, c_arr + size, to_next);
- VERIFY( r3 == codecvt_base::noconv );
- 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;
-}
+++ /dev/null
-// 2000-08-22 Benjamin Kosnik <bkoz@cygnus.com>
-
-// Copyright (C) 2000, 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.1.5 - Template class codecvt [lib.locale.codecvt]
-
-#include <locale>
-#include <testsuite_hooks.h>
-
-
-
-#ifdef _GLIBCPP_USE___ENC_TRAITS
-
-// Need some char_traits specializations for this to work.
-typedef unsigned short unicode_t;
-
-namespace std
-{
- template<>
- struct char_traits<unicode_t>
- {
- typedef unicode_t char_type;
- // Unsigned as wint_t is unsigned.
- typedef unsigned long int_type;
- typedef streampos pos_type;
- typedef streamoff off_type;
- typedef mbstate_t state_type;
-
- static void
- assign(char_type& __c1, const char_type& __c2);
-
- static bool
- eq(const char_type& __c1, const char_type& __c2);
-
- static bool
- lt(const char_type& __c1, const char_type& __c2);
-
- static int
- compare(const char_type* __s1, const char_type* __s2, size_t __n)
- { return memcmp(__s1, __s2, __n); }
-
- static size_t
- length(const char_type* __s);
-
- static const char_type*
- find(const char_type* __s, size_t __n, const char_type& __a);
-
- static char_type*
- move(char_type* __s1, const char_type* __s2, size_t __n);
-
- static char_type*
- copy(char_type* __s1, const char_type* __s2, size_t __n)
- { return static_cast<char_type*>(memcpy(__s1, __s2, __n)); }
-
- static char_type*
- assign(char_type* __s, size_t __n, char_type __a);
-
- static char_type
- to_char_type(const int_type& __c);
-
- static int_type
- to_int_type(const char_type& __c);
-
- static bool
- eq_int_type(const int_type& __c1, const int_type& __c2);
-
- static int_type
- eof();
-
- static int_type
- not_eof(const int_type& __c);
- };
-}
-
-/*
-> how do I check that these conversions are correct?
-Very easy. Since all the characters are from ASCII you simply
-zero-extend the values.
-
-drepper$ echo 'black pearl jasmine tea' | od -t x1
-0000000 62 6c 61 63 6b 20 70 65 61 72 6c 20 6a 61 73 6d
-0000020 69 6e 65 20 74 65 61 0a
-
-So the UCS-2 string is
-
-0x0062, 0x006c, 0x0061, ...
-
-You get the idea. With iconv() you have to take care of the
-byte-order, though. UCS-2 can mean little- or big endian. Looking at
-your result
-
-> $9 = 25856
-
-it shows that the other byte-order is used (25856 == 0x6500).
-*/
-
-
-void
-initialize_state(std::__enc_traits& state)
-{ state._M_init(); }
-
-// Partial specialization using __enc_traits.
-// codecvt<unicode_t, char, __enc_traits>
-// UNICODE - UCS2 (big endian)
-void test01()
-{
- using namespace std;
- typedef codecvt_base::result result;
- typedef unicode_t int_type;
- typedef char ext_type;
- typedef __enc_traits enc_type;
- typedef codecvt<int_type, ext_type, enc_type> unicode_codecvt;
- typedef char_traits<int_type> int_traits;
- typedef char_traits<ext_type> ext_traits;
-
- bool test = true;
- const ext_type* e_lit = "black pearl jasmine tea";
- int size = strlen(e_lit);
-
- char i_lit_base[50] __attribute__((aligned(__alignof__(int_type)))) =
- {
- 0x00, 0x62, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x63, 0x00, 0x6b, 0x00, 0x20,
- 0x00, 0x70, 0x00, 0x65, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6c, 0x00, 0x20,
- 0x00, 0x6a, 0x00, 0x61, 0x00, 0x73, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e,
- 0x00, 0x65, 0x00, 0x20, 0x00, 0x74, 0x00, 0x65, 0x00, 0x61, 0x00, 0xa0
- };
- const int_type* i_lit = reinterpret_cast<int_type*>(i_lit_base);
-
- const ext_type* efrom_next;
- const int_type* ifrom_next;
- 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;
-
- // construct a locale object with the specialized facet.
- locale loc(locale::classic(), new unicode_codecvt);
- // sanity check the constructed locale has the specialized facet.
- VERIFY( has_facet<unicode_codecvt>(loc) );
- const unicode_codecvt& cvt = use_facet<unicode_codecvt>(loc);
-
- // in
- unicode_codecvt::state_type state01("UCS-2BE", "ISO-8859-15", 0xfeff, 0);
- initialize_state(state01);
- // internal encoding is bigger because of bom
- result r1 = cvt.in(state01, e_lit, e_lit + size, efrom_next,
- i_arr, i_arr + size + 1, 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 );
-
- // out
- unicode_codecvt::state_type state02("UCS-2BE", "ISO-8859-15", 0xfeff, 0);
- initialize_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 );
-
- // unshift
- ext_traits::copy(e_arr, e_lit, size);
- unicode_codecvt::state_type state03("UCS-2BE", "ISO-8859-15", 0xfeff, 0);
- initialize_state(state03);
- result r3 = cvt.unshift(state03, e_arr, e_arr + size, eto_next);
- VERIFY( r3 == codecvt_base::noconv );
- VERIFY( !ext_traits::compare(e_arr, e_lit, size) );
- VERIFY( eto_next == e_arr );
-
- int i = cvt.encoding();
- VERIFY( i == 2 ); // Target-dependent.
-
- VERIFY( !cvt.always_noconv() );
-
- unicode_codecvt::state_type state04("UCS-2BE", "ISO-8859-15", 0xfeff, 0);
- initialize_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;
-}
-
-// Partial specialization using __enc_traits.
-// codecvt<unicode_t, char, __enc_traits>
-// UNICODE - UCS2 (little endian)
-void test02()
-{
- using namespace std;
- typedef codecvt_base::result result;
- typedef unsigned short unicode_t;
- typedef unicode_t int_type;
- typedef char ext_type;
- typedef __enc_traits enc_type;
- typedef codecvt<int_type, ext_type, enc_type> unicode_codecvt;
- typedef char_traits<int_type> int_traits;
- typedef char_traits<ext_type> ext_traits;
-
- bool test = true;
- const ext_type* e_lit = "black pearl jasmine tea";
- int size = strlen(e_lit);
-
- char i_lit_base[50] __attribute__((aligned(__alignof__(int_type)))) =
- {
- 0x62, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x63, 0x00, 0x6b, 0x00, 0x20, 0x00,
- 0x70, 0x00, 0x65, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6c, 0x00, 0x20, 0x00,
- 0x6a, 0x00, 0x61, 0x00, 0x73, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e, 0x00,
- 0x65, 0x00, 0x20, 0x00, 0x74, 0x00, 0x65, 0x00, 0x61, 0x00, 0xa0, 0x00
- };
- const int_type* i_lit = reinterpret_cast<int_type*>(i_lit_base);
-
- const ext_type* efrom_next;
- const int_type* ifrom_next;
- 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;
-
- // construct a locale object with the specialized facet.
- locale loc(locale::classic(), new unicode_codecvt);
- // sanity check the constructed locale has the specialized facet.
- VERIFY( has_facet<unicode_codecvt>(loc) );
- const unicode_codecvt& cvt = use_facet<unicode_codecvt>(loc);
-
- // in
- unicode_codecvt::state_type state01("UCS-2LE", "ISO-8859-15", 0xfeff, 0);
- initialize_state(state01);
- // internal encoding is bigger because of bom
- result r1 = cvt.in(state01, e_lit, e_lit + size, efrom_next,
- i_arr, i_arr + size + 1, 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 );
-
- // out
- unicode_codecvt::state_type state02("UCS-2LE", "ISO-8859-15", 0xfeff, 0);
- initialize_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 );
-
- // unshift
- ext_traits::copy(e_arr, e_lit, size);
- unicode_codecvt::state_type state03("UCS-2LE", "ISO-8859-15", 0xfeff, 0);
- initialize_state(state03);
- result r3 = cvt.unshift(state03, e_arr, e_arr + size, eto_next);
- VERIFY( r3 == codecvt_base::noconv );
- VERIFY( !ext_traits::compare(e_arr, e_lit, size) );
- VERIFY( eto_next == e_arr );
-
- int i = cvt.encoding();
- VERIFY( i == 2 ); // Target-dependent.
-
- VERIFY( !cvt.always_noconv() );
-
- unicode_codecvt::state_type state04("UCS-2LE", "ISO-8859-15", 0xfeff, 0);
- initialize_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;
-}
-
-#endif // _GLIBCPP_USE___ENC_TRAITS
-
-int main ()
-{
-#if _GLIBCPP_USE___ENC_TRAITS
- test01();
- test02();
-#endif
-
- return 0;
-}
+++ /dev/null
-// 2000-08-23 Benjamin Kosnik <bkoz@cygnus.com>
-
-// Copyright (C) 2000, 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.1.5 - Template class codecvt [lib.locale.codecvt]
-
-#include <locale>
-#include <testsuite_hooks.h>
-
-#ifdef _GLIBCPP_USE___ENC_TRAITS
-#ifdef _GLIBCPP_USE_WCHAR_T
-
-// Need some char_traits specializations for this to work.
-typedef unsigned short unicode_t;
-
-namespace std
-{
- template<>
- struct char_traits<unicode_t>
- {
- typedef unicode_t char_type;
- // Unsigned as wint_t is unsigned.
- typedef unsigned long int_type;
- typedef streampos pos_type;
- typedef streamoff off_type;
- typedef mbstate_t state_type;
-
- static void
- assign(char_type& __c1, const char_type& __c2);
-
- static bool
- eq(const char_type& __c1, const char_type& __c2);
-
- static bool
- lt(const char_type& __c1, const char_type& __c2);
-
- static int
- compare(const char_type* __s1, const char_type* __s2, size_t __n)
- { return memcmp(__s1, __s2, __n); }
-
- static size_t
- length(const char_type* __s);
-
- static const char_type*
- find(const char_type* __s, size_t __n, const char_type& __a);
-
- static char_type*
- move(char_type* __s1, const char_type* __s2, size_t __n);
-
- static char_type*
- copy(char_type* __s1, const char_type* __s2, size_t __n)
- { return static_cast<char_type*>(memcpy(__s1, __s2, __n)); }
-
- static char_type*
- assign(char_type* __s, size_t __n, char_type __a);
-
- static char_type
- to_char_type(const int_type& __c);
-
- static int_type
- to_int_type(const char_type& __c);
-
- static bool
- eq_int_type(const int_type& __c1, const int_type& __c2);
-
- static int_type
- eof();
-
- static int_type
- not_eof(const int_type& __c);
- };
-}
-
-void
-initialize_state(std::__enc_traits& state)
-{ state._M_init(); }
-
-// Partial specialization using __enc_traits.
-// codecvt<unicode_t, wchar_t, __enc_traits>
-void test01()
-{
- using namespace std;
- typedef codecvt_base::result result;
- typedef unicode_t int_type;
- typedef wchar_t ext_type;
- typedef __enc_traits enc_type;
- typedef codecvt<int_type, ext_type, enc_type> unicode_codecvt;
- typedef char_traits<int_type> int_traits;
- typedef char_traits<ext_type> ext_traits;
-
- bool test = true;
- int size = 23;
- char e_lit_base[96] __attribute__((aligned(__alignof__(ext_type)))) =
- {
- 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x61,
- 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x20,
- 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x61,
- 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x20,
- 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x73,
- 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x6e,
- 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x74,
- 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0xa0
- };
- const ext_type* e_lit = reinterpret_cast<ext_type*>(e_lit_base);
-
- char i_lit_base[48] __attribute__((aligned(__alignof__(int_type)))) =
- {
- 0x00, 0x62, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x63, 0x00, 0x6b, 0x00, 0x20,
- 0x00, 0x70, 0x00, 0x65, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6c, 0x00, 0x20,
- 0x00, 0x6a, 0x00, 0x61, 0x00, 0x73, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e,
- 0x00, 0x65, 0x00, 0x20, 0x00, 0x74, 0x00, 0x65, 0x00, 0x61, 0x00, 0xa0
- };
- const int_type* i_lit = reinterpret_cast<int_type*>(i_lit_base);
-
- const ext_type* efrom_next;
- const int_type* ifrom_next;
- 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;
-
- // construct a locale object with the specialized facet.
- locale loc(locale::classic(), new unicode_codecvt);
- // sanity check the constructed locale has the specialized facet.
- VERIFY( has_facet<unicode_codecvt>(loc) );
- const unicode_codecvt& cvt = use_facet<unicode_codecvt>(loc);
-
- // in
- unicode_codecvt::state_type state01("UCS-2BE", "UCS-4BE", 0xfeff, 0);
- initialize_state(state01);
- result r1 = cvt.in(state01, e_lit, e_lit + size, efrom_next,
- i_arr, i_arr + size + 1, 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 );
-
- // out
- unicode_codecvt::state_type state02("UCS-2BE", "UCS-4BE", 0xfeff, 0);
- initialize_state(state02);
- result r2 = cvt.out(state02, i_lit, i_lit + size, ifrom_next,
- e_arr, e_arr + size, eto_next);
- // XXX 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 );
-
- // unshift
- ext_traits::copy(e_arr, e_lit, size);
- unicode_codecvt::state_type state03("UCS-2BE", "UCS-4BE", 0xfeff, 0);
- initialize_state(state03);
- result r3 = cvt.unshift(state03, e_arr, e_arr + size, eto_next);
- VERIFY( r3 == codecvt_base::noconv );
- VERIFY( !ext_traits::compare(e_arr, e_lit, size) );
- VERIFY( eto_next == e_arr );
-
- int i = cvt.encoding();
- VERIFY( i == 0 );
-
- VERIFY( !cvt.always_noconv() );
-
- unicode_codecvt::state_type state04("UCS-2BE", "UCS-4BE", 0xfeff, 0);
- initialize_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;
-}
-#endif // _GLIBCPP_USE_WCHAR_T
-#endif // _GLIBCPP_USE___ENC_TRAITS
-
-int main ()
-{
-#ifdef _GLIBCPP_USE___ENC_TRAITS
-#ifdef _GLIBCPP_USE_WCHAR_T
- test01();
-#endif
-#endif
- return 0;
-}
-
+++ /dev/null
-// 2000-08-18 Benjamin Kosnik <bkoz@cygnus.com>
-
-// Copyright (C) 2000, 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.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
-// 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...
-#ifdef _GLIBCPP_USE_WCHAR_T
-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 );
-
- // 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 );
-
- // unshift
- strcpy(e_arr, e_lit);
- w_codecvt::state_type state03;
- zero_state(state03);
- result r3 = cvt->unshift(state03, e_arr, e_arr + size, eto_next);
- 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;
-}
+++ /dev/null
-// 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
-
-// { dg-do compile }
-
-#include <locale>
-
-void test01()
-{
- // Check for required base class.
- typedef std::messages<char> 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_collate: public std::collate<unsigned char>
-{ };
-
-void test02()
-{
- gnu_collate facet01;
-}
-
-int main()
-{
- test01();
- test02();
- return 0;
-}
--- /dev/null
+// { 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>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::messages<char> 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;
+}
--- /dev/null
+// { 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
+++ /dev/null
-// 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.2 Template class collate_byname
-
-#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;
- typedef std::collate<char>::string_type string_type;
-
- bool test = true;
- string str;
- locale loc_c = locale::classic();
-
- locale loc_byname(locale::classic(), new collate_byname<char>("de_DE"));
- str = loc_byname.name();
-
- locale loc_de("de_DE");
- str = loc_de.name();
-
- VERIFY( loc_de != loc_byname );
-
- // cache the collate facets
- const collate<char>& coll_byname = use_facet<collate<char> >(loc_byname);
- const collate<char>& coll_de = use_facet<collate<char> >(loc_de);
-
- // Check German "de_DE" locale.
- int i1;
- int i2;
- long l1;
- long l2;
- 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 + size3);
- 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 );
-
-
- // Check byname locale
- int i3;
- int i4;
- long l3;
- long l4;
- size4 = strlen(strlit3) - 1;
- i3 = coll_de.compare(strlit3, strlit3 + size4, strlit3, strlit3 + 7);
- VERIFY ( i3 == 1 );
- i3 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + size4);
- VERIFY ( i3 == -1 );
- i3 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + 7);
- VERIFY ( i3 == 0 );
-
- i3 = coll_de.compare(strlit3, strlit3 + 6, strlit3 + 8, strlit3 + 14);
- VERIFY ( i3 == -1 );
-
- size4 = strlen(strlit4) - 1;
- i4 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + 13);
- VERIFY ( i4 == 1 );
- i4 = coll_de.compare(strlit4, strlit4 + 13, strlit4, strlit4 + size4);
- VERIFY ( i4 == -1 );
- i4 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + size4);
- VERIFY ( i4 == 0 );
-
- l3 = coll_de.hash(strlit3, strlit3 + size4);
- l4 = coll_de.hash(strlit3, strlit3 + size4 - 1);
- VERIFY ( l3 != l4 );
- l3 = coll_de.hash(strlit3, strlit3 + size4);
- l4 = coll_de.hash(strlit4, strlit4 + size4);
- VERIFY ( l3 != l4 );
-
- string str5 = coll_de.transform(strlit3, strlit3 + size3);
- string str6 = coll_de.transform(strlit4, strlit4 + size4);
- i3 = str5.compare(str6);
- i4 = coll_de.compare(strlit3, strlit3 + size4, strlit4, strlit4 + size4);
- VERIFY ( i4 == -1 );
- VERIFY ( i3 * i4 > 0 );
-
- // Verify byname == de
- VERIFY ( str5 == str3 );
- VERIFY ( str6 == str4 );
-}
-
-int main()
-{
- test01();
-
- return 0;
-}
--- /dev/null
+// 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.2 Template class collate_byname
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef std::collate<char>::string_type string_type;
+
+ bool test = true;
+ string str;
+ locale loc_c = locale::classic();
+
+ locale loc_byname(locale::classic(), new collate_byname<char>("de_DE"));
+ str = loc_byname.name();
+
+ locale loc_de("de_DE");
+ str = loc_de.name();
+
+ VERIFY( loc_de != loc_byname );
+
+ // cache the collate facets
+ const collate<char>& coll_byname = use_facet<collate<char> >(loc_byname);
+ const collate<char>& coll_de = use_facet<collate<char> >(loc_de);
+
+ // Check German "de_DE" locale.
+ int i1;
+ int i2;
+ long l1;
+ long l2;
+ 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 + size3);
+ 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 );
+
+
+ // Check byname locale
+ int i3;
+ int i4;
+ long l3;
+ long l4;
+ size4 = strlen(strlit3) - 1;
+ i3 = coll_de.compare(strlit3, strlit3 + size4, strlit3, strlit3 + 7);
+ VERIFY ( i3 == 1 );
+ i3 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + size4);
+ VERIFY ( i3 == -1 );
+ i3 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + 7);
+ VERIFY ( i3 == 0 );
+
+ i3 = coll_de.compare(strlit3, strlit3 + 6, strlit3 + 8, strlit3 + 14);
+ VERIFY ( i3 == -1 );
+
+ size4 = strlen(strlit4) - 1;
+ i4 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + 13);
+ VERIFY ( i4 == 1 );
+ i4 = coll_de.compare(strlit4, strlit4 + 13, strlit4, strlit4 + size4);
+ VERIFY ( i4 == -1 );
+ i4 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + size4);
+ VERIFY ( i4 == 0 );
+
+ l3 = coll_de.hash(strlit3, strlit3 + size4);
+ l4 = coll_de.hash(strlit3, strlit3 + size4 - 1);
+ VERIFY ( l3 != l4 );
+ l3 = coll_de.hash(strlit3, strlit3 + size4);
+ l4 = coll_de.hash(strlit4, strlit4 + size4);
+ VERIFY ( l3 != l4 );
+
+ string str5 = coll_de.transform(strlit3, strlit3 + size3);
+ string str6 = coll_de.transform(strlit4, strlit4 + size4);
+ i3 = str5.compare(str6);
+ i4 = coll_de.compare(strlit3, strlit3 + size4, strlit4, strlit4 + size4);
+ VERIFY ( i4 == -1 );
+ VERIFY ( i3 * i4 > 0 );
+
+ // Verify byname == de
+ VERIFY ( str5 == str3 );
+ VERIFY ( str6 == str4 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2000, 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.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");
-}
-
-#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;
-typedef std::codecvt<wchar_t, char, std::mbstate_t> w_codecvt;
-typedef std::codecvt_byname<wchar_t, char, std::mbstate_t> w_codecvt_byname;
-
-class gnu_codecvt: public c_codecvt { };
-
-class gnu_facet: public std::locale::facet
-{
-public:
- static std::locale::id id;
-};
-
-std::locale::id gnu_facet::id;
-
-// Need some char_traits specializations for this to work.
-typedef unsigned short unicode_t;
-
-namespace std
-{
- template<>
- struct char_traits<unicode_t>
- {
- typedef unicode_t char_type;
- // Unsigned as wint_t is unsigned.
- typedef unsigned long int_type;
- typedef streampos pos_type;
- typedef streamoff off_type;
- typedef mbstate_t state_type;
-
- static void
- assign(char_type& __c1, const char_type& __c2);
-
- static bool
- eq(const char_type& __c1, const char_type& __c2);
-
- static bool
- lt(const char_type& __c1, const char_type& __c2);
-
- static int
- compare(const char_type* __s1, const char_type* __s2, size_t __n)
- { return memcmp(__s1, __s2, __n); }
-
- static size_t
- length(const char_type* __s);
-
- static const char_type*
- find(const char_type* __s, size_t __n, const char_type& __a);
-
- static char_type*
- move(char_type* __s1, const char_type* __s2, size_t __n);
-
- static char_type*
- copy(char_type* __s1, const char_type* __s2, size_t __n)
- { return static_cast<char_type*>(memcpy(__s1, __s2, __n)); }
-
- static char_type*
- assign(char_type* __s, size_t __n, char_type __a);
-
- static char_type
- to_char_type(const int_type& __c);
-
- static int_type
- to_int_type(const char_type& __c);
-
- static bool
- eq_int_type(const int_type& __c1, const int_type& __c2);
-
- static int_type
- eof();
-
- static int_type
- not_eof(const int_type& __c);
- };
-}
-
-void test01()
-{
- using namespace std;
- typedef unicode_t int_type;
- typedef char ext_type;
- typedef __enc_traits enc_type;
- typedef codecvt<int_type, ext_type, enc_type> unicode_codecvt;
-
- bool test = true;
- string str1, str2;
-
- // construct a locale object with the C facet
- const locale loc01 = locale::classic();
-
- // 1
- // template <class Facet> locale(const locale& other, Facet* f)
- // construct a locale object with the specialized facet.
- locale loc02(locale::classic(), new gnu_codecvt);
- VERIFY (loc01 != loc02);
- VERIFY (loc02.name() == "*");
- try
- {
- VERIFY (has_facet<gnu_codecvt>(loc02));
- VERIFY (has_facet<c_codecvt>(loc02));
- VERIFY (has_facet<w_codecvt>(loc02));
- }
- catch(...)
- { VERIFY( false ); }
-
- try
- { use_facet<gnu_facet>(loc02); }
- catch(bad_cast& obj)
- { VERIFY( true ); }
- catch(...)
- { VERIFY( false ); }
-
- // unicode_codecvt
- locale loc13(locale::classic(), new unicode_codecvt);
- VERIFY (loc01 != loc13);
- VERIFY (loc13.name() == "*");
- try
- {
- VERIFY (has_facet<c_codecvt>(loc13));
- VERIFY (has_facet<w_codecvt>(loc13));
- VERIFY (has_facet<unicode_codecvt>(loc13));
- }
- catch(...)
- { VERIFY( false ); }
-
- try
- { use_facet<gnu_facet>(loc13); }
- catch(bad_cast& obj)
- { VERIFY( true ); }
- catch(...)
- { VERIFY( false ); }
-
- // 2
- // locale() throw()
- locale loc03;
- VERIFY (loc03 == loc01);
- VERIFY (loc03.name() == "C");
- locale loc04 = locale::global(loc02);
- locale loc05;
- VERIFY (loc05 != loc03);
- VERIFY (loc05 == loc02);
-
- // 3
- // explicit locale(const char* std_name)
- locale loc06("fr_FR");
- VERIFY (loc06 != loc01);
- VERIFY (loc06 != loc02);
- VERIFY (loc06.name() == "fr_FR");
- locale loc07("");
- VERIFY (loc07 != loc02);
- VERIFY (loc07.name() != "");
- try
- { locale loc08(static_cast<const char*>(NULL)); }
- catch(runtime_error& obj)
- { VERIFY (true); }
- catch(...)
- { VERIFY (false); }
-
- try
- { locale loc08("saturn_SUN*RA"); }
- catch(runtime_error& obj)
- { VERIFY (true); }
- catch(...)
- { VERIFY (false); }
-
- // 4
- // locale(const locale& other, const char* std_name, category)
- {
- // This is the same as 5 only use "C" for loc("C")
- locale loc09(loc06, "C", locale::ctype);
- VERIFY (loc09.name() != "fr_FR");
- VERIFY (loc09.name() != "C");
- VERIFY (loc09.name() != "*");
- VERIFY (loc09 != loc01);
- VERIFY (loc09 != loc06);
-
- locale loc10(loc02, "C", locale::ctype);
- VERIFY (loc10.name() == "*");
- VERIFY (loc10 != loc01); // As not named, even tho facets same...
- VERIFY (loc10 != loc02);
-
- locale loc11(loc01, "C", locale::ctype);
- VERIFY (loc11.name() == "C");
- VERIFY (loc11 == loc01);
-
- try
- { locale loc12(loc01, static_cast<const char*>(NULL), locale::ctype); }
- catch(runtime_error& obj)
- { VERIFY (true); }
- catch(...)
- { VERIFY (false); }
-
- try
- { locale loc13(loc01, "localized by the wu-tang clan", locale::ctype); }
- catch(runtime_error& obj)
- { VERIFY (true); }
- catch(...)
- { VERIFY (false); }
-
- locale loc14(loc06, "C", locale::none);
- VERIFY (loc14.name() == "fr_FR");
- VERIFY (loc14 == loc06);
-
- locale loc15(loc06, "C", locale::collate);
- VERIFY (loc15.name() != "fr_FR");
- VERIFY (loc15.name() != "C");
- VERIFY (loc15.name() != "*");
- VERIFY (loc15.name() != loc09.name());
- VERIFY (loc15 != loc01);
- VERIFY (loc15 != loc06);
- VERIFY (loc15 != loc09);
- }
-
- // 5
- // locale(const locale& other, const locale& one, category)
- {
- // This is the exact same as 4, with locale("C") for "C"
- locale loc09(loc06, loc01, locale::ctype);
- VERIFY (loc09.name() != "fr_FR");
- VERIFY (loc09.name() != "C");
- VERIFY (loc09.name() != "*");
- VERIFY (loc09 != loc01);
- VERIFY (loc09 != loc06);
-
- locale loc10(loc02, loc01, locale::ctype);
- VERIFY (loc10.name() == "*");
- VERIFY (loc10 != loc01); // As not named, even tho facets same...
- VERIFY (loc10 != loc02);
-
- locale loc11(loc01, loc01, locale::ctype);
- VERIFY (loc11.name() == "C");
- VERIFY (loc11 == loc01);
-
- try
- { locale loc12(loc01, static_cast<const char*>(NULL), locale::ctype); }
- catch(runtime_error& obj)
- { VERIFY (true); }
- catch(...)
- { VERIFY (false); }
-
- try
- { locale loc13(loc01, locale("wu-tang clan"), locale::ctype); }
- catch(runtime_error& obj)
- { VERIFY (true); }
- catch(...)
- { VERIFY (false); }
-
- locale loc14(loc06, loc01, locale::none);
- VERIFY (loc14.name() == "fr_FR");
- VERIFY (loc14 == loc06);
-
- locale loc15(loc06, loc01, locale::collate);
- VERIFY (loc15.name() != "fr_FR");
- VERIFY (loc15.name() != "C");
- VERIFY (loc15.name() != "*");
- VERIFY (loc15.name() != loc09.name());
- VERIFY (loc15 != loc01);
- VERIFY (loc15 != loc06);
- VERIFY (loc15 != loc09);
- }
-}
-#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;
-}
+++ /dev/null
-// 1999-08-24 bkoz
-
-// Copyright (C) 2000, 1999 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; 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
-
-// { dg-do compile }
-
-// 1: Test that the locale headers are picking up the correct declaration
-// of the internal type `ctype_base::mask'.
-int mask ();
-
-#include <locale>
-
-// 2: Should be able to instantiate this for other types besides char, wchar_t
-typedef std::ctype<char> cctype;
-
-class gnu_ctype: public std::ctype<unsigned char>
-{
-private:
- const cctype& _M_cctype;
-
-public:
- explicit
- gnu_ctype(size_t __refs = 0)
- : std::ctype<unsigned char>(__refs),
- _M_cctype(std::use_facet<cctype>(std::locale::classic()))
- { }
-
- ~gnu_ctype();
-
-protected:
- virtual bool
- do_is(mask __m, char_type __c) const
- { return _M_cctype.is(__m, __c); }
-
- virtual const char_type*
- do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const
- {
- const char* __c = _M_cctype.is(reinterpret_cast<const char*>(__lo),
- reinterpret_cast<const char*>(__hi), __vec);
- return reinterpret_cast<const char_type*>(__c);
- }
-
- virtual const char_type*
- do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const
- {
- const char* __c = _M_cctype.scan_is(__m,
- reinterpret_cast<const char*>(__lo),
- reinterpret_cast<const char*>(__hi));
- return reinterpret_cast<const char_type*>(__c);
- }
-
- virtual const char_type*
- do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
- {
- const char* __c = _M_cctype.scan_is(__m,
- reinterpret_cast<const char*>(__lo),
- reinterpret_cast<const char*>(__hi));
- return reinterpret_cast<const char_type*>(__c);
- }
-
- virtual char_type
- do_toupper(char_type __c) const
- { return _M_cctype.toupper(__c); }
-
- virtual const char_type*
- do_toupper(char_type* __lo, const char_type* __hi) const
- {
- const char* __c = _M_cctype.toupper(reinterpret_cast<char*>(__lo),
- reinterpret_cast<const char*>(__hi));
- return reinterpret_cast<const char_type*>(__c);
- }
-
- virtual char_type
- do_tolower(char_type __c) const
- { return _M_cctype.tolower(__c); }
-
- virtual const char_type*
- do_tolower(char_type* __lo, const char_type* __hi) const
- {
- const char* __c = _M_cctype.toupper(reinterpret_cast<char*>(__lo),
- reinterpret_cast<const char*>(__hi));
- return reinterpret_cast<const char_type*>(__c);
- }
-
- virtual char_type
- do_widen(char __c) const
- { return _M_cctype.widen(__c); }
-
- virtual const char*
- do_widen(const char* __lo, const char* __hi, char_type* __dest) const
- {
- const char* __c = _M_cctype.widen(reinterpret_cast<const char*>(__lo),
- reinterpret_cast<const char*>(__hi),
- reinterpret_cast<char*>(__dest));
- return __c;
- }
-
- virtual char
- do_narrow(char_type __c, char __dfault) const
- { return _M_cctype.narrow(__c, __dfault); }
-
- virtual const char_type*
- do_narrow(const char_type* __lo, const char_type* __hi, char __dfault,
- char* __dest) const
- {
- const char* __c = _M_cctype.narrow(reinterpret_cast<const char*>(__lo),
- reinterpret_cast<const char*>(__hi),
- __dfault,
- reinterpret_cast<char*>(__dest));
- return reinterpret_cast<const char_type*>(__c);
- }
-
-};
-
-gnu_ctype::~gnu_ctype() { }
-
-gnu_ctype facet01;
-
-// 3: Sanity check ctype_base::mask bitmask requirements
-void
-test01()
-{
- using namespace std;
-
- ctype_base::mask m01;
- ctype_base::mask m02;
-
- m01 = ctype_base::space;
- m02 = ctype_base::xdigit;
-
- m01 & m02;
- m01 | m02;
- m01 ^ m02;
- ~m01;
- m01 &= m02;
- m01 |= m02;
- 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;
-}
--- /dev/null
+// { 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
+
+// 1: Test that the locale headers are picking up the correct declaration
+// of the internal type `ctype_base::mask'.
+int mask ();
+
+#include <locale>
+
+// 2: Should be able to instantiate this for other types besides char, wchar_t
+typedef std::ctype<char> cctype;
+
+class gnu_ctype: public std::ctype<unsigned char>
+{
+private:
+ const cctype& _M_cctype;
+
+public:
+ explicit
+ gnu_ctype(size_t __refs = 0)
+ : std::ctype<unsigned char>(__refs),
+ _M_cctype(std::use_facet<cctype>(std::locale::classic()))
+ { }
+
+ ~gnu_ctype();
+
+protected:
+ virtual bool
+ do_is(mask __m, char_type __c) const
+ { return _M_cctype.is(__m, __c); }
+
+ virtual const char_type*
+ do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const
+ {
+ const char* __c = _M_cctype.is(reinterpret_cast<const char*>(__lo),
+ reinterpret_cast<const char*>(__hi), __vec);
+ return reinterpret_cast<const char_type*>(__c);
+ }
+
+ virtual const char_type*
+ do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const
+ {
+ const char* __c = _M_cctype.scan_is(__m,
+ reinterpret_cast<const char*>(__lo),
+ reinterpret_cast<const char*>(__hi));
+ return reinterpret_cast<const char_type*>(__c);
+ }
+
+ virtual const char_type*
+ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
+ {
+ const char* __c = _M_cctype.scan_is(__m,
+ reinterpret_cast<const char*>(__lo),
+ reinterpret_cast<const char*>(__hi));
+ return reinterpret_cast<const char_type*>(__c);
+ }
+
+ virtual char_type
+ do_toupper(char_type __c) const
+ { return _M_cctype.toupper(__c); }
+
+ virtual const char_type*
+ do_toupper(char_type* __lo, const char_type* __hi) const
+ {
+ const char* __c = _M_cctype.toupper(reinterpret_cast<char*>(__lo),
+ reinterpret_cast<const char*>(__hi));
+ return reinterpret_cast<const char_type*>(__c);
+ }
+
+ virtual char_type
+ do_tolower(char_type __c) const
+ { return _M_cctype.tolower(__c); }
+
+ virtual const char_type*
+ do_tolower(char_type* __lo, const char_type* __hi) const
+ {
+ const char* __c = _M_cctype.toupper(reinterpret_cast<char*>(__lo),
+ reinterpret_cast<const char*>(__hi));
+ return reinterpret_cast<const char_type*>(__c);
+ }
+
+ virtual char_type
+ do_widen(char __c) const
+ { return _M_cctype.widen(__c); }
+
+ virtual const char*
+ do_widen(const char* __lo, const char* __hi, char_type* __dest) const
+ {
+ const char* __c = _M_cctype.widen(reinterpret_cast<const char*>(__lo),
+ reinterpret_cast<const char*>(__hi),
+ reinterpret_cast<char*>(__dest));
+ return __c;
+ }
+
+ virtual char
+ do_narrow(char_type __c, char __dfault) const
+ { return _M_cctype.narrow(__c, __dfault); }
+
+ virtual const char_type*
+ do_narrow(const char_type* __lo, const char_type* __hi, char __dfault,
+ char* __dest) const
+ {
+ const char* __c = _M_cctype.narrow(reinterpret_cast<const char*>(__lo),
+ reinterpret_cast<const char*>(__hi),
+ __dfault,
+ reinterpret_cast<char*>(__dest));
+ return reinterpret_cast<const char_type*>(__c);
+ }
+
+};
+
+gnu_ctype::~gnu_ctype() { }
+
+gnu_ctype facet01;
+
+// 3: Sanity check ctype_base::mask bitmask requirements
+void
+test01()
+{
+ using namespace std;
+
+ ctype_base::mask m01;
+ ctype_base::mask m02;
+
+ m01 = ctype_base::space;
+ m02 = ctype_base::xdigit;
+
+ m01 & m02;
+ m01 | m02;
+ m01 ^ m02;
+ ~m01;
+ m01 &= m02;
+ m01 |= m02;
+ m01 ^= m02;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// { 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;
+}
--- /dev/null
+// 2000-02-16 bkoz
+
+// 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 <testsuite_hooks.h>
+
+// Dietmar Kühl via Peter Schmid
+class comma_ctype: public std::ctype<char>
+{
+public:
+ comma_ctype(): std::ctype<char>() { }
+ 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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 <testsuite_hooks.h>
+
+typedef char char_type;
+class gnu_ctype: public std::ctype<char_type> { };
+
+void test01()
+{
+ bool test = true;
+ const char_type strlit00[] = "manilla, cebu, tandag PHILIPPINES";
+ const char_type strlit01[] = "MANILLA, CEBU, TANDAG PHILIPPINES";
+ const char_type strlit02[] = "manilla, cebu, tandag philippines";
+ const char_type c00 = 'S';
+ const char_type c10 = 's';
+ const char_type c20 = '9';
+ const char_type c30 = ' ';
+ const char_type c40 = '!';
+ const char_type c50 = 'F';
+ const char_type c60 = 'f';
+ const char_type c70 = 'X';
+ const char_type c80 = 'x';
+
+ gnu_ctype gctype;
+ char_type c100;
+ int len = std::char_traits<char_type>::length(strlit00);
+ char_type c_array[len + 1];
+
+ // sanity check ctype_base::mask members
+ int i01 = std::ctype_base::space;
+ int i02 = std::ctype_base::upper;
+ int i03 = std::ctype_base::lower;
+ int i04 = std::ctype_base::digit;
+ int i05 = std::ctype_base::punct;
+ int i06 = std::ctype_base::alpha;
+ int i07 = std::ctype_base::xdigit;
+ int i08 = std::ctype_base::alnum;
+ int i09 = std::ctype_base::graph;
+ int i10 = std::ctype_base::print;
+ int i11 = std::ctype_base::cntrl;
+ int i12 = sizeof(std::ctype_base::mask);
+ VERIFY ( i01 != i02);
+ VERIFY ( i02 != i03);
+ VERIFY ( i03 != i04);
+ VERIFY ( i04 != i05);
+ VERIFY ( i05 != i06);
+ VERIFY ( i06 != i07);
+ VERIFY ( i07 != i08);
+ VERIFY ( i08 != i09);
+ VERIFY ( i09 != i10);
+ VERIFY ( i10 != i11);
+ VERIFY ( i11 != i01);
+
+ // bool is(mask m, char_type c) const;
+ VERIFY( gctype.is(std::ctype_base::space, c30) );
+ VERIFY( gctype.is(std::ctype_base::upper, c00) );
+ VERIFY( gctype.is(std::ctype_base::lower, c10) );
+ VERIFY( gctype.is(std::ctype_base::digit, c20) );
+ VERIFY( gctype.is(std::ctype_base::punct, c40) );
+ VERIFY( gctype.is(std::ctype_base::alpha, c50) );
+ VERIFY( gctype.is(std::ctype_base::alpha, c60) );
+ VERIFY( gctype.is(std::ctype_base::xdigit, c20) );
+ VERIFY( !gctype.is(std::ctype_base::xdigit, c80) );
+ VERIFY( gctype.is(std::ctype_base::alnum, c50) );
+ VERIFY( gctype.is(std::ctype_base::alnum, c20) );
+ VERIFY( gctype.is(std::ctype_base::graph, c40) );
+ VERIFY( gctype.is(std::ctype_base::graph, c20) );
+
+ // const char* is(const char* low, const char* high, mask* vec) const
+ std::ctype_base::mask m00 = static_cast<std::ctype_base::mask>(0);
+ std::ctype_base::mask m01[3];
+ std::ctype_base::mask m02[13];
+ const char_type* cc0 = strlit00;
+ const char_type* cc1 = NULL;
+ const char_type* cc2 = NULL;
+
+ cc0 = strlit00;
+ m01[0] = m00;
+ m01[1] = m00;
+ m01[2] = m00;
+ cc1 = gctype.is(cc0, cc0, m01);
+ VERIFY( cc1 == strlit00 );
+ VERIFY( m01[0] == m00 );
+ 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);
+ VERIFY( m01[0] != m00 );
+ VERIFY( m01[1] != m00 );
+ VERIFY( m01[2] != m00 );
+ VERIFY( gctype.is(m01[0], cc0[0]) );
+ VERIFY( gctype.is(m01[1], cc0[1]) );
+ VERIFY( gctype.is(m01[2], cc0[2]) );
+
+ cc0 = strlit01;
+ cc1 = gctype.is(cc0, cc0 + 13, m02);
+ VERIFY( cc1 == strlit01 + 13);
+ VERIFY( m02[6] != m00 );
+ VERIFY( m02[7] != m00 );
+ VERIFY( m02[8] != m00 );
+ VERIFY( m02[8] != m02[6] );
+ VERIFY( m02[6] != m02[7] );
+ VERIFY( static_cast<bool>(m02[6] & std::ctype_base::alnum) );
+ VERIFY( static_cast<bool>(m02[6] & std::ctype_base::upper) );
+ VERIFY( static_cast<bool>(m02[6] & std::ctype_base::alpha) );
+ VERIFY( static_cast<bool>(m02[7] & std::ctype_base::punct) );
+ VERIFY( static_cast<bool>(m02[8] & std::ctype_base::space) );
+ VERIFY( gctype.is(m02[6], cc0[6]) );
+ VERIFY( gctype.is(m02[7], cc0[7]) );
+ VERIFY( gctype.is(m02[8], cc0[8]) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// { 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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 <testsuite_hooks.h>
+
+typedef wchar_t char_type;
+class gnu_ctype: public std::ctype<char_type> { };
+
+void test01()
+{
+ bool test = true;
+ const char_type strlit00[] = L"manilla, cebu, tandag PHILIPPINES";
+ const char_type strlit01[] = L"MANILLA, CEBU, TANDAG PHILIPPINES";
+ const char_type strlit02[] = L"manilla, cebu, tandag philippines";
+ const char_type c00 = L'S';
+ const char_type c10 = L's';
+ const char_type c20 = L'9';
+ const char_type c30 = L' ';
+ const char_type c40 = L'!';
+ const char_type c50 = L'F';
+ const char_type c60 = L'f';
+ const char_type c70 = L'X';
+ const char_type c80 = L'x';
+
+ gnu_ctype gctype;
+ char_type c100;
+ int len = std::char_traits<char_type>::length(strlit00);
+ char_type c_array[len + 1];
+
+ // sanity check ctype_base::mask members
+ int i01 = std::ctype_base::space;
+ int i02 = std::ctype_base::upper;
+ int i03 = std::ctype_base::lower;
+ int i04 = std::ctype_base::digit;
+ int i05 = std::ctype_base::punct;
+ int i06 = std::ctype_base::alpha;
+ int i07 = std::ctype_base::xdigit;
+ int i08 = std::ctype_base::alnum;
+ int i09 = std::ctype_base::graph;
+ int i10 = std::ctype_base::print;
+ int i11 = std::ctype_base::cntrl;
+ int i12 = sizeof(std::ctype_base::mask);
+ VERIFY ( i01 != i02);
+ VERIFY ( i02 != i03);
+ VERIFY ( i03 != i04);
+ VERIFY ( i04 != i05);
+ VERIFY ( i05 != i06);
+ VERIFY ( i06 != i07);
+ VERIFY ( i07 != i08);
+ VERIFY ( i08 != i09);
+ VERIFY ( i09 != i10);
+ VERIFY ( i10 != i11);
+ VERIFY ( i11 != i01);
+
+ // bool is(mask m, char_type c) const;
+ VERIFY( gctype.is(std::ctype_base::space, c30) );
+ VERIFY( gctype.is(std::ctype_base::upper, c00) );
+ VERIFY( gctype.is(std::ctype_base::lower, c10) );
+ VERIFY( gctype.is(std::ctype_base::digit, c20) );
+ VERIFY( gctype.is(std::ctype_base::punct, c40) );
+ VERIFY( gctype.is(std::ctype_base::alpha, c50) );
+ VERIFY( gctype.is(std::ctype_base::alpha, c60) );
+ VERIFY( gctype.is(std::ctype_base::xdigit, c20) );
+ VERIFY( !gctype.is(std::ctype_base::xdigit, c80) );
+ VERIFY( gctype.is(std::ctype_base::alnum, c50) );
+ VERIFY( gctype.is(std::ctype_base::alnum, c20) );
+ VERIFY( gctype.is(std::ctype_base::graph, c40) );
+ VERIFY( gctype.is(std::ctype_base::graph, c20) );
+
+ // const char* is(const char* low, const char* high, mask* vec) const
+ std::ctype_base::mask m00 = static_cast<std::ctype_base::mask>(0);
+ std::ctype_base::mask m01[3];
+ std::ctype_base::mask m02[13];
+ const char_type* cc0 = strlit00;
+ const char_type* cc1 = NULL;
+ const char_type* cc2 = NULL;
+
+ cc0 = strlit00;
+ m01[0] = m00;
+ m01[1] = m00;
+ m01[2] = m00;
+ cc1 = gctype.is(cc0, cc0, m01);
+ VERIFY( cc1 == strlit00 );
+ VERIFY( m01[0] == m00 );
+ VERIFY( m01[1] == m00 );
+ VERIFY( m01[2] == m00 );
+
+#if 0
+ VERIFY( m01[0] != m00 );
+ VERIFY( m01[1] != m00 );
+ VERIFY( m01[2] != m00 );
+ VERIFY( gctype.is(m01[0], cc0[0]) );
+ VERIFY( gctype.is(m01[1], cc0[1]) );
+ VERIFY( gctype.is(m01[2], cc0[2]) );
+#endif
+
+ cc0 = strlit01;
+ cc1 = gctype.is(cc0, cc0 + 13, m02);
+ VERIFY( cc1 == strlit01 + 13);
+#if 0
+ VERIFY( m02[6] != m00 );
+ VERIFY( m02[7] != m00 );
+ VERIFY( m02[8] != m00 );
+ VERIFY( m02[8] != m02[6] );
+ VERIFY( m02[6] != m02[7] );
+ VERIFY( static_cast<bool>(m02[6] & std::ctype_base::alnum) );
+ VERIFY( static_cast<bool>(m02[6] & std::ctype_base::upper) );
+ VERIFY( static_cast<bool>(m02[6] & std::ctype_base::alpha) );
+ VERIFY( static_cast<bool>(m02[7] & std::ctype_base::punct) );
+ VERIFY( static_cast<bool>(m02[8] & std::ctype_base::space) );
+ VERIFY( gctype.is(m02[6], cc0[6]) );
+ VERIFY( gctype.is(m02[7], cc0[7]) );
+ VERIFY( gctype.is(m02[8], cc0[8]) );
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// { 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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>
+
+void test02()
+{
+ 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);
+
+ // Construct non-asci string.
+ basic_string<wide_type> wide("wibble");
+ wide += wide_type(1240);
+ wide += "kibble";
+ basic_string<char> narrow("wibble");
+ narrow += char(1240);
+ narrow += "kibble";
+ 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()
+{
+ test02();
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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>
+
+void test02()
+{
+ 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);
+
+ // Construct non-asci string.
+ basic_string<wide_type> wide(L"wibble");
+ wide += wide_type(1240);
+ wide += L"kibble";
+ basic_string<char> narrow("wibble");
+ narrow += dfault;
+ narrow += "kibble";
+ 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()
+{
+ test02();
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 2002-05-10 ghazi
+
+// Copyright (C) 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.
+
+// { dg-do run }
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+typedef char char_type;
+typedef std::char_traits<char_type> traits_type;
+class gnu_ctype: public std::ctype<char_type> { };
+
+// These two macros take a ctype mask, a string and a pointer within
+// the string that the scan function should return, usually either the
+// first or last character if the string contains identical values as
+// below.
+#define VERIFY_SCAN_IS(MASK, STRING, EXPECTED) \
+ VERIFY(gctype.scan_is((MASK), (STRING), \
+ (STRING) + traits_type::length(STRING)) == (EXPECTED))
+#define VERIFY_SCAN_NOT(MASK, STRING, EXPECTED) \
+ VERIFY(gctype.scan_not((MASK), (STRING), \
+ (STRING) + traits_type::length(STRING)) == (EXPECTED))
+
+// Sanity check scan_is() and scan_not().
+void test01()
+{
+ bool test = true;
+
+ const char_type *const ca = "aaaaa";
+ const char_type *const cz = "zzzzz";
+ const char_type *const cA = "AAAAA";
+ const char_type *const cZ = "ZZZZZ";
+ const char_type *const c0 = "00000";
+ const char_type *const c9 = "99999";
+ const char_type *const cs = " ";
+ const char_type *const xf = "fffff";
+ const char_type *const xF = "FFFFF";
+ const char_type *const p1 = "!!!!!";
+ const char_type *const p2 = "/////";
+
+ gnu_ctype gctype;
+
+ // 'a'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, ca, ca);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, ca, ca);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, ca, ca+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, ca, ca+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, ca, ca);
+ VERIFY_SCAN_IS (std::ctype_base::lower, ca, ca);
+ VERIFY_SCAN_IS (std::ctype_base::print, ca, ca);
+ VERIFY_SCAN_IS (std::ctype_base::punct, ca, ca+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, ca, ca+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, ca, ca+5);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, ca, ca);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, ca, ca+5);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, ca, ca+5);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, ca, ca);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, ca, ca);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, ca, ca+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, ca, ca+5);
+ VERIFY_SCAN_NOT (std::ctype_base::print, ca, ca+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, ca, ca);
+ VERIFY_SCAN_NOT (std::ctype_base::space, ca, ca);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, ca, ca);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, ca, ca+5);
+
+ // 'z'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, cz, cz);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, cz, cz);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, cz, cz+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, cz, cz+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, cz, cz);
+ VERIFY_SCAN_IS (std::ctype_base::lower, cz, cz);
+ VERIFY_SCAN_IS (std::ctype_base::print, cz, cz);
+ VERIFY_SCAN_IS (std::ctype_base::punct, cz, cz+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, cz, cz+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, cz, cz+5);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, cz, cz+5);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, cz, cz+5);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, cz, cz+5);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, cz, cz);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, cz, cz);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, cz, cz+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, cz, cz+5);
+ VERIFY_SCAN_NOT (std::ctype_base::print, cz, cz+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, cz, cz);
+ VERIFY_SCAN_NOT (std::ctype_base::space, cz, cz);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, cz, cz);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, cz, cz);
+
+ // 'A'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, cA, cA);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, cA, cA);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, cA, cA+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, cA, cA+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, cA, cA);
+ VERIFY_SCAN_IS (std::ctype_base::lower, cA, cA+5);
+ VERIFY_SCAN_IS (std::ctype_base::print, cA, cA);
+ VERIFY_SCAN_IS (std::ctype_base::punct, cA, cA+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, cA, cA+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, cA, cA);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, cA, cA);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, cA, cA+5);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, cA, cA+5);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, cA, cA);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, cA, cA);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, cA, cA+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, cA, cA);
+ VERIFY_SCAN_NOT (std::ctype_base::print, cA, cA+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, cA, cA);
+ VERIFY_SCAN_NOT (std::ctype_base::space, cA, cA);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, cA, cA+5);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, cA, cA+5);
+
+ // 'Z'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, cZ, cZ);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, cZ, cZ);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, cZ, cZ+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, cZ, cZ+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, cZ, cZ);
+ VERIFY_SCAN_IS (std::ctype_base::lower, cZ, cZ+5);
+ VERIFY_SCAN_IS (std::ctype_base::print, cZ, cZ);
+ VERIFY_SCAN_IS (std::ctype_base::punct, cZ, cZ+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, cZ, cZ+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, cZ, cZ);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, cZ, cZ+5);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, cZ, cZ+5);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, cZ, cZ+5);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, cZ, cZ);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, cZ, cZ);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, cZ, cZ+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, cZ, cZ);
+ VERIFY_SCAN_NOT (std::ctype_base::print, cZ, cZ+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, cZ, cZ);
+ VERIFY_SCAN_NOT (std::ctype_base::space, cZ, cZ);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, cZ, cZ+5);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, cZ, cZ);
+
+ // '0'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, c0, c0);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, c0, c0+5);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, c0, c0+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, c0, c0);
+ VERIFY_SCAN_IS (std::ctype_base::graph, c0, c0);
+ VERIFY_SCAN_IS (std::ctype_base::lower, c0, c0+5);
+ VERIFY_SCAN_IS (std::ctype_base::print, c0, c0);
+ VERIFY_SCAN_IS (std::ctype_base::punct, c0, c0+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, c0, c0+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, c0, c0+5);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, c0, c0);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, c0, c0+5);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, c0, c0);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, c0, c0);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, c0, c0+5);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, c0, c0+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, c0, c0);
+ VERIFY_SCAN_NOT (std::ctype_base::print, c0, c0+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, c0, c0);
+ VERIFY_SCAN_NOT (std::ctype_base::space, c0, c0);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, c0, c0);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, c0, c0+5);
+
+ // '9'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, c9, c9);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, c9, c9+5);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, c9, c9+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, c9, c9);
+ VERIFY_SCAN_IS (std::ctype_base::graph, c9, c9);
+ VERIFY_SCAN_IS (std::ctype_base::lower, c9, c9+5);
+ VERIFY_SCAN_IS (std::ctype_base::print, c9, c9);
+ VERIFY_SCAN_IS (std::ctype_base::punct, c9, c9+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, c9, c9+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, c9, c9+5);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, c9, c9);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, c9, c9+5);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, c9, c9);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, c9, c9);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, c9, c9+5);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, c9, c9+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, c9, c9);
+ VERIFY_SCAN_NOT (std::ctype_base::print, c9, c9+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, c9, c9);
+ VERIFY_SCAN_NOT (std::ctype_base::space, c9, c9);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, c9, c9);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, c9, c9+5);
+
+ // ' '
+ VERIFY_SCAN_IS (std::ctype_base::alnum, cs, cs+5);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, cs, cs+5);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, cs, cs+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, cs, cs+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, cs, cs+5);
+ VERIFY_SCAN_IS (std::ctype_base::lower, cs, cs+5);
+ VERIFY_SCAN_IS (std::ctype_base::print, cs, cs);
+ VERIFY_SCAN_IS (std::ctype_base::punct, cs, cs+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, cs, cs);
+ VERIFY_SCAN_IS (std::ctype_base::upper, cs, cs+5);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, cs, cs+5);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, cs, cs);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, cs, cs);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, cs, cs);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, cs, cs);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, cs, cs);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, cs, cs);
+ VERIFY_SCAN_NOT (std::ctype_base::print, cs, cs+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, cs, cs);
+ VERIFY_SCAN_NOT (std::ctype_base::space, cs, cs+5);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, cs, cs);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, cs, cs);
+
+ // 'f'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, xf, xf);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, xf, xf);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, xf, xf+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, xf, xf+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, xf, xf);
+ VERIFY_SCAN_IS (std::ctype_base::lower, xf, xf);
+ VERIFY_SCAN_IS (std::ctype_base::print, xf, xf);
+ VERIFY_SCAN_IS (std::ctype_base::punct, xf, xf+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, xf, xf+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, xf, xf+5);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, xf, xf);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, xf, xf+5);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, xf, xf+5);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, xf, xf);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, xf, xf);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, xf, xf+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, xf, xf+5);
+ VERIFY_SCAN_NOT (std::ctype_base::print, xf, xf+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, xf, xf);
+ VERIFY_SCAN_NOT (std::ctype_base::space, xf, xf);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, xf, xf);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, xf, xf+5);
+
+ // 'F'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, xF, xF);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, xF, xF);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, xF, xF+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, xF, xF+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, xF, xF);
+ VERIFY_SCAN_IS (std::ctype_base::lower, xF, xF+5);
+ VERIFY_SCAN_IS (std::ctype_base::print, xF, xF);
+ VERIFY_SCAN_IS (std::ctype_base::punct, xF, xF+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, xF, xF+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, xF, xF);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, xF, xF);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, xF, xF+5);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, xF, xF+5);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, xF, xF);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, xF, xF);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, xF, xF+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, xF, xF);
+ VERIFY_SCAN_NOT (std::ctype_base::print, xF, xF+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, xF, xF);
+ VERIFY_SCAN_NOT (std::ctype_base::space, xF, xF);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, xF, xF+5);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, xF, xF+5);
+
+ // '!'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, p1, p1+5);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, p1, p1+5);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, p1, p1+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, p1, p1+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, p1, p1);
+ VERIFY_SCAN_IS (std::ctype_base::lower, p1, p1+5);
+ VERIFY_SCAN_IS (std::ctype_base::print, p1, p1);
+ VERIFY_SCAN_IS (std::ctype_base::punct, p1, p1);
+ VERIFY_SCAN_IS (std::ctype_base::space, p1, p1+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, p1, p1+5);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, p1, p1+5);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, p1, p1);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, p1, p1);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, p1, p1);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, p1, p1);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, p1, p1);
+ VERIFY_SCAN_NOT (std::ctype_base::print, p1, p1+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, p1, p1+5);
+ VERIFY_SCAN_NOT (std::ctype_base::space, p1, p1);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, p1, p1);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, p1, p1);
+
+ // '/'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, p2, p2+5);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, p2, p2+5);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, p2, p2+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, p2, p2+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, p2, p2);
+ VERIFY_SCAN_IS (std::ctype_base::lower, p2, p2+5);
+ VERIFY_SCAN_IS (std::ctype_base::print, p2, p2);
+ VERIFY_SCAN_IS (std::ctype_base::punct, p2, p2);
+ VERIFY_SCAN_IS (std::ctype_base::space, p2, p2+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, p2, p2+5);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, p2, p2+5);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, p2, p2);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, p2, p2);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, p2, p2);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, p2, p2);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, p2, p2+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, p2, p2);
+ VERIFY_SCAN_NOT (std::ctype_base::print, p2, p2+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, p2, p2+5);
+ VERIFY_SCAN_NOT (std::ctype_base::space, p2, p2);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, p2, p2);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, p2, p2);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 2002-05-10 ghazi
+
+// Copyright (C) 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.
+
+// { dg-do run }
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+typedef wchar_t char_type;
+typedef std::char_traits<char_type> traits_type;
+class gnu_ctype: public std::ctype<char_type> { };
+
+// These two macros take a ctype mask, a string and a pointer within
+// the string that the scan function should return, usually either the
+// first or last character if the string contains identical values as
+// below.
+#define VERIFY_SCAN_IS(MASK, STRING, EXPECTED) \
+ VERIFY(gctype.scan_is((MASK), (STRING), \
+ (STRING) + traits_type::length(STRING)) == (EXPECTED))
+#define VERIFY_SCAN_NOT(MASK, STRING, EXPECTED) \
+ VERIFY(gctype.scan_not((MASK), (STRING), \
+ (STRING) + traits_type::length(STRING)) == (EXPECTED))
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+// Sanity check scan_is() and scan_not().
+void test01()
+{
+ bool test = true;
+
+ const char_type *const ca = L"aaaaa";
+ const char_type *const cz = L"zzzzz";
+ const char_type *const cA = L"AAAAA";
+ const char_type *const cZ = L"ZZZZZ";
+ const char_type *const c0 = L"00000";
+ const char_type *const c9 = L"99999";
+ const char_type *const cs = L" ";
+ const char_type *const xf = L"fffff";
+ const char_type *const xF = L"FFFFF";
+ const char_type *const p1 = L"!!!!!";
+ const char_type *const p2 = L"/////";
+
+ gnu_ctype gctype;
+
+ // 'a'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, ca, ca);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, ca, ca);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, ca, ca+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, ca, ca+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, ca, ca);
+ VERIFY_SCAN_IS (std::ctype_base::lower, ca, ca);
+ VERIFY_SCAN_IS (std::ctype_base::print, ca, ca);
+ VERIFY_SCAN_IS (std::ctype_base::punct, ca, ca+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, ca, ca+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, ca, ca+5);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, ca, ca);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, ca, ca+5);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, ca, ca+5);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, ca, ca);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, ca, ca);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, ca, ca+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, ca, ca+5);
+ VERIFY_SCAN_NOT (std::ctype_base::print, ca, ca+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, ca, ca);
+ VERIFY_SCAN_NOT (std::ctype_base::space, ca, ca);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, ca, ca);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, ca, ca+5);
+
+ // 'z'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, cz, cz);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, cz, cz);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, cz, cz+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, cz, cz+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, cz, cz);
+ VERIFY_SCAN_IS (std::ctype_base::lower, cz, cz);
+ VERIFY_SCAN_IS (std::ctype_base::print, cz, cz);
+ VERIFY_SCAN_IS (std::ctype_base::punct, cz, cz+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, cz, cz+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, cz, cz+5);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, cz, cz+5);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, cz, cz+5);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, cz, cz+5);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, cz, cz);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, cz, cz);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, cz, cz+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, cz, cz+5);
+ VERIFY_SCAN_NOT (std::ctype_base::print, cz, cz+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, cz, cz);
+ VERIFY_SCAN_NOT (std::ctype_base::space, cz, cz);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, cz, cz);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, cz, cz);
+
+ // 'A'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, cA, cA);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, cA, cA);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, cA, cA+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, cA, cA+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, cA, cA);
+ VERIFY_SCAN_IS (std::ctype_base::lower, cA, cA+5);
+ VERIFY_SCAN_IS (std::ctype_base::print, cA, cA);
+ VERIFY_SCAN_IS (std::ctype_base::punct, cA, cA+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, cA, cA+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, cA, cA);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, cA, cA);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, cA, cA+5);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, cA, cA+5);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, cA, cA);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, cA, cA);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, cA, cA+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, cA, cA);
+ VERIFY_SCAN_NOT (std::ctype_base::print, cA, cA+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, cA, cA);
+ VERIFY_SCAN_NOT (std::ctype_base::space, cA, cA);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, cA, cA+5);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, cA, cA+5);
+
+ // 'Z'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, cZ, cZ);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, cZ, cZ);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, cZ, cZ+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, cZ, cZ+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, cZ, cZ);
+ VERIFY_SCAN_IS (std::ctype_base::lower, cZ, cZ+5);
+ VERIFY_SCAN_IS (std::ctype_base::print, cZ, cZ);
+ VERIFY_SCAN_IS (std::ctype_base::punct, cZ, cZ+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, cZ, cZ+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, cZ, cZ);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, cZ, cZ+5);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, cZ, cZ+5);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, cZ, cZ+5);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, cZ, cZ);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, cZ, cZ);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, cZ, cZ+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, cZ, cZ);
+ VERIFY_SCAN_NOT (std::ctype_base::print, cZ, cZ+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, cZ, cZ);
+ VERIFY_SCAN_NOT (std::ctype_base::space, cZ, cZ);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, cZ, cZ+5);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, cZ, cZ);
+
+ // '0'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, c0, c0);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, c0, c0+5);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, c0, c0+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, c0, c0);
+ VERIFY_SCAN_IS (std::ctype_base::graph, c0, c0);
+ VERIFY_SCAN_IS (std::ctype_base::lower, c0, c0+5);
+ VERIFY_SCAN_IS (std::ctype_base::print, c0, c0);
+ VERIFY_SCAN_IS (std::ctype_base::punct, c0, c0+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, c0, c0+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, c0, c0+5);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, c0, c0);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, c0, c0+5);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, c0, c0);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, c0, c0);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, c0, c0+5);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, c0, c0+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, c0, c0);
+ VERIFY_SCAN_NOT (std::ctype_base::print, c0, c0+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, c0, c0);
+ VERIFY_SCAN_NOT (std::ctype_base::space, c0, c0);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, c0, c0);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, c0, c0+5);
+
+ // '9'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, c9, c9);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, c9, c9+5);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, c9, c9+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, c9, c9);
+ VERIFY_SCAN_IS (std::ctype_base::graph, c9, c9);
+ VERIFY_SCAN_IS (std::ctype_base::lower, c9, c9+5);
+ VERIFY_SCAN_IS (std::ctype_base::print, c9, c9);
+ VERIFY_SCAN_IS (std::ctype_base::punct, c9, c9+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, c9, c9+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, c9, c9+5);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, c9, c9);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, c9, c9+5);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, c9, c9);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, c9, c9);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, c9, c9+5);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, c9, c9+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, c9, c9);
+ VERIFY_SCAN_NOT (std::ctype_base::print, c9, c9+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, c9, c9);
+ VERIFY_SCAN_NOT (std::ctype_base::space, c9, c9);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, c9, c9);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, c9, c9+5);
+
+ // ' '
+ VERIFY_SCAN_IS (std::ctype_base::alnum, cs, cs+5);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, cs, cs+5);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, cs, cs+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, cs, cs+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, cs, cs+5);
+ VERIFY_SCAN_IS (std::ctype_base::lower, cs, cs+5);
+ VERIFY_SCAN_IS (std::ctype_base::print, cs, cs);
+ VERIFY_SCAN_IS (std::ctype_base::punct, cs, cs+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, cs, cs);
+ VERIFY_SCAN_IS (std::ctype_base::upper, cs, cs+5);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, cs, cs+5);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, cs, cs);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, cs, cs);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, cs, cs);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, cs, cs);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, cs, cs);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, cs, cs);
+ VERIFY_SCAN_NOT (std::ctype_base::print, cs, cs+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, cs, cs);
+ VERIFY_SCAN_NOT (std::ctype_base::space, cs, cs+5);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, cs, cs);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, cs, cs);
+
+ // 'f'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, xf, xf);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, xf, xf);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, xf, xf+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, xf, xf+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, xf, xf);
+ VERIFY_SCAN_IS (std::ctype_base::lower, xf, xf);
+ VERIFY_SCAN_IS (std::ctype_base::print, xf, xf);
+ VERIFY_SCAN_IS (std::ctype_base::punct, xf, xf+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, xf, xf+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, xf, xf+5);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, xf, xf);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, xf, xf+5);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, xf, xf+5);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, xf, xf);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, xf, xf);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, xf, xf+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, xf, xf+5);
+ VERIFY_SCAN_NOT (std::ctype_base::print, xf, xf+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, xf, xf);
+ VERIFY_SCAN_NOT (std::ctype_base::space, xf, xf);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, xf, xf);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, xf, xf+5);
+
+ // 'F'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, xF, xF);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, xF, xF);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, xF, xF+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, xF, xF+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, xF, xF);
+ VERIFY_SCAN_IS (std::ctype_base::lower, xF, xF+5);
+ VERIFY_SCAN_IS (std::ctype_base::print, xF, xF);
+ VERIFY_SCAN_IS (std::ctype_base::punct, xF, xF+5);
+ VERIFY_SCAN_IS (std::ctype_base::space, xF, xF+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, xF, xF);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, xF, xF);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, xF, xF+5);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, xF, xF+5);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, xF, xF);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, xF, xF);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, xF, xF+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, xF, xF);
+ VERIFY_SCAN_NOT (std::ctype_base::print, xF, xF+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, xF, xF);
+ VERIFY_SCAN_NOT (std::ctype_base::space, xF, xF);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, xF, xF+5);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, xF, xF+5);
+
+ // '!'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, p1, p1+5);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, p1, p1+5);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, p1, p1+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, p1, p1+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, p1, p1);
+ VERIFY_SCAN_IS (std::ctype_base::lower, p1, p1+5);
+ VERIFY_SCAN_IS (std::ctype_base::print, p1, p1);
+ VERIFY_SCAN_IS (std::ctype_base::punct, p1, p1);
+ VERIFY_SCAN_IS (std::ctype_base::space, p1, p1+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, p1, p1+5);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, p1, p1+5);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, p1, p1);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, p1, p1);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, p1, p1);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, p1, p1);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, p1, p1);
+ VERIFY_SCAN_NOT (std::ctype_base::print, p1, p1+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, p1, p1+5);
+ VERIFY_SCAN_NOT (std::ctype_base::space, p1, p1);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, p1, p1);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, p1, p1);
+
+ // '/'
+ VERIFY_SCAN_IS (std::ctype_base::alnum, p2, p2+5);
+ VERIFY_SCAN_IS (std::ctype_base::alpha, p2, p2+5);
+ VERIFY_SCAN_IS (std::ctype_base::cntrl, p2, p2+5);
+ VERIFY_SCAN_IS (std::ctype_base::digit, p2, p2+5);
+ VERIFY_SCAN_IS (std::ctype_base::graph, p2, p2);
+ VERIFY_SCAN_IS (std::ctype_base::lower, p2, p2+5);
+ VERIFY_SCAN_IS (std::ctype_base::print, p2, p2);
+ VERIFY_SCAN_IS (std::ctype_base::punct, p2, p2);
+ VERIFY_SCAN_IS (std::ctype_base::space, p2, p2+5);
+ VERIFY_SCAN_IS (std::ctype_base::upper, p2, p2+5);
+ VERIFY_SCAN_IS (std::ctype_base::xdigit, p2, p2+5);
+
+ VERIFY_SCAN_NOT (std::ctype_base::alnum, p2, p2);
+ VERIFY_SCAN_NOT (std::ctype_base::alpha, p2, p2);
+ VERIFY_SCAN_NOT (std::ctype_base::cntrl, p2, p2);
+ VERIFY_SCAN_NOT (std::ctype_base::digit, p2, p2);
+ VERIFY_SCAN_NOT (std::ctype_base::graph, p2, p2+5);
+ VERIFY_SCAN_NOT (std::ctype_base::lower, p2, p2);
+ VERIFY_SCAN_NOT (std::ctype_base::print, p2, p2+5);
+ VERIFY_SCAN_NOT (std::ctype_base::punct, p2, p2+5);
+ VERIFY_SCAN_NOT (std::ctype_base::space, p2, p2);
+ VERIFY_SCAN_NOT (std::ctype_base::upper, p2, p2);
+ VERIFY_SCAN_NOT (std::ctype_base::xdigit, p2, p2);
+}
+#endif
+
+int main()
+{
+#ifdef _GLIBCPP_USE_WCHAR_T
+ test01();
+#endif
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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 <testsuite_hooks.h>
+
+typedef char char_type;
+class gnu_ctype: public std::ctype<char_type> { };
+
+void test01()
+{
+ bool test = true;
+ const char_type strlit00[] = "manilla, cebu, tandag PHILIPPINES";
+ const char_type strlit01[] = "MANILLA, CEBU, TANDAG PHILIPPINES";
+ const char_type strlit02[] = "manilla, cebu, tandag philippines";
+ const char_type c00 = 'S';
+ const char_type c10 = 's';
+ const char_type c20 = '9';
+ const char_type c30 = ' ';
+ const char_type c40 = '!';
+ const char_type c50 = 'F';
+ const char_type c60 = 'f';
+ const char_type c70 = 'X';
+ const char_type c80 = 'x';
+
+ gnu_ctype gctype;
+ char_type c100;
+ int len = std::char_traits<char_type>::length(strlit00);
+ char_type c_array[len + 1];
+
+ // sanity check ctype_base::mask members
+ int i01 = std::ctype_base::space;
+ int i02 = std::ctype_base::upper;
+ int i03 = std::ctype_base::lower;
+ int i04 = std::ctype_base::digit;
+ int i05 = std::ctype_base::punct;
+ int i06 = std::ctype_base::alpha;
+ int i07 = std::ctype_base::xdigit;
+ int i08 = std::ctype_base::alnum;
+ int i09 = std::ctype_base::graph;
+ int i10 = std::ctype_base::print;
+ int i11 = std::ctype_base::cntrl;
+ int i12 = sizeof(std::ctype_base::mask);
+ VERIFY ( i01 != i02);
+ VERIFY ( i02 != i03);
+ VERIFY ( i03 != i04);
+ VERIFY ( i04 != i05);
+ VERIFY ( i05 != i06);
+ VERIFY ( i06 != i07);
+ VERIFY ( i07 != i08);
+ VERIFY ( i08 != i09);
+ VERIFY ( i09 != i10);
+ VERIFY ( i10 != i11);
+ VERIFY ( i11 != i01);
+
+ // char_type toupper(char_type c) const
+ c100 = gctype.toupper(c10);
+ VERIFY( c100 == c00 );
+
+ // char_type tolower(char_type c) const
+ c100 = gctype.tolower(c00);
+ VERIFY( c100 == c10 );
+
+ // char_type toupper(char_type* low, const char_type* hi) const
+ std::char_traits<char_type>::copy(c_array, strlit02, len + 1);
+ gctype.toupper(c_array, c_array + len);
+ VERIFY( !std::char_traits<char_type>::compare(c_array, strlit01, len - 1) );
+
+ // char_type tolower(char_type* low, const char_type* hi) const
+ std::char_traits<char_type>::copy(c_array, strlit01, len + 1);
+ gctype.tolower(c_array, c_array + len);
+ VERIFY( !std::char_traits<char_type>::compare(c_array, strlit02, len - 1) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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 <testsuite_hooks.h>
+
+typedef wchar_t char_type;
+class gnu_ctype: public std::ctype<char_type> { };
+
+void test01()
+{
+ bool test = true;
+ const char_type strlit00[] = L"manilla, cebu, tandag PHILIPPINES";
+ const char_type strlit01[] = L"MANILLA, CEBU, TANDAG PHILIPPINES";
+ const char_type strlit02[] = L"manilla, cebu, tandag philippines";
+ const char_type c00 = L'S';
+ const char_type c10 = L's';
+ const char_type c20 = L'9';
+ const char_type c30 = L' ';
+ const char_type c40 = L'!';
+ const char_type c50 = L'F';
+ const char_type c60 = L'f';
+ const char_type c70 = L'X';
+ const char_type c80 = L'x';
+
+ gnu_ctype gctype;
+ char_type c100;
+ int len = std::char_traits<char_type>::length(strlit00);
+ char_type c_array[len + 1];
+
+ // sanity check ctype_base::mask members
+ int i01 = std::ctype_base::space;
+ int i02 = std::ctype_base::upper;
+ int i03 = std::ctype_base::lower;
+ int i04 = std::ctype_base::digit;
+ int i05 = std::ctype_base::punct;
+ int i06 = std::ctype_base::alpha;
+ int i07 = std::ctype_base::xdigit;
+ int i08 = std::ctype_base::alnum;
+ int i09 = std::ctype_base::graph;
+ int i10 = std::ctype_base::print;
+ int i11 = std::ctype_base::cntrl;
+ int i12 = sizeof(std::ctype_base::mask);
+ VERIFY ( i01 != i02);
+ VERIFY ( i02 != i03);
+ VERIFY ( i03 != i04);
+ VERIFY ( i04 != i05);
+ VERIFY ( i05 != i06);
+ VERIFY ( i06 != i07);
+ VERIFY ( i07 != i08);
+ VERIFY ( i08 != i09);
+ VERIFY ( i09 != i10);
+ VERIFY ( i10 != i11);
+ VERIFY ( i11 != i01);
+
+ // char_type toupper(char_type c) const
+ c100 = gctype.toupper(c10);
+ VERIFY( c100 == c00 );
+
+ // char_type tolower(char_type c) const
+ c100 = gctype.tolower(c00);
+ VERIFY( c100 == c10 );
+
+ // char_type toupper(char_type* low, const char_type* hi) const
+ std::char_traits<char_type>::copy(c_array, strlit02, len + 1);
+ gctype.toupper(c_array, c_array + len);
+ VERIFY( !std::char_traits<char_type>::compare(c_array, strlit01, len - 1) );
+
+ // char_type tolower(char_type* low, const char_type* hi) const
+ std::char_traits<char_type>::copy(c_array, strlit01, len + 1);
+ gctype.tolower(c_array, c_array + len);
+ VERIFY( !std::char_traits<char_type>::compare(c_array, strlit02, len - 1) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 2002-05-24 bkoz
+
+// Copyright (C) 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 <vector>
+#include <testsuite_hooks.h>
+
+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("drusilla, louvinia, bayard");
+ basic_string<char> narrow("drusilla, louvinia, bayard");
+ vector<wide_type> wide_chars(narrow.length() + 1);
+
+ // widen(char c) const
+ for (int i = 0; i < narrow.length(); ++i)
+ {
+ char c = ctype_c.widen(narrow[i]);
+ VERIFY( c == wide[i] );
+ }
+
+ // widen(const char* low, const char* high, charT* dest) const
+ ctype_c.widen(&narrow[0], &narrow[narrow.length()], &wide_chars[0]);
+ for (int i = 0; i < narrow.length(); ++i)
+ VERIFY( wide_chars[i] == wide[i] );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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>
+
+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"drusilla, louvinia, bayard");
+ basic_string<char> narrow("drusilla, louvinia, bayard");
+ vector<wide_type> wide_chars(narrow.length() + 1);
+
+ // widen(char c) const
+ for (int i = 0; i < narrow.length(); ++i)
+ {
+ char c = ctype_c.widen(narrow[i]);
+ VERIFY( c == wide[i] );
+ }
+
+ // widen(const char* low, const char* high, charT* dest) const
+ ctype_c.widen(&narrow[0], &narrow[narrow.length()], &wide_chars[0]);
+ for (int i = 0; i < narrow.length(); ++i)
+ VERIFY( wide_chars[i] == wide[i] );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
+++ /dev/null
-// 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 <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> { };
-
-void test01()
-{
- bool test = true;
- const char_type strlit00[] = "manilla, cebu, tandag PHILIPPINES";
- const char_type strlit01[] = "MANILLA, CEBU, TANDAG PHILIPPINES";
- const char_type strlit02[] = "manilla, cebu, tandag philippines";
- const char_type c00 = 'S';
- const char_type c10 = 's';
- const char_type c20 = '9';
- const char_type c30 = ' ';
- const char_type c40 = '!';
- const char_type c50 = 'F';
- const char_type c60 = 'f';
- const char_type c70 = 'X';
- const char_type c80 = 'x';
-
- gnu_ctype gctype;
- char_type c100;
- int len = std::char_traits<char_type>::length(strlit00);
- char_type c_array[len + 1];
-
- // sanity check ctype_base::mask members
- int i01 = std::ctype_base::space;
- int i02 = std::ctype_base::upper;
- int i03 = std::ctype_base::lower;
- int i04 = std::ctype_base::digit;
- int i05 = std::ctype_base::punct;
- int i06 = std::ctype_base::alpha;
- int i07 = std::ctype_base::xdigit;
- int i08 = std::ctype_base::alnum;
- int i09 = std::ctype_base::graph;
- int i10 = std::ctype_base::print;
- int i11 = std::ctype_base::cntrl;
- int i12 = sizeof(std::ctype_base::mask);
- VERIFY ( i01 != i02);
- VERIFY ( i02 != i03);
- VERIFY ( i03 != i04);
- VERIFY ( i04 != i05);
- VERIFY ( i05 != i06);
- VERIFY ( i06 != i07);
- VERIFY ( i07 != i08);
- VERIFY ( i08 != i09);
- VERIFY ( i09 != i10);
- VERIFY ( i10 != i11);
- VERIFY ( i11 != i01);
-
- // bool is(mask m, char_type c) const;
- VERIFY( gctype.is(std::ctype_base::space, c30) );
- VERIFY( gctype.is(std::ctype_base::upper, c00) );
- VERIFY( gctype.is(std::ctype_base::lower, c10) );
- VERIFY( gctype.is(std::ctype_base::digit, c20) );
- VERIFY( gctype.is(std::ctype_base::punct, c40) );
- VERIFY( gctype.is(std::ctype_base::alpha, c50) );
- VERIFY( gctype.is(std::ctype_base::alpha, c60) );
- VERIFY( gctype.is(std::ctype_base::xdigit, c20) );
- VERIFY( !gctype.is(std::ctype_base::xdigit, c80) );
- VERIFY( gctype.is(std::ctype_base::alnum, c50) );
- VERIFY( gctype.is(std::ctype_base::alnum, c20) );
- VERIFY( gctype.is(std::ctype_base::graph, c40) );
- VERIFY( gctype.is(std::ctype_base::graph, c20) );
-
- // const char* is(const char* low, const char* high, mask* vec) const
- std::ctype_base::mask m00 = static_cast<std::ctype_base::mask>(0);
- std::ctype_base::mask m01[3];
- std::ctype_base::mask m02[13];
- const char_type* cc0 = strlit00;
- const char_type* cc1 = NULL;
- const char_type* cc2 = NULL;
-
- cc0 = strlit00;
- m01[0] = m00;
- m01[1] = m00;
- m01[2] = m00;
- cc1 = gctype.is(cc0, cc0, m01);
- VERIFY( cc1 == strlit00 );
- VERIFY( m01[0] == m00 );
- 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);
- VERIFY( m01[0] != m00 );
- VERIFY( m01[1] != m00 );
- VERIFY( m01[2] != m00 );
- VERIFY( gctype.is(m01[0], cc0[0]) );
- VERIFY( gctype.is(m01[1], cc0[1]) );
- VERIFY( gctype.is(m01[2], cc0[2]) );
-
- cc0 = strlit01;
- cc1 = gctype.is(cc0, cc0 + 13, m02);
- VERIFY( cc1 == strlit01 + 13);
- VERIFY( m02[6] != m00 );
- VERIFY( m02[7] != m00 );
- VERIFY( m02[8] != m00 );
- VERIFY( m02[8] != m02[6] );
- VERIFY( m02[6] != m02[7] );
- VERIFY( static_cast<bool>(m02[6] & std::ctype_base::alnum) );
- VERIFY( static_cast<bool>(m02[6] & std::ctype_base::upper) );
- VERIFY( static_cast<bool>(m02[6] & std::ctype_base::alpha) );
- VERIFY( static_cast<bool>(m02[7] & std::ctype_base::punct) );
- VERIFY( static_cast<bool>(m02[8] & std::ctype_base::space) );
- VERIFY( gctype.is(m02[6], cc0[6]) );
- VERIFY( gctype.is(m02[7], cc0[7]) );
- 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;
-}
+++ /dev/null
-// 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 <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> { };
-
-void test01()
-{
- bool test = true;
- const char_type strlit00[] = L"manilla, cebu, tandag PHILIPPINES";
- const char_type strlit01[] = L"MANILLA, CEBU, TANDAG PHILIPPINES";
- const char_type strlit02[] = L"manilla, cebu, tandag philippines";
- const char_type c00 = L'S';
- const char_type c10 = L's';
- const char_type c20 = L'9';
- const char_type c30 = L' ';
- const char_type c40 = L'!';
- const char_type c50 = L'F';
- const char_type c60 = L'f';
- const char_type c70 = L'X';
- const char_type c80 = L'x';
-
- gnu_ctype gctype;
- char_type c100;
- int len = std::char_traits<char_type>::length(strlit00);
- char_type c_array[len + 1];
-
- // sanity check ctype_base::mask members
- int i01 = std::ctype_base::space;
- int i02 = std::ctype_base::upper;
- int i03 = std::ctype_base::lower;
- int i04 = std::ctype_base::digit;
- int i05 = std::ctype_base::punct;
- int i06 = std::ctype_base::alpha;
- int i07 = std::ctype_base::xdigit;
- int i08 = std::ctype_base::alnum;
- int i09 = std::ctype_base::graph;
- int i10 = std::ctype_base::print;
- int i11 = std::ctype_base::cntrl;
- int i12 = sizeof(std::ctype_base::mask);
- VERIFY ( i01 != i02);
- VERIFY ( i02 != i03);
- VERIFY ( i03 != i04);
- VERIFY ( i04 != i05);
- VERIFY ( i05 != i06);
- VERIFY ( i06 != i07);
- VERIFY ( i07 != i08);
- VERIFY ( i08 != i09);
- VERIFY ( i09 != i10);
- VERIFY ( i10 != i11);
- VERIFY ( i11 != i01);
-
- // bool is(mask m, char_type c) const;
- VERIFY( gctype.is(std::ctype_base::space, c30) );
- VERIFY( gctype.is(std::ctype_base::upper, c00) );
- VERIFY( gctype.is(std::ctype_base::lower, c10) );
- VERIFY( gctype.is(std::ctype_base::digit, c20) );
- VERIFY( gctype.is(std::ctype_base::punct, c40) );
- VERIFY( gctype.is(std::ctype_base::alpha, c50) );
- VERIFY( gctype.is(std::ctype_base::alpha, c60) );
- VERIFY( gctype.is(std::ctype_base::xdigit, c20) );
- VERIFY( !gctype.is(std::ctype_base::xdigit, c80) );
- VERIFY( gctype.is(std::ctype_base::alnum, c50) );
- VERIFY( gctype.is(std::ctype_base::alnum, c20) );
- VERIFY( gctype.is(std::ctype_base::graph, c40) );
- VERIFY( gctype.is(std::ctype_base::graph, c20) );
-
- // const char* is(const char* low, const char* high, mask* vec) const
- std::ctype_base::mask m00 = static_cast<std::ctype_base::mask>(0);
- std::ctype_base::mask m01[3];
- std::ctype_base::mask m02[13];
- const char_type* cc0 = strlit00;
- const char_type* cc1 = NULL;
- const char_type* cc2 = NULL;
-
- cc0 = strlit00;
- m01[0] = m00;
- m01[1] = m00;
- m01[2] = m00;
- cc1 = gctype.is(cc0, cc0, m01);
- VERIFY( cc1 == strlit00 );
- VERIFY( m01[0] == m00 );
- 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 );
- VERIFY( m01[2] != m00 );
- VERIFY( gctype.is(m01[0], cc0[0]) );
- VERIFY( gctype.is(m01[1], cc0[1]) );
- VERIFY( gctype.is(m01[2], cc0[2]) );
-#endif
-
- cc0 = strlit01;
- cc1 = gctype.is(cc0, cc0 + 13, m02);
- VERIFY( cc1 == strlit01 + 13);
-#if 0
- VERIFY( m02[6] != m00 );
- VERIFY( m02[7] != m00 );
- VERIFY( m02[8] != m00 );
- VERIFY( m02[8] != m02[6] );
- VERIFY( m02[6] != m02[7] );
- VERIFY( static_cast<bool>(m02[6] & std::ctype_base::alnum) );
- VERIFY( static_cast<bool>(m02[6] & std::ctype_base::upper) );
- VERIFY( static_cast<bool>(m02[6] & std::ctype_base::alpha) );
- VERIFY( static_cast<bool>(m02[7] & std::ctype_base::punct) );
- VERIFY( static_cast<bool>(m02[8] & std::ctype_base::space) );
- VERIFY( gctype.is(m02[6], cc0[6]) );
- VERIFY( gctype.is(m02[7], cc0[7]) );
- VERIFY( gctype.is(m02[8], cc0[8]) );
-#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;
-}
+++ /dev/null
-// 2000-02-16 bkoz
-
-// 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>
-
-// Dietmar Kühl via Peter Schmid
-class comma_ctype: public std::ctype<char>
-{
-public:
- comma_ctype(): std::ctype<char>() { }
- static void get_table()
- { classic_table(); }
-};
-
-int main()
-{
- return 0;
-}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 2002-05-24 bkoz
-
-// Copyright (C) 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 <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;
- 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);
-
- // Construct non-asci string.
- basic_string<wide_type> wide("wibble");
- wide += wide_type(1240);
- wide += "kibble";
- basic_string<char> narrow("wibble");
- narrow += char(1240);
- narrow += "kibble";
- 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();
- test02();
- return 0;
-}
+++ /dev/null
-// 2002-05-24 bkoz
-
-// Copyright (C) 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 <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;
- 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);
-
- // Construct non-asci string.
- basic_string<wide_type> wide(L"wibble");
- wide += wide_type(1240);
- wide += L"kibble";
- basic_string<char> narrow("wibble");
- narrow += dfault;
- narrow += "kibble";
- 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] );
-}
-#endif
-
-int main()
-{
-#ifdef _GLIBCPP_USE_WCHAR_T
- test01();
- test02();
-#endif
- return 0;
-}
+++ /dev/null
-// 2002-05-10 ghazi
-
-// Copyright (C) 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.
-
-// { dg-do run }
-
-#include <locale>
-#include <testsuite_hooks.h>
-
-typedef char char_type;
-typedef std::char_traits<char_type> traits_type;
-class gnu_ctype: public std::ctype<char_type> { };
-
-// These two macros take a ctype mask, a string and a pointer within
-// the string that the scan function should return, usually either the
-// first or last character if the string contains identical values as
-// below.
-#define VERIFY_SCAN_IS(MASK, STRING, EXPECTED) \
- VERIFY(gctype.scan_is((MASK), (STRING), \
- (STRING) + traits_type::length(STRING)) == (EXPECTED))
-#define VERIFY_SCAN_NOT(MASK, STRING, EXPECTED) \
- VERIFY(gctype.scan_not((MASK), (STRING), \
- (STRING) + traits_type::length(STRING)) == (EXPECTED))
-
-// Sanity check scan_is() and scan_not().
-void test01()
-{
- bool test = true;
-
- const char_type *const ca = "aaaaa";
- const char_type *const cz = "zzzzz";
- const char_type *const cA = "AAAAA";
- const char_type *const cZ = "ZZZZZ";
- const char_type *const c0 = "00000";
- const char_type *const c9 = "99999";
- const char_type *const cs = " ";
- const char_type *const xf = "fffff";
- const char_type *const xF = "FFFFF";
- const char_type *const p1 = "!!!!!";
- const char_type *const p2 = "/////";
-
- gnu_ctype gctype;
-
- // 'a'
- VERIFY_SCAN_IS (std::ctype_base::alnum, ca, ca);
- VERIFY_SCAN_IS (std::ctype_base::alpha, ca, ca);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, ca, ca+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, ca, ca+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, ca, ca);
- VERIFY_SCAN_IS (std::ctype_base::lower, ca, ca);
- VERIFY_SCAN_IS (std::ctype_base::print, ca, ca);
- VERIFY_SCAN_IS (std::ctype_base::punct, ca, ca+5);
- VERIFY_SCAN_IS (std::ctype_base::space, ca, ca+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, ca, ca+5);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, ca, ca);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, ca, ca+5);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, ca, ca+5);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, ca, ca);
- VERIFY_SCAN_NOT (std::ctype_base::digit, ca, ca);
- VERIFY_SCAN_NOT (std::ctype_base::graph, ca, ca+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, ca, ca+5);
- VERIFY_SCAN_NOT (std::ctype_base::print, ca, ca+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, ca, ca);
- VERIFY_SCAN_NOT (std::ctype_base::space, ca, ca);
- VERIFY_SCAN_NOT (std::ctype_base::upper, ca, ca);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, ca, ca+5);
-
- // 'z'
- VERIFY_SCAN_IS (std::ctype_base::alnum, cz, cz);
- VERIFY_SCAN_IS (std::ctype_base::alpha, cz, cz);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, cz, cz+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, cz, cz+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, cz, cz);
- VERIFY_SCAN_IS (std::ctype_base::lower, cz, cz);
- VERIFY_SCAN_IS (std::ctype_base::print, cz, cz);
- VERIFY_SCAN_IS (std::ctype_base::punct, cz, cz+5);
- VERIFY_SCAN_IS (std::ctype_base::space, cz, cz+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, cz, cz+5);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, cz, cz+5);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, cz, cz+5);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, cz, cz+5);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, cz, cz);
- VERIFY_SCAN_NOT (std::ctype_base::digit, cz, cz);
- VERIFY_SCAN_NOT (std::ctype_base::graph, cz, cz+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, cz, cz+5);
- VERIFY_SCAN_NOT (std::ctype_base::print, cz, cz+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, cz, cz);
- VERIFY_SCAN_NOT (std::ctype_base::space, cz, cz);
- VERIFY_SCAN_NOT (std::ctype_base::upper, cz, cz);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, cz, cz);
-
- // 'A'
- VERIFY_SCAN_IS (std::ctype_base::alnum, cA, cA);
- VERIFY_SCAN_IS (std::ctype_base::alpha, cA, cA);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, cA, cA+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, cA, cA+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, cA, cA);
- VERIFY_SCAN_IS (std::ctype_base::lower, cA, cA+5);
- VERIFY_SCAN_IS (std::ctype_base::print, cA, cA);
- VERIFY_SCAN_IS (std::ctype_base::punct, cA, cA+5);
- VERIFY_SCAN_IS (std::ctype_base::space, cA, cA+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, cA, cA);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, cA, cA);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, cA, cA+5);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, cA, cA+5);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, cA, cA);
- VERIFY_SCAN_NOT (std::ctype_base::digit, cA, cA);
- VERIFY_SCAN_NOT (std::ctype_base::graph, cA, cA+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, cA, cA);
- VERIFY_SCAN_NOT (std::ctype_base::print, cA, cA+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, cA, cA);
- VERIFY_SCAN_NOT (std::ctype_base::space, cA, cA);
- VERIFY_SCAN_NOT (std::ctype_base::upper, cA, cA+5);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, cA, cA+5);
-
- // 'Z'
- VERIFY_SCAN_IS (std::ctype_base::alnum, cZ, cZ);
- VERIFY_SCAN_IS (std::ctype_base::alpha, cZ, cZ);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, cZ, cZ+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, cZ, cZ+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, cZ, cZ);
- VERIFY_SCAN_IS (std::ctype_base::lower, cZ, cZ+5);
- VERIFY_SCAN_IS (std::ctype_base::print, cZ, cZ);
- VERIFY_SCAN_IS (std::ctype_base::punct, cZ, cZ+5);
- VERIFY_SCAN_IS (std::ctype_base::space, cZ, cZ+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, cZ, cZ);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, cZ, cZ+5);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, cZ, cZ+5);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, cZ, cZ+5);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, cZ, cZ);
- VERIFY_SCAN_NOT (std::ctype_base::digit, cZ, cZ);
- VERIFY_SCAN_NOT (std::ctype_base::graph, cZ, cZ+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, cZ, cZ);
- VERIFY_SCAN_NOT (std::ctype_base::print, cZ, cZ+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, cZ, cZ);
- VERIFY_SCAN_NOT (std::ctype_base::space, cZ, cZ);
- VERIFY_SCAN_NOT (std::ctype_base::upper, cZ, cZ+5);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, cZ, cZ);
-
- // '0'
- VERIFY_SCAN_IS (std::ctype_base::alnum, c0, c0);
- VERIFY_SCAN_IS (std::ctype_base::alpha, c0, c0+5);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, c0, c0+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, c0, c0);
- VERIFY_SCAN_IS (std::ctype_base::graph, c0, c0);
- VERIFY_SCAN_IS (std::ctype_base::lower, c0, c0+5);
- VERIFY_SCAN_IS (std::ctype_base::print, c0, c0);
- VERIFY_SCAN_IS (std::ctype_base::punct, c0, c0+5);
- VERIFY_SCAN_IS (std::ctype_base::space, c0, c0+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, c0, c0+5);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, c0, c0);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, c0, c0+5);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, c0, c0);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, c0, c0);
- VERIFY_SCAN_NOT (std::ctype_base::digit, c0, c0+5);
- VERIFY_SCAN_NOT (std::ctype_base::graph, c0, c0+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, c0, c0);
- VERIFY_SCAN_NOT (std::ctype_base::print, c0, c0+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, c0, c0);
- VERIFY_SCAN_NOT (std::ctype_base::space, c0, c0);
- VERIFY_SCAN_NOT (std::ctype_base::upper, c0, c0);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, c0, c0+5);
-
- // '9'
- VERIFY_SCAN_IS (std::ctype_base::alnum, c9, c9);
- VERIFY_SCAN_IS (std::ctype_base::alpha, c9, c9+5);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, c9, c9+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, c9, c9);
- VERIFY_SCAN_IS (std::ctype_base::graph, c9, c9);
- VERIFY_SCAN_IS (std::ctype_base::lower, c9, c9+5);
- VERIFY_SCAN_IS (std::ctype_base::print, c9, c9);
- VERIFY_SCAN_IS (std::ctype_base::punct, c9, c9+5);
- VERIFY_SCAN_IS (std::ctype_base::space, c9, c9+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, c9, c9+5);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, c9, c9);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, c9, c9+5);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, c9, c9);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, c9, c9);
- VERIFY_SCAN_NOT (std::ctype_base::digit, c9, c9+5);
- VERIFY_SCAN_NOT (std::ctype_base::graph, c9, c9+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, c9, c9);
- VERIFY_SCAN_NOT (std::ctype_base::print, c9, c9+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, c9, c9);
- VERIFY_SCAN_NOT (std::ctype_base::space, c9, c9);
- VERIFY_SCAN_NOT (std::ctype_base::upper, c9, c9);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, c9, c9+5);
-
- // ' '
- VERIFY_SCAN_IS (std::ctype_base::alnum, cs, cs+5);
- VERIFY_SCAN_IS (std::ctype_base::alpha, cs, cs+5);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, cs, cs+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, cs, cs+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, cs, cs+5);
- VERIFY_SCAN_IS (std::ctype_base::lower, cs, cs+5);
- VERIFY_SCAN_IS (std::ctype_base::print, cs, cs);
- VERIFY_SCAN_IS (std::ctype_base::punct, cs, cs+5);
- VERIFY_SCAN_IS (std::ctype_base::space, cs, cs);
- VERIFY_SCAN_IS (std::ctype_base::upper, cs, cs+5);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, cs, cs+5);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, cs, cs);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, cs, cs);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, cs, cs);
- VERIFY_SCAN_NOT (std::ctype_base::digit, cs, cs);
- VERIFY_SCAN_NOT (std::ctype_base::graph, cs, cs);
- VERIFY_SCAN_NOT (std::ctype_base::lower, cs, cs);
- VERIFY_SCAN_NOT (std::ctype_base::print, cs, cs+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, cs, cs);
- VERIFY_SCAN_NOT (std::ctype_base::space, cs, cs+5);
- VERIFY_SCAN_NOT (std::ctype_base::upper, cs, cs);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, cs, cs);
-
- // 'f'
- VERIFY_SCAN_IS (std::ctype_base::alnum, xf, xf);
- VERIFY_SCAN_IS (std::ctype_base::alpha, xf, xf);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, xf, xf+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, xf, xf+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, xf, xf);
- VERIFY_SCAN_IS (std::ctype_base::lower, xf, xf);
- VERIFY_SCAN_IS (std::ctype_base::print, xf, xf);
- VERIFY_SCAN_IS (std::ctype_base::punct, xf, xf+5);
- VERIFY_SCAN_IS (std::ctype_base::space, xf, xf+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, xf, xf+5);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, xf, xf);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, xf, xf+5);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, xf, xf+5);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, xf, xf);
- VERIFY_SCAN_NOT (std::ctype_base::digit, xf, xf);
- VERIFY_SCAN_NOT (std::ctype_base::graph, xf, xf+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, xf, xf+5);
- VERIFY_SCAN_NOT (std::ctype_base::print, xf, xf+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, xf, xf);
- VERIFY_SCAN_NOT (std::ctype_base::space, xf, xf);
- VERIFY_SCAN_NOT (std::ctype_base::upper, xf, xf);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, xf, xf+5);
-
- // 'F'
- VERIFY_SCAN_IS (std::ctype_base::alnum, xF, xF);
- VERIFY_SCAN_IS (std::ctype_base::alpha, xF, xF);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, xF, xF+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, xF, xF+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, xF, xF);
- VERIFY_SCAN_IS (std::ctype_base::lower, xF, xF+5);
- VERIFY_SCAN_IS (std::ctype_base::print, xF, xF);
- VERIFY_SCAN_IS (std::ctype_base::punct, xF, xF+5);
- VERIFY_SCAN_IS (std::ctype_base::space, xF, xF+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, xF, xF);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, xF, xF);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, xF, xF+5);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, xF, xF+5);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, xF, xF);
- VERIFY_SCAN_NOT (std::ctype_base::digit, xF, xF);
- VERIFY_SCAN_NOT (std::ctype_base::graph, xF, xF+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, xF, xF);
- VERIFY_SCAN_NOT (std::ctype_base::print, xF, xF+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, xF, xF);
- VERIFY_SCAN_NOT (std::ctype_base::space, xF, xF);
- VERIFY_SCAN_NOT (std::ctype_base::upper, xF, xF+5);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, xF, xF+5);
-
- // '!'
- VERIFY_SCAN_IS (std::ctype_base::alnum, p1, p1+5);
- VERIFY_SCAN_IS (std::ctype_base::alpha, p1, p1+5);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, p1, p1+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, p1, p1+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, p1, p1);
- VERIFY_SCAN_IS (std::ctype_base::lower, p1, p1+5);
- VERIFY_SCAN_IS (std::ctype_base::print, p1, p1);
- VERIFY_SCAN_IS (std::ctype_base::punct, p1, p1);
- VERIFY_SCAN_IS (std::ctype_base::space, p1, p1+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, p1, p1+5);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, p1, p1+5);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, p1, p1);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, p1, p1);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, p1, p1);
- VERIFY_SCAN_NOT (std::ctype_base::digit, p1, p1);
- VERIFY_SCAN_NOT (std::ctype_base::lower, p1, p1);
- VERIFY_SCAN_NOT (std::ctype_base::print, p1, p1+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, p1, p1+5);
- VERIFY_SCAN_NOT (std::ctype_base::space, p1, p1);
- VERIFY_SCAN_NOT (std::ctype_base::upper, p1, p1);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, p1, p1);
-
- // '/'
- VERIFY_SCAN_IS (std::ctype_base::alnum, p2, p2+5);
- VERIFY_SCAN_IS (std::ctype_base::alpha, p2, p2+5);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, p2, p2+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, p2, p2+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, p2, p2);
- VERIFY_SCAN_IS (std::ctype_base::lower, p2, p2+5);
- VERIFY_SCAN_IS (std::ctype_base::print, p2, p2);
- VERIFY_SCAN_IS (std::ctype_base::punct, p2, p2);
- VERIFY_SCAN_IS (std::ctype_base::space, p2, p2+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, p2, p2+5);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, p2, p2+5);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, p2, p2);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, p2, p2);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, p2, p2);
- VERIFY_SCAN_NOT (std::ctype_base::digit, p2, p2);
- VERIFY_SCAN_NOT (std::ctype_base::graph, p2, p2+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, p2, p2);
- VERIFY_SCAN_NOT (std::ctype_base::print, p2, p2+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, p2, p2+5);
- VERIFY_SCAN_NOT (std::ctype_base::space, p2, p2);
- VERIFY_SCAN_NOT (std::ctype_base::upper, p2, p2);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, p2, p2);
-}
-
-int main()
-{
- test01();
- return 0;
-}
+++ /dev/null
-// 2002-05-10 ghazi
-
-// Copyright (C) 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.
-
-// { dg-do run }
-
-#include <locale>
-#include <testsuite_hooks.h>
-
-typedef wchar_t char_type;
-typedef std::char_traits<char_type> traits_type;
-class gnu_ctype: public std::ctype<char_type> { };
-
-// These two macros take a ctype mask, a string and a pointer within
-// the string that the scan function should return, usually either the
-// first or last character if the string contains identical values as
-// below.
-#define VERIFY_SCAN_IS(MASK, STRING, EXPECTED) \
- VERIFY(gctype.scan_is((MASK), (STRING), \
- (STRING) + traits_type::length(STRING)) == (EXPECTED))
-#define VERIFY_SCAN_NOT(MASK, STRING, EXPECTED) \
- VERIFY(gctype.scan_not((MASK), (STRING), \
- (STRING) + traits_type::length(STRING)) == (EXPECTED))
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-// Sanity check scan_is() and scan_not().
-void test01()
-{
- bool test = true;
-
- const char_type *const ca = L"aaaaa";
- const char_type *const cz = L"zzzzz";
- const char_type *const cA = L"AAAAA";
- const char_type *const cZ = L"ZZZZZ";
- const char_type *const c0 = L"00000";
- const char_type *const c9 = L"99999";
- const char_type *const cs = L" ";
- const char_type *const xf = L"fffff";
- const char_type *const xF = L"FFFFF";
- const char_type *const p1 = L"!!!!!";
- const char_type *const p2 = L"/////";
-
- gnu_ctype gctype;
-
- // 'a'
- VERIFY_SCAN_IS (std::ctype_base::alnum, ca, ca);
- VERIFY_SCAN_IS (std::ctype_base::alpha, ca, ca);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, ca, ca+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, ca, ca+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, ca, ca);
- VERIFY_SCAN_IS (std::ctype_base::lower, ca, ca);
- VERIFY_SCAN_IS (std::ctype_base::print, ca, ca);
- VERIFY_SCAN_IS (std::ctype_base::punct, ca, ca+5);
- VERIFY_SCAN_IS (std::ctype_base::space, ca, ca+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, ca, ca+5);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, ca, ca);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, ca, ca+5);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, ca, ca+5);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, ca, ca);
- VERIFY_SCAN_NOT (std::ctype_base::digit, ca, ca);
- VERIFY_SCAN_NOT (std::ctype_base::graph, ca, ca+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, ca, ca+5);
- VERIFY_SCAN_NOT (std::ctype_base::print, ca, ca+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, ca, ca);
- VERIFY_SCAN_NOT (std::ctype_base::space, ca, ca);
- VERIFY_SCAN_NOT (std::ctype_base::upper, ca, ca);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, ca, ca+5);
-
- // 'z'
- VERIFY_SCAN_IS (std::ctype_base::alnum, cz, cz);
- VERIFY_SCAN_IS (std::ctype_base::alpha, cz, cz);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, cz, cz+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, cz, cz+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, cz, cz);
- VERIFY_SCAN_IS (std::ctype_base::lower, cz, cz);
- VERIFY_SCAN_IS (std::ctype_base::print, cz, cz);
- VERIFY_SCAN_IS (std::ctype_base::punct, cz, cz+5);
- VERIFY_SCAN_IS (std::ctype_base::space, cz, cz+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, cz, cz+5);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, cz, cz+5);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, cz, cz+5);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, cz, cz+5);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, cz, cz);
- VERIFY_SCAN_NOT (std::ctype_base::digit, cz, cz);
- VERIFY_SCAN_NOT (std::ctype_base::graph, cz, cz+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, cz, cz+5);
- VERIFY_SCAN_NOT (std::ctype_base::print, cz, cz+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, cz, cz);
- VERIFY_SCAN_NOT (std::ctype_base::space, cz, cz);
- VERIFY_SCAN_NOT (std::ctype_base::upper, cz, cz);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, cz, cz);
-
- // 'A'
- VERIFY_SCAN_IS (std::ctype_base::alnum, cA, cA);
- VERIFY_SCAN_IS (std::ctype_base::alpha, cA, cA);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, cA, cA+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, cA, cA+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, cA, cA);
- VERIFY_SCAN_IS (std::ctype_base::lower, cA, cA+5);
- VERIFY_SCAN_IS (std::ctype_base::print, cA, cA);
- VERIFY_SCAN_IS (std::ctype_base::punct, cA, cA+5);
- VERIFY_SCAN_IS (std::ctype_base::space, cA, cA+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, cA, cA);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, cA, cA);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, cA, cA+5);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, cA, cA+5);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, cA, cA);
- VERIFY_SCAN_NOT (std::ctype_base::digit, cA, cA);
- VERIFY_SCAN_NOT (std::ctype_base::graph, cA, cA+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, cA, cA);
- VERIFY_SCAN_NOT (std::ctype_base::print, cA, cA+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, cA, cA);
- VERIFY_SCAN_NOT (std::ctype_base::space, cA, cA);
- VERIFY_SCAN_NOT (std::ctype_base::upper, cA, cA+5);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, cA, cA+5);
-
- // 'Z'
- VERIFY_SCAN_IS (std::ctype_base::alnum, cZ, cZ);
- VERIFY_SCAN_IS (std::ctype_base::alpha, cZ, cZ);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, cZ, cZ+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, cZ, cZ+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, cZ, cZ);
- VERIFY_SCAN_IS (std::ctype_base::lower, cZ, cZ+5);
- VERIFY_SCAN_IS (std::ctype_base::print, cZ, cZ);
- VERIFY_SCAN_IS (std::ctype_base::punct, cZ, cZ+5);
- VERIFY_SCAN_IS (std::ctype_base::space, cZ, cZ+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, cZ, cZ);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, cZ, cZ+5);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, cZ, cZ+5);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, cZ, cZ+5);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, cZ, cZ);
- VERIFY_SCAN_NOT (std::ctype_base::digit, cZ, cZ);
- VERIFY_SCAN_NOT (std::ctype_base::graph, cZ, cZ+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, cZ, cZ);
- VERIFY_SCAN_NOT (std::ctype_base::print, cZ, cZ+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, cZ, cZ);
- VERIFY_SCAN_NOT (std::ctype_base::space, cZ, cZ);
- VERIFY_SCAN_NOT (std::ctype_base::upper, cZ, cZ+5);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, cZ, cZ);
-
- // '0'
- VERIFY_SCAN_IS (std::ctype_base::alnum, c0, c0);
- VERIFY_SCAN_IS (std::ctype_base::alpha, c0, c0+5);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, c0, c0+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, c0, c0);
- VERIFY_SCAN_IS (std::ctype_base::graph, c0, c0);
- VERIFY_SCAN_IS (std::ctype_base::lower, c0, c0+5);
- VERIFY_SCAN_IS (std::ctype_base::print, c0, c0);
- VERIFY_SCAN_IS (std::ctype_base::punct, c0, c0+5);
- VERIFY_SCAN_IS (std::ctype_base::space, c0, c0+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, c0, c0+5);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, c0, c0);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, c0, c0+5);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, c0, c0);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, c0, c0);
- VERIFY_SCAN_NOT (std::ctype_base::digit, c0, c0+5);
- VERIFY_SCAN_NOT (std::ctype_base::graph, c0, c0+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, c0, c0);
- VERIFY_SCAN_NOT (std::ctype_base::print, c0, c0+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, c0, c0);
- VERIFY_SCAN_NOT (std::ctype_base::space, c0, c0);
- VERIFY_SCAN_NOT (std::ctype_base::upper, c0, c0);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, c0, c0+5);
-
- // '9'
- VERIFY_SCAN_IS (std::ctype_base::alnum, c9, c9);
- VERIFY_SCAN_IS (std::ctype_base::alpha, c9, c9+5);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, c9, c9+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, c9, c9);
- VERIFY_SCAN_IS (std::ctype_base::graph, c9, c9);
- VERIFY_SCAN_IS (std::ctype_base::lower, c9, c9+5);
- VERIFY_SCAN_IS (std::ctype_base::print, c9, c9);
- VERIFY_SCAN_IS (std::ctype_base::punct, c9, c9+5);
- VERIFY_SCAN_IS (std::ctype_base::space, c9, c9+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, c9, c9+5);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, c9, c9);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, c9, c9+5);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, c9, c9);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, c9, c9);
- VERIFY_SCAN_NOT (std::ctype_base::digit, c9, c9+5);
- VERIFY_SCAN_NOT (std::ctype_base::graph, c9, c9+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, c9, c9);
- VERIFY_SCAN_NOT (std::ctype_base::print, c9, c9+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, c9, c9);
- VERIFY_SCAN_NOT (std::ctype_base::space, c9, c9);
- VERIFY_SCAN_NOT (std::ctype_base::upper, c9, c9);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, c9, c9+5);
-
- // ' '
- VERIFY_SCAN_IS (std::ctype_base::alnum, cs, cs+5);
- VERIFY_SCAN_IS (std::ctype_base::alpha, cs, cs+5);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, cs, cs+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, cs, cs+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, cs, cs+5);
- VERIFY_SCAN_IS (std::ctype_base::lower, cs, cs+5);
- VERIFY_SCAN_IS (std::ctype_base::print, cs, cs);
- VERIFY_SCAN_IS (std::ctype_base::punct, cs, cs+5);
- VERIFY_SCAN_IS (std::ctype_base::space, cs, cs);
- VERIFY_SCAN_IS (std::ctype_base::upper, cs, cs+5);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, cs, cs+5);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, cs, cs);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, cs, cs);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, cs, cs);
- VERIFY_SCAN_NOT (std::ctype_base::digit, cs, cs);
- VERIFY_SCAN_NOT (std::ctype_base::graph, cs, cs);
- VERIFY_SCAN_NOT (std::ctype_base::lower, cs, cs);
- VERIFY_SCAN_NOT (std::ctype_base::print, cs, cs+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, cs, cs);
- VERIFY_SCAN_NOT (std::ctype_base::space, cs, cs+5);
- VERIFY_SCAN_NOT (std::ctype_base::upper, cs, cs);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, cs, cs);
-
- // 'f'
- VERIFY_SCAN_IS (std::ctype_base::alnum, xf, xf);
- VERIFY_SCAN_IS (std::ctype_base::alpha, xf, xf);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, xf, xf+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, xf, xf+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, xf, xf);
- VERIFY_SCAN_IS (std::ctype_base::lower, xf, xf);
- VERIFY_SCAN_IS (std::ctype_base::print, xf, xf);
- VERIFY_SCAN_IS (std::ctype_base::punct, xf, xf+5);
- VERIFY_SCAN_IS (std::ctype_base::space, xf, xf+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, xf, xf+5);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, xf, xf);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, xf, xf+5);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, xf, xf+5);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, xf, xf);
- VERIFY_SCAN_NOT (std::ctype_base::digit, xf, xf);
- VERIFY_SCAN_NOT (std::ctype_base::graph, xf, xf+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, xf, xf+5);
- VERIFY_SCAN_NOT (std::ctype_base::print, xf, xf+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, xf, xf);
- VERIFY_SCAN_NOT (std::ctype_base::space, xf, xf);
- VERIFY_SCAN_NOT (std::ctype_base::upper, xf, xf);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, xf, xf+5);
-
- // 'F'
- VERIFY_SCAN_IS (std::ctype_base::alnum, xF, xF);
- VERIFY_SCAN_IS (std::ctype_base::alpha, xF, xF);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, xF, xF+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, xF, xF+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, xF, xF);
- VERIFY_SCAN_IS (std::ctype_base::lower, xF, xF+5);
- VERIFY_SCAN_IS (std::ctype_base::print, xF, xF);
- VERIFY_SCAN_IS (std::ctype_base::punct, xF, xF+5);
- VERIFY_SCAN_IS (std::ctype_base::space, xF, xF+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, xF, xF);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, xF, xF);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, xF, xF+5);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, xF, xF+5);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, xF, xF);
- VERIFY_SCAN_NOT (std::ctype_base::digit, xF, xF);
- VERIFY_SCAN_NOT (std::ctype_base::graph, xF, xF+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, xF, xF);
- VERIFY_SCAN_NOT (std::ctype_base::print, xF, xF+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, xF, xF);
- VERIFY_SCAN_NOT (std::ctype_base::space, xF, xF);
- VERIFY_SCAN_NOT (std::ctype_base::upper, xF, xF+5);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, xF, xF+5);
-
- // '!'
- VERIFY_SCAN_IS (std::ctype_base::alnum, p1, p1+5);
- VERIFY_SCAN_IS (std::ctype_base::alpha, p1, p1+5);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, p1, p1+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, p1, p1+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, p1, p1);
- VERIFY_SCAN_IS (std::ctype_base::lower, p1, p1+5);
- VERIFY_SCAN_IS (std::ctype_base::print, p1, p1);
- VERIFY_SCAN_IS (std::ctype_base::punct, p1, p1);
- VERIFY_SCAN_IS (std::ctype_base::space, p1, p1+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, p1, p1+5);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, p1, p1+5);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, p1, p1);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, p1, p1);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, p1, p1);
- VERIFY_SCAN_NOT (std::ctype_base::digit, p1, p1);
- VERIFY_SCAN_NOT (std::ctype_base::lower, p1, p1);
- VERIFY_SCAN_NOT (std::ctype_base::print, p1, p1+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, p1, p1+5);
- VERIFY_SCAN_NOT (std::ctype_base::space, p1, p1);
- VERIFY_SCAN_NOT (std::ctype_base::upper, p1, p1);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, p1, p1);
-
- // '/'
- VERIFY_SCAN_IS (std::ctype_base::alnum, p2, p2+5);
- VERIFY_SCAN_IS (std::ctype_base::alpha, p2, p2+5);
- VERIFY_SCAN_IS (std::ctype_base::cntrl, p2, p2+5);
- VERIFY_SCAN_IS (std::ctype_base::digit, p2, p2+5);
- VERIFY_SCAN_IS (std::ctype_base::graph, p2, p2);
- VERIFY_SCAN_IS (std::ctype_base::lower, p2, p2+5);
- VERIFY_SCAN_IS (std::ctype_base::print, p2, p2);
- VERIFY_SCAN_IS (std::ctype_base::punct, p2, p2);
- VERIFY_SCAN_IS (std::ctype_base::space, p2, p2+5);
- VERIFY_SCAN_IS (std::ctype_base::upper, p2, p2+5);
- VERIFY_SCAN_IS (std::ctype_base::xdigit, p2, p2+5);
-
- VERIFY_SCAN_NOT (std::ctype_base::alnum, p2, p2);
- VERIFY_SCAN_NOT (std::ctype_base::alpha, p2, p2);
- VERIFY_SCAN_NOT (std::ctype_base::cntrl, p2, p2);
- VERIFY_SCAN_NOT (std::ctype_base::digit, p2, p2);
- VERIFY_SCAN_NOT (std::ctype_base::graph, p2, p2+5);
- VERIFY_SCAN_NOT (std::ctype_base::lower, p2, p2);
- VERIFY_SCAN_NOT (std::ctype_base::print, p2, p2+5);
- VERIFY_SCAN_NOT (std::ctype_base::punct, p2, p2+5);
- VERIFY_SCAN_NOT (std::ctype_base::space, p2, p2);
- VERIFY_SCAN_NOT (std::ctype_base::upper, p2, p2);
- VERIFY_SCAN_NOT (std::ctype_base::xdigit, p2, p2);
-}
-#endif
-
-int main()
-{
-#ifdef _GLIBCPP_USE_WCHAR_T
- test01();
-#endif
- return 0;
-}
+++ /dev/null
-// 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>
-
-typedef char char_type;
-class gnu_ctype: public std::ctype<char_type> { };
-
-void test01()
-{
- bool test = true;
- const char_type strlit00[] = "manilla, cebu, tandag PHILIPPINES";
- const char_type strlit01[] = "MANILLA, CEBU, TANDAG PHILIPPINES";
- const char_type strlit02[] = "manilla, cebu, tandag philippines";
- const char_type c00 = 'S';
- const char_type c10 = 's';
- const char_type c20 = '9';
- const char_type c30 = ' ';
- const char_type c40 = '!';
- const char_type c50 = 'F';
- const char_type c60 = 'f';
- const char_type c70 = 'X';
- const char_type c80 = 'x';
-
- gnu_ctype gctype;
- char_type c100;
- int len = std::char_traits<char_type>::length(strlit00);
- char_type c_array[len + 1];
-
- // sanity check ctype_base::mask members
- int i01 = std::ctype_base::space;
- int i02 = std::ctype_base::upper;
- int i03 = std::ctype_base::lower;
- int i04 = std::ctype_base::digit;
- int i05 = std::ctype_base::punct;
- int i06 = std::ctype_base::alpha;
- int i07 = std::ctype_base::xdigit;
- int i08 = std::ctype_base::alnum;
- int i09 = std::ctype_base::graph;
- int i10 = std::ctype_base::print;
- int i11 = std::ctype_base::cntrl;
- int i12 = sizeof(std::ctype_base::mask);
- VERIFY ( i01 != i02);
- VERIFY ( i02 != i03);
- VERIFY ( i03 != i04);
- VERIFY ( i04 != i05);
- VERIFY ( i05 != i06);
- VERIFY ( i06 != i07);
- VERIFY ( i07 != i08);
- VERIFY ( i08 != i09);
- VERIFY ( i09 != i10);
- VERIFY ( i10 != i11);
- VERIFY ( i11 != i01);
-
- // char_type toupper(char_type c) const
- c100 = gctype.toupper(c10);
- VERIFY( c100 == c00 );
-
- // char_type tolower(char_type c) const
- c100 = gctype.tolower(c00);
- VERIFY( c100 == c10 );
-
- // char_type toupper(char_type* low, const char_type* hi) const
- std::char_traits<char_type>::copy(c_array, strlit02, len + 1);
- gctype.toupper(c_array, c_array + len);
- VERIFY( !std::char_traits<char_type>::compare(c_array, strlit01, len - 1) );
-
- // char_type tolower(char_type* low, const char_type* hi) const
- std::char_traits<char_type>::copy(c_array, strlit01, len + 1);
- gctype.tolower(c_array, c_array + len);
- 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;
-}
+++ /dev/null
-// 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>
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-typedef wchar_t char_type;
-class gnu_ctype: public std::ctype<char_type> { };
-
-void test01()
-{
- bool test = true;
- const char_type strlit00[] = L"manilla, cebu, tandag PHILIPPINES";
- const char_type strlit01[] = L"MANILLA, CEBU, TANDAG PHILIPPINES";
- const char_type strlit02[] = L"manilla, cebu, tandag philippines";
- const char_type c00 = L'S';
- const char_type c10 = L's';
- const char_type c20 = L'9';
- const char_type c30 = L' ';
- const char_type c40 = L'!';
- const char_type c50 = L'F';
- const char_type c60 = L'f';
- const char_type c70 = L'X';
- const char_type c80 = L'x';
-
- gnu_ctype gctype;
- char_type c100;
- int len = std::char_traits<char_type>::length(strlit00);
- char_type c_array[len + 1];
-
- // sanity check ctype_base::mask members
- int i01 = std::ctype_base::space;
- int i02 = std::ctype_base::upper;
- int i03 = std::ctype_base::lower;
- int i04 = std::ctype_base::digit;
- int i05 = std::ctype_base::punct;
- int i06 = std::ctype_base::alpha;
- int i07 = std::ctype_base::xdigit;
- int i08 = std::ctype_base::alnum;
- int i09 = std::ctype_base::graph;
- int i10 = std::ctype_base::print;
- int i11 = std::ctype_base::cntrl;
- int i12 = sizeof(std::ctype_base::mask);
- VERIFY ( i01 != i02);
- VERIFY ( i02 != i03);
- VERIFY ( i03 != i04);
- VERIFY ( i04 != i05);
- VERIFY ( i05 != i06);
- VERIFY ( i06 != i07);
- VERIFY ( i07 != i08);
- VERIFY ( i08 != i09);
- VERIFY ( i09 != i10);
- VERIFY ( i10 != i11);
- VERIFY ( i11 != i01);
-
- // char_type toupper(char_type c) const
- c100 = gctype.toupper(c10);
- VERIFY( c100 == c00 );
-
- // char_type tolower(char_type c) const
- c100 = gctype.tolower(c00);
- VERIFY( c100 == c10 );
-
- // char_type toupper(char_type* low, const char_type* hi) const
- std::char_traits<char_type>::copy(c_array, strlit02, len + 1);
- gctype.toupper(c_array, c_array + len);
- VERIFY( !std::char_traits<char_type>::compare(c_array, strlit01, len - 1) );
-
- // char_type tolower(char_type* low, const char_type* hi) const
- std::char_traits<char_type>::copy(c_array, strlit01, len + 1);
- gctype.tolower(c_array, c_array + len);
- 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;
-}
+++ /dev/null
-// 2002-05-24 bkoz
-
-// Copyright (C) 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 <vector>
-#include <testsuite_hooks.h>
-
-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("drusilla, louvinia, bayard");
- basic_string<char> narrow("drusilla, louvinia, bayard");
- vector<wide_type> wide_chars(narrow.length() + 1);
-
- // widen(char c) const
- for (int i = 0; i < narrow.length(); ++i)
- {
- char c = ctype_c.widen(narrow[i]);
- VERIFY( c == wide[i] );
- }
-
- // widen(const char* low, const char* high, charT* dest) const
- ctype_c.widen(&narrow[0], &narrow[narrow.length()], &wide_chars[0]);
- for (int i = 0; i < narrow.length(); ++i)
- VERIFY( wide_chars[i] == wide[i] );
-}
-
-int main()
-{
- test01();
- return 0;
-}
+++ /dev/null
-// 2002-05-24 bkoz
-
-// Copyright (C) 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 <vector>
-#include <testsuite_hooks.h>
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-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"drusilla, louvinia, bayard");
- basic_string<char> narrow("drusilla, louvinia, bayard");
- vector<wide_type> wide_chars(narrow.length() + 1);
-
- // widen(char c) const
- for (int i = 0; i < narrow.length(); ++i)
- {
- char c = ctype_c.widen(narrow[i]);
- VERIFY( c == wide[i] );
- }
-
- // widen(const char* low, const char* high, charT* dest) const
- ctype_c.widen(&narrow[0], &narrow[narrow.length()], &wide_chars[0]);
- 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;
-}
+++ /dev/null
-// 2000-08-31 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2000, 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.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>
-
-// 1 a class if a facet if it is publicly derived from another facet
-typedef std::istreambuf_iterator<char> input_iterator;
-typedef std::ostreambuf_iterator<char> output_iterator;
-
-class gnu_collate: public std::collate<char> { };
-class gnu_ctype: public std::ctype<char> { };
-class gnu_codecvt: public std::codecvt<char, char, std::mbstate_t> { };
-class gnu_moneypunct: public std::moneypunct<char> { };
-class gnu_moneypunct_true: public std::moneypunct<char, true> { };
-class gnu_money_get: public std::money_get<char> { };
-class gnu_money_put: public std::money_put<char> { };
-class gnu_numpunct: public std::numpunct<char> { };
-class gnu_num_get: public std::num_get<char> { };
-class gnu_num_put: public std::num_put<char> { };
-class gnu_time_get: public std::time_get<char> { };
-class gnu_time_put: public std::time_put<char> { };
-class gnu_messages: public std::messages<char> { };
-
-class gnu_collate_byname: public std::collate_byname<char>
-{
-public:
- explicit
- gnu_collate_byname(const char* c, size_t refs = 0)
- : std::collate_byname<char>(c, refs) { }
-};
-
-class gnu_ctype_byname: public std::ctype_byname<char>
-{
-public:
- explicit
- gnu_ctype_byname(const char* c, size_t refs = 0)
- : std::ctype_byname<char>(c, refs) { }
-};
-
-class gnu_moneypunct_byname_true: public std::moneypunct_byname<char, true>
-{
-public:
- explicit
- gnu_moneypunct_byname_true(const char* c, size_t refs = 0)
- : std::moneypunct_byname<char, true>(c, refs) { }
-};
-
-class gnu_moneypunct_byname_false: public std::moneypunct_byname<char, false>
-{
-public:
- explicit
- gnu_moneypunct_byname_false(const char* c, size_t refs = 0)
- : std::moneypunct_byname<char, false>(c, refs) { }
-};
-
-
-class gnu_money_get_in: public std::money_get<char, input_iterator>
-{
-public:
- explicit
- gnu_money_get_in(size_t refs = 0)
- : std::money_get<char, input_iterator>(refs) { }
-};
-
-class gnu_money_put_out: public std::money_put<char, output_iterator>
-{
-public:
- explicit
- gnu_money_put_out(size_t refs = 0)
- : std::money_put<char, output_iterator>(refs) { }
-};
-
-class gnu_numpunct_byname: public std::numpunct_byname<char>
-{
-public:
- explicit
- gnu_numpunct_byname(const char* c, size_t refs = 0)
- : std::numpunct_byname<char>(c, refs) { }
-};
-
-class gnu_num_get_in: public std::num_get<char, input_iterator>
-{
-public:
- explicit
- gnu_num_get_in(size_t refs = 0)
- : std::num_get<char, input_iterator>(refs) { }
-};
-
-class gnu_num_put_out: public std::num_put<char, output_iterator>
-{
-public:
- explicit
- gnu_num_put_out(size_t refs = 0)
- : std::num_put<char, output_iterator>(refs) { }
-};
-
-class gnu_time_get_byname: public std::time_get_byname<char>
-{
-public:
- explicit
- gnu_time_get_byname(const char* c, size_t refs = 0)
- : std::time_get_byname<char>(c, refs) { }
-};
-
-class gnu_time_get_in: public std::time_get<char, input_iterator>
-{
-public:
- explicit
- gnu_time_get_in(size_t refs = 0)
- : std::time_get<char, input_iterator>(refs) { }
-};
-
-class gnu_time_put_byname: public std::time_put_byname<char>
-{
-public:
- explicit
- gnu_time_put_byname(const char* c, size_t refs = 0)
- : std::time_put_byname<char>(c, refs) { }
-};
-
-class gnu_time_put_out: public std::time_put<char, output_iterator>
-{
-public:
- explicit
- gnu_time_put_out(size_t refs = 0)
- : std::time_put<char, output_iterator>(refs) { }
-};
-
-class gnu_messages_byname: public std::messages_byname<char>
-{
-public:
- explicit
- gnu_messages_byname(const char* c, size_t refs = 0)
- : std::messages_byname<char>(c, refs) { }
-};
-
-
-// 2 or if it is a class derived from locale:;facet and containing a
-// publicly-accessible declaration as follows:
-class gnu_facet: public std::locale::facet
-{
-public:
- static std::locale::id id;
-};
-
-std::locale::id gnu_facet::id;
-
-void test01()
-{
- bool test = true;
- const std::string name_no("*");
- const std::string name_c("C");
-
- try
- {
- gnu_collate obj01;
- gnu_ctype obj02;
- gnu_codecvt obj03;
- gnu_moneypunct obj04;
- gnu_moneypunct_true obj05;
- gnu_money_get obj06;
- gnu_money_put obj07;
- gnu_numpunct obj08;
- gnu_num_get obj09;
- gnu_num_put obj10;
- gnu_time_get obj11;
- gnu_time_put obj12;
- gnu_messages obj13;
- gnu_time_put_out obj14(0);
- gnu_time_put_byname obj15("C", 0);
- gnu_time_get_in obj16(0);
- gnu_time_get_byname obj17("C", 0);
- gnu_num_put_out obj18(0);
- gnu_num_get_in obj19(0);
- gnu_numpunct_byname obj20("C", 0);
- gnu_money_put_out obj21(0);
- gnu_money_get_in obj22(0);
- gnu_moneypunct_byname_false obj23("C", 0);
- gnu_moneypunct_byname_true obj24("C", 0);
- gnu_ctype_byname obj25("C", 0);
- gnu_collate_byname obj26("C", 0);
- gnu_messages_byname obj27("C", 0);
- }
- catch (std::runtime_error& obj)
- {
- // named locale not valid
- VERIFY( false );
- }
- catch (std::exception& obj)
- {
- // some other error
- VERIFY( false );
- }
-
- // 2
- try
- {
- gnu_facet obj28;
- }
- catch (std::runtime_error& obj)
- {
- // named locale not valid
- VERIFY( false );
- }
- catch (std::exception& obj)
- {
- // some other error
- VERIFY( false );
- }
-}
-
-// 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;
-}
--- /dev/null
+// 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>
+
+// 1 a class if a facet if it is publicly derived from another facet
+typedef std::istreambuf_iterator<char> input_iterator;
+typedef std::ostreambuf_iterator<char> output_iterator;
+
+class gnu_collate: public std::collate<char> { };
+class gnu_ctype: public std::ctype<char> { };
+class gnu_codecvt: public std::codecvt<char, char, std::mbstate_t> { };
+class gnu_moneypunct: public std::moneypunct<char> { };
+class gnu_moneypunct_true: public std::moneypunct<char, true> { };
+class gnu_money_get: public std::money_get<char> { };
+class gnu_money_put: public std::money_put<char> { };
+class gnu_numpunct: public std::numpunct<char> { };
+class gnu_num_get: public std::num_get<char> { };
+class gnu_num_put: public std::num_put<char> { };
+class gnu_time_get: public std::time_get<char> { };
+class gnu_time_put: public std::time_put<char> { };
+class gnu_messages: public std::messages<char> { };
+
+class gnu_collate_byname: public std::collate_byname<char>
+{
+public:
+ explicit
+ gnu_collate_byname(const char* c, size_t refs = 0)
+ : std::collate_byname<char>(c, refs) { }
+};
+
+class gnu_ctype_byname: public std::ctype_byname<char>
+{
+public:
+ explicit
+ gnu_ctype_byname(const char* c, size_t refs = 0)
+ : std::ctype_byname<char>(c, refs) { }
+};
+
+class gnu_moneypunct_byname_true: public std::moneypunct_byname<char, true>
+{
+public:
+ explicit
+ gnu_moneypunct_byname_true(const char* c, size_t refs = 0)
+ : std::moneypunct_byname<char, true>(c, refs) { }
+};
+
+class gnu_moneypunct_byname_false: public std::moneypunct_byname<char, false>
+{
+public:
+ explicit
+ gnu_moneypunct_byname_false(const char* c, size_t refs = 0)
+ : std::moneypunct_byname<char, false>(c, refs) { }
+};
+
+
+class gnu_money_get_in: public std::money_get<char, input_iterator>
+{
+public:
+ explicit
+ gnu_money_get_in(size_t refs = 0)
+ : std::money_get<char, input_iterator>(refs) { }
+};
+
+class gnu_money_put_out: public std::money_put<char, output_iterator>
+{
+public:
+ explicit
+ gnu_money_put_out(size_t refs = 0)
+ : std::money_put<char, output_iterator>(refs) { }
+};
+
+class gnu_numpunct_byname: public std::numpunct_byname<char>
+{
+public:
+ explicit
+ gnu_numpunct_byname(const char* c, size_t refs = 0)
+ : std::numpunct_byname<char>(c, refs) { }
+};
+
+class gnu_num_get_in: public std::num_get<char, input_iterator>
+{
+public:
+ explicit
+ gnu_num_get_in(size_t refs = 0)
+ : std::num_get<char, input_iterator>(refs) { }
+};
+
+class gnu_num_put_out: public std::num_put<char, output_iterator>
+{
+public:
+ explicit
+ gnu_num_put_out(size_t refs = 0)
+ : std::num_put<char, output_iterator>(refs) { }
+};
+
+class gnu_time_get_byname: public std::time_get_byname<char>
+{
+public:
+ explicit
+ gnu_time_get_byname(const char* c, size_t refs = 0)
+ : std::time_get_byname<char>(c, refs) { }
+};
+
+class gnu_time_get_in: public std::time_get<char, input_iterator>
+{
+public:
+ explicit
+ gnu_time_get_in(size_t refs = 0)
+ : std::time_get<char, input_iterator>(refs) { }
+};
+
+class gnu_time_put_byname: public std::time_put_byname<char>
+{
+public:
+ explicit
+ gnu_time_put_byname(const char* c, size_t refs = 0)
+ : std::time_put_byname<char>(c, refs) { }
+};
+
+class gnu_time_put_out: public std::time_put<char, output_iterator>
+{
+public:
+ explicit
+ gnu_time_put_out(size_t refs = 0)
+ : std::time_put<char, output_iterator>(refs) { }
+};
+
+class gnu_messages_byname: public std::messages_byname<char>
+{
+public:
+ explicit
+ gnu_messages_byname(const char* c, size_t refs = 0)
+ : std::messages_byname<char>(c, refs) { }
+};
+
+
+// 2 or if it is a class derived from locale:;facet and containing a
+// publicly-accessible declaration as follows:
+class gnu_facet: public std::locale::facet
+{
+public:
+ static std::locale::id id;
+};
+
+std::locale::id gnu_facet::id;
+
+void test01()
+{
+ bool test = true;
+ const std::string name_no("*");
+ const std::string name_c("C");
+
+ try
+ {
+ gnu_collate obj01;
+ gnu_ctype obj02;
+ gnu_codecvt obj03;
+ gnu_moneypunct obj04;
+ gnu_moneypunct_true obj05;
+ gnu_money_get obj06;
+ gnu_money_put obj07;
+ gnu_numpunct obj08;
+ gnu_num_get obj09;
+ gnu_num_put obj10;
+ gnu_time_get obj11;
+ gnu_time_put obj12;
+ gnu_messages obj13;
+ gnu_time_put_out obj14(0);
+ gnu_time_put_byname obj15("C", 0);
+ gnu_time_get_in obj16(0);
+ gnu_time_get_byname obj17("C", 0);
+ gnu_num_put_out obj18(0);
+ gnu_num_get_in obj19(0);
+ gnu_numpunct_byname obj20("C", 0);
+ gnu_money_put_out obj21(0);
+ gnu_money_get_in obj22(0);
+ gnu_moneypunct_byname_false obj23("C", 0);
+ gnu_moneypunct_byname_true obj24("C", 0);
+ gnu_ctype_byname obj25("C", 0);
+ gnu_collate_byname obj26("C", 0);
+ gnu_messages_byname obj27("C", 0);
+ }
+ catch (std::runtime_error& obj)
+ {
+ // named locale not valid
+ VERIFY( false );
+ }
+ catch (std::exception& obj)
+ {
+ // some other error
+ VERIFY( false );
+ }
+
+ // 2
+ try
+ {
+ gnu_facet obj28;
+ }
+ catch (std::runtime_error& obj)
+ {
+ // named locale not valid
+ VERIFY( false );
+ }
+ catch (std::exception& obj)
+ {
+ // some other error
+ VERIFY( false );
+ }
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 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;
+}
+++ /dev/null
-// 2000-09-11 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2000 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this 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.2 locale globals [lib.locale.global.templates]
-
-#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;
-
- // construct a locale object with the C facet
- const locale& cloc = locale::classic();
- // sanity check the constructed locale has the normal facet
- VERIFY( has_facet<ccodecvt>(cloc) );
-
- // construct a locale object with the specialized facet.
- locale loc(locale::classic(), new gnu_codecvt);
- // sanity check the constructed locale has the specialized facet.
- VERIFY( has_facet<gnu_codecvt>(loc) );
-
- try
- { const ccodecvt& cvt01 = use_facet<ccodecvt>(cloc); }
- catch(...)
- { VERIFY( false ); }
-
- try
- { const gnu_codecvt& cvt02 = use_facet<gnu_codecvt>(loc); }
- catch(...)
- { VERIFY( false ); }
-
- try
- { const ccodecvt& cvt03 = use_facet<gnu_codecvt>(cloc); }
- catch(bad_cast& obj)
- { VERIFY( true ); }
- catch(...)
- { VERIFY( false ); }
-}
-
-int main ()
-{
- test01();
-
- return 0;
-}
--- /dev/null
+// 2000-09-11 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2000 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this 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.2 locale globals [lib.locale.global.templates]
+
+#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;
+
+ // construct a locale object with the C facet
+ const locale& cloc = locale::classic();
+ // sanity check the constructed locale has the normal facet
+ VERIFY( has_facet<ccodecvt>(cloc) );
+
+ // construct a locale object with the specialized facet.
+ locale loc(locale::classic(), new gnu_codecvt);
+ // sanity check the constructed locale has the specialized facet.
+ VERIFY( has_facet<gnu_codecvt>(loc) );
+
+ try
+ { const ccodecvt& cvt01 = use_facet<ccodecvt>(cloc); }
+ catch(...)
+ { VERIFY( false ); }
+
+ try
+ { const gnu_codecvt& cvt02 = use_facet<gnu_codecvt>(loc); }
+ catch(...)
+ { VERIFY( false ); }
+
+ try
+ { const ccodecvt& cvt03 = use_facet<gnu_codecvt>(cloc); }
+ catch(bad_cast& obj)
+ { VERIFY( true ); }
+ catch(...)
+ { VERIFY( false ); }
+}
+
+int main ()
+{
+ test01();
+
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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>
+
+#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;
+typedef std::codecvt<wchar_t, char, std::mbstate_t> w_codecvt;
+typedef std::codecvt_byname<wchar_t, char, std::mbstate_t> w_codecvt_byname;
+
+class gnu_codecvt: public c_codecvt { };
+
+class gnu_facet: public std::locale::facet
+{
+public:
+ static std::locale::id id;
+};
+
+std::locale::id gnu_facet::id;
+
+// Need some char_traits specializations for this to work.
+typedef unsigned short unicode_t;
+
+namespace std
+{
+ template<>
+ struct char_traits<unicode_t>
+ {
+ typedef unicode_t char_type;
+ // Unsigned as wint_t is unsigned.
+ typedef unsigned long int_type;
+ typedef streampos pos_type;
+ typedef streamoff off_type;
+ typedef mbstate_t state_type;
+
+ static void
+ assign(char_type& __c1, const char_type& __c2);
+
+ static bool
+ eq(const char_type& __c1, const char_type& __c2);
+
+ static bool
+ lt(const char_type& __c1, const char_type& __c2);
+
+ static int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n)
+ { return memcmp(__s1, __s2, __n); }
+
+ static size_t
+ length(const char_type* __s);
+
+ static const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a);
+
+ static char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n);
+
+ static char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n)
+ { return static_cast<char_type*>(memcpy(__s1, __s2, __n)); }
+
+ static char_type*
+ assign(char_type* __s, size_t __n, char_type __a);
+
+ static char_type
+ to_char_type(const int_type& __c);
+
+ static int_type
+ to_int_type(const char_type& __c);
+
+ static bool
+ eq_int_type(const int_type& __c1, const int_type& __c2);
+
+ static int_type
+ eof();
+
+ static int_type
+ not_eof(const int_type& __c);
+ };
+}
+
+void test01()
+{
+ using namespace std;
+ typedef unicode_t int_type;
+ typedef char ext_type;
+ typedef __enc_traits enc_type;
+ typedef codecvt<int_type, ext_type, enc_type> unicode_codecvt;
+
+ bool test = true;
+ string str1, str2;
+
+ // construct a locale object with the C facet
+ const locale loc01 = locale::classic();
+
+ // 1
+ // template <class Facet> locale(const locale& other, Facet* f)
+ // construct a locale object with the specialized facet.
+ locale loc02(locale::classic(), new gnu_codecvt);
+ VERIFY (loc01 != loc02);
+ VERIFY (loc02.name() == "*");
+ try
+ {
+ VERIFY (has_facet<gnu_codecvt>(loc02));
+ VERIFY (has_facet<c_codecvt>(loc02));
+ VERIFY (has_facet<w_codecvt>(loc02));
+ }
+ catch(...)
+ { VERIFY( false ); }
+
+ try
+ { use_facet<gnu_facet>(loc02); }
+ catch(bad_cast& obj)
+ { VERIFY( true ); }
+ catch(...)
+ { VERIFY( false ); }
+
+ // unicode_codecvt
+ locale loc13(locale::classic(), new unicode_codecvt);
+ VERIFY (loc01 != loc13);
+ VERIFY (loc13.name() == "*");
+ try
+ {
+ VERIFY (has_facet<c_codecvt>(loc13));
+ VERIFY (has_facet<w_codecvt>(loc13));
+ VERIFY (has_facet<unicode_codecvt>(loc13));
+ }
+ catch(...)
+ { VERIFY( false ); }
+
+ try
+ { use_facet<gnu_facet>(loc13); }
+ catch(bad_cast& obj)
+ { VERIFY( true ); }
+ catch(...)
+ { VERIFY( false ); }
+
+ // 2
+ // locale() throw()
+ locale loc03;
+ VERIFY (loc03 == loc01);
+ VERIFY (loc03.name() == "C");
+ locale loc04 = locale::global(loc02);
+ locale loc05;
+ VERIFY (loc05 != loc03);
+ VERIFY (loc05 == loc02);
+
+ // 3
+ // explicit locale(const char* std_name)
+ locale loc06("fr_FR");
+ VERIFY (loc06 != loc01);
+ VERIFY (loc06 != loc02);
+ VERIFY (loc06.name() == "fr_FR");
+ locale loc07("");
+ VERIFY (loc07 != loc02);
+ VERIFY (loc07.name() != "");
+ try
+ { locale loc08(static_cast<const char*>(NULL)); }
+ catch(runtime_error& obj)
+ { VERIFY (true); }
+ catch(...)
+ { VERIFY (false); }
+
+ try
+ { locale loc08("saturn_SUN*RA"); }
+ catch(runtime_error& obj)
+ { VERIFY (true); }
+ catch(...)
+ { VERIFY (false); }
+
+ // 4
+ // locale(const locale& other, const char* std_name, category)
+ {
+ // This is the same as 5 only use "C" for loc("C")
+ locale loc09(loc06, "C", locale::ctype);
+ VERIFY (loc09.name() != "fr_FR");
+ VERIFY (loc09.name() != "C");
+ VERIFY (loc09.name() != "*");
+ VERIFY (loc09 != loc01);
+ VERIFY (loc09 != loc06);
+
+ locale loc10(loc02, "C", locale::ctype);
+ VERIFY (loc10.name() == "*");
+ VERIFY (loc10 != loc01); // As not named, even tho facets same...
+ VERIFY (loc10 != loc02);
+
+ locale loc11(loc01, "C", locale::ctype);
+ VERIFY (loc11.name() == "C");
+ VERIFY (loc11 == loc01);
+
+ try
+ { locale loc12(loc01, static_cast<const char*>(NULL), locale::ctype); }
+ catch(runtime_error& obj)
+ { VERIFY (true); }
+ catch(...)
+ { VERIFY (false); }
+
+ try
+ { locale loc13(loc01, "localized by the wu-tang clan", locale::ctype); }
+ catch(runtime_error& obj)
+ { VERIFY (true); }
+ catch(...)
+ { VERIFY (false); }
+
+ locale loc14(loc06, "C", locale::none);
+ VERIFY (loc14.name() == "fr_FR");
+ VERIFY (loc14 == loc06);
+
+ locale loc15(loc06, "C", locale::collate);
+ VERIFY (loc15.name() != "fr_FR");
+ VERIFY (loc15.name() != "C");
+ VERIFY (loc15.name() != "*");
+ VERIFY (loc15.name() != loc09.name());
+ VERIFY (loc15 != loc01);
+ VERIFY (loc15 != loc06);
+ VERIFY (loc15 != loc09);
+ }
+
+ // 5
+ // locale(const locale& other, const locale& one, category)
+ {
+ // This is the exact same as 4, with locale("C") for "C"
+ locale loc09(loc06, loc01, locale::ctype);
+ VERIFY (loc09.name() != "fr_FR");
+ VERIFY (loc09.name() != "C");
+ VERIFY (loc09.name() != "*");
+ VERIFY (loc09 != loc01);
+ VERIFY (loc09 != loc06);
+
+ locale loc10(loc02, loc01, locale::ctype);
+ VERIFY (loc10.name() == "*");
+ VERIFY (loc10 != loc01); // As not named, even tho facets same...
+ VERIFY (loc10 != loc02);
+
+ locale loc11(loc01, loc01, locale::ctype);
+ VERIFY (loc11.name() == "C");
+ VERIFY (loc11 == loc01);
+
+ try
+ { locale loc12(loc01, static_cast<const char*>(NULL), locale::ctype); }
+ catch(runtime_error& obj)
+ { VERIFY (true); }
+ catch(...)
+ { VERIFY (false); }
+
+ try
+ { locale loc13(loc01, locale("wu-tang clan"), locale::ctype); }
+ catch(runtime_error& obj)
+ { VERIFY (true); }
+ catch(...)
+ { VERIFY (false); }
+
+ locale loc14(loc06, loc01, locale::none);
+ VERIFY (loc14.name() == "fr_FR");
+ VERIFY (loc14 == loc06);
+
+ locale loc15(loc06, loc01, locale::collate);
+ VERIFY (loc15.name() != "fr_FR");
+ VERIFY (loc15.name() != "C");
+ VERIFY (loc15.name() != "*");
+ VERIFY (loc15.name() != loc09.name());
+ VERIFY (loc15 != loc01);
+ VERIFY (loc15 != loc06);
+ VERIFY (loc15 != loc09);
+ }
+}
+#endif // _GLIBCPP_USE___ENC_TRAITS
+
+int main()
+{
+#if _GLIBCPP_USE___ENC_TRAITS
+ test01();
+#endif
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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>
+
+void
+test02()
+{
+ using namespace std;
+ bool test = true;
+ const string name_c("C");
+ const string name_no("*");
+ string str;
+
+ // construct a locale object with the specialized facet.
+ locale loc_c = locale::classic();
+ locale loc_1(locale::classic(),
+ new numpunct_byname<char>("fr_FR"));
+ locale loc_fr("fr_FR");
+
+ // check names
+ VERIFY( loc_c.name() == name_c );
+ VERIFY( loc_1.name() == name_no );
+
+ // sanity check the constructed locale has the specialized facet.
+ VERIFY( has_facet<numpunct<char> >(loc_1) );
+ VERIFY( has_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() == name_no );
+ VERIFY( loc_2 != loc_c );
+
+ // extract facet
+ const numpunct<char>& nump_1 = use_facet<numpunct<char> >(loc_1);
+ const numpunct<char>& nump_2 = use_facet<numpunct<char> >(loc_2);
+ const numpunct<char>& nump_c = use_facet<numpunct<char> >(loc_c);
+ const numpunct<char>& nump_fr = use_facet<numpunct<char> >(loc_fr);
+
+ // 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();
+
+ char dp2 = nump_1.decimal_point();
+ char th2 = nump_1.thousands_sep();
+ string g2 = nump_1.grouping();
+ string t2 = nump_1.truename();
+ string f2 = nump_1.falsename();
+
+ char dp3 = nump_2.decimal_point();
+ char th3 = nump_2.thousands_sep();
+ string g3 = nump_2.grouping();
+ string t3 = nump_2.truename();
+ string f3 = nump_2.falsename();
+
+ char dp4 = nump_fr.decimal_point();
+ char th4 = nump_fr.thousands_sep();
+ string g4 = nump_fr.grouping();
+ string t4 = nump_fr.truename();
+ string f4 = nump_fr.falsename();
+ VERIFY( dp1 != dp2 );
+ VERIFY( th1 != th2 );
+
+ VERIFY( dp1 == dp3 );
+ VERIFY( th1 == th3 );
+ VERIFY( t1 == t3 );
+ VERIFY( f1 == f3 );
+
+ VERIFY( dp2 == dp4 );
+ VERIFY( th2 == th4 );
+ VERIFY( t2 == t4 );
+ VERIFY( f2 == f4 );
+}
+
+
+int main()
+{
+ test02();
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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>
+
+// 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;
+
+// Verify lifetimes of global objects.
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ string name;
+ locale global_orig;
+ // 1: Destroyed when out of scope.
+ {
+ {
+ {
+ VERIFY( counter == 0 );
+ {
+ locale loc01(locale::classic(), new facet_type);
+ VERIFY( counter == 1 );
+ global_orig = locale::global(loc01);
+ name = loc01.name();
+ }
+ VERIFY( counter == 1 );
+ locale loc02 = locale();
+ // Weak, but it's something...
+ VERIFY( loc02.name() == name );
+ }
+ VERIFY( counter == 1 );
+ // NB: loc03 should be a copy of the previous global locale.
+ locale loc03 = locale::global(global_orig);
+ VERIFY( counter == 1 );
+ VERIFY( loc03.name() == name );
+ }
+ VERIFY( counter == 0 );
+ locale loc04 = locale();
+ VERIFY( loc04 == global_orig );
+ }
+
+ // 2: Not destroyed when out of scope, deliberately leaked.
+ {
+ {
+ {
+ VERIFY( counter == 0 );
+ {
+ locale loc01(locale::classic(), new facet_type(1));
+ VERIFY( counter == 1 );
+ global_orig = locale::global(loc01);
+ name = loc01.name();
+ }
+ VERIFY( counter == 1 );
+ locale loc02 = locale();
+ // Weak, but it's something...
+ VERIFY( loc02.name() == name );
+ }
+ VERIFY( counter == 1 );
+ // NB: loc03 should be a copy of the previous global locale.
+ locale loc03 = locale::global(global_orig);
+ VERIFY( counter == 1 );
+ VERIFY( loc03.name() == name );
+ }
+ VERIFY( counter == 1 );
+ locale loc04 = locale();
+ VERIFY( loc04 == global_orig );
+ }
+ VERIFY( counter == 1 );
+
+ // Restore global settings.
+ locale::global(global_orig);
+}
+
+int main ()
+{
+ test03();
+ return 0;
+}
--- /dev/null
+// 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>
+
+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& cloc = locale::classic();
+ // construct a locale object with the specialized facet.
+ locale loc(locale::classic(), new gnu_codecvt);
+ VERIFY ( cloc != loc );
+ VERIFY ( !(cloc == loc) );
+
+ str1 = cloc.name();
+ str2 = loc.name();
+ VERIFY( loc(str1, str2) == false );
+}
+
+// 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; }
+};
+
+int main ()
+{
+ test01();
+ return 0;
+}
+
+
+
--- /dev/null
+// 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;
+}
+
+
+
+++ /dev/null
-// 2001-01-19 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.3.1.1 numpunct members
-
-#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()
-{
- using namespace std;
- bool test = true;
- const string name_c("C");
- const string name_no("*");
- string str;
-
- // construct a locale object with the specialized facet.
- locale loc_c = locale::classic();
- locale loc_1(locale::classic(),
- new numpunct_byname<char>("fr_FR"));
- locale loc_fr("fr_FR");
-
- // check names
- VERIFY( loc_c.name() == name_c );
- VERIFY( loc_1.name() == name_no );
-
- // sanity check the constructed locale has the specialized facet.
- VERIFY( has_facet<numpunct<char> >(loc_1) );
- VERIFY( has_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() == name_no );
- VERIFY( loc_2 != loc_c );
-
- // extract facet
- const numpunct<char>& nump_1 = use_facet<numpunct<char> >(loc_1);
- const numpunct<char>& nump_2 = use_facet<numpunct<char> >(loc_2);
- const numpunct<char>& nump_c = use_facet<numpunct<char> >(loc_c);
- const numpunct<char>& nump_fr = use_facet<numpunct<char> >(loc_fr);
-
- // 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();
-
- char dp2 = nump_1.decimal_point();
- char th2 = nump_1.thousands_sep();
- string g2 = nump_1.grouping();
- string t2 = nump_1.truename();
- string f2 = nump_1.falsename();
-
- char dp3 = nump_2.decimal_point();
- char th3 = nump_2.thousands_sep();
- string g3 = nump_2.grouping();
- string t3 = nump_2.truename();
- string f3 = nump_2.falsename();
-
- char dp4 = nump_fr.decimal_point();
- char th4 = nump_fr.thousands_sep();
- string g4 = nump_fr.grouping();
- string t4 = nump_fr.truename();
- string f4 = nump_fr.falsename();
- VERIFY( dp1 != dp2 );
- VERIFY( th1 != th2 );
-
- VERIFY( dp1 == dp3 );
- VERIFY( th1 == th3 );
- VERIFY( t1 == t3 );
- VERIFY( f1 == f3 );
-
- VERIFY( dp2 == dp4 );
- VERIFY( th2 == th4 );
- VERIFY( t2 == t4 );
- VERIFY( f2 == f4 );
-}
-
-
-int main()
-{
- test01();
- test02();
- return 0;
-}
+++ /dev/null
-// 2001-07-17 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.7 The message retrieval category
-
-// { dg-do compile }
-
-#include <locale>
-
-void test01()
-{
- // Check for required base class.
- typedef std::messages<char> test_type;
- typedef std::locale::facet base_type1;
- typedef std::messages_base base_type2;
- const test_type& obj = std::use_facet<test_type>(std::locale());
- const base_type1* base1 = &obj;
- const base_type2* base2 = &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_messages: public std::messages<unsigned char>
-{ };
-
-void test02()
-{
- gnu_messages facet01;
-}
-
-int main()
-{
- test01();
- test02();
- return 0;
-}
--- /dev/null
+// { 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>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::messages<char> test_type;
+ typedef std::locale::facet base_type1;
+ typedef std::messages_base base_type2;
+ const test_type& obj = std::use_facet<test_type>(std::locale());
+ const base_type1* base1 = &obj;
+ const base_type2* base2 = &obj;
+
+ // Check for required typedefs
+ typedef test_type::char_type char_type;
+ typedef test_type::string_type string_type;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// { 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;
+}
--- /dev/null
+// 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 test01()
+{
+ 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 German (de_DE) locale.
+ catalog cat_de = mssg_de.open("libstdc++", loc_c, dir);
+ string s01 = mssg_de.get(cat_de, 0, 0, "please");
+ string s02 = mssg_de.get(cat_de, 0, 0, "thank you");
+ VERIFY ( s01 == "bitte" );
+ VERIFY ( s02 == "danke" );
+ mssg_de.close(cat_de);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
+++ /dev/null
-// 2001-07-17 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.7.2 Template class messages_byname
-
-#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;
- typedef std::messages<char>::catalog catalog;
- typedef std::messages<char>::string_type string_type;
-
- bool test = true;
- string str;
- // This is exported through RUNTESTFLAGS in testsuite/Makefile.am.
- const char* dir = LOCALEDIR;
- locale loc_c = locale::classic();
-
- locale loc_byname(locale::classic(), new messages_byname<char>("de_DE"));
- str = loc_byname.name();
-
- locale loc_de("de_DE");
- str = loc_de.name();
-
- VERIFY( loc_de != loc_byname );
-
- // cache the messages facets
- const messages<char>& mssg_byname = use_facet<messages<char> >(loc_byname);
- 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 German (de_DE) locale.
- catalog cat_de = mssg_de.open("libstdc++", loc_c, dir);
- string s01 = mssg_de.get(cat_de, 0, 0, "please");
- string s02 = mssg_de.get(cat_de, 0, 0, "thank you");
- VERIFY ( s01 == "bitte" );
- VERIFY ( s02 == "danke" );
- mssg_de.close(cat_de);
-
- // Check byname locale.
- catalog cat_byname = mssg_byname.open("libstdc++", loc_c, dir);
- string s03 = mssg_byname.get(cat_de, 0, 0, "please");
- string s04 = mssg_byname.get(cat_de, 0, 0, "thank you");
- VERIFY ( s03 == "bitte" );
- VERIFY ( s04 == "danke" );
- mssg_byname.close(cat_byname);
-
- VERIFY ( s01 == s03 );
- VERIFY ( s02 == s04 );
-}
-
-int main()
-{
- test01();
-
- return 0;
-}
--- /dev/null
+// 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.2 Template class messages_byname
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef std::messages<char>::catalog catalog;
+ typedef std::messages<char>::string_type string_type;
+
+ bool test = true;
+ string str;
+ // This is exported through RUNTESTFLAGS in testsuite/Makefile.am.
+ const char* dir = LOCALEDIR;
+ locale loc_c = locale::classic();
+
+ locale loc_byname(locale::classic(), new messages_byname<char>("de_DE"));
+ str = loc_byname.name();
+
+ locale loc_de("de_DE");
+ str = loc_de.name();
+
+ VERIFY( loc_de != loc_byname );
+
+ // cache the messages facets
+ const messages<char>& mssg_byname = use_facet<messages<char> >(loc_byname);
+ 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 German (de_DE) locale.
+ catalog cat_de = mssg_de.open("libstdc++", loc_c, dir);
+ string s01 = mssg_de.get(cat_de, 0, 0, "please");
+ string s02 = mssg_de.get(cat_de, 0, 0, "thank you");
+ VERIFY ( s01 == "bitte" );
+ VERIFY ( s02 == "danke" );
+ mssg_de.close(cat_de);
+
+ // Check byname locale.
+ catalog cat_byname = mssg_byname.open("libstdc++", loc_c, dir);
+ string s03 = mssg_byname.get(cat_de, 0, 0, "please");
+ string s04 = mssg_byname.get(cat_de, 0, 0, "thank you");
+ VERIFY ( s03 == "bitte" );
+ VERIFY ( s04 == "danke" );
+ mssg_byname.close(cat_byname);
+
+ VERIFY ( s01 == s03 );
+ VERIFY ( s02 == s04 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+++ /dev/null
-// 2001-07-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.7.1.1 messages members
-
-#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;
- 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 German (de_DE) locale.
- catalog cat_de = mssg_de.open("libstdc++", loc_c, dir);
- string s01 = mssg_de.get(cat_de, 0, 0, "please");
- string s02 = mssg_de.get(cat_de, 0, 0, "thank you");
- 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;
-}
+++ /dev/null
-// 2001-09-12 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.6.1 Template class money_get
-
-// { dg-do compile }
-
-#include <locale>
-
-void test01()
-{
- // Check for required base class.
- typedef std::money_get<char> 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;
- 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;
-}
--- /dev/null
+// { 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>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::money_get<char> 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;
+ typedef test_type::iter_type iter_type;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// { 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 2001-08-27 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.6.2 Template class money_put
-
-// { dg-do compile }
-
-#include <locale>
-
-void test01()
-{
- // Check for required base class.
- typedef std::money_put<char> 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;
- 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;
-}
--- /dev/null
+// { 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>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::money_put<char> 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;
+ typedef test_type::iter_type iter_type;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// { 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 2001-08-23 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.6.3 Template class moneypunct
-
-// { dg-do compile }
-
-#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>
-{ };
-
-class gnu_moneypunct_f: public std::moneypunct<unsigned char, false>
-{ };
-
-void test03()
-{
- gnu_moneypunct_t facet01;
- gnu_moneypunct_f facet02;
- VERIFY (facet01.intl == true);
- VERIFY (facet02.intl == false);
-}
-
-int main()
-{
- test01();
- test02();
- test03();
- return 0;
-}
--- /dev/null
+// { 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;
+}
--- /dev/null
+// { 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;
+}
--- /dev/null
+// 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
+
+// { dg-do compile }
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Should be able to instantiate this for other types besides char, wchar_t
+class gnu_moneypunct_t: public std::moneypunct<unsigned char, true>
+{ };
+
+class gnu_moneypunct_f: public std::moneypunct<unsigned char, false>
+{ };
+
+void test03()
+{
+ gnu_moneypunct_t facet01;
+ gnu_moneypunct_f facet02;
+ VERIFY (facet01.intl == true);
+ VERIFY (facet02.intl == false);
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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 test02()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_de("de_DE");
+
+ // 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);
+ 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.
+ 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();
+ VERIFY( q1 != char() );
+ VERIFY( q2 != char() );
+ VERIFY( q3 != char() );
+ VERIFY( q4 != char() );
+
+ // sanity check the data is correct.
+ char dp1 = monp_c_t.decimal_point();
+ char th1 = monp_c_t.thousands_sep();
+ string g1 = monp_c_t.grouping();
+ string cs1 = monp_c_t.curr_symbol();
+ string ps1 = monp_c_t.positive_sign();
+ string ns1 = monp_c_t.negative_sign();
+ int fd1 = monp_c_t.frac_digits();
+ pattern pos1 = monp_c_t.pos_format();
+ pattern neg1 = monp_c_t.neg_format();
+
+ char dp2 = monp_de_t.decimal_point();
+ char th2 = monp_de_t.thousands_sep();
+ string g2 = monp_de_t.grouping();
+ string cs2 = monp_de_t.curr_symbol();
+ string ps2 = monp_de_t.positive_sign();
+ string ns2 = monp_de_t.negative_sign();
+ int fd2 = monp_de_t.frac_digits();
+ pattern pos2 = monp_de_t.pos_format();
+ pattern neg2 = monp_de_t.neg_format();
+
+ VERIFY( dp1 != dp2 );
+ VERIFY( th1 != th2 );
+ VERIFY( g1 != g2 );
+ VERIFY( cs1 != cs2 );
+ // VERIFY( ps1 != ps2 );
+ VERIFY( ns1 != ns2 );
+ VERIFY( fd1 != fd2 );
+ 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]));
+
+ VERIFY(static_cast<part>(neg1.field[0]) != static_cast<part>(neg2.field[0]));
+ VERIFY(static_cast<part>(neg1.field[1]) != static_cast<part>(neg2.field[1]));
+ VERIFY(static_cast<part>(neg1.field[2]) != static_cast<part>(neg2.field[2]));
+ VERIFY(static_cast<part>(neg1.field[3]) != static_cast<part>(neg2.field[3]));
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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 test02()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+
+ bool test = true;
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_de("de_DE");
+
+ // 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);
+ 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.
+ 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();
+ VERIFY( q1 != wchar_t() );
+ VERIFY( q2 != wchar_t() );
+ VERIFY( q3 != wchar_t() );
+ VERIFY( q4 != wchar_t() );
+
+ // sanity check the data is correct.
+ wchar_t dp1 = monp_c_t.decimal_point();
+ wchar_t th1 = monp_c_t.thousands_sep();
+ string g1 = monp_c_t.grouping();
+ wstring cs1 = monp_c_t.curr_symbol();
+ wstring ps1 = monp_c_t.positive_sign();
+ wstring ns1 = monp_c_t.negative_sign();
+ int fd1 = monp_c_t.frac_digits();
+ pattern pos1 = monp_c_t.pos_format();
+ pattern neg1 = monp_c_t.neg_format();
+
+ wchar_t dp2 = monp_de_t.decimal_point();
+ wchar_t th2 = monp_de_t.thousands_sep();
+ string g2 = monp_de_t.grouping();
+ wstring cs2 = monp_de_t.curr_symbol();
+ wstring ps2 = monp_de_t.positive_sign();
+ wstring ns2 = monp_de_t.negative_sign();
+ int fd2 = monp_de_t.frac_digits();
+ pattern pos2 = monp_de_t.pos_format();
+ pattern neg2 = monp_de_t.neg_format();
+
+ VERIFY( dp1 != dp2 );
+ VERIFY( th1 != th2 );
+ VERIFY( g1 != g2 );
+ VERIFY( cs1 != cs2 );
+ // VERIFY( ps1 != ps2 );
+ VERIFY( ns1 != ns2 );
+ VERIFY( fd1 != fd2 );
+ 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]));
+
+ VERIFY(static_cast<part>(neg1.field[0]) != static_cast<part>(neg2.field[0]));
+ VERIFY(static_cast<part>(neg1.field[1]) != static_cast<part>(neg2.field[1]));
+ VERIFY(static_cast<part>(neg1.field[2]) != static_cast<part>(neg2.field[2]));
+ VERIFY(static_cast<part>(neg1.field[3]) != static_cast<part>(neg2.field[3]));
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
+++ /dev/null
-// 2001-08-24 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.6.4 Template class moneypunct_byname
-
-#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;
- typedef money_base::part part;
- typedef money_base::pattern pattern;
-
- bool test = true;
- string str;
-
- locale loc_byname(locale::classic(), new moneypunct_byname<char>("de_DE"));
- str = loc_byname.name();
-
- locale loc_de("de_DE");
- str = loc_de.name();
-
- locale loc_c = locale::classic();
-
- VERIFY( loc_de != loc_byname );
-
- // cache the moneypunct facets
- const moneypunct<char>& monp_c = use_facet<moneypunct<char> >(loc_c);
- const moneypunct<char>& monp_byname =
- use_facet<moneypunct<char> >(loc_byname);
- const moneypunct<char>& monp_de = use_facet<moneypunct<char> >(loc_de);
-
- // sanity check that the data match
- char dp1 = monp_de.decimal_point();
- char th1 = monp_de.thousands_sep();
- string g1 = monp_de.grouping();
- string cs1 = monp_de.curr_symbol();
- string ps1 = monp_de.positive_sign();
- string ns1 = monp_de.negative_sign();
- int fd1 = monp_de.frac_digits();
- pattern pos1 = monp_de.pos_format();
- pattern neg1 = monp_de.neg_format();
-
- char dp2 = monp_byname.decimal_point();
- char th2 = monp_byname.thousands_sep();
- string g2 = monp_byname.grouping();
- string cs2 = monp_byname.curr_symbol();
- string ps2 = monp_byname.positive_sign();
- string ns2 = monp_byname.negative_sign();
- int fd2 = monp_byname.frac_digits();
- pattern pos2 = monp_byname.pos_format();
- pattern neg2 = monp_byname.neg_format();
-
- VERIFY( dp1 == dp2 );
- VERIFY( th1 == th2 );
- VERIFY( g1 == g2 );
- VERIFY( cs1 == cs2 );
- VERIFY( ps1 == ps2 );
- VERIFY( ns1 == ns2 );
- VERIFY( fd1 == fd2 );
- 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]));
-
- VERIFY(static_cast<part>(neg1.field[0]) == static_cast<part>(neg2.field[0]));
- VERIFY(static_cast<part>(neg1.field[1]) == static_cast<part>(neg2.field[1]));
- VERIFY(static_cast<part>(neg1.field[2]) == static_cast<part>(neg2.field[2]));
- VERIFY(static_cast<part>(neg1.field[3]) == static_cast<part>(neg2.field[3]));
-
- // ...and don't match "C"
- char dp3 = monp_c.decimal_point();
- VERIFY( dp1 != dp3 );
-}
-
-int main()
-{
- test01();
-
- return 0;
-}
--- /dev/null
+// 2001-08-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.6.4 Template class moneypunct_byname
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef money_base::part part;
+ typedef money_base::pattern pattern;
+
+ bool test = true;
+ string str;
+
+ locale loc_byname(locale::classic(), new moneypunct_byname<char>("de_DE"));
+ str = loc_byname.name();
+
+ locale loc_de("de_DE");
+ str = loc_de.name();
+
+ locale loc_c = locale::classic();
+
+ VERIFY( loc_de != loc_byname );
+
+ // cache the moneypunct facets
+ const moneypunct<char>& monp_c = use_facet<moneypunct<char> >(loc_c);
+ const moneypunct<char>& monp_byname =
+ use_facet<moneypunct<char> >(loc_byname);
+ const moneypunct<char>& monp_de = use_facet<moneypunct<char> >(loc_de);
+
+ // sanity check that the data match
+ char dp1 = monp_de.decimal_point();
+ char th1 = monp_de.thousands_sep();
+ string g1 = monp_de.grouping();
+ string cs1 = monp_de.curr_symbol();
+ string ps1 = monp_de.positive_sign();
+ string ns1 = monp_de.negative_sign();
+ int fd1 = monp_de.frac_digits();
+ pattern pos1 = monp_de.pos_format();
+ pattern neg1 = monp_de.neg_format();
+
+ char dp2 = monp_byname.decimal_point();
+ char th2 = monp_byname.thousands_sep();
+ string g2 = monp_byname.grouping();
+ string cs2 = monp_byname.curr_symbol();
+ string ps2 = monp_byname.positive_sign();
+ string ns2 = monp_byname.negative_sign();
+ int fd2 = monp_byname.frac_digits();
+ pattern pos2 = monp_byname.pos_format();
+ pattern neg2 = monp_byname.neg_format();
+
+ VERIFY( dp1 == dp2 );
+ VERIFY( th1 == th2 );
+ VERIFY( g1 == g2 );
+ VERIFY( cs1 == cs2 );
+ VERIFY( ps1 == ps2 );
+ VERIFY( ns1 == ns2 );
+ VERIFY( fd1 == fd2 );
+ 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]));
+
+ VERIFY(static_cast<part>(neg1.field[0]) == static_cast<part>(neg2.field[0]));
+ VERIFY(static_cast<part>(neg1.field[1]) == static_cast<part>(neg2.field[1]));
+ VERIFY(static_cast<part>(neg1.field[2]) == static_cast<part>(neg2.field[2]));
+ VERIFY(static_cast<part>(neg1.field[3]) == static_cast<part>(neg2.field[3]));
+
+ // ...and don't match "C"
+ char dp3 = monp_c.decimal_point();
+ VERIFY( dp1 != dp3 );
+}
+
+int main()
+{
+ test01();
+
+ return 0;
+}
+++ /dev/null
-// 2001-08-23 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.3.1 moneypunct members
-
-#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;
- typedef money_base::part part;
- typedef money_base::pattern pattern;
-
- 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 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_false& monp_de_f = use_facet<__money_false>(loc_de);
-
- // 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();
- VERIFY( q1 != char() );
- VERIFY( q2 != char() );
- VERIFY( q3 != char() );
- VERIFY( q4 != char() );
-
- // sanity check the data is correct.
- char dp1 = monp_c_t.decimal_point();
- char th1 = monp_c_t.thousands_sep();
- string g1 = monp_c_t.grouping();
- string cs1 = monp_c_t.curr_symbol();
- string ps1 = monp_c_t.positive_sign();
- string ns1 = monp_c_t.negative_sign();
- int fd1 = monp_c_t.frac_digits();
- pattern pos1 = monp_c_t.pos_format();
- pattern neg1 = monp_c_t.neg_format();
-
- char dp2 = monp_de_t.decimal_point();
- char th2 = monp_de_t.thousands_sep();
- string g2 = monp_de_t.grouping();
- string cs2 = monp_de_t.curr_symbol();
- string ps2 = monp_de_t.positive_sign();
- string ns2 = monp_de_t.negative_sign();
- int fd2 = monp_de_t.frac_digits();
- pattern pos2 = monp_de_t.pos_format();
- pattern neg2 = monp_de_t.neg_format();
-
- VERIFY( dp1 != dp2 );
- VERIFY( th1 != th2 );
- VERIFY( g1 != g2 );
- VERIFY( cs1 != cs2 );
- // VERIFY( ps1 != ps2 );
- VERIFY( ns1 != ns2 );
- VERIFY( fd1 != fd2 );
- 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]));
-
- VERIFY(static_cast<part>(neg1.field[0]) != static_cast<part>(neg2.field[0]));
- VERIFY(static_cast<part>(neg1.field[1]) != static_cast<part>(neg2.field[1]));
- VERIFY(static_cast<part>(neg1.field[2]) != static_cast<part>(neg2.field[2]));
- 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;
-}
+++ /dev/null
-// 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.3.1 moneypunct members
-
-#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()
-{
- using namespace std;
- typedef money_base::part part;
- typedef money_base::pattern pattern;
-
- 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 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_false& monp_de_f = use_facet<__money_false>(loc_de);
-
- // 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();
- VERIFY( q1 != wchar_t() );
- VERIFY( q2 != wchar_t() );
- VERIFY( q3 != wchar_t() );
- VERIFY( q4 != wchar_t() );
-
- // sanity check the data is correct.
- wchar_t dp1 = monp_c_t.decimal_point();
- wchar_t th1 = monp_c_t.thousands_sep();
- string g1 = monp_c_t.grouping();
- wstring cs1 = monp_c_t.curr_symbol();
- wstring ps1 = monp_c_t.positive_sign();
- wstring ns1 = monp_c_t.negative_sign();
- int fd1 = monp_c_t.frac_digits();
- pattern pos1 = monp_c_t.pos_format();
- pattern neg1 = monp_c_t.neg_format();
-
- wchar_t dp2 = monp_de_t.decimal_point();
- wchar_t th2 = monp_de_t.thousands_sep();
- string g2 = monp_de_t.grouping();
- wstring cs2 = monp_de_t.curr_symbol();
- wstring ps2 = monp_de_t.positive_sign();
- wstring ns2 = monp_de_t.negative_sign();
- int fd2 = monp_de_t.frac_digits();
- pattern pos2 = monp_de_t.pos_format();
- pattern neg2 = monp_de_t.neg_format();
-
- VERIFY( dp1 != dp2 );
- VERIFY( th1 != th2 );
- VERIFY( g1 != g2 );
- VERIFY( cs1 != cs2 );
- // VERIFY( ps1 != ps2 );
- VERIFY( ns1 != ns2 );
- VERIFY( fd1 != fd2 );
- 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]));
-
- VERIFY(static_cast<part>(neg1.field[0]) != static_cast<part>(neg2.field[0]));
- VERIFY(static_cast<part>(neg1.field[1]) != static_cast<part>(neg2.field[1]));
- VERIFY(static_cast<part>(neg1.field[2]) != static_cast<part>(neg2.field[2]));
- 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;
-}
+++ /dev/null
-// 2001-11-21 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.2.1 Template class num_get
-
-// { dg-do compile }
-
-#include <locale>
-
-void test01()
-{
- // Check for required base class.
- typedef std::num_get<char> 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::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;
-}
--- /dev/null
+// { 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>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::num_get<char> 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::iter_type iter_type;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// { 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;
+}
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
+++ /dev/null
-// 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
+++ /dev/null
-// 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
-
-
-
-
-
+++ /dev/null
-// 2001-11-19 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.2.2 Template class num_put
-
-// { dg-do compile }
-
-#include <locale>
-
-void test01()
-{
- // Check for required base class.
- typedef std::num_put<char> 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::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;
-}
--- /dev/null
+// { 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>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::num_put<char> 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::iter_type iter_type;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// { 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;
+}
--- /dev/null
+// 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;
+}
+
+
--- /dev/null
+// 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;
+}
+
+
--- /dev/null
+// 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;
+}
+
+
--- /dev/null
+// 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;
+}
+
+
--- /dev/null
+// 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;
+}
+
+
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
+
+
--- /dev/null
+// 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;
+}
+
+
--- /dev/null
+// 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;
+}
+
+
--- /dev/null
+// 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;
+}
+
+
--- /dev/null
+// 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;
+}
+
+
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
+++ /dev/null
-// 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;
-}
-
-
+++ /dev/null
-// 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
-
+++ /dev/null
-// 2001-01-23 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.3 The numeric punctuation facet
-
-// { dg-do compile }
-
-#include <locale>
-
-void test01()
-{
- // Check for required base class.
- typedef std::numpunct<char> test_type;
- typedef std::locale::facet base_type;
- const test_type& obj = std::use_facet<test_type>(std::locale());
- 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;
-}
--- /dev/null
+// { 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>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::numpunct<char> test_type;
+ typedef std::locale::facet base_type;
+ const test_type& obj = std::use_facet<test_type>(std::locale());
+ const base_type* base = &obj;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// { 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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 test02()
+{
+ 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();
+
+ char dp2 = nump_us.decimal_point();
+ char th2 = nump_us.thousands_sep();
+ string g2 = nump_us.grouping();
+ string t2 = nump_us.truename();
+ string f2 = nump_us.falsename();
+
+ char dp3 = nump_fr.decimal_point();
+ char th3 = nump_fr.thousands_sep();
+ string g3 = nump_fr.grouping();
+ string t3 = nump_fr.truename();
+ string f3 = nump_fr.falsename();
+
+ char dp4 = nump_de.decimal_point();
+ char th4 = nump_de.thousands_sep();
+ string g4 = nump_de.grouping();
+ string t4 = nump_de.truename();
+ string f4 = nump_de.falsename();
+
+ VERIFY( dp2 != dp3 );
+ VERIFY( th2 != th3 );
+
+ VERIFY( dp2 != dp4 );
+ VERIFY( th2 != th4 );
+ // XXX This isn't actually supported right now.
+ // VERIFY( t2 != t3 );
+ // VERIFY( f2 != f3 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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 test02()
+{
+ 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();
+
+ wchar_t dp2 = nump_us.decimal_point();
+ wchar_t th2 = nump_us.thousands_sep();
+ string g2 = nump_us.grouping();
+ wstring t2 = nump_us.truename();
+ wstring f2 = nump_us.falsename();
+
+ wchar_t dp3 = nump_fr.decimal_point();
+ wchar_t th3 = nump_fr.thousands_sep();
+ string g3 = nump_fr.grouping();
+ wstring t3 = nump_fr.truename();
+ wstring f3 = nump_fr.falsename();
+
+ wchar_t dp4 = nump_de.decimal_point();
+ wchar_t th4 = nump_de.thousands_sep();
+ string g4 = nump_de.grouping();
+ wstring t4 = nump_de.truename();
+ wstring f4 = nump_de.falsename();
+
+ VERIFY( dp2 != dp3 );
+ VERIFY( th2 != th3 );
+
+ VERIFY( dp2 != dp4 );
+ VERIFY( th2 != th4 );
+ // XXX This isn't actually supported right now.
+ // VERIFY( t2 != t3 );
+ // VERIFY( f2 != f3 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
+++ /dev/null
-// 2001-01-24 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.3.2 Template class numpunct_byname
-
-#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;
-
- bool test = true;
- string str;
-
- locale loc_byname(locale::classic(), new numpunct_byname<char>("de_DE"));
- str = loc_byname.name();
-
- locale loc_de("de_DE");
- str = loc_de.name();
-
- locale loc_c = locale::classic();
-
- VERIFY( loc_de != loc_byname );
-
- // cache the numpunct facets
- const numpunct<char>& nump_c = use_facet<numpunct<char> >(loc_c);
- const numpunct<char>& nump_byname = use_facet<numpunct<char> >(loc_byname);
- const numpunct<char>& nump_de = use_facet<numpunct<char> >(loc_de);
-
- // sanity check that the data match
- char dp1 = nump_byname.decimal_point();
- char th1 = nump_byname.thousands_sep();
- string g1 = nump_byname.grouping();
- string t1 = nump_byname.truename();
- string f1 = nump_byname.falsename();
-
- char dp2 = nump_de.decimal_point();
- char th2 = nump_de.thousands_sep();
- string g2 = nump_de.grouping();
- string t2 = nump_de.truename();
- string f2 = nump_de.falsename();
-
- VERIFY( dp1 == dp2 );
- VERIFY( th1 == th2 );
- VERIFY( g1 == g2 );
- VERIFY( t1 == t2 );
- VERIFY( f1 == f2 );
-
- // ...and don't match "C"
- char dp3 = nump_c.decimal_point();
- 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;
-}
--- /dev/null
+// 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 test01()
+{
+ using namespace std;
+
+ bool test = true;
+ string str;
+
+ locale loc_byname(locale::classic(), new numpunct_byname<char>("de_DE"));
+ str = loc_byname.name();
+
+ locale loc_de("de_DE");
+ str = loc_de.name();
+
+ locale loc_c = locale::classic();
+
+ VERIFY( loc_de != loc_byname );
+
+ // cache the numpunct facets
+ const numpunct<char>& nump_c = use_facet<numpunct<char> >(loc_c);
+ const numpunct<char>& nump_byname = use_facet<numpunct<char> >(loc_byname);
+ const numpunct<char>& nump_de = use_facet<numpunct<char> >(loc_de);
+
+ // sanity check that the data match
+ char dp1 = nump_byname.decimal_point();
+ char th1 = nump_byname.thousands_sep();
+ string g1 = nump_byname.grouping();
+ string t1 = nump_byname.truename();
+ string f1 = nump_byname.falsename();
+
+ char dp2 = nump_de.decimal_point();
+ char th2 = nump_de.thousands_sep();
+ string g2 = nump_de.grouping();
+ string t2 = nump_de.truename();
+ string f2 = nump_de.falsename();
+
+ VERIFY( dp1 == dp2 );
+ VERIFY( th1 == th2 );
+ VERIFY( g1 == g2 );
+ VERIFY( t1 == t2 );
+ VERIFY( f1 == f2 );
+
+ // ...and don't match "C"
+ char dp3 = nump_c.decimal_point();
+ VERIFY( dp1 != dp3 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 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;
+}
+++ /dev/null
-// 2001-01-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.3.1.1 nunpunct members
-
-#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;
-
- 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();
-
- char dp2 = nump_us.decimal_point();
- char th2 = nump_us.thousands_sep();
- string g2 = nump_us.grouping();
- string t2 = nump_us.truename();
- string f2 = nump_us.falsename();
-
- char dp3 = nump_fr.decimal_point();
- char th3 = nump_fr.thousands_sep();
- string g3 = nump_fr.grouping();
- string t3 = nump_fr.truename();
- string f3 = nump_fr.falsename();
-
- char dp4 = nump_de.decimal_point();
- char th4 = nump_de.thousands_sep();
- string g4 = nump_de.grouping();
- string t4 = nump_de.truename();
- string f4 = nump_de.falsename();
-
- VERIFY( dp2 != dp3 );
- VERIFY( th2 != th3 );
-
- 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 );
- }
-}
-
-int main()
-{
- test01();
- test02();
- test03();
- return 0;
-}
+++ /dev/null
-// 2001-11-20 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.3.1.1 nunpunct members
-
-#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()
-{
- 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();
-
- wchar_t dp2 = nump_us.decimal_point();
- wchar_t th2 = nump_us.thousands_sep();
- string g2 = nump_us.grouping();
- wstring t2 = nump_us.truename();
- wstring f2 = nump_us.falsename();
-
- wchar_t dp3 = nump_fr.decimal_point();
- wchar_t th3 = nump_fr.thousands_sep();
- string g3 = nump_fr.grouping();
- wstring t3 = nump_fr.truename();
- wstring f3 = nump_fr.falsename();
-
- wchar_t dp4 = nump_de.decimal_point();
- wchar_t th4 = nump_de.thousands_sep();
- string g4 = nump_de.grouping();
- wstring t4 = nump_de.truename();
- wstring f4 = nump_de.falsename();
-
- VERIFY( dp2 != dp3 );
- VERIFY( th2 != th3 );
-
- VERIFY( dp2 != dp4 );
- VERIFY( th2 != th4 );
-}
-
-// 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;
-}
+++ /dev/null
-// 2000-09-11 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2000, 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.1.1.4 locale operators [lib.locale.operators]
-
-#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& cloc = locale::classic();
- // construct a locale object with the specialized facet.
- locale loc(locale::classic(), new gnu_codecvt);
- VERIFY ( cloc != loc );
- VERIFY ( !(cloc == loc) );
-
- str1 = cloc.name();
- str2 = loc.name();
- VERIFY( loc(str1, str2) == false );
-}
-
-// 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 ()
-{
- test01();
- test02();
- return 0;
-}
-
-
-
+++ /dev/null
-// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2000, 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.1.1.5 locale static members [lib.locale.statics]
-
-#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;
-
-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;
-
-// Verify lifetimes of global objects.
-void test03()
-{
- using namespace std;
- bool test = true;
-
- string name;
- locale global_orig;
- // 1: Destroyed when out of scope.
- {
- {
- {
- VERIFY( counter == 0 );
- {
- locale loc01(locale::classic(), new facet_type);
- VERIFY( counter == 1 );
- global_orig = locale::global(loc01);
- name = loc01.name();
- }
- VERIFY( counter == 1 );
- locale loc02 = locale();
- // Weak, but it's something...
- VERIFY( loc02.name() == name );
- }
- VERIFY( counter == 1 );
- // NB: loc03 should be a copy of the previous global locale.
- locale loc03 = locale::global(global_orig);
- VERIFY( counter == 1 );
- VERIFY( loc03.name() == name );
- }
- VERIFY( counter == 0 );
- locale loc04 = locale();
- VERIFY( loc04 == global_orig );
- }
-
- // 2: Not destroyed when out of scope, deliberately leaked.
- {
- {
- {
- VERIFY( counter == 0 );
- {
- locale loc01(locale::classic(), new facet_type(1));
- VERIFY( counter == 1 );
- global_orig = locale::global(loc01);
- name = loc01.name();
- }
- VERIFY( counter == 1 );
- locale loc02 = locale();
- // Weak, but it's something...
- VERIFY( loc02.name() == name );
- }
- VERIFY( counter == 1 );
- // NB: loc03 should be a copy of the previous global locale.
- locale loc03 = locale::global(global_orig);
- VERIFY( counter == 1 );
- VERIFY( loc03.name() == name );
- }
- VERIFY( counter == 1 );
- locale loc04 = locale();
- VERIFY( loc04 == global_orig );
- }
- VERIFY( counter == 1 );
-
- // Restore global settings.
- locale::global(global_orig);
-}
-
-int main ()
-{
- test01();
- test02();
-
- test03();
- return 0;
-}
+++ /dev/null
-// 2001-09-21 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.5.1 Template class time_get
-
-// { dg-do compile }
-
-#include <locale>
-
-void test01()
-{
- // Check for required base class.
- typedef std::time_get<char> test_type;
- typedef std::locale::facet base_type1;
- typedef std::time_base base_type2;
- const test_type& obj = std::use_facet<test_type>(std::locale());
- const base_type1* base1 = &obj;
- const base_type2* base2 = &obj;
-
- // Check for required typedefs
- typedef test_type::char_type char_type;
- 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;
-}
--- /dev/null
+// { 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>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::time_get<char> test_type;
+ typedef std::locale::facet base_type1;
+ typedef std::time_base base_type2;
+ const test_type& obj = std::use_facet<test_type>(std::locale());
+ const base_type1* base1 = &obj;
+ const base_type2* base2 = &obj;
+
+ // Check for required typedefs
+ typedef test_type::char_type char_type;
+ typedef test_type::iter_type iter_type;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// { 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 2001-09-17 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.5.3 Template class time_put
-
-// { dg-do compile }
-
-#include <locale>
-
-void test01()
-{
- // Check for required base class.
- typedef std::time_put<char> 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::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;
-}
--- /dev/null
+// { 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>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::time_put<char> 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::iter_type iter_type;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// { 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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;
-}
// 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() { }