summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character')
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/1.cc57
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/11095-oa.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/11095-ob.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/11095-oc.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/2.cc67
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-3.cc53
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-4.cc54
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/3.cc66
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/4.cc54
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/5.cc76
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/6.cc57
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/8.cc47
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/9555-oc.cc69
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/1.cc55
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/11095-od.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/11095-oe.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/11095-of.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/2.cc65
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-1.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-2.cc48
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-3.cc53
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-4.cc54
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/3.cc64
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/4.cc53
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/5.cc74
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/6.cc55
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/7.cc91
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/8.cc58
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/9555-oc.cc61
29 files changed, 1646 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/1.cc
new file mode 100644
index 000000000..926b68bc7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/1.cc
@@ -0,0 +1,57 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 2003, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// ofstream
+void test01()
+{
+ std::string str01;
+ const int size = 1000;
+ const char name_02[] = "ostream_inserter_char-1.txt";
+
+ // initialize string
+ for(int i=0 ; i < size; i++) {
+ str01 += '1';
+ str01 += '2';
+ str01 += '3';
+ str01 += '4';
+ str01 += '5';
+ str01 += '6';
+ str01 += '7';
+ str01 += '8';
+ str01 += '9';
+ str01 += '\n';
+ }
+ std::ofstream f(name_02);
+
+ f << str01;
+ f.close();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/11095-oa.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/11095-oa.cc
new file mode 100644
index 000000000..aeec2d51c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/11095-oa.cc
@@ -0,0 +1,45 @@
+// 2003-06-05 Paolo Carlini <pcarlini@unitus.it>
+
+// Copyright (C) 2003, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/11095
+// operator<<(basic_ostream&, char)
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::ostringstream oss_01;
+
+ oss_01.width(-60);
+ oss_01 << 'C';
+ VERIFY( oss_01.good() );
+ VERIFY( oss_01.str() == "C" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/11095-ob.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/11095-ob.cc
new file mode 100644
index 000000000..80ef77595
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/11095-ob.cc
@@ -0,0 +1,45 @@
+// 2003-06-05 Paolo Carlini <pcarlini@unitus.it>
+
+// Copyright (C) 2003, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/11095
+// operator<<(basic_ostream<char, _Traits>&, const char*)
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::ostringstream oss_01;
+
+ oss_01.width(-60);
+ oss_01 << "Consoli";
+ VERIFY( oss_01.good() );
+ VERIFY( oss_01.str() == "Consoli" );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/11095-oc.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/11095-oc.cc
new file mode 100644
index 000000000..43e1e0db0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/11095-oc.cc
@@ -0,0 +1,45 @@
+// 2003-06-05 Paolo Carlini <pcarlini@unitus.it>
+
+// Copyright (C) 2003, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/11095
+// operator<<(basic_ostream&, const basic_string&)
+void
+test03()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::ostringstream oss_01;
+
+ oss_01.width(-60);
+ oss_01 << std::string("Consoli");
+ VERIFY( oss_01.good() );
+ VERIFY( oss_01.str() == "Consoli" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/2.cc
new file mode 100644
index 000000000..988da4491
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/2.cc
@@ -0,0 +1,67 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 2003, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// ostringstream width() != zero
+// left
+void
+test02(void)
+{
+ bool test __attribute__((unused)) = true;
+ std::string tmp;
+
+ std::string str01 = "";
+ std::ostringstream oss01;
+ oss01.width(5);
+ oss01.fill('0');
+ oss01.flags(std::ios_base::left);
+ oss01 << str01;
+ tmp = oss01.str();
+ VERIFY( tmp == "00000" );
+
+ std::string str02 = "1";
+ std::ostringstream oss02;
+ oss02.width(5);
+ oss02.fill('0');
+ oss02.flags(std::ios_base::left);
+ oss02 << str02;
+ tmp = oss02.str();
+ VERIFY( tmp == "10000" );
+
+ std::string str03 = "909909";
+ std::ostringstream oss03;
+ oss03.width(5);
+ oss03.fill('0');
+ oss03.flags(std::ios_base::left);
+ oss03 << str03;
+ tmp = oss03.str();
+ VERIFY( tmp == "909909" );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-3.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-3.cc
new file mode 100644
index 000000000..0d1c2f483
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-3.cc
@@ -0,0 +1,53 @@
+// 2006-10-12 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2006, 2007, 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/>.
+
+// { dg-options "-DWIDTH=200000" { target simulator } }
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+#ifndef WIDTH
+#define WIDTH 20000000
+#endif
+
+// libstdc++/28277
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ ostringstream oss_01;
+
+ oss_01.width(WIDTH);
+ const streamsize width = oss_01.width();
+
+ oss_01 << 'a';
+
+ VERIFY( oss_01.good() );
+ VERIFY( oss_01.str().size() == string::size_type(width) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-4.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-4.cc
new file mode 100644
index 000000000..fe80c76ba
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-4.cc
@@ -0,0 +1,54 @@
+// 2006-10-12 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2006, 2007, 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/>.
+
+// { dg-options "-DWIDTH=200000" { target simulator } }
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+#ifndef WIDTH
+#define WIDTH 20000000
+#endif
+
+// libstdc++/28277
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ ostringstream oss_01;
+ const string str_01(50, 'a');
+
+ oss_01.width(WIDTH);
+ const streamsize width = oss_01.width();
+
+ oss_01 << str_01.c_str();
+
+ VERIFY( oss_01.good() );
+ VERIFY( oss_01.str().size() == string::size_type(width) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/3.cc
new file mode 100644
index 000000000..87e299db5
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/3.cc
@@ -0,0 +1,66 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 2003, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// width() != zero
+// right
+void test03(void)
+{
+ bool test __attribute__((unused)) = true;
+ std::string tmp;
+
+ std::string str01 = "";
+ std::ostringstream oss01;
+ oss01.width(5);
+ oss01.fill('0');
+ oss01.flags(std::ios_base::right);
+ oss01 << str01;
+ tmp = oss01.str();
+ VERIFY( tmp == "00000" );
+
+ std::string str02 = "1";
+ std::ostringstream oss02;
+ oss02.width(5);
+ oss02.fill('0');
+ oss02.flags(std::ios_base::right);
+ oss02 << str02;
+ tmp = oss02.str();
+ VERIFY( tmp == "00001" );
+
+ std::string str03 = "909909";
+ std::ostringstream oss03;
+ oss03.width(5);
+ oss03.fill('0');
+ oss03.flags(std::ios_base::right);
+ oss03 << str03;
+ tmp = oss03.str();
+ VERIFY( tmp == "909909" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/4.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/4.cc
new file mode 100644
index 000000000..5ec21367b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/4.cc
@@ -0,0 +1,54 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 2003, 2005, 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// stringstream and large strings
+void
+test04()
+{
+ bool test __attribute__((unused)) = true;
+ std::string str_01;
+ std::string str_tmp;
+ const int i_max=250;
+
+ std::ostringstream oss_02(str_01, std::ios_base::out);
+
+ // template<_CharT, _Traits>
+ // basic_ostream& operator<<(ostream&, const char*)
+ for (int i = 0; i < i_max; ++i)
+ oss_02 << "Test: " << i << std::endl;
+ str_tmp = oss_02.str();
+ VERIFY( !oss_02.bad() );
+ VERIFY( oss_02.good() );
+ VERIFY( str_tmp != str_01 );
+ VERIFY( str_tmp.size() == 2390 );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/5.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/5.cc
new file mode 100644
index 000000000..6b6cbb38d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/5.cc
@@ -0,0 +1,76 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 2003, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// ostringstream and large strings number 2
+void
+test05()
+{
+ bool test __attribute__((unused)) = true;
+ std::string str05, str10;
+
+ typedef std::ostream::pos_type pos_type;
+ typedef std::ostream::off_type off_type;
+ std::string str01;
+ const int size = 1000;
+
+ // initialize string
+ for(int i=0 ; i < size; i++) {
+ str01 += '1';
+ str01 += '2';
+ str01 += '3';
+ str01 += '4';
+ str01 += '5';
+ str01 += '6';
+ str01 += '7';
+ str01 += '8';
+ str01 += '9';
+ str01 += '\n';
+ }
+
+ // test 1: out
+ std::ostringstream sstr01(str01, std::ios_base::out);
+ std::ostringstream sstr02;
+ sstr02 << str01;
+ str05 = sstr01.str();
+ str10 = sstr02.str();
+ VERIFY( str05 == str01 );
+ VERIFY( str10 == str01 );
+
+ // test 2: in | out
+ std::ostringstream sstr04(str01, std::ios_base::out | std::ios_base::in);
+ std::ostringstream sstr05(std::ios_base::in | std::ios_base::out);
+ sstr05 << str01;
+ str05 = sstr04.str();
+ str10 = sstr05.str();
+ VERIFY( str05 == str01 );
+ VERIFY( str10 == str01 );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/6.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/6.cc
new file mode 100644
index 000000000..25aad8a04
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/6.cc
@@ -0,0 +1,57 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 2003, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// ostringstream and positioning, multiple writes
+// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00326.html
+void test06()
+{
+ bool test __attribute__((unused)) = true;
+ const char carray01[] = "mos def & talib kweli are black star";
+
+ // normal
+ std::ostringstream ostr1("mos def");
+ VERIFY( ostr1.str() == "mos def" );
+ ostr1 << " & talib kweli"; // should overwrite first part of buffer
+ VERIFY( ostr1.str() == " & talib kweli" );
+ ostr1 << " are black star"; // should append to string from above
+ VERIFY( ostr1.str() != carray01 );
+ VERIFY( ostr1.str() == " & talib kweli are black star" );
+
+ // appending
+ std::ostringstream ostr2("blackalicious",
+ std::ios_base::out | std::ios_base::ate);
+ VERIFY( ostr2.str() == "blackalicious" );
+ ostr2 << " NIA "; // should not overwrite first part of buffer
+ VERIFY( ostr2.str() == "blackalicious NIA " );
+ ostr2 << "4: deception (5:19)"; // should append to full string from above
+ VERIFY( ostr2.str() == "blackalicious NIA 4: deception (5:19)" );
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/8.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/8.cc
new file mode 100644
index 000000000..f38e2e703
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/8.cc
@@ -0,0 +1,47 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 2003, 2009, 2010 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test08()
+{
+ bool test __attribute__((unused)) = true;
+ char* pt = 0;
+
+ // 1
+ std::ostringstream oss;
+ oss << pt;
+ VERIFY( oss.bad() );
+ VERIFY( oss.str().size() == 0 );
+
+ oss.clear();
+ oss << "";
+ VERIFY( oss.good() );
+}
+
+int main()
+{
+ test08();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/9555-oc.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/9555-oc.cc
new file mode 100644
index 000000000..b46b2aede
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/9555-oc.cc
@@ -0,0 +1,69 @@
+// Copyright (C) 2003, 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/>.
+
+
+#include <ostream>
+#include <streambuf>
+#include <testsuite_hooks.h>
+
+struct buf: std::streambuf
+{
+ virtual int_type overflow(int_type)
+ { throw 0; }
+};
+
+template<typename T>
+void testthrow(T arg)
+{
+ bool test __attribute__((unused)) = true;
+ buf b;
+ std::ostream os(&b);
+ os.exceptions(std::ios::badbit);
+
+ try
+ {
+ os << arg;
+ }
+ catch(int)
+ {
+ // Expected return is zero.
+ VERIFY( os.bad() );
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+}
+
+int main()
+{
+ char c = 'a';
+ unsigned char uc = 'a';
+ signed char sc = 'a';
+ const char* ccp = "governor ann richards";
+ const signed char* cscp = reinterpret_cast<const signed char*>(ccp);
+ const unsigned char* cucp = reinterpret_cast<const unsigned char*>(ccp);
+
+ testthrow(c);
+ testthrow(uc);
+ testthrow(sc);
+ testthrow(ccp);
+ testthrow(cscp);
+ testthrow(cucp);
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/1.cc
new file mode 100644
index 000000000..863590677
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/1.cc
@@ -0,0 +1,55 @@
+// Copyright (C) 2005, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// ofstream
+void test01()
+{
+ std::wstring str01;
+ const int size = 1000;
+ const char name_02[] = "wostream_inserter_char-1.txt";
+
+ // initialize string
+ for(int i=0 ; i < size; i++) {
+ str01 += L'1';
+ str01 += L'2';
+ str01 += L'3';
+ str01 += L'4';
+ str01 += L'5';
+ str01 += L'6';
+ str01 += L'7';
+ str01 += L'8';
+ str01 += L'9';
+ str01 += L'\n';
+ }
+ std::wofstream f(name_02);
+
+ f << str01;
+ f.close();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/11095-od.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/11095-od.cc
new file mode 100644
index 000000000..8fd1d1167
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/11095-od.cc
@@ -0,0 +1,45 @@
+// 2003-06-05 Paolo Carlini <pcarlini@unitus.it>
+
+// Copyright (C) 2003, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/11095
+// operator<<(basic_ostream&, _CharT)
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::wostringstream oss_01;
+
+ oss_01.width(-60);
+ oss_01 << L'C';
+ VERIFY( oss_01.good() );
+ VERIFY( oss_01.str() == L"C" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/11095-oe.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/11095-oe.cc
new file mode 100644
index 000000000..64e630302
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/11095-oe.cc
@@ -0,0 +1,45 @@
+// 2003-06-05 Paolo Carlini <pcarlini@unitus.it>
+
+// Copyright (C) 2003, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/11095
+// operator<<(basic_ostream&, const _CharT*)
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::wostringstream oss_01;
+
+ oss_01.width(-60);
+ oss_01 << L"Consoli";
+ VERIFY( oss_01.good() );
+ VERIFY( oss_01.str() == L"Consoli" );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/11095-of.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/11095-of.cc
new file mode 100644
index 000000000..783027d0e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/11095-of.cc
@@ -0,0 +1,45 @@
+// 2003-06-05 Paolo Carlini <pcarlini@unitus.it>
+
+// Copyright (C) 2003, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/11095
+// operator<<(basic_ostream<_CharT, _Traits>&, const char*)
+void
+test03()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::wostringstream oss_01;
+
+ oss_01.width(-60);
+ oss_01 << "Consoli";
+ VERIFY( oss_01.good() );
+ VERIFY( oss_01.str() == L"Consoli" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/2.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/2.cc
new file mode 100644
index 000000000..361e82938
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/2.cc
@@ -0,0 +1,65 @@
+// Copyright (C) 2005, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// ostringstream width() != zero
+// left
+void
+test02(void)
+{
+ bool test __attribute__((unused)) = true;
+ std::wstring tmp;
+
+ std::wstring str01 = L"";
+ std::wostringstream oss01;
+ oss01.width(5);
+ oss01.fill(L'0');
+ oss01.flags(std::ios_base::left);
+ oss01 << str01;
+ tmp = oss01.str();
+ VERIFY( tmp == L"00000" );
+
+ std::wstring str02 = L"1";
+ std::wostringstream oss02;
+ oss02.width(5);
+ oss02.fill(L'0');
+ oss02.flags(std::ios_base::left);
+ oss02 << str02;
+ tmp = oss02.str();
+ VERIFY( tmp == L"10000" );
+
+ std::wstring str03 = L"909909";
+ std::wostringstream oss03;
+ oss03.width(5);
+ oss03.fill(L'0');
+ oss03.flags(std::ios_base::left);
+ oss03 << str03;
+ tmp = oss03.str();
+ VERIFY( tmp == L"909909" );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-1.cc
new file mode 100644
index 000000000..d2658641d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-1.cc
@@ -0,0 +1,45 @@
+// 2006-07-15 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2006, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/28277
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ wostringstream oss_01;
+ const string str_01(5000000, 'a');
+
+ oss_01 << str_01.c_str();
+
+ VERIFY( oss_01.good() );
+ VERIFY( oss_01.str().size() == str_01.size() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-2.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-2.cc
new file mode 100644
index 000000000..6280fa1d7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-2.cc
@@ -0,0 +1,48 @@
+// 2006-10-12 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2006, 2007, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/28277
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ wostringstream oss_01;
+ const string str_01(50, 'a');
+
+ oss_01.width(5000000);
+ const streamsize width = oss_01.width();
+
+ oss_01 << str_01.c_str();
+
+ VERIFY( oss_01.good() );
+ VERIFY( oss_01.str().size() == wstring::size_type(width) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-3.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-3.cc
new file mode 100644
index 000000000..ea0afa7f0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-3.cc
@@ -0,0 +1,53 @@
+// 2006-10-12 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2006, 2007, 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/>.
+
+// { dg-options "-DWIDTH=500000" { target simulator } }
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+#ifndef WIDTH
+#define WIDTH 50000000
+#endif
+
+// libstdc++/28277
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ wostringstream oss_01;
+
+ oss_01.width(WIDTH);
+ const streamsize width = oss_01.width();
+
+ oss_01 << L'a';
+
+ VERIFY( oss_01.good() );
+ VERIFY( oss_01.str().size() == wstring::size_type(width) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-4.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-4.cc
new file mode 100644
index 000000000..d3563a308
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-4.cc
@@ -0,0 +1,54 @@
+// 2006-10-12 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2006, 2007, 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/>.
+
+// { dg-options "-DWIDTH=500000" { target simulator } }
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+#ifndef WIDTH
+#define WIDTH 50000000
+#endif
+
+// libstdc++/28277
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ wostringstream oss_01;
+ const wstring str_01(50, L'a');
+
+ oss_01.width(WIDTH);
+ const streamsize width = oss_01.width();
+
+ oss_01 << str_01.c_str();
+
+ VERIFY( oss_01.good() );
+ VERIFY( oss_01.str().size() == wstring::size_type(width) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/3.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/3.cc
new file mode 100644
index 000000000..f4a2a9766
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/3.cc
@@ -0,0 +1,64 @@
+// Copyright (C) 2005, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// width() != zero
+// right
+void test03(void)
+{
+ bool test __attribute__((unused)) = true;
+ std::wstring tmp;
+
+ std::wstring str01 = L"";
+ std::wostringstream oss01;
+ oss01.width(5);
+ oss01.fill(L'0');
+ oss01.flags(std::ios_base::right);
+ oss01 << str01;
+ tmp = oss01.str();
+ VERIFY( tmp == L"00000" );
+
+ std::wstring str02 = L"1";
+ std::wostringstream oss02;
+ oss02.width(5);
+ oss02.fill(L'0');
+ oss02.flags(std::ios_base::right);
+ oss02 << str02;
+ tmp = oss02.str();
+ VERIFY( tmp == L"00001" );
+
+ std::wstring str03 = L"909909";
+ std::wostringstream oss03;
+ oss03.width(5);
+ oss03.fill(L'0');
+ oss03.flags(std::ios_base::right);
+ oss03 << str03;
+ tmp = oss03.str();
+ VERIFY( tmp == L"909909" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/4.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/4.cc
new file mode 100644
index 000000000..902539e8c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/4.cc
@@ -0,0 +1,53 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 2003, 2009, 2010 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// stringstream and large strings
+void
+test04()
+{
+ bool test __attribute__((unused)) = true;
+ std::wstring str_01;
+ std::wstring str_tmp;
+ const int i_max=250;
+
+ std::wostringstream oss_02(str_01, std::ios_base::out);
+
+ // template<_CharT, _Traits>
+ // basic_ostream& operator<<(ostream&, const wchar_t*)
+ for (int i = 0; i < i_max; ++i)
+ oss_02 << L"Test: " << i << std::endl;
+ str_tmp = oss_02.str();
+ VERIFY( !oss_02.bad() );
+ VERIFY( oss_02.good() );
+ VERIFY( str_tmp != str_01 );
+ VERIFY( str_tmp.size() == 2390 );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/5.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/5.cc
new file mode 100644
index 000000000..80f6e475a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/5.cc
@@ -0,0 +1,74 @@
+// Copyright (C) 2005, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// ostringstream and large strings number 2
+void
+test05()
+{
+ bool test __attribute__((unused)) = true;
+ std::wstring str05, str10;
+
+ typedef std::wostream::pos_type pos_type;
+ typedef std::wostream::off_type off_type;
+ std::wstring str01;
+ const int size = 1000;
+
+ // initialize string
+ for(int i=0 ; i < size; i++) {
+ str01 += L'1';
+ str01 += L'2';
+ str01 += L'3';
+ str01 += L'4';
+ str01 += L'5';
+ str01 += L'6';
+ str01 += L'7';
+ str01 += L'8';
+ str01 += L'9';
+ str01 += L'\n';
+ }
+
+ // test 1: out
+ std::wostringstream sstr01(str01, std::ios_base::out);
+ std::wostringstream sstr02;
+ sstr02 << str01;
+ str05 = sstr01.str();
+ str10 = sstr02.str();
+ VERIFY( str05 == str01 );
+ VERIFY( str10 == str01 );
+
+ // test 2: in | out
+ std::wostringstream sstr04(str01, std::ios_base::out | std::ios_base::in);
+ std::wostringstream sstr05(std::ios_base::in | std::ios_base::out);
+ sstr05 << str01;
+ str05 = sstr04.str();
+ str10 = sstr05.str();
+ VERIFY( str05 == str01 );
+ VERIFY( str10 == str01 );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/6.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/6.cc
new file mode 100644
index 000000000..b3d6c203f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/6.cc
@@ -0,0 +1,55 @@
+// Copyright (C) 2005, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// ostringstream and positioning, multiple writes
+// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00326.html
+void test06()
+{
+ bool test __attribute__((unused)) = true;
+ const wchar_t carray01[] = L"mos def & talib kweli are black star";
+
+ // normal
+ std::wostringstream ostr1(L"mos def");
+ VERIFY( ostr1.str() == L"mos def" );
+ ostr1 << L" & talib kweli"; // should overwrite first part of buffer
+ VERIFY( ostr1.str() == L" & talib kweli" );
+ ostr1 << L" are black star"; // should append to string from above
+ VERIFY( ostr1.str() != carray01 );
+ VERIFY( ostr1.str() == L" & talib kweli are black star" );
+
+ // appending
+ std::wostringstream ostr2(L"blackalicious",
+ std::ios_base::out | std::ios_base::ate);
+ VERIFY( ostr2.str() == L"blackalicious" );
+ ostr2 << L" NIA "; // should not overwrite first part of buffer
+ VERIFY( ostr2.str() == L"blackalicious NIA " );
+ ostr2 << L"4: deception (5:19)"; // should append to full string from above
+ VERIFY( ostr2.str() == L"blackalicious NIA 4: deception (5:19)" );
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/7.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/7.cc
new file mode 100644
index 000000000..3c588ecfc
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/7.cc
@@ -0,0 +1,91 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 2003, 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <locale>
+#include <testsuite_hooks.h>
+
+// Global counter, needs to be reset after use.
+bool used;
+
+class gnu_ctype : public std::ctype<wchar_t>
+{
+protected:
+ char_type
+ do_widen(char c) const
+ {
+ used = true;
+ return std::ctype<wchar_t>::do_widen(c);
+ }
+
+ const char*
+ do_widen(const char* low, const char* high, char_type* dest) const
+ {
+ used = true;
+ return std::ctype<wchar_t>::do_widen(low, high, dest);
+ }
+};
+
+// 27.6.2.5.4 - Character inserter template functions
+// [lib.ostream.inserters.character]
+void test07()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ const char* buffer = "SFPL 5th floor, outside carrol, the Asian side";
+
+ wostringstream oss;
+ oss.imbue(locale(locale::classic(), new gnu_ctype));
+
+ // 1
+ // template<class charT, class traits>
+ // basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out,
+ // const char* s);
+ used = false;
+ oss << buffer;
+ VERIFY( used ); // Only required for char_type != char
+ wstring str = oss.str();
+ wchar_t c1 = oss.widen(buffer[0]);
+ VERIFY( str[0] == c1 );
+ wchar_t c2 = oss.widen(buffer[1]);
+ VERIFY( str[1] == c2 );
+
+ // 2
+ // template<class charT, class traits>
+ // basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out,
+ // char c);
+ used = false;
+ oss.str(wstring());
+ oss << 'b';
+ VERIFY( used ); // Only required for char_type != char
+ str = oss.str();
+ wchar_t c3 = oss.widen('b');
+ VERIFY( str[0] == c3 );
+}
+
+int main()
+{
+ test07();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/8.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/8.cc
new file mode 100644
index 000000000..76490b3c5
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/8.cc
@@ -0,0 +1,58 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 2003, 2009, 2010 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can 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/>.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test08()
+{
+ bool test __attribute__((unused)) = true;
+ char* pt = 0;
+
+ // 2
+ std::wostringstream woss;
+ woss << pt;
+ VERIFY( woss.bad() );
+ VERIFY( woss.str().size() == 0 );
+
+ woss.clear();
+ woss << "";
+ VERIFY( woss.good() );
+
+ // 3
+ wchar_t* wt = 0;
+ woss.clear();
+ woss << wt;
+ VERIFY( woss.bad() );
+ VERIFY( woss.str().size() == 0 );
+
+ woss.clear();
+ woss << L"";
+ VERIFY( woss.good() );
+}
+
+int main()
+{
+ test08();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/9555-oc.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/9555-oc.cc
new file mode 100644
index 000000000..86fa18c4f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/9555-oc.cc
@@ -0,0 +1,61 @@
+// Copyright (C) 2005, 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/>.
+
+
+#include <ostream>
+#include <streambuf>
+#include <testsuite_hooks.h>
+
+struct buf: std::wstreambuf
+{
+ virtual int_type overflow(int_type)
+ { throw 0; }
+};
+
+template<typename T>
+void testthrow(T arg)
+{
+ bool test __attribute__((unused)) = true;
+ buf b;
+ std::wostream os(&b);
+ os.exceptions(std::wios::badbit);
+
+ try
+ {
+ os << arg;
+ }
+ catch(int)
+ {
+ // Expected return is zero.
+ VERIFY( os.bad() );
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+}
+
+int main()
+{
+ wchar_t c = L'a';
+ const wchar_t* ccp = L"governor ann richards";
+
+ testthrow(c);
+ testthrow(ccp);
+
+ return 0;
+}