summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/27_io/basic_ostringstream
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/27_io/basic_ostringstream')
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/2020.cc54
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/char/3.cc63
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/wchar_t/3.cc61
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/pthread3.cc57
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/rdbuf/char/2832.cc74
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/rdbuf/wchar_t/2832.cc72
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/requirements/base_classes.cc44
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/requirements/explicit_instantiation.cc31
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/requirements/typedefs.cc37
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/1.cc47
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/2.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/str/wchar_t/1.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/str/wchar_t/2.cc43
13 files changed, 673 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/2020.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/2020.cc
new file mode 100644
index 000000000..da6bb68cd
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/2020.cc
@@ -0,0 +1,54 @@
+// 1999-01-17 bkoz test functionality of basic_filebuf for char_type == char
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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/>.
+
+// 27.8.1.1 - Template class basic_filebuf
+// NB: This file is for testing basic_filebuf with NO OTHER INCLUDES.
+
+#include <sstream>
+#include <testsuite_hooks.h>
+#include <testsuite_character.h>
+
+// libstdc++/2020
+// should be able to use custom char_type, custom traits type
+void test07()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::basic_ostringstream<__gnu_test::pod_ushort> gnu_osstr;
+
+ try
+ {
+ gnu_osstr obj;
+ }
+ catch(std::exception& obj)
+ {
+ test = false;
+ VERIFY( test );
+ }
+}
+
+int main()
+{
+ test07();
+ return 0;
+}
+
+
+
+// more surf!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/char/3.cc
new file mode 100644
index 000000000..156433f67
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/char/3.cc
@@ -0,0 +1,63 @@
+// 2001-05-23 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 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/>.
+
+// 27.7.3.2 member functions (ostringstream_members)
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// 03: sanity checks for strings, stringbufs
+void
+test03()
+{
+ bool test __attribute__((unused)) = false;
+
+ // Empty string sanity check.
+ std::string str01;
+ std::string::iterator __i_start = str01.begin();
+ std::string::iterator __i_end = str01.end();
+ std::string::size_type len = str01.size();
+ test = __i_start == __i_end;
+ VERIFY( len == 0 );
+
+ // Full string sanity check.
+ std::string str02("these golden days, i spend waiting for you:\n"
+ "Betty Carter on Verve with I'm Yours and You're Mine.");
+ __i_start = str02.begin();
+ __i_end = str02.end();
+ len = str02.size();
+ VERIFY( __i_start != __i_end );
+ VERIFY( len != 0 );
+
+ // Test an empty ostringstream for sanity.
+ std::ostringstream ostrstream0;
+ std::string str03 = ostrstream0.str();
+ __i_start = str03.begin();
+ __i_end = str03.end();
+ len = str03.size();
+ VERIFY( __i_start == __i_end );
+ VERIFY( len == 0 );
+ VERIFY( str01 == str03 );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/wchar_t/3.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/wchar_t/3.cc
new file mode 100644
index 000000000..91b799741
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/wchar_t/3.cc
@@ -0,0 +1,61 @@
+// Copyright (C) 2004, 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/>.
+
+// 27.7.3.2 member functions (ostringstream_members)
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// 03: sanity checks for strings, stringbufs
+void
+test03()
+{
+ bool test __attribute__((unused)) = false;
+
+ // Empty string sanity check.
+ std::wstring str01;
+ std::wstring::iterator __i_start = str01.begin();
+ std::wstring::iterator __i_end = str01.end();
+ std::wstring::size_type len = str01.size();
+ test = __i_start == __i_end;
+ VERIFY( len == 0 );
+
+ // Full string sanity check.
+ std::wstring str02(L"these golden days, i spend waiting for you:\n"
+ L"Betty Carter on Verve with I'm Yours and You're Mine.");
+ __i_start = str02.begin();
+ __i_end = str02.end();
+ len = str02.size();
+ VERIFY( __i_start != __i_end );
+ VERIFY( len != 0 );
+
+ // Test an empty ostringstream for sanity.
+ std::wostringstream ostrstream0;
+ std::wstring str03 = ostrstream0.str();
+ __i_start = str03.begin();
+ __i_end = str03.end();
+ len = str03.size();
+ VERIFY( __i_start == __i_end );
+ VERIFY( len == 0 );
+ VERIFY( str01 == str03 );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/pthread3.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/pthread3.cc
new file mode 100644
index 000000000..5b87d84c0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/pthread3.cc
@@ -0,0 +1,57 @@
+// 2002-01-23 Loren J. Rittle <rittle@labs.mot.com> <ljrittle@acm.org>
+// Adpated from libstdc++/5347 submitted by markus.breuer@materna.de
+//
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// 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 run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options "-pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options "-pthreads" { target *-*-solaris* } }
+
+#include <sstream>
+#include <pthread.h>
+
+const int max_thread_count = 2;
+const int max_loop_count = 1000000;
+
+void*
+thread_main (void *)
+{
+ for (int i = 0; i < max_loop_count; i++)
+ std::ostringstream oss;
+
+ return 0;
+}
+
+int
+main()
+{
+ pthread_t tid[max_thread_count];
+
+#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500
+ pthread_setconcurrency (max_thread_count);
+#endif
+
+ for (int i = 0; i < max_thread_count; i++)
+ pthread_create (&tid[i], 0, thread_main, 0);
+
+ for (int i = 0; i < max_thread_count; i++)
+ pthread_join (tid[i], 0);
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/rdbuf/char/2832.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/rdbuf/char/2832.cc
new file mode 100644
index 000000000..51f5547b6
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/rdbuf/char/2832.cc
@@ -0,0 +1,74 @@
+// 2001-05-23 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 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/>.
+
+// 27.7.3.2 member functions (ostringstream_members)
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void
+redirect_buffer(std::ios& stream, std::streambuf* new_buf)
+{ stream.rdbuf(new_buf); }
+
+std::streambuf*
+active_buffer(std::ios& stream)
+{ return stream.rdbuf(); }
+
+// libstdc++/2832
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ const char* strlit01 = "fuck war";
+ const std::string str00;
+ const std::string str01(strlit01);
+ std::string str02;
+ std::stringbuf sbuf(str01);
+ std::streambuf* pbasebuf0 = &sbuf;
+
+ std::ostringstream sstrm1;
+ VERIFY( sstrm1.str() == str00 );
+ // derived rdbuf() always returns original streambuf, even though
+ // it's no longer associated with the stream.
+ std::stringbuf* const buf1 = sstrm1.rdbuf();
+ // base rdbuf() returns the currently associated streambuf
+ std::streambuf* pbasebuf1 = active_buffer(sstrm1);
+ redirect_buffer(sstrm1, &sbuf);
+ std::stringbuf* const buf2 = sstrm1.rdbuf();
+ std::streambuf* pbasebuf2 = active_buffer(sstrm1);
+ VERIFY( buf1 == buf2 );
+ VERIFY( pbasebuf1 != pbasebuf2 );
+ VERIFY( pbasebuf2 == pbasebuf0 );
+
+ // derived rdbuf() returns the original buf, so str() doesn't change.
+ VERIFY( sstrm1.str() != str01 );
+ VERIFY( sstrm1.str() == str00 );
+ // however, casting the active streambuf to a stringbuf shows what's up:
+ std::stringbuf* psbuf = dynamic_cast<std::stringbuf*>(pbasebuf2);
+ str02 = psbuf->str();
+ VERIFY( str02 == str01 );
+
+ // How confusing and non-intuitive is this?
+ // These semantics are a joke, a serious defect, and incredibly lame.
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/rdbuf/wchar_t/2832.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/rdbuf/wchar_t/2832.cc
new file mode 100644
index 000000000..b89464043
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/rdbuf/wchar_t/2832.cc
@@ -0,0 +1,72 @@
+// Copyright (C) 2004, 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/>.
+
+// 27.7.3.2 member functions (ostringstream_members)
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void
+redirect_buffer(std::wios& stream, std::wstreambuf* new_buf)
+{ stream.rdbuf(new_buf); }
+
+std::wstreambuf*
+active_buffer(std::wios& stream)
+{ return stream.rdbuf(); }
+
+// libstdc++/2832
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ const wchar_t* strlit01 = L"fuck war";
+ const std::wstring str00;
+ const std::wstring str01(strlit01);
+ std::wstring str02;
+ std::wstringbuf sbuf(str01);
+ std::wstreambuf* pbasebuf0 = &sbuf;
+
+ std::wostringstream sstrm1;
+ VERIFY( sstrm1.str() == str00 );
+ // derived rdbuf() always returns original streambuf, even though
+ // it's no longer associated with the stream.
+ std::wstringbuf* const buf1 = sstrm1.rdbuf();
+ // base rdbuf() returns the currently associated streambuf
+ std::wstreambuf* pbasebuf1 = active_buffer(sstrm1);
+ redirect_buffer(sstrm1, &sbuf);
+ std::wstringbuf* const buf2 = sstrm1.rdbuf();
+ std::wstreambuf* pbasebuf2 = active_buffer(sstrm1);
+ VERIFY( buf1 == buf2 );
+ VERIFY( pbasebuf1 != pbasebuf2 );
+ VERIFY( pbasebuf2 == pbasebuf0 );
+
+ // derived rdbuf() returns the original buf, so str() doesn't change.
+ VERIFY( sstrm1.str() != str01 );
+ VERIFY( sstrm1.str() == str00 );
+ // however, casting the active streambuf to a stringbuf shows what's up:
+ std::wstringbuf* psbuf = dynamic_cast<std::wstringbuf*>(pbasebuf2);
+ str02 = psbuf->str();
+ VERIFY( str02 == str01 );
+
+ // How confusing and non-intuitive is this?
+ // These semantics are a joke, a serious defect, and incredibly lame.
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/requirements/base_classes.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/requirements/base_classes.cc
new file mode 100644
index 000000000..d0b643afb
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/requirements/base_classes.cc
@@ -0,0 +1,44 @@
+// { dg-do compile }
+// 2003-03-26 B enjamin Kosnik <bkoz@redhat.com>
+
+// 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/>.
+
+// 27.8.1.1 - Template class basic_filebuf
+
+#include <ostream>
+#include <sstream>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::ostringstream test_type;
+ typedef std::ostream base_type;
+ const test_type& obj = *new test_type();
+ const base_type* base __attribute__((unused)) = &obj;
+}
+
+// more surf!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..819998914
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/requirements/explicit_instantiation.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// 2002-07-25 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2002, 2004, 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/>.
+
+
+// 27.7.3 - Class basic_ostringstream
+// NB: This file is for testing basic_ostringstream with NO OTHER INCLUDES.
+
+#include <sstream>
+
+namespace std
+{
+ typedef short type_t;
+ template class basic_ostringstream<type_t, char_traits<type_t> >;
+} // test
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/requirements/typedefs.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/requirements/typedefs.cc
new file mode 100644
index 000000000..4772560f2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/requirements/typedefs.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// 2002-07-25 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2002, 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/>.
+
+
+// 27.7.3 - Class basic_ostringstream
+// NB: This file is for testing basic_ostringstream with NO OTHER INCLUDES.
+
+#include <sstream>
+
+// libstdc++/7216
+void test01()
+{
+ // Check for required typedefs
+ typedef std::ostringstream test_type;
+ typedef test_type::char_type char_type;
+ typedef test_type::traits_type traits_type;
+ typedef test_type::int_type int_type;
+ typedef test_type::pos_type pos_type;
+ typedef test_type::off_type off_type;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/1.cc
new file mode 100644
index 000000000..5fe718868
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/1.cc
@@ -0,0 +1,47 @@
+// 2001-05-23 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 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/>.
+
+// 27.7.3.2 member functions (ostringstream_members)
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::ostringstream os01;
+ const std::string str00;
+ const std::string str01 = "123";
+ std::string str02;
+
+ // string str() const
+ str02 = os01.str();
+ VERIFY( str00 == str02 );
+
+ // void str(const basic_string&)
+ os01.str(str01);
+ str02 = os01.str();
+ VERIFY( str01 == str02 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/2.cc
new file mode 100644
index 000000000..c1bb1fc83
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/2.cc
@@ -0,0 +1,45 @@
+// 2001-05-23 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 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/>.
+
+// 27.7.3.2 member functions (ostringstream_members)
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// user-reported error
+class derived_oss: public std::ostringstream
+{
+public:
+ derived_oss() : std::ostringstream() { }
+};
+
+void
+test04()
+{
+ bool test __attribute__((unused)) = true;
+ derived_oss yy;
+ yy << "buena vista social club\n";
+ VERIFY( yy.str() == std::string("buena vista social club\n") );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/wchar_t/1.cc
new file mode 100644
index 000000000..b66d8fa25
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/wchar_t/1.cc
@@ -0,0 +1,45 @@
+// Copyright (C) 2004, 2009, 2010 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/>.
+
+// 27.7.3.2 member functions (ostringstream_members)
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::wostringstream os01;
+ const std::wstring str00;
+ const std::wstring str01 = L"123";
+ std::wstring str02;
+
+ // string str() const
+ str02 = os01.str();
+ VERIFY( str00 == str02 );
+
+ // void str(const basic_string&)
+ os01.str(str01);
+ str02 = os01.str();
+ VERIFY( str01 == str02 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/wchar_t/2.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/wchar_t/2.cc
new file mode 100644
index 000000000..d34b05895
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/wchar_t/2.cc
@@ -0,0 +1,43 @@
+// Copyright (C) 2004, 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/>.
+
+// 27.7.3.2 member functions (ostringstream_members)
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// user-reported error
+class derived_oss: public std::wostringstream
+{
+public:
+ derived_oss() : std::wostringstream() { }
+};
+
+void
+test04()
+{
+ bool test __attribute__((unused)) = true;
+ derived_oss yy;
+ yy << L"buena vista social club\n";
+ VERIFY( yy.str() == std::wstring(L"buena vista social club\n") );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}