diff options
Diffstat (limited to 'libstdc++-v3/testsuite/22_locale')
7 files changed, 0 insertions, 597 deletions
diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread.cc deleted file mode 100644 index 3a89d371f62..00000000000 --- a/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread.cc +++ /dev/null @@ -1,67 +0,0 @@ -// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } } -// { dg-options "-pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* } } -// { dg-options "-pthreads" { target *-*-solaris* } } - -// Copyright (C) 2004 Free Software Foundation -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this 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 <locale> -#include <pthread.h> - -const int max_thread_count = 20; -//const int max_loop_count = 1000000; // orig value -const int max_loop_count = 100000; -const int max_locales = 10; - -void* thread_main(void*) -{ - try - { - std::locale loc_c = std::locale::classic(); - std::locale loc[max_locales]; - for (int j = 0; j < max_locales; ++j) - loc[j] = std::locale(j % 2 ? "en_US" : "fr_FR"); - - for (int i = 0; i < max_loop_count; ++i) - { - int k = i % max_locales; - loc[k] = std::locale::global(loc[k]); - - if (i % 37 == 0) - loc[k] = loc[k].combine<std::ctype<char> >(loc_c); - } - } - catch (...) { } - return 0; -} - -int -main() -{ - pthread_t tid[max_thread_count]; - - for (int i = 0; i < max_thread_count; i++) - pthread_create (&tid[i], NULL, thread_main, 0); - - for (int i = 0; i < max_thread_count; i++) - pthread_join (tid[i], NULL); - - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/17.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/17.cc deleted file mode 100644 index 5216b414aae..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/17.cc +++ /dev/null @@ -1,71 +0,0 @@ -// 2004-03-08 Paolo Carlini <pcarlini@suse.de> - -// Copyright (C) 2004 Free Software Foundation -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; 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> - -// 22.2.6.3, p2: "The value _space_ indicates that at least one space -// is required at that position." -void test01() -{ - using namespace std; - typedef istreambuf_iterator<char> iterator_type; - - bool test __attribute__((unused)) = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_de = __gnu_test::try_named_locale("de_DE@euro"); - VERIFY( loc_c != loc_de ); - - iterator_type end, end02; - 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( err01 == (ios_base::failbit | ios_base::eofbit) ); - - // now try with showbase, to get currency symbol in format - iss.setf(ios_base::showbase); - - iss.str("7.200.000.000,00EUR "); - iterator_type is_it02(iss); - string result2; - ios_base::iostate err02 = ios_base::goodbit; - end02 = mon_get.get(is_it02, end, true, iss, err02, result2); - VERIFY( err02 == ios_base::failbit ); - VERIFY( *end02 == 'E' ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/18.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/18.cc deleted file mode 100644 index 3da65de43d1..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/18.cc +++ /dev/null @@ -1,69 +0,0 @@ -// 2004-03-15 Paolo Carlini <pcarlini@suse.de> - -// Copyright (C) 2004 Free Software Foundation -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; 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> - -// If (str.flags() & str.showbase) is false, the currency symbol is optional, -// but, if found, must be consumed entirely. -void test01() -{ - using namespace std; - typedef istreambuf_iterator<char> iterator_type; - - bool test __attribute__((unused)) = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk = __gnu_test::try_named_locale("en_HK"); - VERIFY( loc_c != loc_hk ); - - iterator_type end, end01, end02; - istringstream iss; - iss.imbue(loc_hk); - // cache the money_get facet - const money_get<char>& mon_get = - use_facet<money_get<char> >(iss.getloc()); - - iss.str("HK7,200,000,000.00"); - iterator_type is_it01(iss); - string result01; - ios_base::iostate err01 = ios_base::goodbit; - end01 = mon_get.get(is_it01, end, false, iss, err01, result01); - VERIFY( err01 == ios_base::failbit ); - VERIFY( *end01 == '7' ); - - iss.str("(HK100,000,000,000.00)"); - iterator_type is_it02(iss); - string result02; - ios_base::iostate err02 = ios_base::goodbit; - end02 = mon_get.get(is_it02, end, true, iss, err02, result02); - VERIFY( err02 == ios_base::failbit ); - VERIFY( *end02 == '1' ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/19.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/19.cc deleted file mode 100644 index 5d9dea2be1e..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/19.cc +++ /dev/null @@ -1,125 +0,0 @@ -// 2004-03-15 Paolo Carlini <pcarlini@suse.de> - -// Copyright (C) 2004 Free Software Foundation -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; 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_01 : public std::moneypunct<char, false> -{ - std::string do_curr_symbol() const { return "$"; } - std::string do_positive_sign() const { return ""; } - std::string do_negative_sign() const { return ""; } - - pattern do_neg_format() const - { - pattern pat = { { value, symbol, none, sign } }; - return pat; - } -}; - -struct My_money_io_02 : public std::moneypunct<char, false> -{ - std::string do_curr_symbol() const { return "%"; } - std::string do_positive_sign() const { return ""; } - std::string do_negative_sign() const { return "-"; } - - pattern do_neg_format() const - { - pattern pat = { { value, symbol, sign, none } }; - return pat; - } -}; - -struct My_money_io_03 : public std::moneypunct<char, false> -{ - std::string do_curr_symbol() const { return "&"; } - std::string do_positive_sign() const { return ""; } - std::string do_negative_sign() const { return ""; } - - pattern do_neg_format() const - { - pattern pat = { { value, space, symbol, sign } }; - return pat; - } -}; - -// When both do_positive_sign and do_negative_sign return an empty -// string, patterns of the forms { value, symbol, none, sign }, -// { value, symbol, sign, none } and { X, Y, symbol, sign } imply -// that the symbol is not consumed since no other characters are -// needed to complete the format. -void test01() -{ - using namespace std; - typedef istreambuf_iterator<char> iterator_type; - - bool test __attribute__((unused)) = true; - - // basic construction - locale loc_01(locale::classic(), new My_money_io_01); - locale loc_02(locale::classic(), new My_money_io_02); - locale loc_03(locale::classic(), new My_money_io_03); - - iterator_type end, end01, end02, end03; - istringstream iss_01, iss_02, iss_03; - iss_01.imbue(loc_01); - iss_02.imbue(loc_02); - iss_03.imbue(loc_03); - // cache the money_get facet - const money_get<char>& mon_get_01 = - use_facet<money_get<char> >(iss_01.getloc()); - const money_get<char>& mon_get_02 = - use_facet<money_get<char> >(iss_02.getloc()); - const money_get<char>& mon_get_03 = - use_facet<money_get<char> >(iss_03.getloc()); - - iss_01.str("10$"); - iterator_type is_it01(iss_01); - string result01; - ios_base::iostate err01 = ios_base::goodbit; - end01 = mon_get_01.get(is_it01, end, false, iss_01, err01, result01); - VERIFY( err01 == ios_base::goodbit ); - VERIFY( *end01 == '$' ); - - iss_02.str("50%"); - iterator_type is_it02(iss_02); - string result02; - ios_base::iostate err02 = ios_base::goodbit; - end02 = mon_get_02.get(is_it02, end, false, iss_02, err02, result02); - VERIFY( err02 == ios_base::goodbit ); - VERIFY( *end02 == '%' ); - - iss_03.str("7 &"); - iterator_type is_it03(iss_03); - string result03; - ios_base::iostate err03 = ios_base::goodbit; - end03 = mon_get_03.get(is_it03, end, false, iss_03, err03, result03); - VERIFY( err03 == ios_base::goodbit ); - VERIFY( *end03 == '&' ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/17.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/17.cc deleted file mode 100644 index e8affd81bb8..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/17.cc +++ /dev/null @@ -1,71 +0,0 @@ -// 2004-03-08 Paolo Carlini <pcarlini@suse.de> - -// Copyright (C) 2004 Free Software Foundation -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; 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> - -// 22.2.6.3, p2: "The value _space_ indicates that at least one space -// is required at that position." -void test01() -{ - using namespace std; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test __attribute__((unused)) = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_de = __gnu_test::try_named_locale("de_DE@euro"); - VERIFY( loc_c != loc_de ); - - iterator_type end, end02; - 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( err01 == (ios_base::failbit | ios_base::eofbit) ); - - // now try with showbase, to get currency symbol in format - iss.setf(ios_base::showbase); - - iss.str(L"7.200.000.000,00EUR "); - iterator_type is_it02(iss); - wstring result2; - ios_base::iostate err02 = ios_base::goodbit; - end02 = mon_get.get(is_it02, end, true, iss, err02, result2); - VERIFY( err02 == ios_base::failbit ); - VERIFY( *end02 == L'E' ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/18.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/18.cc deleted file mode 100644 index 285de236276..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/18.cc +++ /dev/null @@ -1,69 +0,0 @@ -// 2004-03-15 Paolo Carlini <pcarlini@suse.de> - -// Copyright (C) 2004 Free Software Foundation -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; 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> - -// If (str.flags() & str.showbase) is false, the currency symbol is optional, -// but, if found, must be consumed entirely. -void test01() -{ - using namespace std; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test __attribute__((unused)) = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk = __gnu_test::try_named_locale("en_HK"); - VERIFY( loc_c != loc_hk ); - - iterator_type end, end01, end02; - 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()); - - iss.str(L"HK7,200,000,000.00"); - iterator_type is_it01(iss); - wstring result01; - ios_base::iostate err01 = ios_base::goodbit; - end01 = mon_get.get(is_it01, end, false, iss, err01, result01); - VERIFY( err01 == ios_base::failbit ); - VERIFY( *end01 == L'7' ); - - iss.str(L"(HK100,000,000,000.00)"); - iterator_type is_it02(iss); - wstring result02; - ios_base::iostate err02 = ios_base::goodbit; - end02 = mon_get.get(is_it02, end, true, iss, err02, result02); - VERIFY( err02 == ios_base::failbit ); - VERIFY( *end02 == L'1' ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/19.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/19.cc deleted file mode 100644 index 93c63e6ea29..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/19.cc +++ /dev/null @@ -1,125 +0,0 @@ -// 2004-03-15 Paolo Carlini <pcarlini@suse.de> - -// Copyright (C) 2004 Free Software Foundation -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; 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_01 : public std::moneypunct<wchar_t, false> -{ - std::wstring do_curr_symbol() const { return L"$"; } - std::wstring do_positive_sign() const { return L""; } - std::wstring do_negative_sign() const { return L""; } - - pattern do_neg_format() const - { - pattern pat = { { value, symbol, none, sign } }; - return pat; - } -}; - -struct My_money_io_02 : public std::moneypunct<wchar_t, false> -{ - std::wstring do_curr_symbol() const { return L"%"; } - std::wstring do_positive_sign() const { return L""; } - std::wstring do_negative_sign() const { return L"-"; } - - pattern do_neg_format() const - { - pattern pat = { { value, symbol, sign, none } }; - return pat; - } -}; - -struct My_money_io_03 : public std::moneypunct<wchar_t, false> -{ - std::wstring do_curr_symbol() const { return L"&"; } - std::wstring do_positive_sign() const { return L""; } - std::wstring do_negative_sign() const { return L""; } - - pattern do_neg_format() const - { - pattern pat = { { value, space, symbol, sign } }; - return pat; - } -}; - -// When both do_positive_sign and do_negative_sign return an empty -// string, patterns of the forms { value, symbol, none, sign }, -// { value, symbol, sign, none } and { X, Y, symbol, sign } imply -// that the symbol is not consumed since no other characters are -// needed to complete the format. -void test01() -{ - using namespace std; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test __attribute__((unused)) = true; - - // basic construction - locale loc_01(locale::classic(), new My_money_io_01); - locale loc_02(locale::classic(), new My_money_io_02); - locale loc_03(locale::classic(), new My_money_io_03); - - iterator_type end, end01, end02, end03; - wistringstream iss_01, iss_02, iss_03; - iss_01.imbue(loc_01); - iss_02.imbue(loc_02); - iss_03.imbue(loc_03); - // cache the money_get facet - const money_get<wchar_t>& mon_get_01 = - use_facet<money_get<wchar_t> >(iss_01.getloc()); - const money_get<wchar_t>& mon_get_02 = - use_facet<money_get<wchar_t> >(iss_02.getloc()); - const money_get<wchar_t>& mon_get_03 = - use_facet<money_get<wchar_t> >(iss_03.getloc()); - - iss_01.str(L"10$"); - iterator_type is_it01(iss_01); - wstring result01; - ios_base::iostate err01 = ios_base::goodbit; - end01 = mon_get_01.get(is_it01, end, false, iss_01, err01, result01); - VERIFY( err01 == ios_base::goodbit ); - VERIFY( *end01 == L'$' ); - - iss_02.str(L"50%"); - iterator_type is_it02(iss_02); - wstring result02; - ios_base::iostate err02 = ios_base::goodbit; - end02 = mon_get_02.get(is_it02, end, false, iss_02, err02, result02); - VERIFY( err02 == ios_base::goodbit ); - VERIFY( *end02 == L'%' ); - - iss_03.str(L"7 &"); - iterator_type is_it03(iss_03); - wstring result03; - ios_base::iostate err03 = ios_base::goodbit; - end03 = mon_get_03.get(is_it03, end, false, iss_03, err03, result03); - VERIFY( err03 == ios_base::goodbit ); - VERIFY( *end03 == L'&' ); -} - -int main() -{ - test01(); - return 0; -} |