aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2010-03-29 12:22:18 +0000
committerMartin Jambor <mjambor@suse.cz>2010-03-29 12:22:18 +0000
commit18ee0169b09dd09b2781e6db75f585730d87fb44 (patch)
tree9ff944de7597395ca9aa8bc7b40a9613d91f28d0 /libstdc++-v3
parent5f6b98384303d586c1190ec64d678a8721aac461 (diff)
Rsync of gcc and libstdc++ testcases from trunk revision 157748.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/pretty-ipa@157794 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/38365.cc44
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/38368.cc53
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/char/38399.cc54
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/38399.cc54
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/char/38196.cc80
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/char/38210.cc68
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/38196.cc80
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/38210.cc68
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/cons/38244.cc43
9 files changed, 544 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/38365.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/38365.cc
new file mode 100644
index 00000000000..44bda78f04e
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/locale/cons/38365.cc
@@ -0,0 +1,44 @@
+// { dg-require-namedlocale "" }
+
+// Copyright (C) 2008, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.1.1.2 locale constructors and destructors [lib.locale.cons]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// libstdc++/38365
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ locale other(locale("C"));
+ locale one(locale("en_US"), new ctype<char>());
+ locale loc(other, one, locale::collate);
+
+ VERIFY( one.name() == "*" );
+ VERIFY( other.name() == "C" );
+ VERIFY( loc.name() == "*" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/38368.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/38368.cc
new file mode 100644
index 00000000000..be731a4c9c9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/locale/cons/38368.cc
@@ -0,0 +1,53 @@
+// { dg-require-namedlocale "" }
+
+// Copyright (C) 2008, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.1.1.2 locale constructors and destructors [lib.locale.cons]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// libstdc++/38368
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ locale loc(locale("C"), "en_US", locale::collate);
+ locale loc_copy(loc.name().c_str());
+
+ const moneypunct<char, true>& mpunt =
+ use_facet<moneypunct<char, true> >(loc_copy);
+ VERIFY( mpunt.decimal_point() == '.' );
+ VERIFY( mpunt.thousands_sep() == ',' );
+
+ const moneypunct<char, false>& mpunf =
+ use_facet<moneypunct<char, false> >(loc_copy);
+ VERIFY( mpunf.decimal_point() == '.' );
+ VERIFY( mpunf.thousands_sep() == ',' );
+
+ const numpunct<char>& npun = use_facet<numpunct<char> >(loc_copy);
+ VERIFY( npun.decimal_point() == '.' );
+ VERIFY( npun.thousands_sep() == ',' );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/38399.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/38399.cc
new file mode 100644
index 00000000000..506cc866e12
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/char/38399.cc
@@ -0,0 +1,54 @@
+// Copyright (C) 2008, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+class my_moneypunct : public std::moneypunct<char>
+{
+protected:
+ //this should disable fraction part of monetary value
+ int do_frac_digits() const { return 0; }
+};
+
+// libstdc++/38399
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ locale loc(locale(), new my_moneypunct());
+ stringstream ss("123.455");
+ ss.imbue(loc);
+ string digits;
+ ios_base::iostate err;
+ istreambuf_iterator<char> iter =
+ use_facet<money_get<char> >(loc).get(ss, 0, false, ss, err, digits);
+
+ string rest = string(iter, istreambuf_iterator<char>());
+ VERIFY( digits == "123" );
+ VERIFY( rest == ".455" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/38399.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/38399.cc
new file mode 100644
index 00000000000..1fdfa90d750
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/38399.cc
@@ -0,0 +1,54 @@
+// Copyright (C) 2008, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.6.1.1 money_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+class my_moneypunct : public std::moneypunct<wchar_t>
+{
+protected:
+ //this should disable fraction part of monetary value
+ int do_frac_digits() const { return 0; }
+};
+
+// libstdc++/38399
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ locale loc(locale(), new my_moneypunct());
+ wstringstream ss(L"123.455");
+ ss.imbue(loc);
+ wstring digits;
+ ios_base::iostate err;
+ istreambuf_iterator<wchar_t> iter =
+ use_facet<money_get<wchar_t> >(loc).get(ss, 0, false, ss, err, digits);
+
+ wstring rest = wstring(iter, istreambuf_iterator<wchar_t>());
+ VERIFY( digits == L"123" );
+ VERIFY( rest == L".455" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/38196.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/38196.cc
new file mode 100644
index 00000000000..eb0ea840a0c
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/38196.cc
@@ -0,0 +1,80 @@
+// Copyright (C) 2008, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.2.2.1 num_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+class my_punct : public std::numpunct<char>
+{
+protected:
+ std::string do_falsename() const { return "-no-"; }
+};
+
+// libstdc++/38196
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ ostringstream oss1, oss2, oss3, oss4;
+ string result1, result2, result3, result4;
+
+ oss1.imbue(locale(oss1.getloc(), new my_punct));
+ oss2.imbue(locale(oss2.getloc(), new my_punct));
+ oss3.imbue(locale(oss3.getloc(), new my_punct));
+ oss4.imbue(locale(oss4.getloc(), new my_punct));
+ const num_put<char>& ng1 = use_facet<num_put<char> >(oss1.getloc());
+ const num_put<char>& ng2 = use_facet<num_put<char> >(oss2.getloc());
+ const num_put<char>& ng3 = use_facet<num_put<char> >(oss3.getloc());
+ const num_put<char>& ng4 = use_facet<num_put<char> >(oss4.getloc());
+
+ oss1.width(6);
+ oss1.setf(ios_base::boolalpha);
+ ng1.put(oss1.rdbuf(), oss1, '*', false);
+ result1 = oss1.str();
+ VERIFY( result1 == "**-no-" );
+
+ oss2.width(6);
+ oss2.setf(ios_base::right, ios_base::adjustfield);
+ oss2.setf(ios_base::boolalpha);
+ ng2.put(oss2.rdbuf(), oss2, '*', false);
+ result2 = oss2.str();
+ VERIFY( result2 == "**-no-" );
+
+ oss3.width(6);
+ oss3.setf(ios_base::internal, ios_base::adjustfield);
+ oss3.setf(ios_base::boolalpha);
+ ng3.put(oss3.rdbuf(), oss3, '*', false);
+ result3 = oss3.str();
+ VERIFY( result3 == "**-no-" );
+
+ oss4.width(6);
+ oss4.setf(ios_base::left, ios_base::adjustfield);
+ oss4.setf(ios_base::boolalpha);
+ ng4.put(oss4.rdbuf(), oss4, '*', false);
+ result4 = oss4.str();
+ VERIFY( result4 == "-no-**" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/38210.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/38210.cc
new file mode 100644
index 00000000000..d97126a6d83
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/38210.cc
@@ -0,0 +1,68 @@
+// Copyright (C) 2008, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.2.2.1 num_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/38210
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ ostringstream oss1, oss2, oss3, oss4;
+ string result1, result2, result3, result4;
+
+ const num_put<char>& ng1 = use_facet<num_put<char> >(oss1.getloc());
+ const num_put<char>& ng2 = use_facet<num_put<char> >(oss2.getloc());
+ const num_put<char>& ng3 = use_facet<num_put<char> >(oss3.getloc());
+ const num_put<char>& ng4 = use_facet<num_put<char> >(oss4.getloc());
+
+ void* p = (void*)0x1;
+
+ oss1.width(5);
+ ng1.put(oss1.rdbuf(), oss1, '*', p);
+ result1 = oss1.str();
+ VERIFY( result1 == "**0x1" );
+
+ oss2.width(5);
+ oss2.setf(ios_base::right, ios_base::adjustfield);
+ ng2.put(oss2.rdbuf(), oss2, '*', p);
+ result2 = oss2.str();
+ VERIFY( result2 == "**0x1" );
+
+ oss3.width(5);
+ oss3.setf(ios_base::internal, ios_base::adjustfield);
+ ng3.put(oss3.rdbuf(), oss3, '*', p);
+ result3 = oss3.str();
+ VERIFY( result3 == "0x**1" );
+
+ oss4.width(5);
+ oss4.setf(ios_base::left, ios_base::adjustfield);
+ ng4.put(oss4.rdbuf(), oss4, '*', p);
+ result4 = oss4.str();
+ VERIFY( result4 == "0x1**" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/38196.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/38196.cc
new file mode 100644
index 00000000000..76cb5e0282b
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/38196.cc
@@ -0,0 +1,80 @@
+// Copyright (C) 2008, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.2.2.1 num_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+class my_punct : public std::numpunct<wchar_t>
+{
+protected:
+ std::wstring do_falsename() const { return L"-no-"; }
+};
+
+// libstdc++/38196
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ wostringstream oss1, oss2, oss3, oss4;
+ wstring result1, result2, result3, result4;
+
+ oss1.imbue(locale(oss1.getloc(), new my_punct));
+ oss2.imbue(locale(oss2.getloc(), new my_punct));
+ oss3.imbue(locale(oss3.getloc(), new my_punct));
+ oss4.imbue(locale(oss4.getloc(), new my_punct));
+ const num_put<wchar_t>& ng1 = use_facet<num_put<wchar_t> >(oss1.getloc());
+ const num_put<wchar_t>& ng2 = use_facet<num_put<wchar_t> >(oss2.getloc());
+ const num_put<wchar_t>& ng3 = use_facet<num_put<wchar_t> >(oss3.getloc());
+ const num_put<wchar_t>& ng4 = use_facet<num_put<wchar_t> >(oss4.getloc());
+
+ oss1.width(6);
+ oss1.setf(ios_base::boolalpha);
+ ng1.put(oss1.rdbuf(), oss1, L'*', false);
+ result1 = oss1.str();
+ VERIFY( result1 == L"**-no-" );
+
+ oss2.width(6);
+ oss2.setf(ios_base::right, ios_base::adjustfield);
+ oss2.setf(ios_base::boolalpha);
+ ng2.put(oss2.rdbuf(), oss2, L'*', false);
+ result2 = oss2.str();
+ VERIFY( result2 == L"**-no-" );
+
+ oss3.width(6);
+ oss3.setf(ios_base::internal, ios_base::adjustfield);
+ oss3.setf(ios_base::boolalpha);
+ ng3.put(oss3.rdbuf(), oss3, L'*', false);
+ result3 = oss3.str();
+ VERIFY( result3 == L"**-no-" );
+
+ oss4.width(6);
+ oss4.setf(ios_base::left, ios_base::adjustfield);
+ oss4.setf(ios_base::boolalpha);
+ ng4.put(oss4.rdbuf(), oss4, L'*', false);
+ result4 = oss4.str();
+ VERIFY( result4 == L"-no-**" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/38210.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/38210.cc
new file mode 100644
index 00000000000..5b456d1facb
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/38210.cc
@@ -0,0 +1,68 @@
+// Copyright (C) 2008, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.2.2.1 num_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/38210
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ wostringstream oss1, oss2, oss3, oss4;
+ wstring result1, result2, result3, result4;
+
+ const num_put<wchar_t>& ng1 = use_facet<num_put<wchar_t> >(oss1.getloc());
+ const num_put<wchar_t>& ng2 = use_facet<num_put<wchar_t> >(oss2.getloc());
+ const num_put<wchar_t>& ng3 = use_facet<num_put<wchar_t> >(oss3.getloc());
+ const num_put<wchar_t>& ng4 = use_facet<num_put<wchar_t> >(oss4.getloc());
+
+ void* p = (void*)0x1;
+
+ oss1.width(5);
+ ng1.put(oss1.rdbuf(), oss1, L'*', p);
+ result1 = oss1.str();
+ VERIFY( result1 == L"**0x1" );
+
+ oss2.width(5);
+ oss2.setf(ios_base::right, ios_base::adjustfield);
+ ng2.put(oss2.rdbuf(), oss2, L'*', p);
+ result2 = oss2.str();
+ VERIFY( result2 == L"**0x1" );
+
+ oss3.width(5);
+ oss3.setf(ios_base::internal, ios_base::adjustfield);
+ ng3.put(oss3.rdbuf(), oss3, L'*', p);
+ result3 = oss3.str();
+ VERIFY( result3 == L"0x**1" );
+
+ oss4.width(5);
+ oss4.setf(ios_base::left, ios_base::adjustfield);
+ ng4.put(oss4.rdbuf(), oss4, L'*', p);
+ result4 = oss4.str();
+ VERIFY( result4 == L"0x1**" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/38244.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/38244.cc
new file mode 100644
index 00000000000..fae2174b074
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/38244.cc
@@ -0,0 +1,43 @@
+// Copyright (C) 2008, 2009 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 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+
+#include <bitset>
+
+class C0
+{
+ public:
+ C0() : b(0) { }
+ private:
+ std::bitset<1> b;
+};
+
+class C1
+{
+ public:
+ C1() : b(1) { }
+ private:
+ std::bitset<1> b;
+};
+
+// libstdc++/38244
+void func()
+{
+ C0 val0;
+ C1 val1;
+}