2003-10-22 Benjamin Kosnik * include/bits/locale_facets.h: Correct byname facets for "C" locale. * config/locale/generic/ctype_members.cc: Same. * config/locale/generic/messages_members.h: Same. * config/locale/gnu/ctype_members.cc: Same. * config/locale/gnu/messages_members.h: Same. * include/bits/codecvt.h: Same. * src/ctype.cc: Same. * testsuite/22_locale/codecvt_byname/1.cc: New. * testsuite/22_locale/collate/1.cc: Edit. * testsuite/22_locale/collate_byname/1.cc: Derivation tests, move to... * testsuite/22_locale/collate_byname/named_equivalence.cc: ...here. * testsuite/22_locale/ctype/1.cc: Derivation tests. * testsuite/22_locale/ctype/11844.cc: Move... * testsuite/22_locale/ctype_base/11844.cc: ...here. * testsuite/22_locale/ctype_base/1.cc: Move mask bits here. * testsuite/22_locale/ctype_byname/1.cc: Name. * testsuite/22_locale/messages_byname/1.cc: New. * testsuite/22_locale/messages_byname/named_equivalence.cc: New. * testsuite/22_locale/moneypunct_byname/1.cc: Derivation test. * testsuite/22_locale/moneypunct_byname/named_equivalence.cc: New. * testsuite/22_locale/numpunct/1.cc: Edit. * testsuite/22_locale/numpunct_byname/2.cc: Move... * testsuite/22_locale/numpunct/members/char/3.cc: ...here. * testsuite/22_locale/numpunct_byname/1.cc: Derivation tests. * testsuite/22_locale/numpunct_byname/named_equivalence.cc: New. Index: config/locale/generic/ctype_members.cc =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/generic/ctype_members.cc,v retrieving revision 1.7 diff -c -p -r1.7 ctype_members.cc *** config/locale/generic/ctype_members.cc 9 Oct 2003 19:10:54 -0000 1.7 --- config/locale/generic/ctype_members.cc 22 Oct 2003 18:57:10 -0000 *************** namespace std *** 43,50 **** ctype_byname::ctype_byname(const char* __s, size_t __refs) : ctype(0, false, __refs) { ! _S_destroy_c_locale(_M_c_locale_ctype); ! _S_create_c_locale(_M_c_locale_ctype, __s); } #ifdef _GLIBCXX_USE_WCHAR_T --- 43,53 ---- ctype_byname::ctype_byname(const char* __s, size_t __refs) : ctype(0, false, __refs) { ! if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ! { ! _S_destroy_c_locale(_M_c_locale_ctype); ! _S_create_c_locale(_M_c_locale_ctype, __s); ! } } #ifdef _GLIBCXX_USE_WCHAR_T Index: config/locale/generic/messages_members.h =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/generic/messages_members.h,v retrieving revision 1.6 diff -c -p -r1.6 messages_members.h *** config/locale/generic/messages_members.h 2 Oct 2003 16:56:38 -0000 1.6 --- config/locale/generic/messages_members.h 22 Oct 2003 18:57:10 -0000 *************** *** 76,81 **** messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) : messages<_CharT>(__refs) { ! _S_destroy_c_locale(this->_M_c_locale_messages); ! _S_create_c_locale(this->_M_c_locale_messages, __s); } --- 76,84 ---- messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) : messages<_CharT>(__refs) { ! if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ! { ! _S_destroy_c_locale(this->_M_c_locale_messages); ! _S_create_c_locale(this->_M_c_locale_messages, __s); ! } } Index: config/locale/gnu/ctype_members.cc =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/gnu/ctype_members.cc,v retrieving revision 1.12 diff -c -p -r1.12 ctype_members.cc *** config/locale/gnu/ctype_members.cc 6 Oct 2003 22:32:58 -0000 1.12 --- config/locale/gnu/ctype_members.cc 22 Oct 2003 18:57:10 -0000 *************** namespace std *** 43,54 **** template<> ctype_byname::ctype_byname(const char* __s, size_t __refs) : ctype(0, false, __refs) ! { ! _S_destroy_c_locale(_M_c_locale_ctype); ! _S_create_c_locale(_M_c_locale_ctype, __s); ! _M_toupper = _M_c_locale_ctype->__ctype_toupper; ! _M_tolower = _M_c_locale_ctype->__ctype_tolower; ! _M_table = _M_c_locale_ctype->__ctype_b; } #ifdef _GLIBCXX_USE_WCHAR_T --- 43,57 ---- template<> ctype_byname::ctype_byname(const char* __s, size_t __refs) : ctype(0, false, __refs) ! { ! if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ! { ! _S_destroy_c_locale(_M_c_locale_ctype); ! _S_create_c_locale(_M_c_locale_ctype, __s); ! _M_toupper = _M_c_locale_ctype->__ctype_toupper; ! _M_tolower = _M_c_locale_ctype->__ctype_tolower; ! _M_table = _M_c_locale_ctype->__ctype_b; ! } } #ifdef _GLIBCXX_USE_WCHAR_T Index: config/locale/gnu/messages_members.h =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/gnu/messages_members.h,v retrieving revision 1.10 diff -c -p -r1.10 messages_members.h *** config/locale/gnu/messages_members.h 2 Oct 2003 23:06:13 -0000 1.10 --- config/locale/gnu/messages_members.h 22 Oct 2003 18:57:10 -0000 *************** *** 106,111 **** std::strcpy(__tmp, __s); this->_M_name_messages = __tmp; #endif ! _S_destroy_c_locale(this->_M_c_locale_messages); ! _S_create_c_locale(this->_M_c_locale_messages, __s); } --- 106,114 ---- std::strcpy(__tmp, __s); this->_M_name_messages = __tmp; #endif ! if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ! { ! _S_destroy_c_locale(this->_M_c_locale_messages); ! _S_create_c_locale(this->_M_c_locale_messages, __s); ! } } Index: include/bits/codecvt.h =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/codecvt.h,v retrieving revision 1.24 diff -c -p -r1.24 codecvt.h *** include/bits/codecvt.h 2 Oct 2003 16:56:39 -0000 1.24 --- include/bits/codecvt.h 22 Oct 2003 18:57:10 -0000 *************** *** 341,348 **** codecvt_byname(const char* __s, size_t __refs = 0) : codecvt<_InternT, _ExternT, _StateT>(__refs) { ! _S_destroy_c_locale(this->_M_c_locale_codecvt); ! _S_create_c_locale(this->_M_c_locale_codecvt, __s); } protected: --- 341,351 ---- codecvt_byname(const char* __s, size_t __refs = 0) : codecvt<_InternT, _ExternT, _StateT>(__refs) { ! if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ! { ! _S_destroy_c_locale(this->_M_c_locale_codecvt); ! _S_create_c_locale(this->_M_c_locale_codecvt, __s); ! } } protected: Index: include/bits/locale_facets.h =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/locale_facets.h,v retrieving revision 1.67 diff -c -p -r1.67 locale_facets.h *** include/bits/locale_facets.h 21 Oct 2003 14:22:42 -0000 1.67 --- include/bits/locale_facets.h 22 Oct 2003 18:57:11 -0000 *************** namespace std *** 795,803 **** template class numpunct_byname : public numpunct<_CharT> { - // Data Member. - __c_locale _M_c_locale_numpunct; - public: typedef _CharT char_type; typedef basic_string<_CharT> string_type; --- 795,800 ---- *************** namespace std *** 806,819 **** numpunct_byname(const char* __s, size_t __refs = 0) : numpunct<_CharT>(__refs) { ! this->_S_create_c_locale(_M_c_locale_numpunct, __s); ! this->_M_initialize_numpunct(_M_c_locale_numpunct); } protected: virtual ! ~numpunct_byname() ! { this->_S_destroy_c_locale(_M_c_locale_numpunct); } }; template --- 803,820 ---- numpunct_byname(const char* __s, size_t __refs = 0) : numpunct<_CharT>(__refs) { ! if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ! { ! __c_locale __tmp; ! this->_S_create_c_locale(__tmp, __s); ! this->_M_initialize_numpunct(__tmp); ! this->_S_destroy_c_locale(__tmp); ! } } protected: virtual ! ~numpunct_byname() { } }; template *************** namespace std *** 1151,1158 **** collate_byname(const char* __s, size_t __refs = 0) : collate<_CharT>(__refs) { ! this->_S_destroy_c_locale(this->_M_c_locale_collate); ! this->_S_create_c_locale(this->_M_c_locale_collate, __s); } protected: --- 1152,1162 ---- collate_byname(const char* __s, size_t __refs = 0) : collate<_CharT>(__refs) { ! if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ! { ! this->_S_destroy_c_locale(this->_M_c_locale_collate); ! this->_S_create_c_locale(this->_M_c_locale_collate, __s); ! } } protected: *************** namespace std *** 1589,1595 **** typedef _OutIter iter_type; explicit ! time_put_byname(const char* /*__s*/, size_t __refs = 0) : time_put<_CharT, _OutIter>(__refs) { }; --- 1593,1599 ---- typedef _OutIter iter_type; explicit ! time_put_byname(const char*, size_t __refs = 0) : time_put<_CharT, _OutIter>(__refs) { }; *************** namespace std *** 1805,1812 **** template class moneypunct_byname : public moneypunct<_CharT, _Intl> { - __c_locale _M_c_locale_moneypunct; - public: typedef _CharT char_type; typedef basic_string<_CharT> string_type; --- 1809,1814 ---- *************** namespace std *** 1817,1830 **** moneypunct_byname(const char* __s, size_t __refs = 0) : moneypunct<_CharT, _Intl>(__refs) { ! this->_S_create_c_locale(_M_c_locale_moneypunct, __s); ! this->_M_initialize_moneypunct(_M_c_locale_moneypunct); } protected: virtual ! ~moneypunct_byname() ! { this->_S_destroy_c_locale(_M_c_locale_moneypunct); } }; template --- 1819,1836 ---- moneypunct_byname(const char* __s, size_t __refs = 0) : moneypunct<_CharT, _Intl>(__refs) { ! if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ! { ! __c_locale __tmp; ! this->_S_create_c_locale(__tmp, __s); ! this->_M_initialize_moneypunct(__tmp); ! this->_S_destroy_c_locale(__tmp); ! } } protected: virtual ! ~moneypunct_byname() { } }; template Index: src/ctype.cc =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/src/ctype.cc,v retrieving revision 1.5 diff -c -p -r1.5 ctype.cc *** src/ctype.cc 21 Oct 2003 14:22:42 -0000 1.5 --- src/ctype.cc 22 Oct 2003 18:57:11 -0000 *************** namespace std *** 99,107 **** template<> ctype_byname::ctype_byname(const char* __s, size_t __refs) : ctype(__refs) ! { ! _S_destroy_c_locale(_M_c_locale_ctype); ! _S_create_c_locale(_M_c_locale_ctype, __s); } #endif } // namespace std --- 99,110 ---- template<> ctype_byname::ctype_byname(const char* __s, size_t __refs) : ctype(__refs) ! { ! if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ! { ! _S_destroy_c_locale(_M_c_locale_ctype); ! _S_create_c_locale(_M_c_locale_ctype, __s); ! } } #endif } // namespace std Index: testsuite/22_locale/codecvt_byname/1.cc =================================================================== RCS file: testsuite/22_locale/codecvt_byname/1.cc diff -N testsuite/22_locale/codecvt_byname/1.cc *** /dev/null 1 Jan 1970 00:00:00 -0000 --- testsuite/22_locale/codecvt_byname/1.cc 22 Oct 2003 18:57:11 -0000 *************** *** 0 **** --- 1,44 ---- + // { dg-do compile } + // 2001-08-27 Benjamin Kosnik + + // 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 + + void test01() + { + // Check for required base class. + typedef std::codecvt_byname test_type; + typedef std::codecvt base_type; + const test_type& obj = std::use_facet(std::locale::classic()); + const base_type* base __attribute__((unused)) = &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; + } Index: testsuite/22_locale/collate/1.cc =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/22_locale/collate/1.cc,v retrieving revision 1.2 diff -c -p -r1.2 1.cc *** testsuite/22_locale/collate/1.cc 23 Sep 2003 20:02:17 -0000 1.2 --- testsuite/22_locale/collate/1.cc 22 Oct 2003 18:57:11 -0000 *************** *** 26,32 **** void test01() { // Check for required base class. ! typedef std::messages test_type; typedef std::locale::facet base_type; const test_type& obj = std::use_facet(std::locale()); const base_type* base __attribute__((unused)) = &obj; --- 26,32 ---- void test01() { // Check for required base class. ! typedef std::collate test_type; typedef std::locale::facet base_type; const test_type& obj = std::use_facet(std::locale()); const base_type* base __attribute__((unused)) = &obj; Index: testsuite/22_locale/collate_byname/1.cc =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/22_locale/collate_byname/1.cc,v retrieving revision 1.5 diff -c -p -r1.5 1.cc *** testsuite/22_locale/collate_byname/1.cc 23 Sep 2003 20:02:19 -0000 1.5 --- testsuite/22_locale/collate_byname/1.cc 22 Oct 2003 18:57:11 -0000 *************** *** 1,6 **** ! // 2001-08-15 Benjamin Kosnik ! // 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 --- 1,7 ---- ! // { dg-do compile } ! // 2001-08-15 Benjamin Kosnik ! // 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 *************** *** 18,131 **** // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. ! // 22.2.4.2 Template class collate_byname #include - #include void test01() { ! using namespace std; ! typedef std::collate::string_type string_type; ! ! bool test __attribute__((unused)) = true; ! string str; ! locale loc_c = locale::classic(); ! ! locale loc_de = __gnu_test::try_named_locale("de_DE"); ! str = loc_de.name(); ! ! locale loc_byname(locale::classic(), new collate_byname("de_DE")); ! str = loc_byname.name(); ! ! VERIFY( loc_de != loc_byname ); ! ! // cache the collate facets ! const collate& coll_de = use_facet >(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() --- 19,39 ---- // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. ! // 22.2.4 The collate category #include void test01() { ! // Check for required base class. ! typedef std::collate_byname test_type; ! typedef std::collate base_type; ! const test_type& obj = std::use_facet(std::locale::classic()); ! const base_type* base __attribute__((unused)) = &obj; ! ! // Check for required typedefs ! typedef test_type::char_type char_type; ! typedef test_type::string_type string_type; } int main() Index: testsuite/22_locale/collate_byname/named_equivalence.cc =================================================================== RCS file: testsuite/22_locale/collate_byname/named_equivalence.cc diff -N testsuite/22_locale/collate_byname/named_equivalence.cc *** /dev/null 1 Jan 1970 00:00:00 -0000 --- testsuite/22_locale/collate_byname/named_equivalence.cc 22 Oct 2003 18:57:11 -0000 *************** *** 0 **** --- 1,135 ---- + // 2001-08-15 Benjamin Kosnik + + // 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 + #include + + void test01() + { + using namespace std; + typedef std::collate::string_type string_type; + + bool test __attribute__((unused)) = true; + string str; + locale loc_c = locale::classic(); + + locale loc_de = __gnu_test::try_named_locale("de_DE"); + str = loc_de.name(); + + locale loc_byname(locale::classic(), new collate_byname("de_DE")); + str = loc_byname.name(); + + VERIFY( loc_de != loc_byname ); + + // cache the collate facets + const collate& coll_de = use_facet >(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; + } Index: testsuite/22_locale/ctype/1.cc =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/22_locale/ctype/1.cc,v retrieving revision 1.2 diff -c -p -r1.2 1.cc *** testsuite/22_locale/ctype/1.cc 23 Sep 2003 20:02:20 -0000 1.2 --- testsuite/22_locale/ctype/1.cc 22 Oct 2003 18:57:11 -0000 *************** *** 1,7 **** // { 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 --- 1,7 ---- // { dg-do compile } ! // 2001-08-15 Benjamin Kosnik ! // Copyright (C) 2003 Free Software Foundation // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the *************** *** 19,162 **** // 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 ! // 2: Should be able to instantiate this for other types besides char, wchar_t ! typedef std::ctype cctype; ! ! class gnu_ctype: public std::ctype ! { ! private: ! const cctype& _M_cctype; ! ! public: ! explicit ! gnu_ctype(size_t __refs = 0) ! : std::ctype(__refs), ! _M_cctype(std::use_facet(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(__lo), ! reinterpret_cast(__hi), __vec); ! return reinterpret_cast(__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(__lo), ! reinterpret_cast(__hi)); ! return reinterpret_cast(__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(__lo), ! reinterpret_cast(__hi)); ! return reinterpret_cast(__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(__lo), ! reinterpret_cast(__hi)); ! return reinterpret_cast(__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(__lo), ! reinterpret_cast(__hi)); ! return reinterpret_cast(__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(__lo), ! reinterpret_cast(__hi), ! reinterpret_cast(__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(__lo), ! reinterpret_cast(__hi), ! __dfault, ! reinterpret_cast(__dest)); ! return reinterpret_cast(__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; ! ctype_base::mask res; ! ! m01 = ctype_base::space; ! m02 = ctype_base::xdigit; ! ! res = m01 & m02; ! res = m01 | m02; ! res = m01 ^ m02; ! res = ~m01; ! m01 &= m02; ! m01 |= m02; ! m01 ^= m02; } ! int main() ! { test01(); return 0; } --- 19,44 ---- // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. ! // 22.2.1.1 - Template class ctype #include ! void test01() { ! // Check for required base class. ! typedef std::ctype test_type; ! typedef std::locale::facet base_type1; ! typedef std::ctype_base base_type2; ! const test_type& obj = std::use_facet(std::locale::classic()); ! const base_type1* base1 __attribute__((unused)) = &obj; ! const base_type2* base2 __attribute__((unused)) = &obj; ! // Check for required typedefs ! typedef test_type::char_type char_type; } ! int main() ! { test01(); return 0; } Index: testsuite/22_locale/ctype/11844.cc =================================================================== RCS file: testsuite/22_locale/ctype/11844.cc diff -N testsuite/22_locale/ctype/11844.cc *** testsuite/22_locale/ctype/11844.cc 9 Oct 2003 19:10:54 -0000 1.1 --- /dev/null 1 Jan 1970 00:00:00 -0000 *************** *** 1,47 **** - // Copyright (C) 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 The ctype category - - #include - #include - - // libstdc++/11844 - void test01() - { - typedef std::ctype_base ctb; - bool test __attribute__((unused)) = true; - - VERIFY( ctb::alnum == (ctb::alpha | ctb::digit) ); - VERIFY( ctb::graph == (ctb::alnum | ctb::punct) ); - } - - int main() - { - test01(); - return 0; - } --- 0 ---- Index: testsuite/22_locale/ctype_base/1.cc =================================================================== RCS file: testsuite/22_locale/ctype_base/1.cc diff -N testsuite/22_locale/ctype_base/1.cc *** /dev/null 1 Jan 1970 00:00:00 -0000 --- testsuite/22_locale/ctype_base/1.cc 22 Oct 2003 18:57:11 -0000 *************** *** 0 **** --- 1,56 ---- + // { 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 + + // 2: Sanity check ctype_base::mask bitmask requirements + void + test01() + { + using namespace std; + + ctype_base::mask m01; + ctype_base::mask m02; + ctype_base::mask res; + + m01 = ctype_base::space; + m02 = ctype_base::xdigit; + + res = m01 & m02; + res = m01 | m02; + res = m01 ^ m02; + res = ~m01; + m01 &= m02; + m01 |= m02; + m01 ^= m02; + } + + int main() + { + test01(); + return 0; + } Index: testsuite/22_locale/ctype_base/11844.cc =================================================================== RCS file: testsuite/22_locale/ctype_base/11844.cc diff -N testsuite/22_locale/ctype_base/11844.cc *** /dev/null 1 Jan 1970 00:00:00 -0000 --- testsuite/22_locale/ctype_base/11844.cc 22 Oct 2003 18:57:11 -0000 *************** *** 0 **** --- 1,47 ---- + // Copyright (C) 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 The ctype category + + #include + #include + + // libstdc++/11844 + void test01() + { + typedef std::ctype_base ctb; + bool test __attribute__((unused)) = true; + + VERIFY( ctb::alnum == (ctb::alpha | ctb::digit) ); + VERIFY( ctb::graph == (ctb::alnum | ctb::punct) ); + } + + int main() + { + test01(); + return 0; + } Index: testsuite/22_locale/ctype_byname/1.cc =================================================================== RCS file: testsuite/22_locale/ctype_byname/1.cc diff -N testsuite/22_locale/ctype_byname/1.cc *** /dev/null 1 Jan 1970 00:00:00 -0000 --- testsuite/22_locale/ctype_byname/1.cc 22 Oct 2003 18:57:11 -0000 *************** *** 0 **** --- 1,42 ---- + // { dg-do compile } + // 2001-08-15 Benjamin Kosnik + + // Copyright (C) 2003 Free Software Foundation + // + // This file is part of the GNU ISO C++ Library. This library is free + // software; you can redistribute it and/or modify it under the + // terms of the GNU General Public License as published by the + // Free Software Foundation; either version 2, or (at your option) + // any later version. + + // This library is distributed in the hope that it will be useful, + // but WITHOUT ANY WARRANTY; without even the implied warranty of + // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + // GNU General Public License for more details. + + // You should have received a copy of the GNU General Public License along + // with this library; 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.1 - Template class ctype + + #include + + void test01() + { + // Check for required base class. + typedef std::ctype_byname test_type; + typedef std::ctype base_type; + const test_type& obj = std::use_facet(std::locale::classic()); + const base_type* base __attribute__((unused)) = &obj; + + // Check for required typedefs + typedef test_type::char_type char_type; + } + + int main() + { + test01(); + return 0; + } Index: testsuite/22_locale/messages_byname/1.cc =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/22_locale/messages_byname/1.cc,v retrieving revision 1.6 diff -c -p -r1.6 1.cc *** testsuite/22_locale/messages_byname/1.cc 23 Sep 2003 20:02:27 -0000 1.6 --- testsuite/22_locale/messages_byname/1.cc 22 Oct 2003 18:57:11 -0000 *************** *** 1,4 **** ! // 2001-07-17 Benjamin Kosnik // Copyright (C) 2001, 2003 Free Software Foundation // --- 1,5 ---- ! // { dg-do compile } ! // 2001-07-17 Benjamin Kosnik // Copyright (C) 2001, 2003 Free Software Foundation // *************** *** 18,74 **** // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. ! // 22.2.7.2 Template class messages_byname #include - #include void test01() { ! using namespace std; ! typedef std::messages::catalog catalog; ! typedef std::messages::string_type string_type; ! ! bool test __attribute__((unused)) = true; ! string str; ! // This is defined through CXXFLAGS in scripts/testsuite_flags[.in]. ! const char* dir = LOCALEDIR; ! locale loc_c = locale::classic(); ! ! locale loc_de = __gnu_test::try_named_locale("de_DE"); ! str = loc_de.name(); ! ! locale loc_byname(locale::classic(), new messages_byname("de_DE")); ! str = loc_byname.name(); ! ! VERIFY( loc_de != loc_byname ); ! ! // cache the messages facets ! const messages& mssg_byname = use_facet >(loc_byname); ! const messages& mssg_de = use_facet >(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() --- 19,39 ---- // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. ! // 22.2.7 The message retrieval category #include void test01() { ! // Check for required base class. ! typedef std::messages_byname test_type; ! typedef std::messages base_type; ! const test_type& obj = std::use_facet(std::locale::classic()); ! const base_type* base __attribute__((unused)) = &obj; ! ! // Check for required typedefs ! typedef test_type::char_type char_type; ! typedef test_type::string_type string_type; } int main() Index: testsuite/22_locale/messages_byname/named_equivalence.cc =================================================================== RCS file: testsuite/22_locale/messages_byname/named_equivalence.cc diff -N testsuite/22_locale/messages_byname/named_equivalence.cc *** /dev/null 1 Jan 1970 00:00:00 -0000 --- testsuite/22_locale/messages_byname/named_equivalence.cc 22 Oct 2003 18:57:11 -0000 *************** *** 0 **** --- 1,78 ---- + // 2001-07-17 Benjamin Kosnik + + // 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 + #include + + void test01() + { + using namespace std; + typedef std::messages::catalog catalog; + typedef std::messages::string_type string_type; + + bool test __attribute__((unused)) = true; + string str; + // This is defined through CXXFLAGS in scripts/testsuite_flags[.in]. + const char* dir = LOCALEDIR; + locale loc_c = locale::classic(); + + locale loc_de = __gnu_test::try_named_locale("de_DE"); + str = loc_de.name(); + + locale loc_byname(locale::classic(), new messages_byname("de_DE")); + str = loc_byname.name(); + + VERIFY( loc_de != loc_byname ); + + // cache the messages facets + const messages& mssg_byname = use_facet >(loc_byname); + const messages& mssg_de = use_facet >(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; + } Index: testsuite/22_locale/moneypunct_byname/1.cc =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/22_locale/moneypunct_byname/1.cc,v retrieving revision 1.5 diff -c -p -r1.5 1.cc *** testsuite/22_locale/moneypunct_byname/1.cc 23 Sep 2003 20:02:30 -0000 1.5 --- testsuite/22_locale/moneypunct_byname/1.cc 22 Oct 2003 18:57:11 -0000 *************** *** 1,4 **** ! // 2001-08-24 Benjamin Kosnik // Copyright (C) 2001, 2003 Free Software Foundation // --- 1,5 ---- ! // { dg-do compile } ! // 2001-08-23 Benjamin Kosnik // Copyright (C) 2001, 2003 Free Software Foundation // *************** *** 18,94 **** // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. ! // 22.2.6.4 Template class moneypunct_byname #include #include void test01() { ! using namespace std; ! typedef money_base::part part; ! typedef money_base::pattern pattern; ! ! bool test __attribute__((unused)) = true; ! string str; ! ! locale loc_de = __gnu_test::try_named_locale("de_DE"); ! str = loc_de.name(); ! ! locale loc_byname(locale::classic(), new moneypunct_byname("de_DE")); ! str = loc_byname.name(); ! ! locale loc_c = locale::classic(); ! ! VERIFY( loc_de != loc_byname ); ! ! // cache the moneypunct facets ! const moneypunct& monp_c = use_facet >(loc_c); ! const moneypunct& monp_byname = ! use_facet >(loc_byname); ! const moneypunct& monp_de = use_facet >(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(pos1.field[0]) == static_cast(pos2.field[0])); ! VERIFY(static_cast(pos1.field[1]) == static_cast(pos2.field[1])); ! VERIFY(static_cast(pos1.field[2]) == static_cast(pos2.field[2])); ! VERIFY(static_cast(pos1.field[3]) == static_cast(pos2.field[3])); ! ! VERIFY(static_cast(neg1.field[0]) == static_cast(neg2.field[0])); ! VERIFY(static_cast(neg1.field[1]) == static_cast(neg2.field[1])); ! VERIFY(static_cast(neg1.field[2]) == static_cast(neg2.field[2])); ! VERIFY(static_cast(neg1.field[3]) == static_cast(neg2.field[3])); ! ! // ...and don't match "C" ! char dp3 = monp_c.decimal_point(); ! VERIFY( dp1 != dp3 ); } int main() --- 19,40 ---- // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. ! // 22.2.6.3 Template class moneypunct #include #include void test01() { ! // Check for required base class. ! typedef std::moneypunct_byname test_type; ! typedef std::moneypunct base_type; ! const test_type& obj = std::use_facet(std::locale()); ! const base_type* base __attribute__((unused)) = &obj; ! ! // Check for required typedefs ! typedef test_type::char_type char_type; ! typedef test_type::string_type string_type; } int main() Index: testsuite/22_locale/moneypunct_byname/named_equivalence.cc =================================================================== RCS file: testsuite/22_locale/moneypunct_byname/named_equivalence.cc diff -N testsuite/22_locale/moneypunct_byname/named_equivalence.cc *** /dev/null 1 Jan 1970 00:00:00 -0000 --- testsuite/22_locale/moneypunct_byname/named_equivalence.cc 22 Oct 2003 18:57:11 -0000 *************** *** 0 **** --- 1,98 ---- + // 2001-08-24 Benjamin Kosnik + + // 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 + #include + + void test01() + { + using namespace std; + typedef money_base::part part; + typedef money_base::pattern pattern; + + bool test __attribute__((unused)) = true; + string str; + + locale loc_de = __gnu_test::try_named_locale("de_DE"); + str = loc_de.name(); + + locale loc_byname(locale::classic(), new moneypunct_byname("de_DE")); + str = loc_byname.name(); + + locale loc_c = locale::classic(); + + VERIFY( loc_de != loc_byname ); + + // cache the moneypunct facets + const moneypunct& monp_c = use_facet >(loc_c); + const moneypunct& monp_byname = + use_facet >(loc_byname); + const moneypunct& monp_de = use_facet >(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(pos1.field[0]) == static_cast(pos2.field[0])); + VERIFY(static_cast(pos1.field[1]) == static_cast(pos2.field[1])); + VERIFY(static_cast(pos1.field[2]) == static_cast(pos2.field[2])); + VERIFY(static_cast(pos1.field[3]) == static_cast(pos2.field[3])); + + VERIFY(static_cast(neg1.field[0]) == static_cast(neg2.field[0])); + VERIFY(static_cast(neg1.field[1]) == static_cast(neg2.field[1])); + VERIFY(static_cast(neg1.field[2]) == static_cast(neg2.field[2])); + VERIFY(static_cast(neg1.field[3]) == static_cast(neg2.field[3])); + + // ...and don't match "C" + char dp3 = monp_c.decimal_point(); + VERIFY( dp1 != dp3 ); + } + + int main() + { + test01(); + return 0; + } Index: testsuite/22_locale/numpunct/1.cc =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/22_locale/numpunct/1.cc,v retrieving revision 1.2 diff -c -p -r1.2 1.cc *** testsuite/22_locale/numpunct/1.cc 23 Sep 2003 20:02:32 -0000 1.2 --- testsuite/22_locale/numpunct/1.cc 22 Oct 2003 18:57:11 -0000 *************** void test01() *** 30,35 **** --- 30,39 ---- typedef std::locale::facet base_type; const test_type& obj = std::use_facet(std::locale()); const base_type* base __attribute__((unused)) = &obj; + + // Check for required typedefs + typedef test_type::char_type char_type; + typedef test_type::string_type string_type; } int main() Index: testsuite/22_locale/numpunct/members/char/3.cc =================================================================== RCS file: testsuite/22_locale/numpunct/members/char/3.cc diff -N testsuite/22_locale/numpunct/members/char/3.cc *** /dev/null 1 Jan 1970 00:00:00 -0000 --- testsuite/22_locale/numpunct/members/char/3.cc 22 Oct 2003 18:57:11 -0000 *************** *** 0 **** --- 1,45 ---- + // 2001-01-24 Benjamin Kosnik + + // 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 + #include + + void test02() + { + using namespace std; + + bool test __attribute__((unused)) = true; + + locale loc_it = __gnu_test::try_named_locale("it_IT"); + + const numpunct& nump_it = use_facet >(loc_it); + + string g = nump_it.grouping(); + + VERIFY( g == "" ); + } + + int main() + { + test02(); + return 0; + } Index: testsuite/22_locale/numpunct_byname/1.cc =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/22_locale/numpunct_byname/1.cc,v retrieving revision 1.5 diff -c -p -r1.5 1.cc *** testsuite/22_locale/numpunct_byname/1.cc 23 Sep 2003 20:02:33 -0000 1.5 --- testsuite/22_locale/numpunct_byname/1.cc 22 Oct 2003 18:57:11 -0000 *************** *** 1,6 **** ! // 2001-01-24 Benjamin Kosnik ! // 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 --- 1,7 ---- ! // { dg-do compile } ! // 2001-01-23 Benjamin Kosnik ! // Copyright (C) 2001, 2003 Free Software Foundation // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the *************** *** 18,72 **** // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. ! // 22.2.3.2 Template class numpunct_byname #include - #include void test01() { ! using namespace std; ! ! bool test __attribute__((unused)) = true; ! string str; ! ! locale loc_de = __gnu_test::try_named_locale("de_DE"); ! str = loc_de.name(); ! ! locale loc_byname(locale::classic(), new numpunct_byname("de_DE")); ! str = loc_byname.name(); ! ! locale loc_c = locale::classic(); ! ! VERIFY( loc_de != loc_byname ); ! ! // cache the numpunct facets ! const numpunct& nump_c = use_facet >(loc_c); ! const numpunct& nump_byname = use_facet >(loc_byname); ! const numpunct& nump_de = use_facet >(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() --- 19,39 ---- // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. ! // 22.2.3 The numeric punctuation facet #include void test01() { ! // Check for required base class. ! typedef std::numpunct_byname test_type; ! typedef std::numpunct base_type; ! const test_type& obj = std::use_facet(std::locale()); ! const base_type* base __attribute__((unused)) = &obj; ! ! // Check for required typedefs ! typedef test_type::char_type char_type; ! typedef test_type::string_type string_type; } int main() Index: testsuite/22_locale/numpunct_byname/2.cc =================================================================== RCS file: testsuite/22_locale/numpunct_byname/2.cc diff -N testsuite/22_locale/numpunct_byname/2.cc *** testsuite/22_locale/numpunct_byname/2.cc 23 Sep 2003 20:02:33 -0000 1.5 --- /dev/null 1 Jan 1970 00:00:00 -0000 *************** *** 1,45 **** - // 2001-01-24 Benjamin Kosnik - - // 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 - #include - - void test02() - { - using namespace std; - - bool test __attribute__((unused)) = true; - - locale loc_it = __gnu_test::try_named_locale("it_IT"); - - const numpunct& nump_it = use_facet >(loc_it); - - string g = nump_it.grouping(); - - VERIFY( g == "" ); - } - - int main() - { - test02(); - return 0; - } --- 0 ---- Index: testsuite/22_locale/numpunct_byname/named_equivalence.cc =================================================================== RCS file: testsuite/22_locale/numpunct_byname/named_equivalence.cc diff -N testsuite/22_locale/numpunct_byname/named_equivalence.cc *** /dev/null 1 Jan 1970 00:00:00 -0000 --- testsuite/22_locale/numpunct_byname/named_equivalence.cc 22 Oct 2003 18:57:11 -0000 *************** *** 0 **** --- 1,76 ---- + // 2001-01-24 Benjamin Kosnik + + // 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 + #include + + void test01() + { + using namespace std; + + bool test __attribute__((unused)) = true; + string str; + + locale loc_de = __gnu_test::try_named_locale("de_DE"); + str = loc_de.name(); + + locale loc_byname(locale::classic(), new numpunct_byname("de_DE")); + str = loc_byname.name(); + + locale loc_c = locale::classic(); + + VERIFY( loc_de != loc_byname ); + + // cache the numpunct facets + const numpunct& nump_c = use_facet >(loc_c); + const numpunct& nump_byname = use_facet >(loc_byname); + const numpunct& nump_de = use_facet >(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; + }