summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-21 20:33:34 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-21 20:33:34 +0000
commitb9e8095bd7c7b1492baf175e1ebf336dc3ff6e4d (patch)
treee72cc26bb321e8bf90f4e68330674848db54eddf /libstdc++-v3/testsuite
parent61dfea14dbc2e4d8b70a6f1df61bce8aa70340ce (diff)
downloadgcc-b9e8095bd7c7b1492baf175e1ebf336dc3ff6e4d.tar.gz
2000-04-21 Benjamin Kosnik <bkoz@redhat.com>
* libstdc++-v3: New directory. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33317 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_ciso646.cc131
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_fstream.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_iomanip.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_ios.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_iosfwd.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_iostream.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_istream.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_ostream.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_sstream.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_streambuf.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers.cc83
-rw-r--r--libstdc++-v3/testsuite/18_support/numeric_limits.cc95
-rw-r--r--libstdc++-v3/testsuite/21_strings/append.cc170
-rw-r--r--libstdc++-v3/testsuite/21_strings/capacity.cc181
-rw-r--r--libstdc++-v3/testsuite/21_strings/char_traits.cc122
-rw-r--r--libstdc++-v3/testsuite/21_strings/compare.cc132
-rw-r--r--libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc189
-rw-r--r--libstdc++-v3/testsuite/21_strings/element_access.cc102
-rw-r--r--libstdc++-v3/testsuite/21_strings/find.cc202
-rw-r--r--libstdc++-v3/testsuite/21_strings/insert.cc200
-rw-r--r--libstdc++-v3/testsuite/21_strings/inserters_extractors.cc315
-rw-r--r--libstdc++-v3/testsuite/21_strings/invariants.cc181
-rw-r--r--libstdc++-v3/testsuite/21_strings/nonmember.cc306
-rw-r--r--libstdc++-v3/testsuite/21_strings/operations.cc58
-rw-r--r--libstdc++-v3/testsuite/21_strings/replace.cc96
-rw-r--r--libstdc++-v3/testsuite/21_strings/substr.cc86
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype.cc34
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype_char_members.cc105
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset_ctor.cc90
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset_shift.cc116
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset.cc73
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector_capacity.cc69
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector_ctor.cc64
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector_modifiers.cc71
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istreambuf_iterator.cc127
-rw-r--r--libstdc++-v3/testsuite/24_iterators/iterator.cc599
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/min_max.cc51
-rw-r--r--libstdc++-v3/testsuite/26_numerics/binary_closure.cc36
-rw-r--r--libstdc++-v3/testsuite/26_numerics/buggy_complex.cc37
-rw-r--r--libstdc++-v3/testsuite/26_numerics/c_math.cc61
-rw-r--r--libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc95
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray.cc8
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf-1.tst158
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf-1.txt158
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf-2.tst1
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf-3.tst7
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf.cc528
-rw-r--r--libstdc++-v3/testsuite/27_io/fpos.cc178
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base_callbacks.cc74
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base_members_static.cc66
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_ctor.cc94
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc114
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc123
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_members.cc152
-rw-r--r--libstdc++-v3/testsuite/27_io/iostream_objects.cc117
-rw-r--r--libstdc++-v3/testsuite/27_io/istream.cc64
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc387
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_char.cc232
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_other-1.tst65
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_other-1.txt65
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_other-2.tst65
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_other.cc197
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_manip.cc93
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_sentry.cc86
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_unformatted-1.tst7
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_unformatted-1.txt7
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_unformatted-2.tst0
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_unformatted.cc582
-rw-r--r--libstdc++-v3/testsuite/27_io/istringstream_members.cc86
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream.cc52
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc303
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_char-1.tst1000
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc271
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_other-1.tst158
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_other-2.tst158
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc100
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_manip.cc92
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_unformatted.cc55
-rw-r--r--libstdc++-v3/testsuite/27_io/streambuf.cc257
-rw-r--r--libstdc++-v3/testsuite/27_io/stringbuf.cc452
-rw-r--r--libstdc++-v3/testsuite/27_io/stringstream.cc174
-rw-r--r--libstdc++-v3/testsuite/ext/headers.cc33
-rw-r--r--libstdc++-v3/testsuite/printnow.c13
83 files changed, 11433 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/17_intro/header_ciso646.cc b/libstdc++-v3/testsuite/17_intro/header_ciso646.cc
new file mode 100644
index 00000000000..6677db733ad
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_ciso646.cc
@@ -0,0 +1,131 @@
+// 1999-05-20 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, ciso646
+
+#include <ciso646>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+// 2.11 Keywords
+// alternative representations
+// and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq
+
+// C 2.2.2 Header <iso646.h>
+// The tokens (as above) are keywords and do not appear as macros in <ciso646>.
+
+// Test for macros.
+bool test01()
+{
+ bool test = true;
+
+#ifdef and
+ test = false;
+#endif
+
+#ifdef and_eq
+ test = false;
+#endif
+
+#ifdef bitand
+ test = false;
+#endif
+
+#ifdef bitor
+ test = false;
+#endif
+
+#ifdef compl
+ test = false;
+#endif
+
+#ifdef not_eq
+ test = false;
+#endif
+
+#ifdef not_or
+ test = false;
+#endif
+
+#ifdef or
+ test = false;
+#endif
+
+#ifdef or_eq
+ test = false;
+#endif
+
+#ifdef xor
+ test = false;
+#endif
+
+#ifdef xor_eq
+ test = false;
+#endif
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+// Equivalance in usage.
+bool test02()
+{
+ bool test = true;
+
+ bool arg1 = true;
+ bool arg2 = false;
+ int int1 = 45;
+ int int2 = 0;
+
+#if 0
+ // XXX g++ doesn't like this. Recognizes the keyword, but can't
+ // parse what's next.
+ test &= arg1 && int1;
+ test &= arg1 and int1;
+
+ test &= (arg1 && arg2) == (arg1 and arg2);
+ test &= (arg1 && int1) == (arg1 and int1);
+#endif
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+int main(void)
+{
+ test01();
+ test02();
+
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_fstream.cc b/libstdc++-v3/testsuite/17_intro/header_fstream.cc
new file mode 100644
index 00000000000..7b7cf7c29a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_fstream.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, fstream
+
+#include <fstream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_iomanip.cc b/libstdc++-v3/testsuite/17_intro/header_iomanip.cc
new file mode 100644
index 00000000000..70fd7746443
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_iomanip.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, iomanip
+
+#include <iomanip>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_ios.cc b/libstdc++-v3/testsuite/17_intro/header_ios.cc
new file mode 100644
index 00000000000..e761ea61da9
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_ios.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, ios
+
+#include <ios>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_iosfwd.cc b/libstdc++-v3/testsuite/17_intro/header_iosfwd.cc
new file mode 100644
index 00000000000..60f21f93ef9
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_iosfwd.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, iosfwd
+
+#include <iosfwd>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_iostream.cc b/libstdc++-v3/testsuite/17_intro/header_iostream.cc
new file mode 100644
index 00000000000..549969d4aee
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_iostream.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, iostream
+
+#include <iostream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_istream.cc b/libstdc++-v3/testsuite/17_intro/header_istream.cc
new file mode 100644
index 00000000000..1e64ebf4644
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_istream.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, istream
+
+#include <istream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_ostream.cc b/libstdc++-v3/testsuite/17_intro/header_ostream.cc
new file mode 100644
index 00000000000..0bc90b5a5ab
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_ostream.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, ostream
+
+#include <ostream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_sstream.cc b/libstdc++-v3/testsuite/17_intro/header_sstream.cc
new file mode 100644
index 00000000000..b04e5ea324b
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_sstream.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, sstream
+
+#include <sstream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_streambuf.cc b/libstdc++-v3/testsuite/17_intro/header_streambuf.cc
new file mode 100644
index 00000000000..0847156eceb
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_streambuf.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, streambuf
+
+#include <streambuf>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/headers.cc b/libstdc++-v3/testsuite/17_intro/headers.cc
new file mode 100644
index 00000000000..d95f17aee68
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/headers.cc
@@ -0,0 +1,83 @@
+// 1999-05-12 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers
+
+
+// "C++" headers
+#include <algorithm>
+#include <bitset>
+#include <complex>
+#include <deque>
+#include <exception>
+#include <fstream>
+#include <functional>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <iostream>
+#include <istream>
+#include <iterator>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#include <memory>
+#include <new>
+#include <numeric>
+#include <ostream>
+#include <queue>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <streambuf>
+#include <string>
+#include <typeinfo>
+#include <utility>
+#include <valarray>
+#include <vector>
+
+// "C" headers
+#include <cassert>
+#include <cctype>
+#include <cerrno>
+#include <cfloat>
+#include <ciso646>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <csetjmp>
+#include <csignal>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+
+// "C" headers that might not work if wchar_t support is disabled.
+#include <bits/c++config.h>
+#if _GLIBCPP_USE_WCHAR_T
+ #include <cwchar>
+ #include <cwctype>
+#endif
+
+int main() { }
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits.cc b/libstdc++-v3/testsuite/18_support/numeric_limits.cc
new file mode 100644
index 00000000000..d5ae37104ac
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits.cc
@@ -0,0 +1,95 @@
+// 1999-08-23 bkoz
+
+// Copyright (C) 1999 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 18.2.1.1 template class numeric_limits
+
+#include <limits>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+
+template<typename T>
+ struct A
+ {
+ int key;
+ public:
+ A(int i = 0): key(i) { }
+ bool
+ operator==(int i) { return i == key; }
+ };
+
+struct B { };
+
+
+bool test01()
+{
+ bool test = true;
+ std::numeric_limits< A<B> > obj;
+
+ test &= !obj.is_specialized;
+ test &= obj.min() == 0;
+ test &= obj.max() == 0;
+ test &= obj.digits == 0;
+ test &= obj.digits10 == 0;
+ test &= !obj.is_signed;
+ test &= !obj.is_integer;
+ test &= !obj.is_exact;
+ test &= obj.radix == 0;
+ test &= obj.epsilon() == 0;
+ test &= obj.round_error() == 0;
+ test &= obj.min_exponent == 0;
+ test &= obj.min_exponent10 == 0;
+ test &= obj.max_exponent == 0;
+ test &= obj.max_exponent10 == 0;
+ test &= !obj.has_infinity;
+ test &= !obj.has_quiet_NaN;
+ test &= !obj.has_signaling_NaN;
+ test &= !obj.has_denorm;
+ test &= !obj.has_denorm_loss;
+ test &= obj.infinity() == 0;
+ test &= obj.quiet_NaN() == 0;
+ test &= obj.signaling_NaN() == 0;
+ test &= obj.denorm_min() == 0;
+ test &= !obj.is_iec559;
+ test &= !obj.is_bounded;
+ test &= !obj.is_modulo;
+ test &= !obj.traps;
+ test &= !obj.tinyness_before;
+ test &= obj.round_style == std::round_toward_zero;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+
+ return 0;
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/append.cc b/libstdc++-v3/testsuite/21_strings/append.cc
new file mode 100644
index 00000000000..4dc4aa909ea
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/append.cc
@@ -0,0 +1,170 @@
+// 1999-07-08 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.3 basic_string::assign
+
+#include <string>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::const_reference cref;
+ typedef std::string::reference ref;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const char str_lit01[] = "point bolivar, texas";
+ const std::string str01(str_lit01);
+ const std::string str02("corpus, ");
+ const std::string str03;
+ std::string str05;
+
+
+ // string& append(const string&)
+ str05 = str02;
+ str05.append(str05);
+ test &= str05 == "corpus, corpus, ";
+ str05.append(str01);
+ test &= str05 == "corpus, corpus, point bolivar, texas";
+ str05.append(str03);
+ test &= str05 == "corpus, corpus, point bolivar, texas";
+ std::string str06;
+ str06.append(str05);
+ test &= str06 == str05;
+
+
+ // string& append(const string&, size_type pos, size_type n)
+ str05.erase();
+ str06.erase();
+ csz01 = str03.size();
+ try {
+ str06.append(str03, csz01 + 1, 0);
+ test &= false;
+ }
+ catch(std::out_of_range& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ csz01 = str01.size();
+ try {
+ str06.append(str01, csz01 + 1, 0);
+ test &= false;
+ }
+ catch(std::out_of_range& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ str05 = str02;
+ str05.append(str01, 0, std::string::npos);
+ test &= str05 == "corpus, point bolivar, texas";
+ test &= str05 != str02;
+
+ str06 = str02;
+ str06.append(str01, 15, std::string::npos);
+ test &= str06 == "corpus, texas";
+ test &= str02 != str06;
+
+
+ // string& append(const char* s)
+ str05.erase();
+ str06.erase();
+ str05.append("");
+ test &= str05 == str03;
+
+ str05.append(str_lit01);
+ test &= str05 == str01;
+
+ str06 = str02;
+ str06.append("corpus, ");
+ test &= str06 == "corpus, corpus, ";
+
+
+ // string& append(const char* s, size_type n)
+ str05.erase();
+ str06.erase();
+ str05.append("", 0);
+ test &= str05.size() == 0;
+ test &= str05 == str03;
+
+ str05.append(str_lit01, sizeof(str_lit01) - 1);
+ test &= str05 == str01;
+
+ str06 = str02;
+ str06.append("corpus, ", 6);
+ test &= str06 == "corpus, corpus";
+
+ str06 = str02;
+ str06.append("corpus, ", 12);
+ test &= str06 != "corpus, corpus, ";
+
+
+ // string& append(size_type n, char c)
+ str05.erase();
+ str06.erase();
+ str05.append(0, 'a');
+ test &= str05 == str03;
+ str06.append(8, '.');
+ test &= str06 == "........";
+
+
+ // template<typename InputIter>
+ // string& append(InputIter first, InputIter last)
+ str05.erase();
+ str06.erase();
+ str05.append(str03.begin(), str03.end());
+ test &= str05 == str03;
+
+ str06 = str02;
+ str06.append(str01.begin(), str01.begin() + str01.find('r'));
+ test &= str06 == "corpus, point boliva";
+ test &= str06 != str01;
+ test &= str06 != str02;
+
+ str05 = str01;
+ str05.append(str05.begin(), str05.begin() + str05.find('r'));
+ test &= str05 == "point bolivar, texaspoint boliva";
+ test &= str05 != str01;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/capacity.cc b/libstdc++-v3/testsuite/21_strings/capacity.cc
new file mode 100644
index 00000000000..5673434db87
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/capacity.cc
@@ -0,0 +1,181 @@
+// 1999-05-11 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.3 string capacity
+
+#include <string>
+#include <cstdio>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+template<typename T>
+ struct A { };
+
+template<typename T>
+ bool
+ operator==(const A<T>& a, const A<T>& b) { }
+
+template<typename T>
+ bool
+ operator<(const A<T>& a, const A<T>& b) { }
+
+struct B { };
+
+bool test01()
+{
+ // 1 POD types : resize, capacity, reserve
+ bool test = true;
+ std::string str01;
+ typedef std::string::size_type size_type_s;
+
+ size_type_s sz01 = str01.capacity();
+ str01.reserve(100);
+ size_type_s sz02 = str01.capacity();
+ test &= sz02 >= sz01;
+ test &= sz02 >= 100;
+ str01.reserve();
+ sz01 = str01.capacity();
+ test &= sz01 >= 0;
+
+ sz01 = str01.size() + 5;
+ str01.resize(sz01);
+ sz02 = str01.size();
+ test &= sz01 == sz02;
+
+ sz01 = str01.size() - 5;
+ str01.resize(sz01);
+ sz02 = str01.size();
+ test &= sz01 == sz02;
+
+ std::string str05(30, 'q');
+ std::string str06 = str05;
+ str05 = str06 + str05;
+ test &= str05.capacity() >= str05.size();
+ test &= str06.capacity() >= str06.size();
+
+ // 2 non POD types : resize, capacity, reserve
+ std::basic_string< A<B> > str02;
+ typedef std::basic_string< A<B> >::size_type size_type_o;
+ size_type_o sz03;
+ size_type_o sz04;
+
+ sz03 = str02.capacity();
+ str02.reserve(100);
+ sz04 = str02.capacity();
+ test &= sz04 >= sz03;
+ test &= sz04 >= 100;
+ str02.reserve();
+ sz03 = str02.capacity();
+ test &= sz03 >= 0;
+
+ sz03 = str02.size() + 5;
+ str02.resize(sz03);
+ sz04 = str02.size();
+ test &= sz03 == sz04;
+
+ sz03 = str02.size() - 5;
+ str02.resize(sz03);
+ sz04 = str02.size();
+ test &= sz03 == sz04;
+
+ A<B> inst_obj;
+ std::basic_string<A<B> > str07(30, inst_obj);
+ std::basic_string<A<B> > str08 = str07;
+ str07 = str08 + str07;
+ test &= str07.capacity() >= str07.size();
+ test &= str08.capacity() >= str08.size();
+
+ // 3 POD types: size, length, max_size, clear(), empty()
+ bool b01;
+ std::string str011;
+ b01 = str01.empty();
+ test &= b01 == true;
+ sz01 = str01.size();
+ sz02 = str01.length();
+ test &= sz01 == sz02;
+ str01.c_str();
+ sz01 = str01.size();
+ sz02 = str01.length();
+ test &= sz01 == sz02;
+
+ sz01 = str01.length();
+ str01.c_str();
+ str011 = str01 + "_addendum_";
+ str01.c_str();
+ sz02 = str01.length();
+ test &= sz01 == sz02;
+ sz02 = str011.length();
+ test &= sz02 > sz01;
+
+ // trickster allocator (__USE_MALLOC, luke) issues involved with these:
+ std::string str3 = "8-chars_8-chars_";
+ const char* p3 = str3.c_str();
+ std::string str4 = str3 + "7-chars";
+ const char* p4 = str3.c_str();
+
+ sz01 = str01.size();
+ sz02 = str01.max_size();
+ test &= sz02 >= sz01;
+
+ sz01 = str01.size();
+ str01.clear();
+ b01 = str01.empty();
+ test &= b01 == true;
+ sz02 = str01.size();
+ test &= sz01 >= sz02;
+
+
+ // 4 non-POD types: size, length, max_size, clear(), empty()
+ b01 = str02.empty();
+ test &= b01 == true;
+ sz03 = str02.size();
+ sz04 = str02.length();
+ test &= sz03 == sz04;
+ str02.c_str();
+ sz03 = str02.size();
+ sz04 = str02.length();
+ test &= sz03 == sz04;
+
+ sz03 = str02.max_size();
+ test &= sz03 >= sz04;
+
+ sz03 = str02.size();
+ str02.clear();
+ b01 = str02.empty();
+ test &= b01 == true;
+ sz04 = str02.size();
+ test &= sz03 >= sz04;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/char_traits.cc b/libstdc++-v3/testsuite/21_strings/char_traits.cc
new file mode 100644
index 00000000000..5d814bf17cc
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/char_traits.cc
@@ -0,0 +1,122 @@
+// 1999-06-03 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.1 Characher traits
+
+#include <string>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+int test01(void)
+{
+ bool test = true;
+ const std::string str_01("zuma beach");
+ const std::string str_02("montara and ocean beach");
+
+ // 21.1.1 character traits requirements
+
+ // Key for decoding what function signatures really mean:
+ // X == char_traits<_CharT>
+ // [c,d] == _CharT
+ // [p,q] == const _CharT*
+ // s == _CharT*
+ // [n,i,j] == size_t
+ // f == X::int_type
+ // pos == X::pos_type
+ // state == X::state_type
+
+ // void X::assign(char c, char d)
+ // assigns c = d;
+ char c1 = 'z';
+ char c2 = 'u';
+ test &= c1 != c2;
+ std::char_traits<char>::assign(c1,c2);
+ test &= c1 == 'u';
+
+ // char* X::move(char* s, const char* p, size_t n)
+ // for each i in [0,n) performs X::assign(s[i], p[i]). Copies
+ // correctly even where p is in [s, s + n), and yields s.
+ char array1[] = {'z', 'u', 'm', 'a', ' ', 'b', 'e', 'a', 'c', 'h', 0};
+ const char str_lit1[] = "montara and ocean beach";
+ int len = sizeof(str_lit1) + sizeof(array1) - 1; // two terminating chars
+ char array2[len];
+
+ test &= str_lit1[0] == 'm';
+ c1 = array2[0];
+ c2 = str_lit1[0];
+ char c3 = array2[1];
+ char c4 = str_lit1[1];
+ std::char_traits<char>::move(array2, str_lit1, 0);
+ test &= array2[0] == c1;
+ test &= str_lit1[0] == c2;
+ std::char_traits<char>::move(array2, str_lit1, 1);
+ test &= array2[0] == c2;
+ test &= str_lit1[0] == c2;
+ test &= array2[1] == c3;
+ test &= str_lit1[1] == c4;
+ std::char_traits<char>::move(array2, str_lit1, 2);
+ test &= array2[0] == c2;
+ test &= str_lit1[0] == c2;
+ test &= array2[1] == c4;
+ test &= str_lit1[1] == c4;
+
+ char* pc1 = array1 + 1;
+ c1 = pc1[0];
+ c2 = array1[0];
+ test &= c1 != c2;
+ char* pc2 = std::char_traits<char>::move(array1, pc1, 0);
+ c3 = pc1[0];
+ c4 = array1[0];
+ test &= c1 == c3;
+ test &= c2 == c4;
+ test &= pc2 == array1;
+
+ c1 = pc1[0];
+ c2 = array1[0];
+ char* pc3 = pc1;
+ pc2 = std::char_traits<char>::move(array1, pc1, 10);
+ c3 = pc1[0];
+ c4 = array1[0];
+ test &= c1 != c3; // underlying char array changed.
+ test &= c4 != c3;
+ test &= pc2 == array1;
+ test &= pc3 == pc1; // but pointers o-tay
+ c1 = *(str_01.data());
+ c2 = array1[0];
+ test &= c1 != c2;
+
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/compare.cc b/libstdc++-v3/testsuite/21_strings/compare.cc
new file mode 100644
index 00000000000..b3d81a08f2b
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/compare.cc
@@ -0,0 +1,132 @@
+// 980930 bkoz work with libstdc++v3
+
+// Copyright (C) 1998-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.6.8 basic_string::compare
+// int compare(const basic_string& str) const;
+// int compare(size_type pos1, size_type n1, const basic_string& str) const;
+// int compare(size_type pos1, size_type n1, const basic_string& str,
+// size_type pos2, size_type n2) const;
+// int compare(const charT* s) const;
+// int compare(size_type pos1, size_type n1,
+// const charT* s, size_type n2 = npos) const;
+
+// NB compare should be thought of as a lexographical compare, ie how
+// things would be sorted in a dictionary.
+
+#include <string>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+enum want_value {lt=0, z=1, gt=2};
+
+void test_value(int result, want_value expected);
+void test_value(int result, want_value expected) {
+ bool pass = false;
+
+ switch (expected) {
+ case lt:
+ if (result < 0)
+ pass = true;
+ break;
+ case z:
+ if (!result)
+ pass = true;
+ break;
+ case gt:
+ if (result > 0)
+ pass = true;
+ break;
+ default:
+ pass = false; //should not get here
+ }
+
+#ifdef DEBUG_ASSERT
+ assert(pass);
+#endif
+}
+
+
+int test01(void) {
+
+ std::string str_0("costa rica");
+ std::string str_1("costa marbella");
+ std::string str_2;
+
+ //sanity check
+ test_value(strcmp("costa marbella", "costa rica"), lt);
+ test_value(strcmp("costa rica", "costa rica"), z);
+ test_value(strcmp(str_1.data(), str_0.data()), lt);
+ test_value(strcmp(str_0.data(), str_1.data()), gt);
+ test_value(strncmp(str_1.data(), str_0.data(), 6), z);
+ test_value(strncmp(str_1.data(), str_0.data(), 14), lt);
+ test_value(memcmp(str_1.data(), str_0.data(), 6), z);
+ test_value(memcmp(str_1.data(), str_0.data(), 14), lt);
+ test_value(memcmp("costa marbella", "costa rica", 14), lt);
+
+ // int compare(const basic_string& str) const;
+ test_value(str_0.compare(str_1), gt); //because r>m
+ test_value(str_1.compare(str_0), lt); //because m<r
+ str_2 = str_0;
+ test_value(str_2.compare(str_0), z);
+ str_2 = "cost";
+ test_value(str_2.compare(str_0), lt);
+ str_2 = "costa ricans";
+ test_value(str_2.compare(str_0), gt);
+
+ // int compare(size_type pos1, size_type n1, const basic_string& str) const;
+ test_value(str_1.compare(0, 6, str_0), lt);
+ str_2 = "cost";
+ test_value(str_1.compare(0, 4, str_2), z);
+ test_value(str_1.compare(0, 5, str_2), gt);
+
+ // int compare(size_type pos1, size_type n1, const basic_string& str,
+ // size_type pos2, size_type n2) const;
+ test_value(str_1.compare(0, 6, str_0, 0, 6), z);
+ test_value(str_1.compare(0, 7, str_0, 0, 7), lt);
+ test_value(str_0.compare(0, 7, str_1, 0, 7), gt);
+
+ // int compare(const charT* s) const;
+ test_value(str_0.compare("costa marbella"), gt);
+ test_value(str_1.compare("costa rica"), lt);
+ str_2 = str_0;
+ test_value(str_2.compare("costa rica"), z);
+ test_value(str_2.compare("cost"), gt);
+ test_value(str_2.compare("costa ricans"), lt);
+
+ // int compare(size_type pos, size_type n1, const charT* str,
+ // size_type n2 = npos) const;
+ test_value(str_1.compare(0, 6, "costa rica", 0, 6), z);
+ test_value(str_1.compare(0, 7, "costa rica", 0, 7), lt);
+ test_value(str_0.compare(0, 7, "costa marbella", 0, 7), gt);
+
+ return 0;
+}
+
+
+int main() {
+ test01();
+}
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc b/libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc
new file mode 100644
index 00000000000..9756b0345b4
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc
@@ -0,0 +1,189 @@
+// 1999-06-04 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.1 basic_string constructors.
+
+#include <new>
+#include <string>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+int test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::iterator citerator;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const char str_lit01[] = "rodeo beach, marin";
+ const std::string str01(str_lit01);
+ const std::string str02("baker beach, san francisco");
+
+ // basic_string(const string&, size_type pos = 0, siz_type n = npos, alloc)
+ csz01 = str01.size();
+ try {
+ std::string str03(str01, csz01 + 1);
+ test &= false;
+ }
+ catch(std::out_of_range& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ try {
+ std::string str03(str01, csz01);
+ test &= str03.size() == 0;
+ test &= str03.size() <= str03.capacity();
+ }
+ catch(...) {
+ test &= false;
+ }
+
+
+ // basic_string(const char* s, size_type n, alloc)
+ csz01 = str01.max_size();
+ // NB: As strlen(str_lit01) != csz01, this test is undefined. It
+ // should not crash, but what gets constructed is a bit arbitrary.
+ try {
+ std::string str03(str_lit01, csz01 + 1);
+ test &= true;
+ }
+ catch(std::length_error& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ // NB: As strlen(str_lit01) != csz01, this test is undefined. It
+ // should not crash, but what gets constructed is a bit arbitrary.
+ try {
+ std::string str04(str_lit01, npos); // the "maverick's" of all string objects.
+ test &= true;
+ }
+ catch(std::length_error& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ try {
+ std::string str03(str_lit01, csz01 - 1);
+ test &= str03.size() != 0;
+ test &= str03.size() <= str03.capacity();
+ }
+ // NB: bad_alloc is regrettable but entirely kosher for
+ // out-of-memory situations.
+ catch(std::bad_alloc& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+
+ // basic_string(const char* s, const allocator& a = allocator())
+ std::string str04(str_lit01);
+ test &= str01 == str04;
+
+
+ // basic_string(size_type n, char c, const allocator& a = allocator())
+ csz01 = str01.max_size();
+ try {
+ std::string str03(csz01 + 1, 'z');
+ test &= false;
+ }
+ catch(std::length_error& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ try {
+ std::string str04(npos, 'b'); // the "maverick's" of all string objects.
+ test &= false;
+ }
+ catch(std::length_error& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ try {
+ std::string str03(csz01 - 1, 'z');
+ test &= str03.size() != 0;
+ test &= str03.size() <= str03.capacity();
+ }
+ // NB: bad_alloc is regrettable but entirely kosher for
+ // out-of-memory situations.
+ catch(std::bad_alloc& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+
+ // template<typename _InputIter>
+ // basic_string(_InputIter begin, _InputIter end, const allocator& a)
+ std::string str06(str01.begin(), str01.end());
+ test &= str06 == str01;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+void test02()
+{
+ bool test = true;
+
+ // template<typename _InputIter>
+ // basic_string(_InputIter begin, _InputIter end, const allocator& a)
+ // where _InputIter is integral [21.3.1 para 15]
+ std::string s(10,0);
+ test &= s.size() == 10;
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main()
+{
+ test01();
+ test02();
+}
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/element_access.cc b/libstdc++-v3/testsuite/21_strings/element_access.cc
new file mode 100644
index 00000000000..6f1ba0657ac
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/element_access.cc
@@ -0,0 +1,102 @@
+// 1999-06-08 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.4 basic_string element access
+
+#include <string>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::const_reference cref;
+ typedef std::string::reference ref;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const std::string str01("tamarindo, costa rica");
+ std::string str02("14th street beach, capitola, california");
+ std::string str03;
+
+ // const_reference operator[] (size_type pos) const;
+ csz01 = str01.size();
+ cref cref1 = str01[csz01 - 1];
+ test &= cref1 == 'a';
+ cref cref2 = str01[csz01];
+ test &= cref2 == char();
+
+ // reference operator[] (size_type pos);
+ csz02 = str02.size();
+ ref ref1 = str02[csz02 - 1];
+ test &= ref1 == 'a';
+ ref ref2 = str02[1];
+ test &= ref2 == '4';
+
+ // const_reference at(size_type pos) const;
+ csz01 = str01.size();
+ cref cref3 = str01.at(csz01 - 1);
+ test &= cref3 == 'a';
+ try {
+ cref cref4 = str01.at(csz01);
+ test &= false; // Should not get here, as exception thrown.
+ }
+ catch(std::out_of_range& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ // reference at(size_type pos);
+ csz01 = str02.size();
+ ref ref3 = str02.at(csz02 - 1);
+ test &= ref3 == 'a';
+ try {
+ ref ref4 = str02.at(csz02);
+ test &= false; // Should not get here, as exception thrown.
+ }
+ catch(std::out_of_range& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+
+
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/find.cc b/libstdc++-v3/testsuite/21_strings/find.cc
new file mode 100644
index 00000000000..6459f999f09
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/find.cc
@@ -0,0 +1,202 @@
+// 1999-06-09 bkoz
+
+// Copyright (C) 1994, 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.6.1 basic_string find
+
+#include <string>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::const_reference cref;
+ typedef std::string::reference ref;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const char str_lit01[] = "mave";
+ const std::string str01("mavericks, santa cruz");
+ std::string str02(str_lit01);
+ std::string str03("s, s");
+ std::string str04;
+
+ // size_type find(const string&, size_type pos = 0) const;
+ csz01 = str01.find(str01);
+ test &= csz01 == 0;
+ csz01 = str01.find(str01, 4);
+ test &= csz01 == npos;
+ csz01 = str01.find(str02, 0);
+ test &= csz01 == 0;
+ csz01 = str01.find(str02, 3);
+ test &= csz01 == npos;
+ csz01 = str01.find(str03, 0);
+ test &= csz01 == 8;
+ csz01 = str01.find(str03, 3);
+ test &= csz01 == 8;
+ csz01 = str01.find(str03, 12);
+ test &= csz01 == npos;
+ // It is implementation-defined if a given string contains an empty
+ // string. The only two times a char_type() (== empty string) ending
+ // element is required to be part of the string is on c_str() and
+ // operator[size()] const: the indeterminate, stored state of the
+ // string can vary, and not include a terminal char_type().
+ csz01 = str01.find(str04, 0);
+ test &= csz01 == npos || csz01 == str01.size();
+ csz01 = str01.find(str04, 5);
+ test &= csz01 == npos || csz01 == str01.size();
+
+ // size_type find(const char* s, size_type pos, size_type n) const;
+ csz01 = str01.find(str_lit01, 0, 3);
+ test &= csz01 == 0;
+ csz01 = str01.find(str_lit01, 3, 0);
+ test &= csz01 == npos;
+
+ // size_type find(const char* s, size_type pos = 0) const;
+ csz01 = str01.find(str_lit01);
+ test &= csz01 == 0;
+ csz01 = str01.find(str_lit01, 3);
+ test &= csz01 == npos;
+
+ // size_type find(char c, size_type pos = 0) const;
+ csz01 = str01.find('z');
+ csz02 = str01.size() - 1;
+ test &= csz01 == csz02;
+ csz01 = str01.find('/');
+ test &= csz01 == npos;
+
+
+ // size_type find_first_of(const string&, size_type pos = 0) const;
+ std::string str05("xena rulez");
+ csz01 = str01.find_first_of(str01);
+ test &= csz01 == 0;
+ csz01 = str01.find_first_of(str01, 4);
+ test &= csz01 == 4;
+ csz01 = str01.find_first_of(str02, 0);
+ test &= csz01 == 0;
+ csz01 = str01.find_first_of(str02, 3);
+ test &= csz01 == 3;
+ csz01 = str01.find_first_of(str03, 0);
+ test &= csz01 == 8;
+ csz01 = str01.find_first_of(str03, 3);
+ test &= csz01 == 8;
+ csz01 = str01.find_first_of(str03, 12);
+ test &= csz01 == 16;
+ csz01 = str01.find_first_of(str05, 0);
+ test &= csz01 == 1;
+ csz01 = str01.find_first_of(str05, 4);
+ test &= csz01 == 4;
+
+ // It is implementation-defined if a given string contains an empty
+ // string. The only two times a char_type() (== empty string) ending
+ // element is required to be part of the string is on c_str() and
+ // operator[size()] const: the indeterminate, stored state of the
+ // string can vary, and not include a terminal char_type().
+ csz01 = str01.find_first_of(str04, 0);
+ test &= csz01 == npos || csz01 == str01.size();
+ csz01 = str01.find_first_of(str04, 5);
+ test &= csz01 == npos || csz01 == str01.size();
+
+ // size_type find_first_of(const char* s, size_type pos, size_type n) const;
+ csz01 = str01.find_first_of(str_lit01, 0, 3);
+ test &= csz01 == 0;
+ csz01 = str01.find_first_of(str_lit01, 3, 0);
+ test &= csz01 == npos;
+
+ // size_type find_first_of(const char* s, size_type pos = 0) const;
+ csz01 = str01.find_first_of(str_lit01);
+ test &= csz01 == 0;
+ csz01 = str01.find_first_of(str_lit01, 3);
+ test &= csz01 == 3;
+
+ // size_type find_first_of(char c, size_type pos = 0) const;
+ csz01 = str01.find_first_of('z');
+ csz02 = str01.size() - 1;
+ test &= csz01 == csz02;
+
+ // size_type find_last_of(const string& str, size_type pos = 0) const;
+ // size_type find_last_of(const char* s, size_type pos, size_type n) const;
+ // size_type find_last_of(const char* s, size_type pos = 0) const;
+ // size_type find_last_of(char c, size_type pos = 0) const;
+
+#if 1
+// from tstring.cc, from jason merrill, et. al.
+ std::string x;
+ std::string::size_type pos;
+ pos = x.find_last_not_of('X');
+ test &= pos == npos;
+ pos = x.find_last_not_of("XYZ");
+ test &= pos == npos;
+
+ std::string y("a");
+ pos = y.find_last_not_of('X');
+ test &= pos == 0;
+ pos = y.find_last_not_of('a');
+ test &= pos == npos;
+ pos = y.find_last_not_of("XYZ");
+ test &= pos == 0;
+ pos = y.find_last_not_of("a");
+ test &= pos == npos;
+
+ std::string z("ab");
+ pos = z.find_last_not_of('X');
+ test &= pos == 1;
+ pos = z.find_last_not_of("XYZ");
+ test &= pos == 1;
+ pos = z.find_last_not_of('b');
+ test &= pos == 0;
+ pos = z.find_last_not_of("Xb");
+ test &= pos == 0;
+ pos = z.find_last_not_of("Xa");
+ test &= pos == 1;
+ pos = z.find_last_of("ab");
+ test &= pos == 1;
+ pos = z.find_last_of("Xa");
+ test &= pos == 0;
+ pos = z.find_last_of("Xb");
+ test &= pos == 1;
+ pos = z.find_last_of("XYZ");
+ test &= pos == std::string::npos;
+ pos = z.find_last_of('a');
+ test &= pos == 0;
+ pos = z.find_last_of('b');
+ test &= pos == 1;
+ pos = z.find_last_of('X');
+ test &= pos == std::string::npos;
+#endif
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/insert.cc b/libstdc++-v3/testsuite/21_strings/insert.cc
new file mode 100644
index 00000000000..71617d675f1
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/insert.cc
@@ -0,0 +1,200 @@
+// 1999-06-03 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.4 basic_string::insert
+
+#include <string>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+int test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::iterator citerator;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const std::string str01("rodeo beach, marin");
+ const std::string str02("baker beach, san francisco");
+ std::string str03;
+
+ // string& insert(size_type p1, const string& str, size_type p2, size_type n)
+ // requires:
+ // 1) p1 <= size()
+ // 2) p2 <= str.size()
+ // 3) rlen = min(n, str.size() - p2)
+ // throws:
+ // 1) out_of_range if p1 > size() || p2 > str.size()
+ // 2) length_error if size() >= npos - rlen
+ // effects:
+ // replaces *this with new string of length size() + rlen such that
+ // nstr[0] to nstr[p1] == thisstr[0] to thisstr[p1]
+ // nstr[p1 + 1] to nstr[p1 + rlen] == str[p2] to str[p2 + rlen]
+ // nstr[p1 + 1 + rlen] to nstr[...] == thisstr[p1 + 1] to thisstr[...]
+ str03 = str01;
+ csz01 = str03.size();
+ csz02 = str02.size();
+ try {
+ str03.insert(csz01 + 1, str02, 0, 5);
+ test &= false;
+ }
+ catch(std::out_of_range& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ str03 = str01;
+ csz01 = str03.size();
+ csz02 = str02.size();
+ try {
+ str03.insert(0, str02, csz02 + 1, 5);
+ test &= false;
+ }
+ catch(std::out_of_range& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ csz01 = str01.max_size();
+ try {
+ std::string str04(csz01, 'b');
+ str03 = str04;
+ csz02 = str02.size();
+ try {
+ str03.insert(0, str02, 0, 5);
+ test &= false;
+ }
+ catch(std::length_error& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+ }
+ catch(std::bad_alloc& failure){
+ test &= true;
+ }
+ catch(std::exception& failure){
+ test &= false;
+ }
+
+ str03 = str01;
+ csz01 = str03.size();
+ csz02 = str02.size();
+ str03.insert(13, str02, 0, 12);
+ test&= str03 == "rodeo beach, baker beach,marin";
+
+ str03 = str01;
+ csz01 = str03.size();
+ csz02 = str02.size();
+ str03.insert(0, str02, 0, 12);
+ test&= str03 == "baker beach,rodeo beach, marin";
+
+ str03 = str01;
+ csz01 = str03.size();
+ csz02 = str02.size();
+ str03.insert(csz01, str02, 0, csz02);
+ test&= str03 == "rodeo beach, marinbaker beach, san francisco";
+
+ // string& insert(size_type __p, const string& string);
+ // insert(p1, str, 0, npos)
+ str03 = str01;
+ csz01 = str03.size();
+ csz02 = str02.size();
+ str03.insert(csz01, str02);
+ test&= str03 == "rodeo beach, marinbaker beach, san francisco";
+
+ str03 = str01;
+ csz01 = str03.size();
+ csz02 = str02.size();
+ str03.insert(0, str02);
+ test&= str03 == "baker beach, san franciscorodeo beach, marin";
+
+ // string& insert(size_type __p, const char* s, size_type n);
+ // insert(p1, string(s,n))
+ str03 = str02;
+ csz01 = str03.size();
+ str03.insert(0, "-break at the bridge", 20);
+ test&= str03 == "-break at the bridgebaker beach, san francisco";
+
+ // string& insert(size_type __p, const char* s);
+ // insert(p1, string(s))
+ str03 = str02;
+ str03.insert(0, "-break at the bridge");
+ test&= str03 == "-break at the bridgebaker beach, san francisco";
+
+ // string& insert(size_type __p, size_type n, char c)
+ // insert(p1, string(n,c))
+ str03 = str02;
+ csz01 = str03.size();
+ str03.insert(csz01, 5, 'z');
+ test&= str03 == "baker beach, san franciscozzzzz";
+
+ // iterator insert(iterator p, char c)
+ // inserts a copy of c before the character referred to by p
+ str03 = str02;
+ citerator cit01 = str03.begin();
+ str03.insert(cit01, 'u');
+ test&= str03 == "ubaker beach, san francisco";
+
+ // iterator insert(iterator p, size_type n, char c)
+ // inserts n copies of c before the character referred to by p
+ str03 = str02;
+ cit01 = str03.begin();
+ str03.insert(cit01, 5, 'u');
+ test&= str03 == "uuuuubaker beach, san francisco";
+
+ // template<inputit>
+ // void
+ // insert(iterator p, inputit first, inputit, last)
+ // ISO-14882: defect #7 part 1 clarifies this member function to be:
+ // insert(p - begin(), string(first,last))
+ str03 = str02;
+ csz01 = str03.size();
+ str03.insert(str03.begin(), str01.begin(), str01.end());
+ test&= str03 == "rodeo beach, marinbaker beach, san francisco";
+
+ str03 = str02;
+ csz01 = str03.size();
+ str03.insert(str03.end(), str01.begin(), str01.end());
+ test&= str03 == "baker beach, san franciscorodeo beach, marin";
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/inserters_extractors.cc b/libstdc++-v3/testsuite/21_strings/inserters_extractors.cc
new file mode 100644
index 00000000000..8b476fd4e77
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/inserters_extractors.cc
@@ -0,0 +1,315 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.9 inserters and extractors
+
+// NB: This file is predicated on sstreams, istreams, and ostreams
+// working, not to mention other major details like char_traits, and
+// all of the string class.
+
+#include <string>
+#include <stdexcept>
+#include <sstream>
+#include <fstream>
+#include <iostream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::const_reference cref;
+ typedef std::string::reference ref;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const char str_lit01[] = "sailing grand traverse bay
+ from Elk Rapids to the point reminds me of miles";
+ const std::string str01(str_lit01);
+ const std::string str02("sailing");
+ const std::string str03("grand");
+ const std::string str04("traverse");
+ const std::string str05;
+ std::string str10;
+
+ // istream& operator>>(istream&, string&)
+ std::istringstream istrs01(str01);
+ istrs01 >> str10;
+ test &= str10 == str02;
+ try {
+ std::istringstream::int_type i01 = istrs01.peek(); //a-boo
+ test &= std::istringstream::traits_type::to_char_type(i01) == ' ';
+ }
+ catch(std::exception& fail) {
+ test &= false; // shouldn't throw
+ }
+
+ istrs01 >> str10;
+ test &= str10 == str03;
+ istrs01 >> str10;
+ test &= str10 == str04; // sentry picks out the white spaces. .
+
+ std::istringstream istrs02(str05); // empty
+ istrs02 >> str10;
+ test &= str10 == str04;
+
+ // istream& getline(istream&, string&, char)
+ // istream& getline(istream&, string&)
+ try {
+ getline(istrs01, str10);
+ test &= !istrs01.fail();
+ test &= !istrs01.eof();
+ test &= istrs01.good();
+ test &= str10 == " bay";
+ }
+ catch(std::exception& fail) {
+ test &= false; // shouldn't throw
+ }
+
+ try {
+ istrs01.clear();
+ getline(istrs01, str10,'\t');
+ test &= !istrs01.fail();
+ test &= !istrs01.eof();
+ test &= istrs01.good();
+ test &= str10 == str05;
+ }
+ catch(std::exception& fail) {
+ test &= false; // shouldn't throw
+ }
+
+ try {
+ istrs01.clear();
+ getline(istrs01, str10,'\t');
+ test &= !istrs01.fail();
+ test &= !istrs01.eof();
+ test &= istrs01.good();
+ test &= str10 == str05;
+ }
+ catch(std::exception& fail) {
+ test &= false; // shouldn't throw
+ }
+
+ try {
+ istrs01.clear();
+ getline(istrs01, str10, '.');
+ test &= !istrs01.fail();
+ test &= istrs01.eof();
+ test &= !istrs01.good();
+ test &= str10 == "\t from Elk Rapids to the point reminds me of miles";
+ }
+ catch(std::exception& fail) {
+ test &= false; // shouldn't throw
+ }
+
+ try {
+ getline(istrs02, str10);
+ test &= istrs02.fail();
+ test &= istrs02.eof();
+ test &= str10 == "\t from Elk Rapids to the point reminds me of miles";
+ }
+ catch(std::exception& fail) {
+ test &= false; // shouldn't throw
+ }
+
+ // ostream& operator<<(ostream&, const basic_string&)
+ std::ostringstream ostrs01;
+ try {
+ ostrs01 << str01;
+ test &= ostrs01.str() == str01;
+ }
+ catch(std::exception& fail) {
+ test &= false;
+ }
+
+ std::string hello_world;
+ std::cout << hello_world;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+
+// testing basic_stringbuf::xsputn via stress testing with large strings
+// based on a bug report libstdc++ 9
+void test04(int size)
+{
+ bool test = true;
+ std::string str(size, 's');
+ int expected_size = (2 * (size + sizeof(char)));
+ std::ostringstream oss(str);
+
+ // sanity checks
+ test &= str.size() == size;
+ test &= oss.good();
+
+ // stress test
+ oss << str << std::endl;
+ if (!oss.good())
+ test = false;
+
+ oss << str << std::endl;
+ if (!oss.good())
+ test = false;
+
+ test &= str.size() == size;
+ test &= oss.good();
+ std::string str_tmp = oss.str();
+ test &= str_tmp.size() == expected_size;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+
+// testing basic_filebuf::xsputn via stress testing with large strings
+// based on a bug report libstdc++ 9
+// mode == out
+void test05(int size)
+{
+ bool test = true;
+ const char* filename = "testsuite/inserters_extractors-1.txt";
+ const char fillc = 'f';
+ std::ofstream ofs(filename);
+ std::string str(size, fillc);
+
+ // sanity checks
+ test &= str.size() == size;
+ test &= ofs.good();
+
+ // stress test
+ ofs << str << std::endl;
+ if (!ofs.good())
+ test = false;
+
+ ofs << str << std::endl;
+ if (!ofs.good())
+ test = false;
+
+ test &= str.size() == size;
+ test &= ofs.good();
+
+ ofs.close();
+
+ // sanity check on the written file
+ std::ifstream ifs(filename);
+ int count = 0;
+ char c;
+ while (count <= (2 * size) + 4)
+ {
+ ifs >> c;
+ if (ifs.good() && c == fillc)
+ {
+ ++count;
+ c = '0';
+ }
+ else
+ break;
+ }
+
+ test &= count == 2 * size;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+
+// istringstream/stringbuf extractor properly size buffer based on
+// actual, not allocated contents (string.size() vs. string.capacity()).
+// http://sourceware.cygnus.com/ml/libstdc++/1999-q4/msg00049.html
+void test06(void)
+{
+ bool test = true;
+
+ typedef std::string::size_type size_type;
+ std::string str01("@silent");
+ size_type i01 = str01.size();
+ size_type i02 = str01.capacity();
+ str01.erase(0, 1);
+ size_type i03 = str01.size();
+ size_type i04 = str01.capacity();
+ test &= i01 - 1 == i03;
+ test &= i02 >= i04;
+
+ std::istringstream is(str01);
+ std::string str02;
+ is >> str02 >> std::ws;
+ size_type i05 = str02.size();
+ size_type i06 = str02.capacity();
+ test &= i05 == i03;
+ test &= i06 <= i04;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+// http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00085.html
+// istream::operator>>(string)
+// sets failbit
+// NB: this is a defect in the standard.
+void test07(void)
+{
+ bool test = true;
+ const std::string name("z6.cc");
+ std::istringstream iss (name);
+ int i = 0;
+ std::string s;
+ while (iss >> s)
+ ++i;
+
+ test &= i < 3;
+ test &= static_cast<bool>(iss.rdstate() & std::ios_base::failbit);
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main()
+{
+ test01();
+
+ test04(1); // expected_size == 4
+ test04(1000); // expected_size == 2002
+ test04(10000); // expected_size == 20002
+
+ test05(1);
+ test05(1000);
+ test05(10000);
+
+ test06();
+ test07();
+
+ return 0;
+}
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/invariants.cc b/libstdc++-v3/testsuite/21_strings/invariants.cc
new file mode 100644
index 00000000000..1eeabd3d026
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/invariants.cc
@@ -0,0 +1,181 @@
+// 1999-06-08 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3 template class basic_string
+
+#include <string>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+// Do a quick sanity check on known problems with element access and
+// ref-counted strings. These should all pass, regardless of the
+// underlying string implementation, of course.
+bool test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::iterator siterator;
+ typedef std::string::reverse_iterator sriterator;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+ siterator it1;
+ sriterator rit1;
+
+ std::string str01("montara beach, half moon bay");
+ const std::string str02("ocean beach, san francisco");
+ std::string str03;
+
+ // 21.3 p 5
+
+ // References, pointers, and iterators referring to the elements of
+ // a basic_string may be invalidated by the following uses of that
+ // basic_string object:
+
+ // ...
+
+ // Susequent to any of the above uses except the forms of insert()
+ // and erase() which return iterators, the first call to non-const
+ // member functions operator[](), at(), begin(), rbegin(), end(), or
+ // rend()
+
+ str03 = str01;
+ it1 = str01.begin();
+ *it1 = 'x';
+ test &= str01[0] == 'x';
+ test &= str03[0] == 'm';
+
+ str03 = str01;
+ csz01 = str01.size();
+ rit1 = str01.rbegin(); // NB: Pointing at one-past the end, so ...
+ *rit1 = 'z'; // ... but it's taken care of here
+ test &= str01[csz01 - 1] == 'z';
+ test &= str03[csz01 - 1] == 'y';
+
+ str03 = str01;
+ csz01 = str01.size();
+ std::string::reference r1 = str01.at(csz01 - 2);
+ test &= str03 == str01;
+ r1 = 'd';
+ test &= str01[csz01 - 2] == 'd';
+ test &= str03[csz01 - 2] == 'a';
+
+ str03 = str01;
+ csz01 = str01.size();
+ std::string::reference r2 = str01[csz01 - 3];
+ test &= str03 == str01;
+ r2 = 'w';
+ test &= str01[csz01 - 3] == 'w';
+ test &= str03[csz01 - 3] == 'b';
+
+ str03 = str01;
+ csz02 = str01.size();
+ it1 = str01.end();
+ test &= str03 == str01;
+ --it1;
+ *it1 = 'q';
+ test &= str01[csz02 - 1] == 'q';
+ test &= str03[csz02 - 1] == 'z';
+
+ str03 = str01;
+ rit1 = str01.rend();
+ test &= str03 == str01;
+ --rit1;
+ *rit1 = 'p';
+ test &= str01[0] == 'p';
+ test &= str03[0] == 'x';
+
+ // need to also test for const begin/const end
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+// Do another sanity check, this time for member functions that return
+// iterators, namely insert and erase.
+bool test02(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::iterator siterator;
+ typedef std::string::reverse_iterator sriterator;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+ siterator it1;
+ sriterator rit1;
+
+ const std::string str01("its beach, santa cruz");
+
+ std::string str02 = str01;
+ std::string str05 = str02; // optional, so that begin below causes a mutate
+ std::string::iterator p = str02.insert(str02.begin(), ' ');
+ std::string str03 = str02;
+ test &= str03 == str02;
+ *p = '!';
+ test &= *str03.c_str() == ' ';
+ str03[0] = '@';
+ test &= str02[0] == '!';
+ test &= *p == '!';
+ test &= str02 != str05;
+ test &= str02 != str03;
+
+ std::string str10 = str01;
+ std::string::iterator p2 = str10.insert(str10.begin(), 'a');
+ std::string str11 = str10;
+ *p2 = 'e';
+ test &= str11 != str10;
+
+ std::string str06 = str01;
+ std::string str07 = str06; // optional, so that begin below causes a mutate
+ p = str06.erase(str06.begin());
+ std::string str08 = str06;
+ test &= str08 == str06;
+ *p = '!';
+ test &= *str08.c_str() == 't';
+ str08[0] = '@';
+ test &= str06[0] == '!';
+ test &= *p == '!';
+ test &= str06 != str07;
+ test &= str06 != str08;
+
+ std::string str12 = str01;
+ p2 = str12.erase(str12.begin(), str12.begin() + str12.size() - 1);
+ std::string str13 = str12;
+ *p2 = 'e';
+ test &= str12 != str13;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+ test01();
+ test02();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/nonmember.cc b/libstdc++-v3/testsuite/21_strings/nonmember.cc
new file mode 100644
index 00000000000..2116839e7f1
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/nonmember.cc
@@ -0,0 +1,306 @@
+// 1998-10-01, 1999-06-25 bkoz
+
+// Copyright (C) 1998-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.1 basic_string non-member functions
+
+// 21.3.7.2 operator==
+/*
+template<class charT, class traits, class Allocator>
+ bool operator==(const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator==(const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator==(const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+*/
+
+// 21.3.7.3 operator!=
+/*
+template<class charT, class traits, class Allocator>
+ bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator!=(const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+*/
+
+// 21.3.7.4 operator<
+/*
+template<class charT, class traits, class Allocator>
+ bool operator< (const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator< (const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator< (const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+*/
+
+// 21.3.7.5 operator>
+/*
+template<class charT, class traits, class Allocator>
+ bool operator> (const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator> (const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator> (const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+*/
+
+//21.3.7.6 operator<=
+/*
+template<class charT, class traits, class Allocator>
+ bool operator<=(const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator<=(const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator<=(const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+*/
+
+// 21.3.7.7 operator>=
+/*
+template<class charT, class traits, class Allocator>
+ bool operator>=(const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator>=(const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator>=(const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+*/
+
+#include <string>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+int test01(void)
+{
+ bool test = true;
+ std::string str_0("costa rica");
+ std::string str_1("costa marbella");
+ std::string str_2("cost");
+ std::string str_3("costa ricans");
+ std::string str_4;
+
+ str_4 = str_0;
+ //comparisons between string objects
+ test &= !(str_0 == str_1);
+ test &= !(str_0 == str_2);
+ test &= !(str_0 == str_3);
+ test &= !(str_1 == str_0);
+ test &= !(str_2 == str_0);
+ test &= !(str_3 == str_0);
+ test &= str_4 == str_0;
+ test &= str_0 == str_4;
+
+ test &= str_0 != str_1;
+ test &= str_0 != str_2;
+ test &= str_0 != str_3;
+ test &= str_1 != str_0;
+ test &= str_2 != str_0;
+ test &= str_3 != str_0;
+ test &= !(str_0 != str_4);
+ test &= !(str_4 != str_0);
+
+ test &= str_0 > str_1; //true cuz r>m
+ test &= str_0 > str_2;
+ test &= !(str_0 > str_3);
+ test &= !(str_1 > str_0); //false cuz m<r
+ test &= !(str_2 > str_0);
+ test &= str_3 > str_0;
+ test &= !(str_0 > str_4);
+ test &= !(str_4 > str_0);
+
+ test &= !(str_0 < str_1); //false cuz r>m
+ test &= !(str_0 < str_2);
+ test &= str_0 < str_3;
+ test &= str_1 < str_0; //true cuz m<r
+ test &= str_2 < str_0;
+ test &= !(str_3 < str_0);
+ test &= !(str_0 < str_4);
+ test &= !(str_4 < str_0);
+
+ test &= str_0 >= str_1; //true cuz r>m
+ test &= str_0 >= str_2;
+ test &= !(str_0 >= str_3);
+ test &= !(str_1 >= str_0);//false cuz m<r
+ test &= !(str_2 >= str_0);
+ test &= str_3 >= str_0;
+ test &= str_0 >= str_4;
+ test &= str_4 >= str_0;
+
+ test &= !(str_0 <= str_1);//false cuz r>m
+ test &= !(str_0 <= str_2);
+ test &= str_0 <= str_3;
+ test &= str_1 <= str_0;//true cuz m<r
+ test &= str_2 <= str_0;
+ test &= !(str_3 <= str_0);
+ test &= str_0 <= str_4;
+ test &= str_4 <= str_0;
+
+ //comparisons between string object and string literal
+ test &= !(str_0 == "costa marbella");
+ test &= !(str_0 == "cost");
+ test &= !(str_0 == "costa ricans");
+ test &= !("costa marbella" == str_0);
+ test &= !("cost" == str_0);
+ test &= !("costa ricans" == str_0);
+ test &= "costa rica" == str_0;
+ test &= str_0 == "costa rica";
+
+ test &= str_0 != "costa marbella";
+ test &= str_0 != "cost";
+ test &= str_0 != "costa ricans";
+ test &= "costa marbella" != str_0;
+ test &= "cost" != str_0;
+ test &= "costa ricans" != str_0;
+ test &= !("costa rica" != str_0);
+ test &= !(str_0 != "costa rica");
+
+ test &= str_0 > "costa marbella"; //true cuz r>m
+ test &= str_0 > "cost";
+ test &= !(str_0 > "costa ricans");
+ test &= !("costa marbella" > str_0);//false cuz m<r
+ test &= !("cost" > str_0);
+ test &= "costa ricans" > str_0;
+ test &= !("costa rica" > str_0);
+ test &= !(str_0 > "costa rica");
+
+ test &= !(str_0 < "costa marbella");//false cuz r>m
+ test &= !(str_0 < "cost");
+ test &= str_0 < "costa ricans";
+ test &= "costa marbella" < str_0;//true cuz m<r
+ test &= "cost" < str_0;
+ test &= !("costa ricans" < str_0);
+ test &= !("costa rica" < str_0);
+ test &= !(str_0 < "costa rica");
+
+ test &= str_0 >= "costa marbella";//true cuz r>m
+ test &= str_0 >= "cost";
+ test &= !(str_0 >= "costa ricans");
+ test &= !("costa marbella" >= str_0);//false cuz m<r
+ test &= !("cost" >= str_0);
+ test &= "costa ricans" >= str_0;
+ test &= "costa rica" >= str_0;
+ test &= str_0 >= "costa rica";
+
+ test &= !(str_0 <= "costa marbella");//false cuz r>m
+ test &= !(str_0 <= "cost");
+ test &= str_0 <= "costa ricans";
+ test &= "costa marbella" <= str_0;//true cuz m<r
+ test &= "cost" <= str_0;
+ test &= !("costa ricans" <= str_0);
+ test &= "costa rica" <= str_0;
+ test &= str_0 <= "costa rica";
+
+ // 21.3.7.1 operator+
+/*
+template<class charT, class traits, class Allocator>
+ basic_string<charT,traits,Allocator>
+ operator+(const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ basic_string<charT,traits,Allocator>
+ operator+(const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ basic_string<charT,traits,Allocator>
+ operator+(const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+
+template<class charT, class traits, class Allocator>
+ basic_string<charT,traits,Allocator>
+ operator+(charT lhs, const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ basic_string<charT,traits,Allocator>
+ operator+(const basic_string<charT,traits,Allocator>& lhs, charT rhs);
+*/
+
+ str_4 = str_0 + "ns";
+ test &= str_4 == str_3;
+
+ const std::string str_5(" marbella");
+ str_4 = "costa" + str_5;
+ test &= str_4 == str_1;
+
+ std::string str_6("ns");
+ str_4 = str_0 + str_6;
+ test &= str_4 == str_3;
+
+ str_4 = str_0 + 'n';
+ str_4 = str_4 + 's';
+ test &= str_4 == str_3;
+
+ str_4 = 'a' + str_6;
+ str_4 = 'c' + str_4;
+ str_4 = 'i' + str_4;
+ str_4 = 'r' + str_4;
+ str_4 = ' ' + str_4;
+ str_4 = 'a' + str_4;
+ str_4 = 't' + str_4;
+ str_4 = 's' + str_4;
+ str_4 = 'o' + str_4;
+ str_4 = 'c' + str_4;
+ test &= str_4 == str_3;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return 0;
+}
+
+int main() {
+ test01();
+}
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/operations.cc b/libstdc++-v3/testsuite/21_strings/operations.cc
new file mode 100644
index 00000000000..06e811f5ca4
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/operations.cc
@@ -0,0 +1,58 @@
+// 1999-05-07 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.6 string operations
+
+#include <string>
+#include <cstdio>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+int test01(void)
+{
+ bool test = true;
+
+ std::string str1;
+ std::string str2;
+
+ // Should get this:
+ // 1:8-chars_8-chars_
+ // 2:8-chars_8-chars_
+ str1 = std::string("8-chars_") + "8-chars_";
+ const char* p1 = str1.c_str();
+ // printf("1:%s\n", str1.c_str());
+ str2 = str1 + "7-chars";
+ // printf("2:%s\n", str1.c_str()); //str1 is gone
+ const char* p2 = str1.c_str();
+ return 0;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
diff --git a/libstdc++-v3/testsuite/21_strings/replace.cc b/libstdc++-v3/testsuite/21_strings/replace.cc
new file mode 100644
index 00000000000..b72604a2499
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/replace.cc
@@ -0,0 +1,96 @@
+// 1999-06-10 bkoz
+
+// Copyright (C) 1994, 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.6 basic_string::replace
+
+#include <string>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::const_reference cref;
+ typedef std::string::reference ref;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const char str_lit01[] = "ventura, california";
+ const std::string str01(str_lit01);
+ std::string str02("del mar, california");
+ std::string str03(" and ");
+ std::string str05;
+
+ // string& replace(size_type pos, size_type n, const string& string)
+ // string& replace(size_type pos1, size_type n1, const string& string,
+ // size_type pos2, size_type n2)
+ // string& replace(size_type pos, size_type n1, const char* s, size_type n2)
+ // string& replace(size_type pos, size_type n1, const char* s)
+ // string& replace(size_type pos, size_type n1, size_type n2, char c)
+ // string& replace(iterator it1, iterator it2, const string& str)
+ // string& replace(iterator it1, iterator it2, const chat* s, size_type n)
+ // string& replace(iterator it1, iterator it2, const chat* s)
+ // string& replace(iterator it1, iterator it2, size_type n, char c)
+ // template<typename InputIter>
+ // string& replace(iterator it1, iterator it2, InputIter j1, InputIter j2)
+
+#if 1
+ // with mods, from tstring.cc, from jason merrill, et. al.
+ std::string X = "Hello";
+ std::string x = X;
+
+ char ch = x[0];
+ test &= ch == 'H';
+
+ std::string z = x.substr(2, 3);
+ test &= z == "llo";
+
+ x.replace(2, 2, "r");
+ test &= x == "Hero";
+
+ x = X;
+ x.replace(0, 1, "j");
+ test &= x == "jello";
+
+ int ar[] = { 'H', 'e', 'l', 'l', 'o' };
+ x.replace(find(x.begin(), x.end(), 'l'),
+ find(x.rbegin(), x.rend(), 'l').base(), ar,
+ ar + sizeof(ar) / sizeof(ar[0]));
+ test &= x == "jeHelloo";
+#endif
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/substr.cc b/libstdc++-v3/testsuite/21_strings/substr.cc
new file mode 100644
index 00000000000..354dbb2e7cf
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/substr.cc
@@ -0,0 +1,86 @@
+// 1999-06-10 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.6.7 basic_string::substr
+
+#include <string>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::const_reference cref;
+ typedef std::string::reference ref;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const char str_lit01[] = "rockaway, pacifica";
+ const std::string str01(str_lit01);
+ std::string str02;
+
+ // basic_string<charT, _Traits, _Alloc>
+ // substr(size_type pos = 0, size_type n = npos) const;
+ csz01 = str01.size();
+ str02 = str01.substr(0, 1);
+ test &= str02 == "r";
+ str02 = str01.substr(10);
+ test &= str02 == "pacifica";
+
+ try {
+ str02 = str01.substr(csz01 + 1);
+ test &= false;
+ }
+ catch(std::out_of_range& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ try {
+ str02 = str01.substr(csz01);
+ test &= str02.size() == 0;
+ }
+ catch(std::out_of_range& fail) {
+ test &= false;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/22_locale/ctype.cc b/libstdc++-v3/testsuite/22_locale/ctype.cc
new file mode 100644
index 00000000000..b983c92c90f
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype.cc
@@ -0,0 +1,34 @@
+// 1999-08-24 bkoz
+
+// Copyright (C) 2000, 1999 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.1 the ctype category
+
+// 1: Test that the locale headers are picking up the correct declaration
+// of the internal type `ctype_base::mask'.
+int mask ();
+
+#include <locale>
+
+// 2: Should be able to instantiate this for other types besides char, wchar_t
+class gnu_ctype: public std::ctype<unsigned char> { };
+gnu_ctype facet01;
+
+
+int main() { }
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_char_members.cc b/libstdc++-v3/testsuite/22_locale/ctype_char_members.cc
new file mode 100644
index 00000000000..06ce7c39413
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype_char_members.cc
@@ -0,0 +1,105 @@
+// 2000-02-16 bkoz
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 22.2.1.3.2 ctype<char> members
+
+#include <locale>
+// NB: Don't include any other headers in this file.
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+class gnu_ctype: public std::ctype<char> {};
+
+void test01()
+{
+ bool test = true;
+ const char strlit00[] = "manilla, cebu, tandag PHILIPPINES";
+ const char strlit01[] = "MANILLA, CEBU, TANDAG PHILIPPINES";
+ const char strlit02[] = "manilla, cebu, tandag philippines";
+ const char c00 = 'S';
+ const char c10 = 's';
+ const char c20 = '9';
+ const char c30 = ' ';
+ const char c40 = '!';
+ const char c50 = 'F';
+ const char c60 = 'f';
+ const char c70 = 'X';
+ const char c80 = 'x';
+
+ gnu_ctype gctype;
+ char c100;
+ int len = std::char_traits<char>::length(strlit00);
+ char c_array[len + 1];
+
+ // bool is(mask m, char c) const;
+ test &= gctype.is(std::ctype_base::space, c30);
+ test &= gctype.is(std::ctype_base::upper, c00);
+ test &= gctype.is(std::ctype_base::lower, c10);
+ test &= gctype.is(std::ctype_base::digit, c20);
+ test &= gctype.is(std::ctype_base::punct, c40);
+ test &= gctype.is(std::ctype_base::alpha, c50);
+ test &= gctype.is(std::ctype_base::alpha, c60);
+ test &= gctype.is(std::ctype_base::xdigit, c20);
+ test &= !gctype.is(std::ctype_base::xdigit, c80);
+ test &= gctype.is(std::ctype_base::alnum, c50);
+ test &= gctype.is(std::ctype_base::alnum, c20);
+ test &= gctype.is(std::ctype_base::graph, c40);
+ test &= gctype.is(std::ctype_base::graph, c20);
+
+ // char toupper(char c) const
+ c100 = gctype.toupper(c10);
+ test &= c100 == c00;
+
+ // char tolower(char c) const
+ c100 = gctype.tolower(c00);
+ test &= c100 == c10;
+
+ // char toupper(char* low, const char* hi) const
+ std::char_traits<char>::copy(c_array, strlit02, len + 1);
+ gctype.toupper(c_array, c_array + len);
+ test &= !std::char_traits<char>::compare(c_array, strlit01, len - 1);
+
+ // char tolower(char* low, const char* hi) const
+ std::char_traits<char>::copy(c_array, strlit01, len + 1);
+ gctype.tolower(c_array, c_array + len);
+ test &= !std::char_traits<char>::compare(c_array, strlit02, len - 1);
+
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main() {
+ test01();
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/23_containers/bitset_ctor.cc b/libstdc++-v3/testsuite/23_containers/bitset_ctor.cc
new file mode 100644
index 00000000000..922d47028a0
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset_ctor.cc
@@ -0,0 +1,90 @@
+// 1999-06-08 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 23.3.5.1 bitset constructors
+
+#include <string>
+#include <bitset>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+
+ // bitset()
+ const size_t n1 = 5;
+ std::bitset<n1> bit01;
+ for (int i = 0; i < n1; ++i)
+ test &= !bit01.test(i);
+
+ // bitset(unsigned long)
+ const size_t n2 = 32;
+ unsigned long ul1 = 2;
+ std::bitset<n2> bit02(ul1);
+ test &= !bit02.test(0);
+ test &= bit02.test(1);
+ test &= !bit02.test(2);
+
+ // template<_CharT, _Traits, _Alloc>
+ // explicit bitset(const basic_string<_C,_T,_A>&, size_type pos, size_type n)
+ std::string str01("stuff smith sessions");
+ const size_t n3 = 128;
+ try {
+ std::bitset<n3> bit03(str01, 5);
+ }
+ catch(std::invalid_argument& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test&= false;
+ }
+
+ std::string str02("010101000011");
+ int sz = str02.size();
+ try {
+ std::bitset<n3> bit03(str02, 0);
+ std::string str03;
+ for (int i = 0; i < sz; ++i)
+ str03 += (bit03.test(i) ? '1' : '0');
+ reverse(str03.begin(), str03.end());
+ test &= str03 == str02;
+ }
+ catch(std::invalid_argument& fail) {
+ test &= false;
+ }
+ catch(...) {
+ test&= false;
+ }
+
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+ test01();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset_shift.cc b/libstdc++-v3/testsuite/23_containers/bitset_shift.cc
new file mode 100644
index 00000000000..d439edba369
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset_shift.cc
@@ -0,0 +1,116 @@
+// 2000-01-15 Anders Widell <awl@hem.passagen.se>
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <string>
+#include <set>
+#include <bitset>
+
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+static char original_bits[1024];
+static char left_shifted[1024];
+static char right_shifted[1024];
+
+char
+random_bit() {
+ static long x = 1;
+ return ((x = (3432L*x + 6789L) % 9973L) & 1) + '0';
+}
+
+void
+initialise(size_t size) {
+ for (size_t i=0; i<size; i++)
+ original_bits[i] = random_bit();
+
+ original_bits[size] = '\0';
+ left_shifted[size] = '\0';
+ right_shifted[size] = '\0';
+}
+
+void
+shift_arrays(size_t shift_step, size_t size) {
+ for (size_t i=shift_step; i<size; i++) {
+ right_shifted[i] = original_bits[i-shift_step];
+ left_shifted[size-i-1] = original_bits[size+shift_step-i-1];
+ }
+ for (size_t i=0; i<shift_step && i<size; i++) {
+ right_shifted[i] = '0';
+ left_shifted[size-i-1] = '0';
+ }
+}
+
+template <size_t size>
+ bool
+ do_test() {
+ bool test = true;
+
+ std::bitset<size> shifted;
+ std::bitset<size> correct;
+
+ initialise(size);
+
+ //std::bitset<size> original = std::string(original_bits);
+ std::bitset<size> original = std::bitset<size> (std::string(original_bits));
+
+ for (size_t shift_step=0; shift_step==0 || shift_step<size; shift_step++) {
+ shift_arrays(shift_step, size);
+
+ shifted = original;
+ shifted <<= shift_step;
+ //correct = std::string(left_shifted);
+ correct = std::bitset<size> (std::string(left_shifted));
+ test &= shifted == correct;
+
+ shifted = original;
+ shifted >>= shift_step;
+ //correct = std::string(right_shifted);
+ correct = std::bitset<size> (std::string(right_shifted));
+ test &= shifted == correct;
+ }
+
+ return test;
+ }
+
+bool
+test01() {
+ bool test = true;
+
+ test &= do_test<32>();
+ test &= do_test<48>();
+ test &= do_test<64>();
+
+ test &= do_test<511>();
+ test &= do_test<513>();
+ test &= do_test<997>();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int
+main() {
+ test01();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset.cc b/libstdc++-v3/testsuite/23_containers/multiset.cc
new file mode 100644
index 00000000000..5e9c195c84c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset.cc
@@ -0,0 +1,73 @@
+// 1999-06-24 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 23.3.4 template class multiset
+
+#include <iostream>
+#include <set>
+#include <algorithm>
+
+namespace std {
+ std::ostream&
+ operator<<(std::ostream& os, std::pair<int, int> const& p)
+ { return os << p.first << ' ' << p.second; }
+}
+
+bool
+operator<(std::pair<int, int> const& lhs, std::pair<int, int> const& rhs)
+{ return lhs.first < rhs.first; }
+
+int main ()
+{
+ typedef std::multiset<std::pair<int, int> >::iterator iterator;
+ std::pair<int, int> p(69, 0);
+ std::multiset<std::pair<int, int> > s;
+
+ for (p.second = 0; p.second < 5; ++p.second)
+ s.insert(p);
+ for (iterator it = s.begin(); it != s.end(); ++it)
+ if (it->second < 5)
+ {
+ s.insert(it, p);
+ ++p.second;
+ }
+
+ // XXX need to use debug-assert here and get this working with an
+ // ostrinsrtream, that way we can just check the strings for
+ // equivalance.
+ std::copy(s.begin(), s.end(),
+ std::ostream_iterator<std::pair<int, int> >(std::cout, "\n"));
+
+ return 0;
+}
+
+/* output:
+69 5
+69 0
+69 6
+69 1
+69 7
+69 2
+69 8
+69 3
+69 9
+69 4
+*/
+
diff --git a/libstdc++-v3/testsuite/23_containers/vector_capacity.cc b/libstdc++-v3/testsuite/23_containers/vector_capacity.cc
new file mode 100644
index 00000000000..c5207f41361
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector_capacity.cc
@@ -0,0 +1,69 @@
+// 1999-05-07
+// bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 23.2.4.2 vector capacity
+
+#include <vector>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+template<typename T>
+ struct A { };
+
+struct B { };
+
+bool test01()
+{
+
+ // non POD types
+ bool test = true;
+ std::vector< A<B> > vec01;
+ typedef std::vector< A<B> >::size_type size_type;
+
+ size_type sz01 = vec01.capacity();
+ vec01.reserve(100);
+ size_type sz02 = vec01.capacity();
+ test &= sz02 >= sz01;
+
+ sz01 = vec01.size() + 5;
+ vec01.resize(sz01);
+ sz02 = vec01.size();
+ test &= sz01 == sz02;
+
+ sz01 = vec01.size() - 5;
+ vec01.resize(sz01);
+ sz02 = vec01.size();
+ test &= sz01 == sz02;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector_ctor.cc b/libstdc++-v3/testsuite/23_containers/vector_ctor.cc
new file mode 100644
index 00000000000..204ab55286e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector_ctor.cc
@@ -0,0 +1,64 @@
+// 1999-06-29
+// bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 23.2.4.1 vector constructors, copy, and assignment
+
+#include <vector>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+template<typename T>
+ struct A { };
+
+struct B { };
+
+bool test01()
+{
+
+ // 1
+ bool test = true;
+ std::vector< A<B> > vec01;
+ std::vector< A<B> > vec02(5);
+ typedef std::vector< A<B> >::size_type size_type;
+
+ vec01 = vec02;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// 2
+template class std::vector<double>;
+template class std::vector< A<B> >;
+
+int main()
+{
+ test01();
+
+ return 0;
+}
+
+
+
diff --git a/libstdc++-v3/testsuite/23_containers/vector_modifiers.cc b/libstdc++-v3/testsuite/23_containers/vector_modifiers.cc
new file mode 100644
index 00000000000..b72d749c503
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector_modifiers.cc
@@ -0,0 +1,71 @@
+// 1999-11-09 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 23.2.4.3 vector modifiers
+
+#include <vector>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+template<typename T>
+ struct A { };
+
+struct B { };
+
+// vector::insert(iterator, inputiterator first, inputiterator last)
+bool test01()
+{
+ bool test = true;
+
+ // POD types
+ typedef std::vector<int> vec_POD;
+ vec_POD vec01;
+ int i01 = 5;
+ int* pi01 = &i01;
+ vec01.insert(vec01.begin(), pi01, pi01 + 1);
+
+ // non POD types
+ typedef std::vector< A<B> > vec_nonPOD;
+ vec_nonPOD vec02;
+ A<B> np01;
+ A<B>* pnp01 = &np01;
+ vec02.insert(vec02.begin(), pnp01, pnp01 + 1);
+
+ // Test that assign compiles.
+ vec01.assign (pi01, pi01 + 1);
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator.cc b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator.cc
new file mode 100644
index 00000000000..6338015d365
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator.cc
@@ -0,0 +1,127 @@
+// 1999-06-28 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 24.5.3 template class istreambuf_iterator
+
+#include <sstream>
+#include <iterator>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+
+ typedef std::istreambuf_iterator<char> cistreambuf_iter;
+ typedef cistreambuf_iter::streambuf_type cstreambuf_type;
+ bool test = true;
+ const char slit01[] = "playa hermosa, liberia, guanacaste";
+ std::string str01(slit01);
+ std::istringstream istrs00(str01);
+ std::istringstream istrs01(str01);
+
+ // ctor sanity checks
+ cistreambuf_iter istrb_it01(istrs00);
+ cistreambuf_iter istrb_it02;
+ std::string tmp(istrb_it01, istrb_it02);
+ test &= tmp == str01;
+
+ cistreambuf_iter istrb_it03(0);
+ cistreambuf_iter istrb_it04;
+ test &= istrb_it03 == istrb_it04;
+
+ cistreambuf_iter istrb_it05(istrs01);
+ cistreambuf_iter istrb_it06(istrs01.rdbuf());
+ test &= istrb_it05 == istrb_it06;
+
+ // bool equal(istreambuf_iter& b)
+ cistreambuf_iter istrb_it07(0);
+ cistreambuf_iter istrb_it08;
+ test &= istrb_it07.equal(istrb_it08);
+ cistreambuf_iter istrb_it09(0);
+ cistreambuf_iter istrb_it10;
+ test &= istrb_it10.equal(istrb_it09);
+
+ cistreambuf_iter istrb_it11(istrs01);
+ cistreambuf_iter istrb_it12(istrs01.rdbuf());
+ test &= istrb_it11.equal(istrb_it12);
+ cistreambuf_iter istrb_it13(istrs01);
+ cistreambuf_iter istrb_it14(istrs01.rdbuf());
+ test &= istrb_it14.equal(istrb_it13);
+
+ cistreambuf_iter istrb_it15(istrs01);
+ cistreambuf_iter istrb_it16;
+ test &= !(istrb_it15.equal(istrb_it16));
+ cistreambuf_iter istrb_it17(istrs01);
+ cistreambuf_iter istrb_it18;
+ test &= !(istrb_it18.equal(istrb_it17));
+
+ // bool operator==(const istreambuf_iterator&a, const istreambuf_iterator& b)
+ // bool operator!=(const istreambuf_iterator&a, const istreambuf_iterator& b)
+ cistreambuf_iter istrb_it19(0);
+ cistreambuf_iter istrb_it20;
+ test &= istrb_it19 == istrb_it20;
+
+ cistreambuf_iter istrb_it21(istrs01);
+ cistreambuf_iter istrb_it22(istrs01.rdbuf());
+ test &= istrb_it22 == istrb_it21;
+
+ cistreambuf_iter istrb_it23(istrs01);
+ cistreambuf_iter istrb_it24;
+ test &= istrb_it23 != istrb_it24;
+
+ cistreambuf_iter istrb_it25(0);
+ cistreambuf_iter istrb_it26(istrs01.rdbuf());
+ test &= istrb_it25 != istrb_it26;
+
+ // charT operator*() const
+ // istreambuf_iterator& operator++();
+ // istreambuf_iterator& operator++(int);
+ cistreambuf_iter istrb_it27(istrs01.rdbuf());
+ char c;
+ for (int i = 0; i < sizeof(slit01) - 2; ++i)
+ {
+ c = *istrb_it27++;
+ test &= c == slit01[i];
+ }
+
+ std::istringstream istrs02(str01);
+ cistreambuf_iter istrb_it28(istrs02);
+ for (int i = 0; i < sizeof(slit01) - 3;)
+ {
+ c = *++istrb_it28;
+ test &= c == slit01[++i];
+ }
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/24_iterators/iterator.cc b/libstdc++-v3/testsuite/24_iterators/iterator.cc
new file mode 100644
index 00000000000..fe60704fd77
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/iterator.cc
@@ -0,0 +1,599 @@
+// 24.1.5 Random accesss iterators
+// 24.3.1 Iterator traits
+// (basic_string and vector implementations)
+//
+// Copyright (C) 1999 Philip Martin
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program 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 program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA
+
+
+#include <string>
+#include <vector>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+int string_stuff()
+{
+ int failures(0);
+
+ std::string s("abcde");
+
+ std::string::iterator i1(s.begin());
+ if (*i1 != 'a')
+ ++failures;
+
+ ++i1;
+ if (*i1 != 'b')
+ ++failures;
+
+ if (*i1++ != 'b')
+ ++failures;
+ if (*i1 != 'c')
+ ++failures;
+
+ ++ ++i1;
+ if (*i1 != 'e')
+ ++failures;
+
+ --i1;
+ if (*i1 != 'd')
+ ++failures;
+
+ if (*i1-- != 'd')
+ ++failures;
+ if (*i1 != 'c')
+ ++failures;
+
+ -- --i1;
+ if (*i1 != 'a')
+ ++failures;
+
+ std::string::iterator i2;
+ i2 = s.end();
+ std::iterator_traits<std::string::iterator>::difference_type d1;
+ d1 = i2 - i1;
+ if (d1 != 5)
+ ++failures;
+
+ std::iterator_traits<std::string::iterator>::value_type v1;
+ v1 = i1[0];
+ if (v1 != 'a')
+ ++failures;
+
+ std::iterator_traits<std::string::iterator>::reference r1(i1[0]);
+ if (r1 != 'a')
+ ++failures;
+ r1 = 'x';
+ if (r1 != 'x')
+ ++failures;
+ r1 = 'a';
+
+ if ((i1 != i2) != true)
+ ++failures;
+ if ((i1 == i2) != false)
+ ++failures;
+ if ((i1 < i2) != true)
+ ++failures;
+ if ((i1 > i2) != false)
+ ++failures;
+ if ((i1 <= i2) != true)
+ ++failures;
+ if ((i1 >= i2) != false)
+ ++failures;
+
+ std::string::iterator i3;
+ i3 = i1;
+ if ((i3 == i1) != true)
+ ++failures;
+
+ i3 += 5;
+ if ((i3 == i2) != true)
+ ++failures;
+
+ i3 -= 5;
+ if ((i3 == i1) != true)
+ ++failures;
+
+ if (i3 + 5 != i2)
+ ++failures;
+
+ if (5 + i3 != i2)
+ ++failures;
+
+ if (i2 - 5 != i3)
+ ++failures;
+
+ if (i1[0] != 'a')
+ ++failures;
+
+ i1[4] = 'x';
+ if (i2[-1] != 'x')
+ ++failures;
+ i1[4] = 'e';
+
+ i1[2] = 'x';
+ if (i2[-3] != 'x')
+ ++failures;
+ i1[2] = 'c';
+
+ std::string::const_iterator ci1(s.begin());
+ if (*ci1 != 'a')
+ ++failures;
+
+ ++ci1;
+ if (*ci1 != 'b')
+ ++failures;
+
+ if (*ci1++ != 'b')
+ ++failures;
+ if (*ci1 != 'c')
+ ++failures;
+
+ ++ ++ci1;
+ if (*ci1 != 'e')
+ ++failures;
+
+ --ci1;
+ if (*ci1 != 'd')
+ ++failures;
+
+ if (*ci1-- != 'd')
+ ++failures;
+ if (*ci1 != 'c')
+ ++failures;
+
+ -- --ci1;
+ if (*ci1 != 'a')
+ ++failures;
+
+ std::string::const_iterator ci2;
+ ci2 = s.end();
+ std::iterator_traits<std::string::const_iterator>::difference_type d2;
+ d2 = ci2 - ci1;
+ if (d2 != 5)
+ ++failures;
+
+ std::iterator_traits<std::string::const_iterator>::value_type v2;
+ v2 = ci1[0];
+ if (v2 != 'a')
+ ++failures;
+
+ std::iterator_traits<std::string::const_iterator>::reference r2(ci1[0]);
+ if (r2 != 'a')
+ ++failures;
+
+ if ((ci1 != ci2) != true)
+ ++failures;
+ if ((ci1 == ci2) != false)
+ ++failures;
+ if ((ci1 < ci2) != true)
+ ++failures;
+ if ((ci1 > ci2) != false)
+ ++failures;
+ if ((ci1 <= ci2) != true)
+ ++failures;
+ if ((ci1 >= ci2) != false)
+ ++failures;
+
+ std::string::const_iterator ci3;
+ ci3 = ci1;
+ if ((ci3 == ci1) != true)
+ ++failures;
+
+ ci3 += 5;
+ if ((ci3 == ci2) != true)
+ ++failures;
+
+ ci3 -= 5;
+ if ((ci3 == ci1) != true)
+ ++failures;
+
+ if (ci3 + 5 != ci2)
+ ++failures;
+
+ if (5 + ci3 != ci2)
+ ++failures;
+
+ if (ci2 - 5 != ci3)
+ ++failures;
+
+ if (ci1[2] != 'c')
+ ++failures;
+
+ if (ci2[-1] != 'e')
+ ++failures;
+
+ // iterator and const_iterator
+ std::string::const_iterator ci4(i1);
+ if ((ci4 == i1) != true)
+ ++failures;
+ if ((ci4 != i1) != false)
+ ++failures;
+ if ((ci4 < i1) != false)
+ ++failures;
+ if ((ci4 > i1) != false)
+ ++failures;
+ if ((ci4 <= i1) != true)
+ ++failures;
+ if ((ci4 >= i1) != true)
+ ++failures;
+ ci4 = i2;
+ if ((i2 == ci4) != true)
+ ++failures;
+ if ((i2 < ci4) != false)
+ ++failures;
+ if ((i2 > ci4) != false)
+ ++failures;
+ if ((i2 <= ci4) != true)
+ ++failures;
+ if ((i2 >= ci4) != true)
+ ++failures;
+
+ const std::string cs("ABCDE");
+ std::string::const_iterator ci5(cs.begin());
+ if (ci5[0] != 'A')
+ ++failures;
+
+ return failures;
+}
+
+int vector_stuff()
+{
+ int failures(0);
+
+ std::vector<int> v;
+ v.push_back(int(1));
+ v.push_back(int(2));
+ v.push_back(int(3));
+ v.push_back(int(4));
+ v.push_back(int(5));
+
+ std::vector<int>::iterator i1(v.begin());
+ if (*i1 != 1)
+ ++failures;
+
+ ++i1;
+ if (*i1 != 2)
+ ++failures;
+
+ if (*i1++ != 2)
+ ++failures;
+ if (*i1 != 3)
+ ++failures;
+
+ ++ ++i1;
+ if (*i1 != 5)
+ ++failures;
+
+ --i1;
+ if (*i1 != 4)
+ ++failures;
+
+ if (*i1-- != 4)
+ ++failures;
+ if (*i1 != 3)
+ ++failures;
+
+ -- --i1;
+ if (*i1 != 1)
+ ++failures;
+
+ std::vector<int>::iterator i2;
+ i2 = v.end();
+ std::iterator_traits<std::vector<int>::iterator>::difference_type d1;
+ d1 = i2 - i1;
+ if (d1 != 5)
+ ++failures;
+
+ std::iterator_traits<std::vector<int>::iterator>::value_type v1;
+ v1 = i1[0];
+ if (v1 != 1)
+ ++failures;
+
+ std::iterator_traits<std::vector<int>::iterator>::reference r1(i1[0]);
+ if (r1 != 1)
+ ++failures;
+ r1 = 9;
+ if (r1 != 9)
+ ++failures;
+ r1 = 1;
+
+ if ((i1 != i2) != true)
+ ++failures;
+ if ((i1 == i2) != false)
+ ++failures;
+ if ((i1 < i2) != true)
+ ++failures;
+ if ((i1 > i2) != false)
+ ++failures;
+ if ((i1 <= i2) != true)
+ ++failures;
+ if ((i1 >= i2) != false)
+ ++failures;
+
+ std::vector<int>::iterator i3;
+ i3 = i1;
+ if ((i3 == i1) != true)
+ ++failures;
+
+ i3 += 5;
+ if ((i3 == i2) != true)
+ ++failures;
+
+ i3 -= 5;
+ if ((i3 == i1) != true)
+ ++failures;
+
+ if (i3 + 5 != i2)
+ ++failures;
+
+ if (5 + i3 != i2)
+ ++failures;
+
+ if (i2 - 5 != i3)
+ ++failures;
+
+ if (i1[0] != 1)
+ ++failures;
+
+ i1[4] = 9;
+ if (i2[-1] != 9)
+ ++failures;
+ i1[4] = 5;
+
+ i1[2] = 9;
+ if (i2[-3] != 9)
+ ++failures;
+ i1[2] = 3;
+
+ std::vector<int>::const_iterator ci1(v.begin());
+ if (*ci1 != 1)
+ ++failures;
+
+ ++ci1;
+ if (*ci1 != 2)
+ ++failures;
+
+ if (*ci1++ != 2)
+ ++failures;
+ if (*ci1 != 3)
+ ++failures;
+
+ ++ ++ci1;
+ if (*ci1 != 5)
+ ++failures;
+
+ --ci1;
+ if (*ci1 != 4)
+ ++failures;
+
+ if (*ci1-- != 4)
+ ++failures;
+ if (*ci1 != 3)
+ ++failures;
+
+ -- --ci1;
+ if (*ci1 != 1)
+ ++failures;
+
+ std::vector<int>::const_iterator ci2;
+ ci2 = v.end();
+ std::iterator_traits<std::vector<int>::const_iterator>::difference_type d2;
+ d2 = ci2 - ci1;
+ if (d2 != 5)
+ ++failures;
+
+ std::iterator_traits<std::vector<int>::const_iterator>::value_type v2;
+ v2 = ci1[0];
+ if (v2 != 1)
+ ++failures;
+
+ std::iterator_traits<std::vector<int>::const_iterator>::reference
+ r2(ci1[0]);
+ if (r2 != 1)
+ ++failures;
+
+ if ((ci1 != ci2) != true)
+ ++failures;
+ if ((ci1 == ci2) != false)
+ ++failures;
+ if ((ci1 < ci2) != true)
+ ++failures;
+ if ((ci1 > ci2) != false)
+ ++failures;
+ if ((ci1 <= ci2) != true)
+ ++failures;
+ if ((ci1 >= ci2) != false)
+ ++failures;
+
+ std::vector<int>::const_iterator ci3;
+ ci3 = ci1;
+ if ((ci3 == ci1) != true)
+ ++failures;
+
+ ci3 += 5;
+ if ((ci3 == ci2) != true)
+ ++failures;
+
+ ci3 -= 5;
+ if ((ci3 == ci1) != true)
+ ++failures;
+
+ if (ci3 + 5 != ci2)
+ ++failures;
+
+ if (5 + ci3 != ci2)
+ ++failures;
+
+ if (ci2 - 5 != ci3)
+ ++failures;
+
+ if (ci1[2] != 3)
+ ++failures;
+
+ if (ci2[-1] != 5)
+ ++failures;
+
+ // iterator to const_iterator
+ std::vector<int>::const_iterator ci4(i1);
+ if ((ci4 == i1) != true)
+ ++failures;
+ if ((ci4 != i1) != false)
+ ++failures;
+ if ((ci4 < i1) != false)
+ ++failures;
+ if ((ci4 > i1) != false)
+ ++failures;
+ if ((ci4 <= i1) != true)
+ ++failures;
+ if ((ci4 >= i1) != true)
+ ++failures;
+ ci4 = i2;
+ if ((i2 == ci4) != true)
+ ++failures;
+ if ((i2 < ci4) != false)
+ ++failures;
+ if ((i2 > ci4) != false)
+ ++failures;
+ if ((i2 <= ci4) != true)
+ ++failures;
+ if ((i2 >= ci4) != true)
+ ++failures;
+
+ const std::vector<int> cv(v);
+ std::vector<int>::const_iterator ci5(cv.begin());
+ if (ci5[0] != 1)
+ ++failures;
+
+ std::vector<std::string> vs;
+ vs.push_back(std::string("abc"));
+ std::vector<std::string>::iterator ivs(vs.begin());
+ if (ivs->c_str()[1] != 'b')
+ ++failures;
+
+ return failures;
+}
+
+int reverse_stuff()
+{
+ int failures(0);
+
+ std::string s("abcde");
+
+ std::string::reverse_iterator ri(s.rbegin());
+ if (*ri != 'e')
+ ++failures;
+
+ std::iterator_traits<std::string::reverse_iterator>::difference_type d;
+ d = s.rend() - ri;
+ if (d != 5)
+ ++failures;
+
+ const std::string cs("abcde");
+ std::string::const_reverse_iterator cri(cs.rend());
+ if (cri - 5 != cs.rbegin())
+ ++failures;
+
+ return failures;
+}
+
+// the following should be compiler errors
+// flag runtime errors in case they slip through the compiler
+int wrong_stuff()
+{
+ int failures(0);
+
+#ifdef ITER24_F1
+ extern void f(std::vector<std::string*>::iterator);
+ std::vector<std::string*> vs[2];
+ f(vs); // address of array is not an iterator
+ failures++;
+#endif
+
+#ifdef ITER24_F2
+ std::string s;
+ char *i = s.begin(); // begin() doesn't return a pointer
+ failures++;
+#endif
+
+#ifdef ITER24_F3
+ std::string::const_iterator ci;
+ std::string::iterator i;
+ if (i - ci) // remove const_ is a warning
+ i++;
+ // failures++; only a warning
+#endif
+
+#ifdef ITER24_F4
+ std::vector<char>::iterator iv;
+ std::string::iterator is(iv);// vector<char> is not string
+ failures++;
+#endif
+
+#ifdef ITER24_F5
+ std::vector<char>::iterator iv;
+ std::string::iterator is;
+ if (iv == is) // vector<char> is not string
+ ++iv;
+ failures++;
+#endif
+
+#ifdef ITER24_F6
+ std::vector<char>::const_iterator ci;
+ std::vector<char>::iterator i = ci; // remove const_ is a warning
+ ++i;
+ // failures++; only a warning
+#endif
+
+#ifdef ITER24_F7
+ std::vector<int> v(1);
+ std::vector<int>::const_iterator ci(v.begin());
+ *ci = 1; // cannot assign through const_iterator
+ failures++;
+#endif
+
+#ifdef ITER24_F8
+ std::vector<const int> v(1);
+ std::vector<const int>::reference r(v.begin()[0]);
+ r = 1; // cannot assign through reference to const
+ failures++;
+#endif
+
+ return failures;
+}
+
+int main(int argc, char **argv)
+{
+ int failures(0);
+
+ failures += string_stuff();
+
+ failures += vector_stuff();
+
+ failures += reverse_stuff();
+
+ failures += wrong_stuff();
+
+#ifdef DEBUG_ASSERT
+ assert (failures == 0);
+#endif
+
+ return failures ? 1 : 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/25_algorithms/min_max.cc b/libstdc++-v3/testsuite/25_algorithms/min_max.cc
new file mode 100644
index 00000000000..a5219bf80b1
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/min_max.cc
@@ -0,0 +1,51 @@
+// 2000-03-29 sss/bkoz
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <algorithm>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+void test01()
+{
+ bool test = true;
+ const int& x = std::max(1, 2);
+ const int& y = std::max(3, 4);
+ test &= x == 2;
+ test &= y == 4;
+
+ const int& z = std::min(1, 2);
+ const int& w = std::min(3, 4);
+ test &= z == 1;
+ test &= w == 3;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
+
+
diff --git a/libstdc++-v3/testsuite/26_numerics/binary_closure.cc b/libstdc++-v3/testsuite/26_numerics/binary_closure.cc
new file mode 100644
index 00000000000..f670d4ac3c8
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/binary_closure.cc
@@ -0,0 +1,36 @@
+// 19990805 gdr
+//
+// XXX: to impove later.
+// Origin: Andreas Amann <amann@physik.tu-berlin.de>
+// CXXFLAGS: -g
+
+#include <iostream>
+#include <valarray>
+
+
+int main()
+{
+ std::valarray<double> a(10), b(10), c(10), d(10);
+
+ a = 1.2;
+ b = 3.1;
+
+ c = 4.0;
+
+ d = ( 2.0 * b + a ); // works
+ std::cout << "d[4] = " << d[4] << std::endl;
+
+ d = (a * 2.0 + b ); // works
+ std::cout << "d[4] = " << d[4] << std::endl;
+
+ d = (a + b * 2.0 ); // segfaults!
+ std::cout << "d[4] = " << d[4] << std::endl;
+ d = (a + 2.0* b );
+
+ std::cout << "d[4] = " << d[4] << std::endl;
+ d = (a + 2.0* b );
+ std::cout << "d[4] = " << d[4] << std::endl;
+ d = (a + 2.0* b );
+
+ std::cout << "d[4] = " << d[4] << std::endl;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/buggy_complex.cc b/libstdc++-v3/testsuite/26_numerics/buggy_complex.cc
new file mode 100644
index 00000000000..ebe8e98bdb8
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/buggy_complex.cc
@@ -0,0 +1,37 @@
+// 2000-02-09
+// Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+
+// Test buggy builtin GNU __complex__ support. This used to cause
+// an ICE on some 64-bits plateforms.
+// Origin: petter@matfys.lth.se
+
+#include <complex>
+
+int main()
+{
+ std::complex<double> a(9), b(0, 8), c;
+
+ c = a * b;
+
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/26_numerics/c_math.cc b/libstdc++-v3/testsuite/26_numerics/c_math.cc
new file mode 100644
index 00000000000..0ccdd3f7186
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/c_math.cc
@@ -0,0 +1,61 @@
+// 1999-06-05
+// Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+// Copyright (C) 2000, 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <cmath>
+#include <cassert>
+
+// test compilation.
+void test01()
+{
+ float a = 1.f;
+ float b;
+ std::modf(a, &b);
+}
+
+// need more extravagant checks than this, of course, but this used to core...
+void test02()
+{
+ sin(static_cast<float>(0));
+}
+
+// as did this.
+void test03()
+{
+ double powtest = pow(2., 0);
+}
+
+// this used to abort.
+void test04()
+{
+ float x[2] = {1, 2};
+ float y = 3.4;
+ std::modf(y, &x[0]);
+ assert (x[1] == 2);
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc b/libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc
new file mode 100644
index 00000000000..d827e1b5f86
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc
@@ -0,0 +1,95 @@
+// 2000-02-10
+// Petter Urkedal <petter@matfys.lth.se>
+
+// Copyright (C) 2000 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <complex>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+template<typename R>
+inline bool flteq(R x, R y)
+{
+ if (x == R(0)) return y == R(0);
+ else return fabs(x-y) < 1e-6*fabs(x);
+}
+
+template<typename R>
+void test_good(std::string str, R x, R y)
+{
+ bool test = true;
+ std::complex<R> z;
+ char ch;
+ std::istringstream iss(str);
+ iss >> z >> ch;
+ test &= iss.good();
+ test &= flteq(z.real(), x);
+ test &= flteq(z.imag(), y);
+ test &= ch == '#';
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+template<typename R>
+void test_fail(std::string str)
+{
+ std::complex<R> z;
+ std::istringstream iss(str);
+ iss >> z;
+#ifdef DEBUG_ASSERT
+ assert(iss.fail() && !iss.bad());
+#endif
+}
+
+template<typename R>
+int testall()
+{
+ test_good<R>("(-1.1,3.7)#", -1.1, 3.7);
+ test_good<R>("( .7e6 , \n-3.1)#", .7e6, -3.1);
+ test_good<R>("(\t0,-1)#", 0.0, -1.0);
+ test_good<R>("(-3.14)#", -3.14, 0.0);
+ test_good<R>("-.1#", -.1, 0.0);
+ test_good<R>(" ( -2.7e3 )#", -2.7e3, 0.0);
+ test_good<R>(" -.1#", -.1, 0.0);
+ test_fail<R>("(a,1)");
+ test_fail<R>("(,1)");
+ test_fail<R>("(1,a)");
+ test_fail<R>("(1, )");
+ test_fail<R>("|1,1)");
+ test_fail<R>("(1|1)");
+ test_fail<R>("(1,1|");
+}
+
+int main()
+{
+ testall<float>();
+ testall<double>();
+ testall<long double>();
+ return 0;
+}
+
+
+
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray.cc b/libstdc++-v3/testsuite/26_numerics/valarray.cc
new file mode 100644
index 00000000000..6ee792a3d17
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray.cc
@@ -0,0 +1,8 @@
+// 19990404 gdr
+
+#include <valarray>
+
+int main()
+{
+ std::valarray<double> a(20);
+}
diff --git a/libstdc++-v3/testsuite/27_io/filebuf-1.tst b/libstdc++-v3/testsuite/27_io/filebuf-1.tst
new file mode 100644
index 00000000000..cb3c57f7dfd
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/filebuf-1.tst
@@ -0,0 +1,158 @@
+// 990117 bkoz
+// test functionality of basic_filebuf for char_type == char
+// this is a data file for 27filebuf.cc
+
+// Copyright (C) 1997-1999 Cygnus Solutions
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+/mnt/cdrom/sarah_vaughan/sarah_vaughan.allofme
+/mnt/cdrom/sarah_vaughan/sarah_vaughan.speaklow
+
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_01_the_way_i_feel
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_02_seduction_kidnap
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_03_just_a_ny_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_04_butterflies_i_remem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_05_luxury_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_06_my_house
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_07_the_women_gather
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_08_the_life_i_led
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_09_when_i_die
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_10_revolutionary_dreams
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_11_winter_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_12_a_certain_peace_i_nap
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_13_poem_for_a_lady_whose
+
+/mnt/cdrom/marley-songs_of_freedom/disk_1/
+/mnt/cdrom/marley-songs_of_freedom/disk_2/
+/mnt/cdrom/marley-songs_of_freedom/disk_4/
+
+/mnt/cdrom/marley-songs_of_freedom/disk_1/back out
+/mnt/cdrom/marley-songs_of_freedom/disk_1/bend down low
+/mnt/cdrom/marley-songs_of_freedom/disk_1/bus dem shut (pyaka)
+/mnt/cdrom/marley-songs_of_freedom/disk_1/caution
+/mnt/cdrom/marley-songs_of_freedom/disk_1/do it twice
+/mnt/cdrom/marley-songs_of_freedom/disk_1/don't rock the boat
+/mnt/cdrom/marley-songs_of_freedom/disk_1/duppy conqueror
+/mnt/cdrom/marley-songs_of_freedom/disk_1/hammer
+/mnt/cdrom/marley-songs_of_freedom/disk_1/hypocrites
+/mnt/cdrom/marley-songs_of_freedom/disk_1/i'm still waiting
+/mnt/cdrom/marley-songs_of_freedom/disk_1/judge not
+/mnt/cdrom/marley-songs_of_freedom/disk_1/mellow mood
+/mnt/cdrom/marley-songs_of_freedom/disk_1/mr brown
+/mnt/cdrom/marley-songs_of_freedom/disk_1/nice time
+/mnt/cdrom/marley-songs_of_freedom/disk_1/one cup of coffee
+/mnt/cdrom/marley-songs_of_freedom/disk_1/one love_people get ready
+/mnt/cdrom/marley-songs_of_freedom/disk_1/put it on
+/mnt/cdrom/marley-songs_of_freedom/disk_1/simmer down
+/mnt/cdrom/marley-songs_of_freedom/disk_1/small axe
+/mnt/cdrom/marley-songs_of_freedom/disk_1/soul rebel
+/mnt/cdrom/marley-songs_of_freedom/disk_1/soul shake down party
+/mnt/cdrom/marley-songs_of_freedom/disk_1/stir it up (original)
+/mnt/cdrom/marley-songs_of_freedom/disk_1/sun is shining
+/mnt/cdrom/marley-songs_of_freedom/disk_1/thank you lord (original)
+/mnt/cdrom/marley-songs_of_freedom/disk_2/acoustic medley
+/mnt/cdrom/marley-songs_of_freedom/disk_2/burnin' and lootin'
+/mnt/cdrom/marley-songs_of_freedom/disk_2/concrete jungle
+/mnt/cdrom/marley-songs_of_freedom/disk_2/craven choke puppy
+/mnt/cdrom/marley-songs_of_freedom/disk_2/get up stand up
+/mnt/cdrom/marley-songs_of_freedom/disk_2/guava jelly
+/mnt/cdrom/marley-songs_of_freedom/disk_2/high tide or low tide
+/mnt/cdrom/marley-songs_of_freedom/disk_2/i shot the sheriff
+/mnt/cdrom/marley-songs_of_freedom/disk_2/i'm hurting inside
+/mnt/cdrom/marley-songs_of_freedom/disk_2/iron lion zion
+/mnt/cdrom/marley-songs_of_freedom/disk_2/lick samba
+/mnt/cdrom/marley-songs_of_freedom/disk_2/lively up yourself
+/mnt/cdrom/marley-songs_of_freedom/disk_2/natty dread
+/mnt/cdrom/marley-songs_of_freedom/disk_2/no more trouble
+/mnt/cdrom/marley-songs_of_freedom/disk_2/rastaman chant
+/mnt/cdrom/marley-songs_of_freedom/disk_2/screw face
+/mnt/cdrom/marley-songs_of_freedom/disk_2/slave driver
+/mnt/cdrom/marley-songs_of_freedom/disk_2/trenchtown rock
+/mnt/cdrom/marley-songs_of_freedom/disk_4/africa unite
+/mnt/cdrom/marley-songs_of_freedom/disk_4/babylon system
+/mnt/cdrom/marley-songs_of_freedom/disk_4/bad card
+/mnt/cdrom/marley-songs_of_freedom/disk_4/coming in from the cold (12
+/mnt/cdrom/marley-songs_of_freedom/disk_4/could you be loved (12 mix
+/mnt/cdrom/marley-songs_of_freedom/disk_4/forever loving jah
+/mnt/cdrom/marley-songs_of_freedom/disk_4/give thanks and praise
+/mnt/cdrom/marley-songs_of_freedom/disk_4/one drop
+/mnt/cdrom/marley-songs_of_freedom/disk_4/one dub
+/mnt/cdrom/marley-songs_of_freedom/disk_4/rastaman live up
+/mnt/cdrom/marley-songs_of_freedom/disk_4/real situation
+/mnt/cdrom/marley-songs_of_freedom/disk_4/redemption song (live in pi
+/mnt/cdrom/marley-songs_of_freedom/disk_4/ride natty ride (12 mix)
+/mnt/cdrom/marley-songs_of_freedom/disk_4/so much trouble in the worl
+/mnt/cdrom/marley-songs_of_freedom/disk_4/survival
+/mnt/cdrom/marley-songs_of_freedom/disk_4/why should i (previously un
+/mnt/cdrom/marley-songs_of_freedom/disk_4/zimbabwe
+
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_01_pandemonium
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_02_sync_disjecta
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_03_object_unknown
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_04_it's_nice_not
+/mnt/cdrom/dj_spooky_rid-2dim_warefare/djspooky_05_dialectical_tra
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_06_post-human_soph
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_07_quilombo_ex
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_08_rekonstruction
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_09_scientifik
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_10_a_conversation
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_11_peace_in_zaire
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_13_degree_zero
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_14_roman_planeta
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_15_bass_digitalis
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_16_polyphony_of
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_17_riddim_warfare
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_18_the_nerd
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_20_theme_of_the
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_21_twilight_fugue
+
+/mnt/cdrom/stuff_smith_mosaic/disk3/01_desert_sands
+/mnt/cdrom/stuff_smith_mosaic/disk3/02_soft_winds
+/mnt/cdrom/stuff_smith_mosaic/disk3/03_time_and_again
+/mnt/cdrom/stuff_smith_mosaic/disk3/04_it_don't_mean_a_thing
+/mnt/cdrom/stuff_smith_mosaic/disk3/05_in_a_mellotone
+/mnt/cdrom/stuff_smith_mosaic/disk3/06_i_know_that_you_know
+/mnt/cdrom/stuff_smith_mosaic/disk3/07_heat_wave
+/mnt/cdrom/stuff_smith_mosaic/disk3/08_things_ain't_what_they_used_to_be
+/mnt/cdrom/stuff_smith_mosaic/disk3/09_body_and_soul
+
+So I take a break, wander down to the park to stand, then lean into
+the concrete railing demarking the beginnings of space, oceanic
+space. I watch the waves break, and form, and ease back out to sea and
+wrap my arms around myself and hug tightly because it's early in the
+morning and windy, and the sun is late getting out of bed today, which
+is good because if there was brilliant light illuminating all the
+beauty around me I would be shocked, stunned, forced to retreat back
+into my cabana in a daze, blinded by hummingbirds and callilillies and
+un-named red, yellow, and blue flowers. Green envelopes me, waves
+sooth me. I can see the wind flip the top of the waves seaward, right
+before they break. The sea seems so calm from my perch above the fray
+that I wonder if maybe there is just some part of the deepest, most
+abstract ocean where there is a large creature who happily chews
+plankton and wags its tail in gentle, adulating waves that spread and
+move and gracefully glide thousands of miles, to crash upon a beach,
+one after the other, politely waiting for a turn to dance with the
+seashore.
+
+I know: it is what the Mexican schoolchildren call "la vibora de la
+mer," the serpent of the sea.
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/filebuf-1.txt b/libstdc++-v3/testsuite/27_io/filebuf-1.txt
new file mode 100644
index 00000000000..cb3c57f7dfd
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/filebuf-1.txt
@@ -0,0 +1,158 @@
+// 990117 bkoz
+// test functionality of basic_filebuf for char_type == char
+// this is a data file for 27filebuf.cc
+
+// Copyright (C) 1997-1999 Cygnus Solutions
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+/mnt/cdrom/sarah_vaughan/sarah_vaughan.allofme
+/mnt/cdrom/sarah_vaughan/sarah_vaughan.speaklow
+
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_01_the_way_i_feel
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_02_seduction_kidnap
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_03_just_a_ny_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_04_butterflies_i_remem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_05_luxury_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_06_my_house
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_07_the_women_gather
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_08_the_life_i_led
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_09_when_i_die
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_10_revolutionary_dreams
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_11_winter_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_12_a_certain_peace_i_nap
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_13_poem_for_a_lady_whose
+
+/mnt/cdrom/marley-songs_of_freedom/disk_1/
+/mnt/cdrom/marley-songs_of_freedom/disk_2/
+/mnt/cdrom/marley-songs_of_freedom/disk_4/
+
+/mnt/cdrom/marley-songs_of_freedom/disk_1/back out
+/mnt/cdrom/marley-songs_of_freedom/disk_1/bend down low
+/mnt/cdrom/marley-songs_of_freedom/disk_1/bus dem shut (pyaka)
+/mnt/cdrom/marley-songs_of_freedom/disk_1/caution
+/mnt/cdrom/marley-songs_of_freedom/disk_1/do it twice
+/mnt/cdrom/marley-songs_of_freedom/disk_1/don't rock the boat
+/mnt/cdrom/marley-songs_of_freedom/disk_1/duppy conqueror
+/mnt/cdrom/marley-songs_of_freedom/disk_1/hammer
+/mnt/cdrom/marley-songs_of_freedom/disk_1/hypocrites
+/mnt/cdrom/marley-songs_of_freedom/disk_1/i'm still waiting
+/mnt/cdrom/marley-songs_of_freedom/disk_1/judge not
+/mnt/cdrom/marley-songs_of_freedom/disk_1/mellow mood
+/mnt/cdrom/marley-songs_of_freedom/disk_1/mr brown
+/mnt/cdrom/marley-songs_of_freedom/disk_1/nice time
+/mnt/cdrom/marley-songs_of_freedom/disk_1/one cup of coffee
+/mnt/cdrom/marley-songs_of_freedom/disk_1/one love_people get ready
+/mnt/cdrom/marley-songs_of_freedom/disk_1/put it on
+/mnt/cdrom/marley-songs_of_freedom/disk_1/simmer down
+/mnt/cdrom/marley-songs_of_freedom/disk_1/small axe
+/mnt/cdrom/marley-songs_of_freedom/disk_1/soul rebel
+/mnt/cdrom/marley-songs_of_freedom/disk_1/soul shake down party
+/mnt/cdrom/marley-songs_of_freedom/disk_1/stir it up (original)
+/mnt/cdrom/marley-songs_of_freedom/disk_1/sun is shining
+/mnt/cdrom/marley-songs_of_freedom/disk_1/thank you lord (original)
+/mnt/cdrom/marley-songs_of_freedom/disk_2/acoustic medley
+/mnt/cdrom/marley-songs_of_freedom/disk_2/burnin' and lootin'
+/mnt/cdrom/marley-songs_of_freedom/disk_2/concrete jungle
+/mnt/cdrom/marley-songs_of_freedom/disk_2/craven choke puppy
+/mnt/cdrom/marley-songs_of_freedom/disk_2/get up stand up
+/mnt/cdrom/marley-songs_of_freedom/disk_2/guava jelly
+/mnt/cdrom/marley-songs_of_freedom/disk_2/high tide or low tide
+/mnt/cdrom/marley-songs_of_freedom/disk_2/i shot the sheriff
+/mnt/cdrom/marley-songs_of_freedom/disk_2/i'm hurting inside
+/mnt/cdrom/marley-songs_of_freedom/disk_2/iron lion zion
+/mnt/cdrom/marley-songs_of_freedom/disk_2/lick samba
+/mnt/cdrom/marley-songs_of_freedom/disk_2/lively up yourself
+/mnt/cdrom/marley-songs_of_freedom/disk_2/natty dread
+/mnt/cdrom/marley-songs_of_freedom/disk_2/no more trouble
+/mnt/cdrom/marley-songs_of_freedom/disk_2/rastaman chant
+/mnt/cdrom/marley-songs_of_freedom/disk_2/screw face
+/mnt/cdrom/marley-songs_of_freedom/disk_2/slave driver
+/mnt/cdrom/marley-songs_of_freedom/disk_2/trenchtown rock
+/mnt/cdrom/marley-songs_of_freedom/disk_4/africa unite
+/mnt/cdrom/marley-songs_of_freedom/disk_4/babylon system
+/mnt/cdrom/marley-songs_of_freedom/disk_4/bad card
+/mnt/cdrom/marley-songs_of_freedom/disk_4/coming in from the cold (12
+/mnt/cdrom/marley-songs_of_freedom/disk_4/could you be loved (12 mix
+/mnt/cdrom/marley-songs_of_freedom/disk_4/forever loving jah
+/mnt/cdrom/marley-songs_of_freedom/disk_4/give thanks and praise
+/mnt/cdrom/marley-songs_of_freedom/disk_4/one drop
+/mnt/cdrom/marley-songs_of_freedom/disk_4/one dub
+/mnt/cdrom/marley-songs_of_freedom/disk_4/rastaman live up
+/mnt/cdrom/marley-songs_of_freedom/disk_4/real situation
+/mnt/cdrom/marley-songs_of_freedom/disk_4/redemption song (live in pi
+/mnt/cdrom/marley-songs_of_freedom/disk_4/ride natty ride (12 mix)
+/mnt/cdrom/marley-songs_of_freedom/disk_4/so much trouble in the worl
+/mnt/cdrom/marley-songs_of_freedom/disk_4/survival
+/mnt/cdrom/marley-songs_of_freedom/disk_4/why should i (previously un
+/mnt/cdrom/marley-songs_of_freedom/disk_4/zimbabwe
+
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_01_pandemonium
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_02_sync_disjecta
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_03_object_unknown
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_04_it's_nice_not
+/mnt/cdrom/dj_spooky_rid-2dim_warefare/djspooky_05_dialectical_tra
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_06_post-human_soph
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_07_quilombo_ex
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_08_rekonstruction
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_09_scientifik
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_10_a_conversation
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_11_peace_in_zaire
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_13_degree_zero
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_14_roman_planeta
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_15_bass_digitalis
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_16_polyphony_of
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_17_riddim_warfare
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_18_the_nerd
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_20_theme_of_the
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_21_twilight_fugue
+
+/mnt/cdrom/stuff_smith_mosaic/disk3/01_desert_sands
+/mnt/cdrom/stuff_smith_mosaic/disk3/02_soft_winds
+/mnt/cdrom/stuff_smith_mosaic/disk3/03_time_and_again
+/mnt/cdrom/stuff_smith_mosaic/disk3/04_it_don't_mean_a_thing
+/mnt/cdrom/stuff_smith_mosaic/disk3/05_in_a_mellotone
+/mnt/cdrom/stuff_smith_mosaic/disk3/06_i_know_that_you_know
+/mnt/cdrom/stuff_smith_mosaic/disk3/07_heat_wave
+/mnt/cdrom/stuff_smith_mosaic/disk3/08_things_ain't_what_they_used_to_be
+/mnt/cdrom/stuff_smith_mosaic/disk3/09_body_and_soul
+
+So I take a break, wander down to the park to stand, then lean into
+the concrete railing demarking the beginnings of space, oceanic
+space. I watch the waves break, and form, and ease back out to sea and
+wrap my arms around myself and hug tightly because it's early in the
+morning and windy, and the sun is late getting out of bed today, which
+is good because if there was brilliant light illuminating all the
+beauty around me I would be shocked, stunned, forced to retreat back
+into my cabana in a daze, blinded by hummingbirds and callilillies and
+un-named red, yellow, and blue flowers. Green envelopes me, waves
+sooth me. I can see the wind flip the top of the waves seaward, right
+before they break. The sea seems so calm from my perch above the fray
+that I wonder if maybe there is just some part of the deepest, most
+abstract ocean where there is a large creature who happily chews
+plankton and wags its tail in gentle, adulating waves that spread and
+move and gracefully glide thousands of miles, to crash upon a beach,
+one after the other, politely waiting for a turn to dance with the
+seashore.
+
+I know: it is what the Mexican schoolchildren call "la vibora de la
+mer," the serpent of the sea.
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/filebuf-2.tst b/libstdc++-v3/testsuite/27_io/filebuf-2.tst
new file mode 100644
index 00000000000..f25bba46d92
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/filebuf-2.tst
@@ -0,0 +1 @@
+ac23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras23456789:;< \ No newline at end of file
diff --git a/libstdc++-v3/testsuite/27_io/filebuf-3.tst b/libstdc++-v3/testsuite/27_io/filebuf-3.tst
new file mode 100644
index 00000000000..d998eef2330
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/filebuf-3.tst
@@ -0,0 +1,7 @@
+bd2
+456x
+9mzuva?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
+because because
+because. . .
+of the wonderful things he does!!
+ok \ No newline at end of file
diff --git a/libstdc++-v3/testsuite/27_io/filebuf.cc b/libstdc++-v3/testsuite/27_io/filebuf.cc
new file mode 100644
index 00000000000..830e0b1ee58
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/filebuf.cc
@@ -0,0 +1,528 @@
+// 990117 bkoz test functionality of basic_filebuf for char_type == char
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// NB: this test assumes that _M_buf_size == 40, and not the usual
+// buffer_size length of 8092, so that overflow/underflow can be
+// simulated a bit more readily.
+
+#include <fstream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+const char carray_01[] = "santa cruz or sandiego?";
+const char carray_02[] = "memphis, new orleans, and savanah";
+const char name_01[] = "testsuite/filebuf-1.txt"; // file with data in it
+const char name_02[] = "testsuite/filebuf-2.txt"; // empty file, need to create
+const char name_03[] = "testsuite/filebuf-3.txt"; // empty file, need to create
+
+class derived_filebuf: public std::filebuf
+{
+ public:
+ void
+ set_size(int_type __size) { _M_buf_size = __size; }
+};
+
+derived_filebuf fb_01; // in
+derived_filebuf fb_02; // out
+derived_filebuf fb_03; // in | out
+
+const int buffer_size = 8192;
+
+// initialize filebufs to be the same size regardless of platform
+void test00()
+{
+ fb_01.set_size(buffer_size);
+ fb_02.set_size(buffer_size);
+ fb_03.set_size(buffer_size);
+}
+
+// test the filebuf/stringbuf locale settings
+bool test01() {
+ std::locale loc_tmp;
+ loc_tmp = fb_01.getloc();
+ fb_01.pubimbue(loc_tmp); //This should initialize _M_init to true
+ fb_01.getloc(); //This should just return _M_locale
+
+ return true;
+}
+
+
+// test member functions functions
+bool test02() {
+ bool test = true;
+
+ // bool is_open()
+ test &= !fb_01.is_open();
+ test &= !fb_02.is_open();
+ test &= !fb_03.is_open();
+
+ // filebuf_type* open(const char* __s, ios_base::openmode __mode)
+ fb_01.open(name_01, std::ios_base::in | std::ios_base::ate);
+ fb_02.open(name_02, std::ios_base::in | std::ios_base::out | std::ios_base::trunc);
+ // Try to open two different files without closing the first:
+ // Should keep the old file attached, and disregard attempt to overthrow.
+ fb_02.open(name_03, std::ios_base::in | std::ios_base::out);
+ fb_03.open(name_03, std::ios_base::out | std::ios_base::trunc);
+ test &= fb_01.is_open();
+ test &= fb_02.is_open();
+ test &= fb_03.is_open();
+
+ // filebuf_type* close()
+ fb_01.close();
+ fb_02.close();
+ fb_03.close();
+ test &= !fb_01.is_open();
+ test &= !fb_02.is_open();
+ test &= !fb_03.is_open();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+// test overloaded virtual functions
+bool test03() {
+ typedef std::filebuf::int_type int_type;
+ typedef std::filebuf::traits_type traits_type;
+ typedef std::filebuf::pos_type pos_type;
+ typedef std::filebuf::off_type off_type;
+ typedef size_t size_type;
+
+ bool test = true;
+ std::filebuf f_tmp;
+ std::streamsize strmsz_1, strmsz_2;
+ std::streamoff strmof_1, strmof_2;
+ int i = 0, j = 0, k = 0;
+
+ // GET
+ // int showmanyc()
+ // returns an estimate of the numbers of chars in the seq, or -1.
+ // if __retval > 0, then calls to underflow won't return
+ // traits_type::eof() till at least __retval chars.
+ // if __retval == -1, then calls to underflow or uflow will fail.
+ // NB overriding def if it can determine more chars can be read from
+ // the input sequence.
+
+ // int in_avail()
+ // if a read position is available, return _M_in_end - _M_in_cur.
+ // else return showmanyc.
+ strmof_1 = fb_01.in_avail();
+ strmof_2 = fb_02.in_avail();
+ test &= strmof_1 == -1;
+ test &= strmof_1 == strmof_2; //fail because not open
+ strmof_1 = fb_03.in_avail();
+ test &= strmof_1 == strmof_2;
+ fb_01.open(name_01, std::ios_base::in);
+ fb_02.open(name_02, std::ios_base::out | std::ios_base::trunc);
+ fb_03.open(name_03, std::ios_base::out | std::ios_base::in | std::ios_base::trunc);
+ strmof_1 = fb_01.in_avail();
+ strmof_2 = fb_02.in_avail();
+ test &= strmof_1 != strmof_2;
+ test &= strmof_1 >= 0;
+ test &= strmof_2 == -1; // empty file
+ strmof_1 = fb_03.in_avail();
+ test &= strmof_1 == -1; // empty file
+
+ // int_type sbumpc()
+ // if read_cur not avail returns uflow(), else return *read_cur & increment
+ int_type c1 = fb_01.sbumpc();
+ int_type c2 = fb_02.sbumpc();
+ test &= c1 != c2;
+ test &= c1 == '/';
+ test &= c2 == -1;
+ int_type c3 = fb_01.sbumpc();
+ int_type c4 = fb_02.sbumpc();
+ test &= c3 != c4;
+ test &= c1 == c3; // fluke, both happen to be '/'
+ test &= c2 == c4;
+ int_type c5 = fb_03.sbumpc();
+ test &= c5 == traits_type::eof();
+ // XXX should do some kind of test to make sure that internal
+ // buffers point ot the same thing, to check consistancy.
+
+ // int_type sgetc()
+ // if read_cur not avail, return uflow(), else return *read_cur
+ int_type c6 = fb_01.sgetc();
+ int_type c7 = fb_02.sgetc();
+ test &= c6 != c3;
+ test &= c7 == c4; // both -1
+ int_type c8 = fb_01.sgetc();
+ int_type c9 = fb_02.sgetc();
+ test &= c6 == c8;
+ test &= c7 == c9;
+ c5 = fb_03.sgetc();
+ test &= c5 == traits_type::eof();
+
+ // int_type snextc()
+ // calls sbumpc and if sbumpc != eof, return sgetc
+ c6 = fb_01.snextc();
+ c7 = fb_02.snextc();
+ test &= c6 != c8;
+ test &= c7 == c9; // -1
+ test &= c6 == '9';
+ c6 = fb_01.snextc();
+ c7 = fb_02.snextc();
+ test &= c6 != c8;
+ test &= c7 == c9; // -1
+ test &= c6 == '9';
+ c5 = fb_03.snextc();
+ test &= c5 == traits_type::eof();
+
+ // streamsize sgetn(char_type *s, streamsize n)
+ // streamsize xsgetn(char_type *s, streamsize n)
+ // assign up to n chars to s from input sequence, indexing in_cur as
+ // approp and returning the number of chars assigned
+ strmsz_1 = fb_01.in_avail();
+ strmsz_2 = fb_02.in_avail();
+ test = strmsz_1 != strmsz_2;
+ char carray1[13] = "";
+ strmsz_1 = fb_01.sgetn(carray1, 10);
+ char carray2[buffer_size] = "";
+ strmsz_2 = fb_02.sgetn(carray2, 10);
+ test &= strmsz_1 != strmsz_2;
+ test &= strmsz_1 == 10;
+ test &= strmsz_2 == 0;
+ c1 = fb_01.sgetc();
+ c2 = fb_02.sgetc();
+ test &= c1 == '\n';
+ test &= c7 == c2; // n != i
+ strmsz_1 = fb_03.sgetn(carray1, 10);
+ test &= !strmsz_1; //zero
+ strmsz_1 = fb_01.in_avail();
+ strmsz_2 = fb_01.sgetn(carray2, strmsz_1 + 5);
+ test &= strmsz_1 == strmsz_2 - 5;
+ c4 = fb_01.sgetc(); // buffer should have underflowed from above.
+ test &= c4 == 'i';
+ strmsz_1 = fb_01.in_avail();
+ test &= strmsz_1 > 0;
+ strmsz_2 = fb_01.sgetn(carray2, strmsz_1 + 5);
+ test &= strmsz_1 == strmsz_2; //at the end of the actual file
+ strmsz_1 = fb_02.in_avail();
+ strmsz_2 = fb_02.sgetn(carray2, strmsz_1 + 5);
+ test &= strmsz_1 == -1;
+ test &= strmsz_2 == 0;
+ c4 = fb_02.sgetc(); // should be EOF
+ test &= c4 == traits_type::eof();
+
+ // PUT
+ // int_type sputc(char_type c)
+ // if out_cur not avail, return overflow(traits_type::to_int_type(c))
+ // else, stores c at out_cur,
+ // increments out_cur, and returns c as int_type
+ // strmsz_1 = fb_03.in_avail(); // XXX valid for in|out??
+ c1 = fb_02.sputc('a');
+ c2 = fb_03.sputc('b');
+ test &= c1 != c2;
+ c1 = fb_02.sputc('c');
+ c2 = fb_03.sputc('d');
+ test &= c1 != c2;
+ // strmsz_2 = fb_03.in_avail();
+ // test &= strmsz_1 != strmsz_2;
+ for (int i = 50; i <= 90; ++i)
+ c2 = fb_02.sputc(char(i));
+ // 27filebuf-2.txt == ac23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX
+ // fb_02._M_out_cur = '2'
+ strmsz_1 = fb_03.in_avail();
+ for (int i = 50; i <= 90; ++i)
+ c2 = fb_03.sputc(char(i));
+ strmsz_2 = fb_03.in_avail();
+ // test &= strmsz_1 != strmsz_2;
+ // test &= strmsz_1 > 0;
+ // test &= strmsz_2 > 0;
+ // 27filebuf-2.txt == bd23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX
+ // fb_02._M_out_cur = '2'
+ c3 = fb_01.sputc('a'); // should be EOF because this is read-only
+ test &= c3 == traits_type::eof();
+
+ // streamsize sputn(const char_typs* s, streamsize n)
+ // write up to n chars to out_cur from s, returning number assigned
+ // NB *sputn will happily put '\0' into your stream if you give it a chance*
+ strmsz_1 = fb_03.sputn("racadabras", 10);//"abracadabras or what?"
+ test &= strmsz_1 == 10;
+ strmsz_2 = fb_03.sputn(", i wanna reach out and", 10);
+ test &= strmsz_2 == 10;
+ test &= strmsz_1 == strmsz_2;
+ // fb_03._M_out_beg = "YZracadabras, i wanna FGHIJKLMNOPQRSTUVW"
+ // fb_03._M_out_cur = "FGHIJKLMNOPQRSTUVW"
+ strmsz_1 = fb_02.sputn("racadabras", 10);
+ test &= strmsz_1 == 10;
+ // fb_02._M_out_beg = "YZracadabras<=>?@ABCDEFGHIJKLMNOPQRSTUVW"
+ // fb_02._M_out_cur = "<=>?@ABCDEFGHIJKLMNOPQRSTUVW"
+ strmsz_1 = fb_01.sputn("racadabra", 10);
+ test &= strmsz_1 == 0;
+
+ // PUTBACK
+ // int_type pbfail(int_type c)
+ // called when gptr() null, gptr() == eback(), or traits::eq(*gptr, c) false
+ // "pending sequence" is:
+ // 1) everything as defined in underflow
+ // 2) + if (traits::eq_int_type(c, traits::eof()), then input
+ // sequence is backed up one char before the pending sequence is
+ // determined.
+ // 3) + if (not 2) then c is prepended. Left unspecified is
+ // whether the input sequence is backedup or modified in any way
+ // returns traits::eof() for failure, unspecified other value for success
+
+ // int_type sputbackc(char_type c)
+ // if in_cur not avail || ! traits::eq(c, gptr() [-1]), return pbfail
+ // otherwise decrements in_cur and returns *gptr()
+ c1 = fb_03.sgetc(); // -1
+ c2 = fb_03.sputbackc('z');
+ strmsz_2 = fb_03.in_avail();
+ c3 = fb_03.sgetc();
+ test &= c3 == c2;
+ test &= c1 != c3;
+ test &= 1 == strmsz_2;
+ //test for _in_cur == _in_beg
+ // fb_03._M_out_beg = "bd23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracada" etc
+ fb_03.pubseekoff(10, std::ios_base::beg,
+ std::ios_base::in | std::ios_base::out);
+ fb_03.sputc('m');
+ strmsz_1 = fb_03.in_avail();
+ c1 = fb_03.sgetc();
+ fb_03.snextc();
+ c2 = fb_03.sputbackc('z');
+ strmsz_2 = fb_03.in_avail();
+ c3 = fb_03.sgetc();
+ test &= c1 != c2;
+ test &= c3 == c2;
+ test &= c1 != c3;
+ test &= c2 == 'z';
+ test &= strmsz_1 == strmsz_2;
+ // test for replacing char with identical one
+ fb_03.snextc();
+ fb_03.sputc('u');
+ fb_03.sputc('v');
+ fb_03.sputc('a');
+ strmsz_1 = fb_03.in_avail();
+ c2 = fb_03.sputbackc('a');
+ strmsz_2 = fb_03.in_avail();
+ c3 = fb_03.sgetc();
+ test &= c3 == c2;
+ test &= strmsz_1 + 1 == strmsz_2;
+ //test for ios_base::out
+ c1 = fb_02.sgetc(); // undefined
+ c2 = fb_02.sputbackc('a');
+ test &= c1 == c2;
+ test &= c1 == -1;
+
+ // int_type sungetc()
+ // if in_cur not avail, return pbackfail(), else decrement and
+ // return to_int_type(*gptr())
+ // fb_03._M_out_beg = "uvaacadabras, i wannaZ[\\]^_`abcdefghijkl"
+ // fb_03._M_out_cur = "aacadabras, i wannaZ[\\]^_`abcdefghijkl"
+ strmsz_1 = fb_03.in_avail();
+ c2 = fb_03.sungetc(); // delete the 'a'
+ strmsz_2 = fb_03.in_avail();
+ test &= c2 == 'v';
+ test &= strmsz_1 + 1 == strmsz_2;
+ //test for _in_cur == _in_beg
+ for (int i = 50; i < 32 + 29; ++i)
+ fb_02.sputc(char(i));
+ fb_02.pubseekoff(0, std::ios_base::beg, std::ios_base::out);
+ strmsz_1 = fb_02.in_avail();
+ c1 = fb_02.sgetc();
+ c2 = fb_02.sungetc();
+ strmsz_2 = fb_02.in_avail();
+ c3 = fb_02.sgetc();
+ test &= c1 == c2;
+ test &= c3 == c2;
+ test &= c1 == c3;
+ test &= c2 == traits_type::eof();
+ test &= strmsz_1 == strmsz_2;
+ //test for _in_cur == _in_end
+ fb_03.pubseekoff(0, std::ios_base::end);
+ strmsz_1 = fb_03.in_avail(); // -1 cuz at the end
+ c1 = fb_03.sgetc();
+ c2 = fb_03.sungetc();
+ strmsz_2 = fb_03.in_avail(); // 1
+ c3 = fb_03.sgetc();
+ test &= c1 != c2;
+ // test &= c2 == c3 || c2 == traits_type::not_eof(int(c3));
+ test &= strmsz_2 != strmsz_1;
+ test &= strmsz_2 == 1;
+ //test for ios_base::out
+
+ // BUFFER MANAGEMENT & POSITIONING
+ // int sync()
+ // if a put area exists, overflow.
+ // if a get area exists, do something undefined. (like, nothing)
+ strmsz_1 = fb_01.in_avail();
+ fb_01.pubsync();
+ strmsz_2 = fb_01.in_avail();
+ test &= strmsz_2 == strmsz_1;
+ strmsz_1 = fb_02.in_avail();
+ fb_02.pubsync();
+ // 27filebuf-2.txt == 53 bytes after this.
+ strmsz_2 = fb_02.in_avail();
+ test &= strmsz_2 == -1;
+ test &= strmsz_2 == strmsz_1;
+ strmsz_1 = fb_03.in_avail();
+ fb_03.pubsync();
+ // 27filebuf-3.txt
+ // bd23456789mzuva?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
+ // 63 bytes.
+ strmsz_2 = fb_03.in_avail();
+ test &= strmsz_1 == 1;
+ test &= strmsz_2 == 1;
+
+ // setbuf
+ // pubsetbuf(char_type* s, streamsize n)
+ fb_01.pubsetbuf(0,0);
+ fb_02.pubsetbuf(0,0);
+ fb_03.pubsetbuf(0,0);
+ // Need to test unbuffered output, which means calling this on some
+ // things that have just been opened.
+
+
+ // seekoff
+ // pubseekoff(off_type off, ios_base::seekdir way, ios_base::openmode which)
+ // alters the stream position to off
+ pos_type pt_1(off_type(-1));
+ pos_type pt_2(off_type(0));
+ off_type off_1 = 0;
+ off_type off_2 = 0;
+ //IN|OUT
+ // 27filebuf-3.txt = bd23456789:;<=>?...
+ //beg
+ strmsz_1 = fb_03.in_avail();
+ pt_1 = fb_03.pubseekoff(2, std::ios_base::beg);
+ strmsz_2 = fb_03.in_avail();
+ off_1 = pt_1._M_position();
+ test &= off_1 > 0;
+ c1 = fb_03.snextc(); //current in pointer +1
+ test &= c1 == '3';
+ c2 = fb_03.sputc('\n'); //current in pointer +1
+ c3 = fb_03.sgetc();
+ test &= c2 != c3;
+ test &= c3 == '4';
+ fb_03.pubsync();
+ c1 = fb_03.sgetc();
+ test &= c1 == c3;
+ //cur
+ // 27filebuf-3.txt = bd2\n456789:;<=>?...
+ pt_2 = fb_03.pubseekoff(2, std::ios_base::cur);
+ off_2 = pt_2._M_position();
+ test &= (off_2 == (off_1 + 2 + 1 + 1));
+ c1 = fb_03.snextc(); //current in pointer +1
+ test &= c1 == '7';
+ c2 = fb_03.sputc('x'); //test current out pointer
+ c3 = fb_03.sputc('\n');
+ c1 = fb_03.sgetc();
+ fb_03.pubsync();
+ c3 = fb_03.sgetc();
+ test &= c1 == c3;
+ //end
+ // 27filebuf-3.txt = "bd2\n456x\n9"
+ pt_2 = fb_03.pubseekoff(0, std::ios_base::end,
+ std::ios_base::in|std::ios_base::out);
+ off_1 = pt_2._M_position();
+ test &= off_1 > off_2; //weak, but don't know exactly where it ends
+ c3 = fb_03.sputc('\n');
+ strmsz_1 = fb_03.sputn("because because because. . .", 28);
+ test &= strmsz_1 == 28;
+ c1 = fb_03.sungetc();
+ fb_03.pubsync();
+ c3 = fb_03.sgetc();
+ test &= c1 == c3;
+ // IN
+ // OUT
+
+
+ // seekpos
+ // pubseekpos(pos_type sp, ios_base::openmode)
+ // alters the stream position to sp
+ //IN|OUT
+ //beg
+ pt_1 = fb_03.pubseekoff(78, std::ios_base::beg);
+ off_1 = pt_1._M_position();
+ test &= off_1 > 0;
+ c1 = fb_03.snextc(); //current in pointer +1
+ test &= c1 == ' ';
+ c2 = fb_03.sputc('\n'); //test current out pointer
+ c3 = fb_03.sgetc();
+ fb_03.pubsync(); //resets pointers
+ pt_2 = fb_03.pubseekpos(pt_1);
+ off_2 = pt_2._M_position();
+ test &= off_1 == off_2;
+ c3 = fb_03.snextc(); //current in pointer +1
+ test &= c2 == c3;
+ pt_1 = fb_03.pubseekoff(0, std::ios_base::end);
+ off_1 = pt_1._M_position();
+ test &= off_1 > off_2;
+ fb_03.sputn("\nof the wonderful things he does!!\nok", 37);
+ fb_03.pubsync();
+
+ // IN
+ // OUT
+
+ // VIRTUALS (indirectly tested)
+ // underflow
+ // if read position avail, returns *gptr()
+
+ // pbackfail(int_type c)
+ // put c back into input sequence
+
+ // overflow
+ // appends c to output seq
+
+ // NB Have to close these suckers. . .
+ // filebuf_type* close()
+ fb_01.close();
+ fb_02.close();
+ fb_03.close();
+ test &= !fb_01.is_open();
+ test &= !fb_02.is_open();
+ test &= !fb_03.is_open();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+int main() {
+ test00();
+ test01();
+ test02();
+ test03();
+
+ return 0;
+}
+
+
+
+// more surf!!!
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/fpos.cc b/libstdc++-v3/testsuite/27_io/fpos.cc
new file mode 100644
index 00000000000..2e8c2759611
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/fpos.cc
@@ -0,0 +1,178 @@
+// 1999-09-20 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 27.4.3 template class fpos
+
+#include <ios>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+void test01()
+{
+ bool test = true;
+
+ typedef mbstate_t state_type;
+ state_type state01;
+ state_type state02;
+
+ std::streampos pos01;
+ std::streampos pos02;
+
+ std::streamoff off01;
+ std::streamoff off02;
+
+ std::streamsize size01;
+ std::streamsize size02;
+
+ // 27.4.3.1 fpos members
+ // void state(state_type s);
+ // state_type state();
+#if 0
+// XXX Need to have some sanity checking for the mbstate_t type, or
+// whatever the insantiating type for class fpos happens to be for
+// streampos, as things like equality operators and assignment
+// operators, increment and deincrement operators need to be in place.
+ pos01.state(state02);
+ state01 = pos01.state();
+ test &= state01 == state02;
+#endif
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+// 27.4.3.2 fpos requirements/invariants
+void test02()
+{
+ bool test = true;
+
+ typedef mbstate_t state_type;
+ state_type state01;
+ state_type state02;
+
+ std::streamoff off01;
+ std::streamoff off02 = 997;
+
+ int i01 = 0;
+ int i02 = 999;
+
+ // p(i), p = i
+ std::streampos pos01(i02);
+ std::streampos pos02 = i02;
+ test &= pos01 == pos02;
+
+ // p(o), p = o
+ // NB: P(o) is only required.
+ std::streampos pos03(off02);
+ std::streampos pos04 = off02;
+ test &= pos03 == pos04;
+
+ // O(p)
+ std::streamoff off03(pos04);
+ test &= off03 == off02;
+
+ // p == q, p!= q
+ test &= pos01 == pos02;
+ test &= pos02 != pos03;
+
+ // q = p + o
+ // p += o
+ pos03 = pos03 + off02;
+ pos04 += off02;
+ test &= pos03 == pos04;
+
+ // q = p - o
+ // p -= o
+ pos03 = pos03 - off02;
+ pos04 -= off02;
+ test &= pos03 == pos04;
+
+ // o = p - q
+ test &= 0 == pos03 - pos04;
+
+ // streamsize -> streamoff
+ // streamoff -> streamsize
+ off01 = off02;
+ std::streamsize size01(off02);
+ std::streamoff off04(size01);
+ test &= off01 == off04;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+void test03()
+{
+ bool test = true;
+
+ typedef mbstate_t state_type;
+ state_type state01;
+ state_type state02;
+
+ std::streamoff off01;
+ std::streamoff off02 = 997;
+
+ int i01 = 0;
+ int i02 = 999;
+
+ // casts to const streamoff
+ // (yes, I know this is weak code)
+ const std::streampos pos01 = 0;
+ off01 = pos01;
+
+ // equality/inequality with const args
+ const std::streampos pos02(54);
+ std::streampos pos03(44);
+ test &= !(pos03 == pos02);
+ test &= pos03 != pos02;
+ test &= !(pos02 == pos03);
+ test &= pos02 != pos03;
+
+ // default values
+ std::streampos pos04;
+ test &= (std::streamoff)pos04 == 0;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main() {
+ test01();
+ test02();
+ test03();
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ios_base_callbacks.cc b/libstdc++-v3/testsuite/27_io/ios_base_callbacks.cc
new file mode 100644
index 00000000000..5f7aeabb054
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base_callbacks.cc
@@ -0,0 +1,74 @@
+// 1999-11-10 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.4.2.6 ios_base callbacks
+
+#include <string>
+#include <sstream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+const std::string str01("the nubians of plutonia");
+std::string str02;
+
+void
+callb01(std::ios_base::event e, std::ios_base& b, int i)
+{ str02 += "the nubians"; }
+
+void
+callb02(std::ios_base::event e, std::ios_base& b, int i)
+{ str02 += " of "; }
+
+void
+callb03(std::ios_base::event e, std::ios_base& b, int i)
+{ str02 += "plutonia"; }
+
+bool test01()
+{
+ bool test = true;
+ std::locale locco("saturn_SUN*RA");
+ std::stringbuf strbuf01;
+ std::ios ios01(&strbuf01);
+
+ ios01.register_callback(callb03, 1);
+ ios01.register_callback(callb02, 1);
+ ios01.register_callback(callb01, 1);
+ ios01.imbue(locco);
+ test &= str01 == str02;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+int main(void)
+{
+ test01();
+
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ios_base_members_static.cc b/libstdc++-v3/testsuite/27_io/ios_base_members_static.cc
new file mode 100644
index 00000000000..f01372c07c3
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base_members_static.cc
@@ -0,0 +1,66 @@
+// 1999-05-21 bkoz
+// 2000-05-21 bkoz
+
+// Copyright (C) 1999, 2000 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.4.2.4 ios_base static members
+
+#include <sstream>
+#include <iostream>
+
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01()
+{
+ bool test = true;
+
+ std::stringbuf strbuf01;
+ std::ios ios01(&strbuf01);
+
+ // 1: basic invocation
+ test &= ios01.sync_with_stdio();
+ test &= ios01.sync_with_stdio(false); //returns previous state
+
+ // 2: need to test interleaving of C and C++ io on a file object.
+ test &= std::cout.good();
+ test &= !std::cout.sync_with_stdio(0);
+ test &= std::cout.good();
+ test &= !std::cout.sync_with_stdio(0);
+ test &= std::cout.good();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+int main(void)
+{
+ test01();
+
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ios_ctor.cc b/libstdc++-v3/testsuite/27_io/ios_ctor.cc
new file mode 100644
index 00000000000..eeaa6c910cc
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_ctor.cc
@@ -0,0 +1,94 @@
+// 1999-07-23 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 27.4.4.1 basic_ios constructors
+
+#include <ios>
+#include <sstream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+void test01()
+{
+ bool test = true;
+ std::string str_01("jade cove, big sur");
+ std::string str_05;
+ std::stringbuf strb_01;
+ std::stringbuf strb_02(str_01, std::ios_base::in);
+ std::stringbuf strb_03(str_01, std::ios_base::out);
+ const std::ios_base::fmtflags flag01 = std::ios_base::skipws |
+ std::ios_base::dec;
+ std::ios_base::fmtflags flag02, flag03;
+ const std::locale glocale = std::locale();
+
+ // explicit basic_ios(streambuf* sb)
+ std::ios ios_00(0);
+ std::ios ios_01(&strb_01);
+ std::ios ios_02(&strb_02);
+ std::ios ios_03(&strb_03);
+
+ // basic_ios()
+ // NB: This is protected so need to go through fstream
+
+ // void init(sreambuf* sb)
+ // NB: This is protected so need to go through fstream/stringstream
+ // Can double-check the accuracy of the above initializations though.
+ test &= ios_00.rdbuf() == 0;
+ test &= ios_00.tie() == 0;
+ test &= ios_00.rdstate() == std::ios_base::badbit;
+ test &= ios_00.exceptions() == std::ios_base::goodbit;
+ flag02 = ios_00.flags();
+ test &= flag02 == flag01;
+ test &= ios_00.width() == 0;
+ test &= ios_00.precision() == 6;
+ test &= ios_00.fill() == ios_00.widen(' ');
+ test &= ios_00.getloc() == glocale;
+
+ test &= ios_01.rdbuf() == &strb_01;
+ test &= ios_01.tie() == 0;
+ test &= ios_01.rdstate() == std::ios_base::goodbit;
+ test &= ios_01.exceptions() == std::ios_base::goodbit;
+ flag02 = ios_01.flags();
+ test &= flag02 == flag01;
+ test &= ios_01.width() == 0;
+ test &= ios_01.precision() == 6;
+ test &= ios_01.fill() == ios_01.widen(' ');
+ test &= ios_01.getloc() == glocale;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main() {
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc b/libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc
new file mode 100644
index 00000000000..ebe1472cc35
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc
@@ -0,0 +1,114 @@
+// 981027 ncm work with libstdc++v3
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <iostream>
+#include <sstream>
+#include <locale>
+#include <iomanip>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+struct MyNP : std::numpunct<char>
+{
+ std::string do_grouping() const;
+ char do_thousands_sep() const;
+};
+
+std::string MyNP::do_grouping() const { static std::string s("\3"); return s; }
+char MyNP::do_thousands_sep() const { return ' '; }
+
+void test01()
+{
+ std::cout.imbue(std::locale(std::locale(), new MyNP));
+ std::cout << std::oct << std::showbase;
+ std::cout << -0123456l << std::endl;
+
+ std::cout << ":" << std::setw(11);
+ std::cout << -01234567l << ":" << std::endl;
+
+ std::cout << ":" << std::setw(11) << std::left;
+ std::cout << -0123456l << ":" << std::endl;
+
+ std::cout << ":" << std::setw(11) << std::right;
+ std::cout << -012345l << ":" << std::endl;
+
+ std::cout << ":" << std::setw(11) << std::internal;
+ std::cout << -01234l << ":" << std::endl;
+
+ std::cout << std::hex;
+ std::cout << std::setfill('0');
+ std::cout << std::internal;
+ std::cout << std::showbase;
+ std::cout << std::setw(16);
+ std::cout << 0x12345678l << std::endl;
+#ifdef DEBUG_ASSERT
+ assert (std::cout.good());
+#endif
+}
+
+void test02()
+{
+ bool test = true;
+ const std::string str_blank;
+ std::string str_tmp;
+ std::stringbuf strbuf;
+ std::ostream o(&strbuf);
+
+ o << std::setw(6) << std::right << "san";
+ test &= strbuf.str() == " san";
+ strbuf.str(str_blank);
+
+ o << std::setw(6) << std::internal << "fran";
+ test &= strbuf.str() == " fran";
+ strbuf.str(str_blank);
+
+ o << std::setw(6) << std::left << "cisco";
+ test &= strbuf.str() == "cisco ";
+ strbuf.str(str_blank);
+
+#ifdef DEBUG_ASSERT
+ assert (test);
+#endif
+}
+
+int main() {
+ test01();
+ return 0;
+}
+
+// Projected output:
+/*
+-0 123 456
+:-01 234 567:
+:-0 123 456 :
+: -012 345:
+:- 01 234:
+0x000012 345 678
+*/
diff --git a/libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc b/libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc
new file mode 100644
index 00000000000..d0030ff9906
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc
@@ -0,0 +1,123 @@
+// 981027 ncm work with libstdc++v3
+
+// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <iostream>
+#include <sstream>
+#include <locale>
+#include <iomanip>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+struct MyNP : std::numpunct<char>
+{
+ std::string do_truename() const;
+ std::string do_falsename() const;
+};
+
+std::string MyNP::do_truename() const { static std::string s("yea"); return s; }
+std::string MyNP::do_falsename() const { static std::string s("nay"); return s; }
+
+void test01()
+{
+ std::cout << true << " " << false << std::endl;
+ std::cout << std::boolalpha;
+ std::cout << true << " " << false << std::endl;
+
+ std::cout << ":" << std::setw(6) << std::internal << true << ":" << std::endl;
+ std::cout << ":" << std::setw(6) << std::left << true << ":" << std::endl;
+ std::cout << ":" << std::setw(6) << std::right << false << ":" << std::endl;
+ std::cout << std::noboolalpha;
+ std::cout << ":" << std::setw(3) << std::internal << true << ":" << std::endl;
+ std::cout << ":" << std::setw(3) << std::left << true << ":" << std::endl;
+ std::cout << ":" << std::setw(3) << std::right << false << ":" << std::endl;
+
+ std::locale loc = std::locale (std::locale(), new MyNP);
+ std::cout.imbue(loc);
+
+ std::cout << std::boolalpha;
+ std::cout << true << " " << false << std::endl;
+
+ std::cout << ":" << std::setw(6) << std::internal << true << ":" << std::endl;
+ std::cout << ":" << std::setw(6) << std::left << true << ":" << std::endl;
+ std::cout << ":" << std::setw(6) << std::right << false << ":" << std::endl;
+
+#ifdef DEBUG_ASSERT
+ assert (std::cout.good());
+#endif
+}
+
+void test02()
+{
+ bool test = true;
+ const std::string strue("true");
+ const std::string sfalse("false");
+ std::string str01;
+ std::string str02;
+
+ std::locale loc("");
+ std::ostringstream ostr01;
+ ostr01.imbue(loc);
+ std::ios_base::fmtflags ff = ostr01.flags(std::ios_base::boolalpha);
+
+ ostr01 << true;
+ str02 = ostr01.str();
+ test &= str02 == strue;
+
+ ostr01.str(str01);
+ ostr01 << false;
+ str02 = ostr01.str();
+ test &= str02 == sfalse;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main() {
+ test01();
+ test02();
+ return 0;
+}
+
+// Projected output:
+/*
+1 0
+true false
+: true:
+:true :
+: false:
+: 1:
+:1 :
+: 0:
+yea nay
+: yea:
+:yea :
+: nay:
+*/
diff --git a/libstdc++-v3/testsuite/27_io/ios_members.cc b/libstdc++-v3/testsuite/27_io/ios_members.cc
new file mode 100644
index 00000000000..0f36967f03b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_members.cc
@@ -0,0 +1,152 @@
+// 1999-09-20 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 27.4.4.2 basic_ios member functions
+
+#include <ios>
+// NB: Don't include any other headers in this file.
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+void test01()
+{
+ bool test = true;
+
+ std::ios_base::fmtflags flag02, flag03;
+ const std::ios_base::fmtflags flag01 = std::ios_base::skipws
+ | std::ios_base::dec;
+
+ const std::locale glocale = std::locale();
+
+ std::ios ios_01(NULL);
+ std::ios::char_type ct01;
+ std::ios::char_type ct02('x');;
+
+ // 27.4.2.3 locales
+ ios_01.imbue(glocale);
+
+ // char narrow(char_type c, char dfault) const;
+ char c1 = ios_01.narrow(ct02, 0);
+ test &= c1 == 'x';
+
+ // char_type widen(char c) const;
+ ct01 = ios_01.widen('c');
+ test &= ct01 == 'c';
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+// 27.4.4.3 basic_ios iostate flags function
+void test02()
+{
+ bool test = true;
+
+ typedef std::ios_base::fmtflags fmtflags;
+ typedef std::ios_base::iostate iostate;
+ using std::ios_base;
+
+ iostate iostate02, iostate03;
+ const iostate iostate01 = std::ios_base::badbit | std::ios_base::eofbit;
+ const iostate iostate04 = std::ios_base::badbit;
+
+ const std::locale glocale = std::locale();
+
+ std::ios ios_01(NULL);
+ std::ios::char_type ct01;
+ std::ios::char_type ct02('x');;
+
+ // bool fail() const
+ test &= ios_01.fail();
+
+ // bool operator!() const
+ test &= !ios_01;
+
+ // iostate rdstate() const
+ iostate03 = ios_01.rdstate();
+ test &= static_cast<bool>(iostate03 & std::ios_base::badbit);
+
+ // void clear(iostate state = goodbit)
+ try {
+ ios_01.clear(std::ios_base::eofbit);
+ iostate02 = ios_01.rdstate();
+ test &= static_cast<bool>(iostate02 & iostate01);
+ }
+ catch(std::ios_base::failure& fail) {
+ test &= false;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ // iostate exceptions() const
+ test &= ios_01.exceptions() == std::ios_base::goodbit;
+
+ // void exceptions(iostate except)
+ try {
+ ios_01.exceptions(std::ios_base::eofbit);
+ test &= false;
+ }
+ catch(std::ios_base::failure& fail) {
+ iostate02 = ios_01.exceptions();
+ test &= static_cast<bool>(iostate02 & std::ios_base::eofbit);
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ // basic_ios& copyfmt(const basic_ios& rhs)
+ std::ios ios_02(NULL);
+ ios_02.exceptions(std::ios_base::eofbit);
+ test &= static_cast<bool>(ios_02.exceptions() & std::ios_base::eofbit);
+ try {
+ ios_01.copyfmt(ios_02);
+ test &= false;
+ }
+ catch(std::ios_base::failure& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main() {
+ test01();
+ test02();
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/27_io/iostream_objects.cc b/libstdc++-v3/testsuite/27_io/iostream_objects.cc
new file mode 100644
index 00000000000..4151ceada98
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/iostream_objects.cc
@@ -0,0 +1,117 @@
+// 990519 bkoz
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// Include all the headers except for iostream.
+#include <algorithm>
+#include <bitset>
+#include <complex>
+#include <deque>
+#include <exception>
+#include <fstream>
+#include <functional>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <istream>
+#include <iterator>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#include <memory>
+#include <new>
+#include <numeric>
+#include <ostream>
+#include <queue>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <streambuf>
+#include <string>
+#include <typeinfo>
+#include <utility>
+#include <valarray>
+#include <vector>
+#include <cassert>
+#include <cctype>
+#include <cerrno>
+#include <cfloat>
+#include <ciso646>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <csetjmp>
+#include <csignal>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#if _GLIBCPP_USE_WCHAR_T
+ #include <bits/c++config.h>
+ #include <cwchar>
+ #include <cwctype>
+#endif
+
+// Include iostream last, just to make is as difficult as possible to
+// properly initialize the standard iostream objects.
+#include <iostream>
+
+// Make sure all the standard streams are defined.
+bool test01()
+{
+ bool test = true;
+
+ char array1[20];
+ typedef std::ios::traits_type ctraits_type;
+ ctraits_type::int_type i = 15;
+ ctraits_type::copy(array1, "testing istream", i);
+ array1[i] = '\0';
+ std::cout << "testing cout" << std::endl;
+ std::cerr << "testing cerr" << std::endl;
+ test &= std::cerr.flags() & std::ios_base::unitbuf;
+ std::clog << "testing clog" << std::endl;
+ // std::cin >> array1; // requires somebody to type something in.
+ test &= std::cin.tie() == &std::cout;
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ wchar_t array2[20];
+ typedef std::wios::traits_type wtraits_type;
+ wtraits_type::int_type wi = 15;
+ wtraits_type::copy(array2, L"testing istream", wi);
+ std::wcout << L"testing wcout" << std::endl;
+ std::wcerr << L"testing wcerr" << std::endl;
+ test &= std::wcerr.flags() & std::ios_base::unitbuf;
+ std::wclog << L"testing wclog" << std::endl;
+ // std::wcin >> array2; // requires somebody to type something in.
+ test &= std::wcin.tie() == &std::wcout;
+#endif
+
+ return true;
+}
+
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/istream.cc b/libstdc++-v3/testsuite/27_io/istream.cc
new file mode 100644
index 00000000000..ea07f2e502c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream.cc
@@ -0,0 +1,64 @@
+// 1999-09-20 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 27.6.1.1 basic_istream
+// NB: This file is for testing istream with NO OTHER INCLUDES.
+
+// XXX only if using namespaces, as without leads to duplicate symbols
+#if _GLIBCPP_USE_NAMESPACES
+#include <istream>
+#include <bits/basic_ios.tcc> // XXX Hack, in a perfect world this not needed.
+#include <locale> // XXX As above, needed for ctype/num_get use_facets(...)
+#include <bits/locale_facets.tcc> // XXX
+
+namespace test {
+
+ using namespace std;
+ typedef short type_t;
+ template class basic_istream<type_t, char_traits<type_t> >;
+
+#if 0
+ template
+ const ctype<type_t>&
+ use_facet<ctype<type_t> >(const locale&);
+
+ typedef istreambuf_iterator<type_t, char_traits<type_t> > traits_t;
+ template
+ const num_get<type_t, traits_t>&
+ use_facet<num_get<type_t, traits_t> >(const locale&);
+#endif
+
+} // test
+#endif
+
+int main() {
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc
new file mode 100644
index 00000000000..f6250b1010a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc
@@ -0,0 +1,387 @@
+// 1999-04-12 bkoz
+
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.2 arithmetic extractors
+
+#include <istream>
+#include <ostream>
+#include <sstream>
+#include <locale>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+std::string str_01;
+std::string str_02("true false 0 1 110001");
+std::string str_03("-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5");
+
+std::stringbuf isbuf_01(std::ios_base::in);
+std::stringbuf isbuf_02(str_02, std::ios_base::in);
+std::stringbuf isbuf_03(str_03, std::ios_base::in);
+
+std::istream is_01(NULL);
+std::istream is_02(&isbuf_02);
+std::istream is_03(&isbuf_03);
+std::stringstream ss_01(str_01);
+
+// minimal sanity check
+bool test01() {
+
+ bool test = true;
+
+ // Integral Types:
+ bool b1 = false;
+ bool b2 = false;
+ short s1 = 0;
+ int i1 = 0;
+ long l1 = 0;
+ unsigned short us1 = 0;
+ unsigned int ui1 = 0;
+ unsigned long ul1 = 0;
+
+ // Floating-point Types:
+ float f1 = 0;
+ double d1 = 0;
+ long double ld1 = 0;
+
+ // process alphanumeric versions of bool values
+ std::ios_base::fmtflags fmt = is_02.flags();
+ bool testfmt = fmt & std::ios_base::boolalpha;
+ is_02.setf(std::ios_base::boolalpha);
+ fmt = is_02.flags();
+ testfmt = fmt & std::ios_base::boolalpha;
+ is_02 >> b1;
+ test &= b1 == 1;
+ is_02 >> b1;
+ test &= b1 == 0;
+
+ // process numeric versions of of bool values
+ is_02.unsetf(std::ios_base::boolalpha);
+ fmt = is_02.flags();
+ testfmt = fmt & std::ios_base::boolalpha;
+ is_02 >> b1;
+ test &= b1 == 0;
+ is_02 >> b1;
+ test &= b1 == 1;
+
+ // is_03 == "-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5"
+ is_03 >> l1;
+ test &= l1 == -19999999;
+ is_03 >> ul1;
+ test &= ul1 == 777777;
+ is_03 >> i1;
+ test &= i1 == -234234;
+ is_03 >> ui1;
+ test &= ui1 == 233;
+ is_03 >> s1;
+ test &= s1 == -234;
+ is_03 >> us1;
+ test &= us1 == 33;
+ is_03 >> b1;
+ test &= b1 == 1;
+ is_03 >> ld1;
+ test &= ld1 == 66300.25;
+ is_03 >> d1;
+ test &= d1 == .315;
+ is_03 >> f1;
+ test &= f1 == 1.5;
+
+ // test void pointers
+ int i = 55;
+ void* po = &i;
+ void* pi;
+
+ ss_01 << po;
+ ss_01 >> pi;
+ test &= po == pi;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// elaborated test for ints
+bool test02() {
+
+ bool test = true;
+ const std::string str_01("20000AB");
+ std::stringbuf strb_01(str_01, std::ios_base::in);
+ std::istream is(&strb_01);
+
+ int n = 15;
+ is >> n;
+ test &= n == 20000;
+ char c = is.peek();
+ test &= c == 65;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+bool test03()
+{
+ std::stringbuf sbuf;
+ std::istream istr(&sbuf);
+ std::ostream ostr(&sbuf);
+
+ bool test = true;
+ long l01;
+ ostr << "12220101";
+ istr >> l01; // _M_in_end set completely incorrectly here.
+ test &= l01 == 12220101;
+ test &= istr.rdstate() == std::ios_base::eofbit;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00081.html
+// Jim Parsons
+void test06()
+{
+ // default locale, grouping is turned off
+ bool test = true;
+ unsigned int h4, h3, h2;
+ char c;
+ std::string s("205,199,144");
+ std::istringstream is(s);
+
+ is >> h4; // 205
+ test &= h4 == 205;
+ is >> c; // ','
+ test &= c == ',';
+
+ is >> h4; // 199
+ test &= h4 == 199;
+ is >> c; // ','
+ test &= c == ',';
+
+ is >> h4; // 144
+ test &= is.rdstate() == std::ios_base::eofbit;
+ test &= h4 == 144;
+ is >> c; // EOF
+ test &= c == ',';
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+namespace std {
+ class test_numpunct1 : public numpunct<char>
+ {
+ protected:
+ string
+ do_grouping() const
+ { return string(1, '\003'); }
+ };
+} // namespace std
+
+void test07()
+{
+ // manufactured locale, grouping is turned on
+ bool test = true;
+ unsigned int h4 = 0, h3 = 0, h2 = 0;
+ float f1 = 0.0;
+ const std::string s1("205,199 23,445.25 1,024,365 123,22,24");
+ std::istringstream is(s1);
+ is.imbue(std::locale(std::locale(), new std::test_numpunct1));
+
+ // Basic operation.
+ is >> h4;
+ test &= h4 == 205199;
+ test &= is.good();
+
+ is.clear();
+ is >> f1;
+ test &= f1 == 23445.25;
+ test &= is.good();
+
+ is.clear();
+ is >> h3;
+ test &= h3 == 1024365;
+ test &= is.good();
+
+ is.clear();
+ is >> h2;
+ test &= h2 == 0;
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::eofbit);
+
+ // Stress tests for explicit errors in grouping corner cases. The
+ // validity of these tests and results have been hammered out in
+ // private email between bkoz and ncm between Jan 25 and Jan 27, 2000.
+ // Thanks nate -- benjamin
+ const std::string s2(",111 4,,4 0.25,345 5..25 156,, 1,000000 1000000 1234,567");
+ h3 = h4 = h2 = 0;
+ f1 = 0.0;
+ const char c_control = '?';
+ char c = c_control;
+ is.clear();
+ is.str(s2);
+
+ is >> h4;
+ test &= h4 == 0;
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ is.clear();
+ is >> c;
+ test &= c == ',';
+ test &= is.good();
+
+ is.ignore(3);
+ is >> f1;
+ test &= f1 == 0.0;
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ is.clear();
+ is >> c;
+ test &= c == ',';
+ is >> c;
+ test &= c == '4';
+ test &= is.good();
+
+ is >> f1;
+ test &= f1 == 0.25;
+ test &= is.good();
+ is >> c;
+ test &= c == ',';
+ is >> h2;
+ test &= h2 == 345;
+ test &= is.good();
+ f1 = 0.0;
+ h2 = 0;
+
+ is >> f1;
+ test &= f1 == 5.0;
+ test &= is.good();
+ is >> f1;
+ test &= f1 == .25;
+ test &= is.good();
+
+ is >> h3;
+ test &= h3 == 0;
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ is.clear();
+ is >> c;
+ test &= c == ','; // second one
+ test &= is.good();
+
+ is >> h2;
+ test &= h2 == 0;
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ is.clear();
+
+ is >> h2;
+ test &= h2 == 1000000;
+ test &= is.good();
+ h2 = 0;
+
+ is >> h2;
+ test &= h2 == 0;
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::eofbit);
+ is.clear();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+namespace std {
+ class test_numpunct2 : public numpunct<char>
+ {
+ protected:
+ string
+ do_grouping() const
+ { return string("\002\003"); }
+ };
+} // namespace std
+
+void test08()
+{
+ // manufactured locale, grouping is turned on
+ bool test = true;
+ unsigned int h4 = 0, h3 = 0, h2 = 0;
+ float f1 = 0.0;
+ const std::string s1("1,22 205,19 22,123,22");
+ const std::string s2("1,220 2050,19 202,123,22");
+
+ std::istringstream is(s1);
+ is.imbue(std::locale(std::locale(), new std::test_numpunct2));
+
+ // Basic operation.
+ is >> h4;
+ test &= h4 == 122;
+ test &= is.good();
+
+ is.clear();
+ is >> h3;
+ test &= h3 == 20519;
+ test &= is.good();
+
+ is.clear();
+ is >> h2;
+ test &= h2 == 2212322;
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::eofbit);
+
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+
+ test06();
+ test07();
+ test08();
+ return 0;
+}
+
+
+
+
+
+// paul miller was right on with riddim warfare!
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_char.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_char.cc
new file mode 100644
index 00000000000..6a6312855f4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_extractor_char.cc
@@ -0,0 +1,232 @@
+// 1999-07-26 bkoz
+
+// Copyright (C) 1999 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.3 character extractors
+
+#include <istream>
+#include <sstream>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+bool test01() {
+
+ bool test = true;
+ std::string str_01;
+ const std::string str_02("coltrane playing 'softly as a morning sunrise'");
+ const std::string str_03("coltrane");
+
+ std::stringbuf isbuf_01(std::ios_base::in);
+ std::stringbuf isbuf_02(str_02, std::ios_base::in);
+ std::istream is_01(NULL);
+ std::istream is_02(&isbuf_02);
+
+ std::ios_base::iostate state1, state2, statefail;
+ statefail = std::ios_base::failbit;
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(istream&, _CharT*)
+ int n = 20;
+ char array1[n];
+ typedef std::ios::traits_type ctraits_type;
+ ctraits_type::int_type i1, i2;
+
+ state1 = is_01.rdstate();
+ i1 = ctraits_type::length(array1);
+ is_01 >> array1; // should snake 0 characters, not alter stream state
+ i2 = ctraits_type::length(array1);
+ state2 = is_01.rdstate();
+ test &= i1 == i2;
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & statefail);
+
+ state1 = is_02.rdstate();
+ is_02 >> array1; // should snake "coltrane"
+ state2 = is_02.rdstate();
+ test &= state1 == state2;
+ test &= !static_cast<bool>(state2 & statefail);
+ test &= array1[str_03.size() - 1] == 'e';
+ array1[str_03.size()] = '\0';
+ test &= !str_03.compare(0, str_03.size(), array1);
+ std::istream::int_type int1 = is_02.peek(); // should be ' '
+ test &= int1 == ' ';
+
+ state1 = is_02.rdstate();
+ is_02 >> array1; // should snake "playing" as sentry "eats" ws
+ state2 = is_02.rdstate();
+ int1 = is_02.peek(); // should be ' '
+ test &= int1 == ' ';
+ test &= state1 == state2;
+ test &= !static_cast<bool>(state2 & statefail);
+
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(istream&, unsigned char*)
+ unsigned char array2[n];
+ state1 = is_02.rdstate();
+ is_02 >> array2; // should snake 'softly
+ state2 = is_02.rdstate();
+ test &= state1 == state2;
+ test &= !static_cast<bool>(state2 & statefail);
+ test &= array2[0] == '\'';
+ test &= array2[1] == 's';
+ test &= array2[6] == 'y';
+ int1 = is_02.peek(); // should be ' '
+ test &= int1 == ' ';
+
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(istream&, signed char*)
+ signed char array3[n];
+ state1 = is_02.rdstate();
+ is_02 >> array3; // should snake "as"
+ state2 = is_02.rdstate();
+ test &= state1 == state2;
+ test &= !static_cast<bool>(state2 & statefail);
+ test &= array3[0] == 'a';
+ test &= array3[1] == 's';
+ int1 = is_02.peek(); // should be ' '
+ test &= int1 == ' ';
+
+
+ // testing with width() control enabled.
+ is_02.width(8);
+ state1 = is_02.rdstate();
+ is_02 >> array1; // should snake a
+ state2 = is_02.rdstate();
+ test &= state1 == state2;
+ test &= !ctraits_type::compare(array1, "a", 2);
+
+ is_02.width(1);
+ state1 = is_02.rdstate();
+ is_02 >> array1; // should snake nothing, set failbit
+ state2 = is_02.rdstate();
+ test &= state1 != state2;
+ test &= state2 == statefail;
+ test &= array1[0] == '\0';
+
+ is_02.width(8);
+ is_02.clear();
+ state1 = is_02.rdstate();
+ test &= !state1;
+ is_02 >> array1; // should snake "morning"
+ state2 = is_02.rdstate();
+ test &= state1 == state2;
+ test &= !ctraits_type::compare(array1, "morning", 8);
+
+ // testing for correct exception setting
+ const std::string str_04(" impulse!!");
+ std::stringbuf isbuf_03(str_04, std::ios_base::in);
+ std::stringbuf isbuf_04(str_04, std::ios_base::in);
+ std::istream is_03(&isbuf_03);
+ std::istream is_04(&isbuf_04);
+
+ is_03 >> array1;
+ test &= !ctraits_type::compare(array1,"impulse!!", 10);
+ test &= is_03.rdstate() == std::ios_base::eofbit;
+
+ is_04.width(9);
+ is_04 >> array1;
+ test &= ! std::ios::traits_type::compare(array1,"impulse!", 9);
+ test &= !is_04.rdstate();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+bool test02() {
+
+ typedef std::ios::traits_type ctraits_type;
+
+ bool test = true;
+ std::string str_01;
+ const std::string str_02("or coltrane playing tunji with jimmy garrison");
+ const std::string str_03("coltrane");
+
+ std::stringbuf isbuf_01(std::ios_base::in);
+ std::stringbuf isbuf_02(str_02, std::ios_base::in);
+ std::istream is_01(NULL);
+ std::istream is_02(&isbuf_02);
+ std::ios_base::iostate state1, state2, statefail;
+ statefail = std::ios_base::failbit;
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(istream&, _CharT&)
+ char c1 = 'c', c2 = 'c';
+ state1 = is_01.rdstate();
+ is_01 >> c1;
+ state2 = is_01.rdstate();
+ test &= state1 != state2;
+ test &= c1 == c2;
+ test &= static_cast<bool>(state2 & statefail);
+
+ state1 = is_02.rdstate();
+ is_02 >> c1;
+ state2 = is_02.rdstate();
+ test &= state1 == state2;
+ test &= c1 == 'o';
+ is_02 >> c1;
+ is_02 >> c1;
+ test &= c1 == 'c';
+ test &= !static_cast<bool>(state2 & statefail);
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(istream&, unsigned char&)
+ unsigned char uc1 = 'c';
+ state1 = is_02.rdstate();
+ is_02 >> uc1;
+ state2 = is_02.rdstate();
+ test &= state1 == state2;
+ test &= uc1 == 'o';
+ is_02 >> uc1;
+ is_02 >> uc1;
+ test &= uc1 == 't';
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(istream&, signed char&)
+ signed char sc1 = 'c';
+ state1 = is_02.rdstate();
+ is_02 >> sc1;
+ state2 = is_02.rdstate();
+ test &= state1 == state2;
+ test &= sc1 == 'r';
+ is_02 >> sc1;
+ is_02 >> sc1;
+ test &= sc1 == 'n';
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+int main()
+{
+ test01();
+ test02();
+
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.tst b/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.tst
new file mode 100644
index 00000000000..717a04c5f4d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.tst
@@ -0,0 +1,65 @@
+// 990811 bkoz
+
+// Copyright (C) 1999 Cygnus Solutions
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Repatriation
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/Vivian Jackson and the Prop
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/Michael Rose - Born Free (d
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Love Thy Nei
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Defe
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Ralp
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Tommy McCook and Don D. Jnr
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Big Youth and Vivian Jackso
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Big Youth Fi
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Upsetter Mix - Rally Dub
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Dicky Burton - God Is Watch
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Pablo and Vivian Jackson -
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Rock King Tu
+/mnt/cdrom/TORTOISE_millions_now_living/tortoise_5
+/mnt/cdrom/TORTOISE_millions_now_living/tortoise_6
+/mnt/cdrom/bettycarter_i'myours,you'remine/This time
+/mnt/cdrom/bettycarter_i'myours,you'remine/I'm Yours, You're Mine
+/mnt/cdrom/bettycarter_i'myours,you'remine/Lonely House
+/mnt/cdrom/bettycarter_i'myours,you'remine/Close Your Eyes
+/mnt/cdrom/bettycarter_i'myours,you'remine/Useless Landscape
+/mnt/cdrom/bettycarter_i'myours,you'remine/East of the Sun
+/mnt/cdrom/bettycarter_i'myours,you'remine/September Song
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Naima's Love Song
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Stay As Sweet As You Are
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Make Him Believe
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/I Should Care
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Once Upon a Summertime
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/You Go To My Head
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/In the Still Of the Night
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/When It's Sleepy Time Down
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/The Love We Had Yesterday
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Dip Bag
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/You're Mine, Too
+/mnt/cdrom/c_adderly_somethin'_else/Autumn Leaves
+/mnt/cdrom/c_adderly_somethin'_else/Love For Sale
+/mnt/cdrom/c_adderly_somethin'_else/Somethin' Else
+/mnt/cdrom/c_adderly_somethin'_else/One For Daddy-O
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.txt b/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.txt
new file mode 100644
index 00000000000..717a04c5f4d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.txt
@@ -0,0 +1,65 @@
+// 990811 bkoz
+
+// Copyright (C) 1999 Cygnus Solutions
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Repatriation
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/Vivian Jackson and the Prop
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/Michael Rose - Born Free (d
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Love Thy Nei
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Defe
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Ralp
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Tommy McCook and Don D. Jnr
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Big Youth and Vivian Jackso
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Big Youth Fi
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Upsetter Mix - Rally Dub
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Dicky Burton - God Is Watch
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Pablo and Vivian Jackson -
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Rock King Tu
+/mnt/cdrom/TORTOISE_millions_now_living/tortoise_5
+/mnt/cdrom/TORTOISE_millions_now_living/tortoise_6
+/mnt/cdrom/bettycarter_i'myours,you'remine/This time
+/mnt/cdrom/bettycarter_i'myours,you'remine/I'm Yours, You're Mine
+/mnt/cdrom/bettycarter_i'myours,you'remine/Lonely House
+/mnt/cdrom/bettycarter_i'myours,you'remine/Close Your Eyes
+/mnt/cdrom/bettycarter_i'myours,you'remine/Useless Landscape
+/mnt/cdrom/bettycarter_i'myours,you'remine/East of the Sun
+/mnt/cdrom/bettycarter_i'myours,you'remine/September Song
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Naima's Love Song
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Stay As Sweet As You Are
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Make Him Believe
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/I Should Care
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Once Upon a Summertime
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/You Go To My Head
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/In the Still Of the Night
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/When It's Sleepy Time Down
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/The Love We Had Yesterday
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Dip Bag
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/You're Mine, Too
+/mnt/cdrom/c_adderly_somethin'_else/Autumn Leaves
+/mnt/cdrom/c_adderly_somethin'_else/Love For Sale
+/mnt/cdrom/c_adderly_somethin'_else/Somethin' Else
+/mnt/cdrom/c_adderly_somethin'_else/One For Daddy-O
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_other-2.tst b/libstdc++-v3/testsuite/27_io/istream_extractor_other-2.tst
new file mode 100644
index 00000000000..717a04c5f4d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_extractor_other-2.tst
@@ -0,0 +1,65 @@
+// 990811 bkoz
+
+// Copyright (C) 1999 Cygnus Solutions
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Repatriation
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/Vivian Jackson and the Prop
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/Michael Rose - Born Free (d
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Love Thy Nei
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Defe
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Ralp
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Tommy McCook and Don D. Jnr
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Big Youth and Vivian Jackso
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Big Youth Fi
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Upsetter Mix - Rally Dub
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Dicky Burton - God Is Watch
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Pablo and Vivian Jackson -
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Rock King Tu
+/mnt/cdrom/TORTOISE_millions_now_living/tortoise_5
+/mnt/cdrom/TORTOISE_millions_now_living/tortoise_6
+/mnt/cdrom/bettycarter_i'myours,you'remine/This time
+/mnt/cdrom/bettycarter_i'myours,you'remine/I'm Yours, You're Mine
+/mnt/cdrom/bettycarter_i'myours,you'remine/Lonely House
+/mnt/cdrom/bettycarter_i'myours,you'remine/Close Your Eyes
+/mnt/cdrom/bettycarter_i'myours,you'remine/Useless Landscape
+/mnt/cdrom/bettycarter_i'myours,you'remine/East of the Sun
+/mnt/cdrom/bettycarter_i'myours,you'remine/September Song
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Naima's Love Song
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Stay As Sweet As You Are
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Make Him Believe
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/I Should Care
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Once Upon a Summertime
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/You Go To My Head
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/In the Still Of the Night
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/When It's Sleepy Time Down
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/The Love We Had Yesterday
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Dip Bag
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/You're Mine, Too
+/mnt/cdrom/c_adderly_somethin'_else/Autumn Leaves
+/mnt/cdrom/c_adderly_somethin'_else/Love For Sale
+/mnt/cdrom/c_adderly_somethin'_else/Somethin' Else
+/mnt/cdrom/c_adderly_somethin'_else/One For Daddy-O
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc
new file mode 100644
index 00000000000..09b1ac27576
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc
@@ -0,0 +1,197 @@
+// 1999-07-28 bkoz
+
+// Copyright (C) 1999 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.3 basic_istream::operator>>
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+
+// stringbufs.
+bool test01() {
+
+ typedef std::ios::traits_type ctraits_type;
+
+ bool test = true;
+ const std::string str_01;
+ const std::string str_02("art taylor kickin it on DAKAR");
+ std::string strtmp;
+
+ std::stringbuf isbuf_00(std::ios_base::in);
+ std::stringbuf isbuf_01(std::ios_base::in | std::ios_base::out);
+ std::stringbuf isbuf_02(str_01, std::ios_base::in);
+ std::stringbuf isbuf_03(str_01, std::ios_base::in | std::ios_base::out);
+ std::stringbuf isbuf_04(str_02, std::ios_base::in);
+ std::stringbuf isbuf_05(str_02, std::ios_base::in | std::ios_base::out);
+
+ std::istream is_00(NULL);
+ std::istream is_01(&isbuf_01);
+ std::istream is_02(&isbuf_02);
+ std::istream is_03(&isbuf_03);
+ std::istream is_04(&isbuf_04);
+ std::istream is_05(&isbuf_05);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(basic_istream& (*pf) (basic_istream&))
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(basic_ios& (*pf) (basic_ios&))
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(ios_base& (*pf) (ios_base&))
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(basic_streambuf*)
+
+ // null istream to empty in_buf
+ state1 = is_00.rdstate();
+ is_00 >> &isbuf_00;
+ state2 = is_00.rdstate();
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & statefail);
+ test &= isbuf_00.str() == str_01;
+
+ // null istream to empty in_out_buf
+ is_00.clear(std::ios_base::goodbit);
+ state1 = is_00.rdstate();
+ is_00 >> &isbuf_01;
+ state2 = is_00.rdstate();
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & statefail);
+ test &= isbuf_01.str() == str_01;
+
+ // null istream to full in_buf
+ is_00.clear(std::ios_base::goodbit);
+ state1 = is_00.rdstate();
+ is_00 >> &isbuf_04;
+ state2 = is_00.rdstate();
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & statefail);
+ test &= isbuf_04.str() == str_02;
+
+ // null istream to full in_out_buf
+ is_00.clear(std::ios_base::goodbit);
+ state1 = is_00.rdstate();
+ is_00 >> &isbuf_05;
+ state2 = is_00.rdstate();
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & statefail);
+ test &= isbuf_05.str() == str_02;
+
+ // empty but non-null istream to full in_buf
+ state1 = is_02.rdstate();
+ is_02 >> &isbuf_04;
+ state2 = is_02.rdstate();
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & statefail);
+ test &= isbuf_04.str() == str_02; // as only an "in" buffer
+ test &= isbuf_04.sgetc() == 'a';
+
+ // empty but non-null istream to full in_out_buf
+ is_02.clear(std::ios_base::goodbit);
+ state1 = is_02.rdstate();
+ is_02 >> &isbuf_05;
+ state2 = is_02.rdstate();
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & statefail);
+ test &= isbuf_05.str() == str_02; // as only an "in" buffer
+ test &= isbuf_05.sgetc() == 'a';
+
+ // full istream to empty in_buf (need out_buf, you know?)
+ state1 = is_04.rdstate();
+ is_04 >> &isbuf_02;
+ state2 = is_04.rdstate();
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & statefail);
+ test &= isbuf_02.str() == str_01; // as only an "in" buffer
+ test &= isbuf_02.sgetc() == ctraits_type::eof();
+ test &= is_04.peek() == ctraits_type::eof(); // as failed
+
+ // full istream to empty in_out_buf
+ is_04.clear(std::ios_base::goodbit);
+ state1 = is_04.rdstate();
+ is_04 >> &isbuf_03;
+ state2 = is_04.rdstate();
+ test &= state1 != state2;
+ test &= !static_cast<bool>(state2 & statefail);
+ test &= state2 == stateeof;
+ strtmp = isbuf_03.str();
+ test &= strtmp == str_02; // as only an "in" buffer
+ test &= isbuf_03.sgetc() == 'a';
+ test &= is_04.peek() == ctraits_type::eof();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// filebufs.
+bool test02() {
+
+ bool test = true;
+ typedef std::ios::traits_type ctraits_type;
+ const char name_01[] = "testsuite/istream_extractor_other-1.txt"; //read
+ const char name_02[] = "testsuite/istream_extractor_other-2.txt"; //write
+
+ std::filebuf fbin, fbout;
+ fbin.open(name_01, std::ios_base::in);
+ fbout.open(name_02, std::ios_base::out | std::ios_base::trunc);
+ test &= fbin.is_open();
+ test &= fbout.is_open();
+
+ if (test)
+ {
+ std::istream is(&fbin);
+ is.unsetf(std::ios_base::skipws);
+ is >> &fbout;
+ }
+
+ fbout.close();
+ fbin.close();
+ test &= !fbin.is_open();
+ test &= !fbout.is_open();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_manip.cc b/libstdc++-v3/testsuite/27_io/istream_manip.cc
new file mode 100644
index 00000000000..206e4068d6c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_manip.cc
@@ -0,0 +1,93 @@
+// 1999-07-22 bkoz
+
+// Copyright (C) 1994, 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.4 standard basic_istream manipulators
+
+#include <istream>
+#include <sstream>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+
+ const char str_lit01[] = " venice ";
+ const std::string str01(" santa barbara ");
+ std::string str02(str_lit01);
+ std::string str04;
+ std::string str05;
+ std::ios_base::iostate flag1, flag2, flag3, flag4, flag5;
+
+ // template<_CharT, _Traits>
+ // basic_istream<_CharT, _Traits>& ws(basic_istream<_Char, _Traits>& is)
+ std::istringstream iss01(str01);
+ std::istringstream iss02(str01);
+
+ iss01 >> str04;
+ test &= str04.size() != str01.size();
+ test &= str04 == "santa";
+
+ iss02 >> std::ws;
+ iss02 >> str05;
+ test &= str05.size() != str01.size();
+ test &= str05 == "santa";
+ test &= str05 == str04;
+
+ iss01 >> str04;
+ test &= str04.size() != str01.size();
+ test &= str04 == "barbara";
+
+ iss02 >> std::ws;
+ iss02 >> str05;
+ test &= str05.size() != str01.size();
+ test &= str05 == "barbara";
+ test &= str05 == str04;
+
+ flag3 = std::ios_base::eofbit;
+ flag4 = std::ios_base::badbit;
+ flag5 = std::ios_base::failbit;
+ test &= !iss01.fail();
+ test &= !iss02.fail();
+ test &= !iss01.eof();
+ test &= !iss02.eof();
+
+ iss01 >> std::ws;
+ test &= !iss01.fail();
+ test &= iss01.eof();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_sentry.cc b/libstdc++-v3/testsuite/27_io/istream_sentry.cc
new file mode 100644
index 00000000000..ba4f7cb1bd8
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_sentry.cc
@@ -0,0 +1,86 @@
+// 1999-10-14 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 27.6.1.1.2 class basic_istream::sentry
+
+#include <istream>
+#include <sstream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+void test01()
+{
+ bool test = true;
+ const char* lit01 = "stereolab on the bolsinga tip";
+ const std::string str01(lit01);
+
+ std::stringbuf strbuf01;
+ std::stringbuf strbuf02(str01);
+ std::istream istr01(&strbuf01);
+ std::istream istr02(&strbuf02);
+
+ // test negatives
+ std::istream::sentry sentry01(istr01);
+ test &= bool(sentry01) == false;
+
+ std::istream::sentry sentry02(istr01, true);
+ test &= bool(sentry02) == false;
+
+ // positive tests
+ std::istream::sentry sentry03(istr02);
+ test &= bool(sentry03) == true;
+
+ std::istream::sentry sentry04(istr02, true);
+ test &= bool(sentry04) == true;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+
+int main() {
+
+ test01();
+ return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_unformatted-1.tst b/libstdc++-v3/testsuite/27_io/istream_unformatted-1.tst
new file mode 100644
index 00000000000..5d9eafa2a36
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_unformatted-1.tst
@@ -0,0 +1,7 @@
+bd2
+456x
+9mzuv>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
+because because
+because. .
+of the wonderful things he does!!
+ok \ No newline at end of file
diff --git a/libstdc++-v3/testsuite/27_io/istream_unformatted-1.txt b/libstdc++-v3/testsuite/27_io/istream_unformatted-1.txt
new file mode 100644
index 00000000000..5d9eafa2a36
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_unformatted-1.txt
@@ -0,0 +1,7 @@
+bd2
+456x
+9mzuv>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
+because because
+because. .
+of the wonderful things he does!!
+ok \ No newline at end of file
diff --git a/libstdc++-v3/testsuite/27_io/istream_unformatted-2.tst b/libstdc++-v3/testsuite/27_io/istream_unformatted-2.tst
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_unformatted-2.tst
diff --git a/libstdc++-v3/testsuite/27_io/istream_unformatted.cc b/libstdc++-v3/testsuite/27_io/istream_unformatted.cc
new file mode 100644
index 00000000000..df2245791d2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_unformatted.cc
@@ -0,0 +1,582 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.3 unformatted input functions
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+
+bool test01() {
+
+ typedef std::ios::traits_type traits_type;
+
+ bool test = true;
+ const std::string str_01;
+ const std::string str_02("soul eyes: john coltrane quartet");
+ std::string strtmp;
+
+ std::stringbuf isbuf_03(str_02, std::ios_base::in);
+ std::stringbuf isbuf_04(str_02, std::ios_base::in);
+
+ std::istream is_00(NULL);
+ std::istream is_03(&isbuf_03);
+ std::istream is_04(&isbuf_04);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+ // istream& read(char_type* s, streamsize n)
+ char carray[60] = "";
+ state1 = is_04.rdstate();
+ is_04.read(carray, 0);
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+
+ state1 = is_04.rdstate();
+ is_04.read(carray, 9);
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+ test &= !strncmp(carray, "soul eyes", 9);
+ test &= is_04.peek() == ':';
+
+ state1 = is_03.rdstate();
+ is_03.read(carray, 60);
+ state2 = is_03.rdstate();
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & stateeof);
+ test &= static_cast<bool>(state2 & statefail);
+ test &= !strncmp(carray, "soul eyes: john coltrane quartet", 35);
+
+
+ // istream& ignore(streamsize n = 1, int_type delim = traits::eof())
+ state1 = is_04.rdstate();
+ is_04.ignore();
+ test &= is_04.gcount() == 1;
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+ test &= is_04.peek() == ' ';
+
+ state1 = is_04.rdstate();
+ is_04.ignore(0);
+ test &= is_04.gcount() == 0;
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+ test &= is_04.peek() == ' ';
+
+ state1 = is_04.rdstate();
+ is_04.ignore(5, traits_type::to_int_type(' '));
+ test &= is_04.gcount() == 1;
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+ test &= is_04.peek() == 'j';
+
+ // int_type peek()
+ state1 = is_04.rdstate();
+ test &= is_04.peek() == 'j';
+ test &= is_04.gcount() == 0;
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+
+ is_04.ignore(30);
+ state1 = is_04.rdstate();
+ test &= is_04.peek() == traits_type::eof();
+ test &= is_04.gcount() == 0;
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+
+
+ // istream& putback(char c)
+ is_04.clear();
+ state1 = is_04.rdstate();
+ is_04.putback('|');
+ test &= is_04.gcount() == 0;
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+ test &= is_04.peek() == '|';
+
+ // istream& unget()
+ is_04.clear();
+ state1 = is_04.rdstate();
+ is_04.unget();
+ test &= is_04.gcount() == 0;
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+ test &= is_04.peek() == 'e';
+
+ // int sync()
+ int i = is_00.sync();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+bool test02(void)
+{
+ typedef std::char_traits<char> traits_type;
+
+ bool test = true;
+ const char str_lit01[] = " sun*ra
+ and his myth science arkestra present
+ angles and demons @ play
+ the nubians of plutonia";
+ std::string str01(str_lit01);
+ std::string strtmp;
+
+ std::stringbuf sbuf_04(str01, std::ios_base::in);
+
+ std::istream is_00(NULL);
+ std::istream is_04(&sbuf_04);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+ std::streamsize count1, count2;
+ char carray1[400] = "";
+
+ // istream& getline(char* s, streamsize n, char delim)
+ // istream& getline(char* s, streamsize n)
+ state1 = is_00.rdstate();
+ is_00.getline(carray1, 20, '*');
+ state2 = is_00.rdstate();
+ test &= is_04.gcount() == 0;
+ test &= state1 != state2;
+ test &= bool(state2 & statefail);
+
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 1, '\t'); // extracts, throws away
+ state2 = is_04.rdstate();
+ test &= is_04.gcount() == 1;
+ test &= state1 == state2;
+ test &= state1 == 0;
+ test &= !traits_type::compare("", carray1, 1);
+
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 20, '*');
+ state2 = is_04.rdstate();
+ test &= is_04.gcount() == 10;
+ test &= state1 == state2;
+ test &= state1 == 0;
+ test &= !traits_type::compare("\t\t sun", carray1, 10);
+
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 20);
+ state2 = is_04.rdstate();
+ test &= is_04.gcount() == 4;
+ test &= state1 == state2;
+ test &= state1 == 0;
+ test &= !traits_type::compare("ra ", carray1, 4);
+
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 65);
+ state2 = is_04.rdstate();
+ test &= is_04.gcount() == 64;
+ test &= state1 != state2;
+ test &= state2 == statefail;
+ test &= !traits_type::compare(" and his myth science arkestra presen", carray1, 65);
+
+ is_04.clear();
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 120, '|');
+ state2 = is_04.rdstate();
+ test &= is_04.gcount() == 106;
+ test &= state1 != state2;
+ test &= state2 == stateeof;
+
+ is_04.clear();
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 100, '|');
+ state2 = is_04.rdstate();
+ test &= is_04.gcount() == 0;
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & stateeof);
+ test &= static_cast<bool>(state2 & statefail);
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+bool test03(void)
+{
+ typedef std::char_traits<char> traits_type;
+
+ bool test = true;
+ const char str_lit01[] = " sun*ra
+ & his arkestra, featuring john gilmore:
+ jazz in silhouette: images and forecasts of tomorrow";
+ std::string str01(str_lit01);
+ std::string strtmp;
+
+ std::stringbuf sbuf_03;
+ std::stringbuf sbuf_04(str01, std::ios_base::in);
+ std::stringbuf sbuf_05(str01, std::ios_base::in);
+
+ std::istream is_00(NULL);
+ std::istream is_04(&sbuf_04);
+ std::istream is_05(&sbuf_05);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+ std::streamsize count1, count2;
+ char carray1[400] = "";
+
+ // int_type get()
+ // istream& get(char*, streamsize, char delim)
+ // istream& get(char*, streamsize)
+ // istream& get(streambuf&, char delim)
+ // istream& get(streambuf&)
+ is_00.get(carray1, 2);
+ test &= static_cast<bool>(is_00.rdstate() & statefail);
+ test &= is_00.gcount() == 0;
+
+ is_04.get(carray1, 4);
+ test &= !(is_04.rdstate() & statefail);
+ test &= !traits_type::compare(carray1, " ", 4);
+ test &= is_04.gcount() == 3;
+
+ is_04.clear();
+ is_04.get(carray1 + 3, 200);
+ test &= !(is_04.rdstate() & statefail);
+ test &= !(is_04.rdstate() & stateeof);
+ test &= !traits_type::compare(carray1, str_lit01, 10);
+ test &= is_04.gcount() == 7;
+
+ is_04.clear();
+ is_04.get(carray1, 200);
+ test &= !(is_04.rdstate() & stateeof);
+ test &= static_cast<bool>(is_04.rdstate() & statefail); // delimiter
+ test &= is_04.gcount() == 0;
+ is_04.clear();
+ is_04.get(carray1, 200, '[');
+ test &= static_cast<bool>(is_04.rdstate() & stateeof);
+ test &= !(is_04.rdstate() & statefail);
+ test &= is_04.gcount() == 125;
+ is_04.clear();
+ is_04.get(carray1, 200);
+ test &= static_cast<bool>(is_04.rdstate() & stateeof);
+ test &= static_cast<bool>(is_04.rdstate() & statefail);
+ test &= is_04.gcount() == 0;
+
+ std::stringbuf sbuf_02(std::ios_base::in);
+ is_05.clear();
+ is_05.get(sbuf_02);
+ test &= is_05.gcount() == 0;
+ test &= static_cast<bool>(is_05.rdstate() & statefail);
+ test &= !(is_05.rdstate() & stateeof);
+
+ is_05.clear();
+ is_05.get(sbuf_03);
+ test &= is_05.gcount() == 10;
+ test &= sbuf_03.str() == " sun*ra ";
+ test &= !(is_05.rdstate() & statefail);
+ test &= !(is_05.rdstate() & stateeof);
+
+ is_05.clear();
+ is_05.get(sbuf_03, '|');
+ test &= is_05.gcount() == 125;
+ test &= sbuf_03.str() == str_lit01;
+ test &= !(is_05.rdstate() & statefail);
+ test &= static_cast<bool>(is_05.rdstate() & stateeof);
+
+ is_05.clear();
+ is_05.get(sbuf_03, '|');
+ test &= is_05.gcount() == 0;
+ test &= static_cast<bool>(is_05.rdstate() & stateeof);
+ test &= static_cast<bool>(is_05.rdstate() & statefail);
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// fstreams
+void test04(void)
+{
+ bool test = true;
+ std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
+ std::ios_base::iostate state01, state02;
+ const char str_lit01[] = "testsuite/istream_unformatted-1.txt";
+ const char str_lit02[] = "testsuite/istream_unformatted-2.txt";
+ std::ifstream if01(str_lit01, std::ios_base::in | std::ios_base::out);
+ std::ifstream if02(str_lit01, std::ios_base::in);
+ std::ifstream if03(str_lit02, std::ios_base::out | std::ios_base::trunc);
+ test &= if01.good();
+ test &= if02.good();
+ test &= if03.good();
+
+ std::istream is01(if01.rdbuf());
+ std::istream is02(if02.rdbuf());
+ std::istream is03(if03.rdbuf());
+
+ // pos_type tellg()
+ // in | out
+ pos01 = is01.tellg();
+ pos02 = is01.tellg();
+ test &= pos01 == pos02;
+ // test &= istream::pos_type(0) != pos01; //depricated
+
+ // in
+ pos03 = is02.tellg();
+ pos04 = is02.tellg();
+ test &= pos03 == pos04;
+ // test &= istream::pos_type(0) != pos03; //depricated
+
+ // out
+ pos05 = is03.tellg();
+ pos06 = is03.tellg();
+ test &= pos05 == pos06;
+ // test &= istream::pos_type(0) != pos01; //depricated
+
+ // istream& seekg(pos_type)
+ // istream& seekg(off_type, ios_base::seekdir)
+
+ // cur
+ // NB: see library issues list 136. It's the v-3 interp that seekg
+ // only sets the input buffer, or else istreams with buffers that
+ // have _M_mode == ios_base::out will fail to have consistency
+ // between seekg and tellg.
+ state01 = is01.rdstate();
+ is01.seekg(10, std::ios_base::cur);
+ state02 = is01.rdstate();
+ pos01 = is01.tellg();
+ test &= pos01 == pos02 + 10;
+ test &= state01 == state02;
+ pos02 = is01.tellg();
+ test &= pos02 == pos01;
+
+ state01 = is02.rdstate();
+ is02.seekg(10, std::ios_base::cur);
+ state02 = is02.rdstate();
+ pos03 = is02.tellg();
+ test &= pos03 == pos04 + 10;
+ test &= state01 == state02;
+ pos04 = is02.tellg();
+ test &= pos03 == pos04;
+
+ state01 = is03.rdstate();
+ is03.seekg(10, std::ios_base::cur);
+ state02 = is03.rdstate();
+ pos05 = is03.tellg();
+ test &= pos05 == pos06 + 10;
+ test &= state01 == state02;
+ pos06 = is03.tellg();
+ test &= pos05 == pos06;
+
+ // beg
+ state01 = is01.rdstate();
+ is01.seekg(20, std::ios_base::beg);
+ state02 = is01.rdstate();
+ pos01 = is01.tellg();
+ test &= pos01 == pos02 + 10;
+ test &= state01 == state02;
+ pos02 = is01.tellg();
+ test &= pos02 == pos01;
+
+ state01 = is02.rdstate();
+ is02.seekg(20, std::ios_base::beg);
+ state02 = is02.rdstate();
+ pos03 = is02.tellg();
+ test &= pos03 == pos04 + 10;
+ test &= state01 == state02;
+ pos04 = is02.tellg();
+ test &= pos03 == pos04;
+
+ state01 = is03.rdstate();
+ is03.seekg(20, std::ios_base::beg);
+ state02 = is03.rdstate();
+ pos05 = is03.tellg();
+ test &= pos05 == pos06 + 10;
+ test &= state01 == state02;
+ pos06 = is03.tellg();
+ test &= pos05 == pos06;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+// stringstreams
+void test05(void)
+{
+ bool test = true;
+ std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
+ std::ios_base::iostate state01, state02;
+ const char str_lit01[] = "testsuite/istream_unformatted-1.tst";
+ std::ifstream if01(str_lit01);
+ std::ifstream if02(str_lit01);
+ std::ifstream if03(str_lit01);
+ test &= if01.good();
+ test &= if02.good();
+ test &= if03.good();
+
+ std::stringbuf strbuf01(std::ios_base::in | std::ios_base::out);
+ if01 >> &strbuf01;
+ // initialize stringbufs that are ios_base::out
+ std::stringbuf strbuf03(strbuf01.str(), std::ios_base::out);
+ // initialize stringbufs that are ios_base::in
+ std::stringbuf strbuf02(strbuf01.str(), std::ios_base::in);
+
+ std::istream is01(&strbuf01);
+ std::istream is02(&strbuf02);
+ std::istream is03(&strbuf03);
+
+ // pos_type tellg()
+ // in | out
+ pos01 = is01.tellg();
+ pos02 = is01.tellg();
+ test &= pos01 == pos02;
+ // test &= istream::pos_type(0) != pos01; // deprecated
+
+ // in
+ pos03 = is02.tellg();
+ pos04 = is02.tellg();
+ test &= pos03 == pos04;
+ // test &= istream::pos_type(0) != pos03; // deprecated
+
+ // out
+ pos05 = is03.tellg();
+ pos06 = is03.tellg();
+ test &= pos05 == pos06;
+ // test &= istream::pos_type(0) != pos01; //deprecated
+
+ // istream& seekg(pos_type)
+ // istream& seekg(off_type, ios_base::seekdir)
+
+ // cur
+ // NB: see library issues list 136. It's the v-3 interp that seekg
+ // only sets the input buffer, or else istreams with buffers that
+ // have _M_mode == ios_base::out will fail to have consistency
+ // between seekg and tellg.
+ state01 = is01.rdstate();
+ is01.seekg(10, std::ios_base::cur);
+ state02 = is01.rdstate();
+ pos01 = is01.tellg();
+ test &= pos01 == pos02 + 10;
+ test &= state01 == state02;
+ pos02 = is01.tellg();
+ test &= pos02 == pos01;
+
+ state01 = is02.rdstate();
+ is02.seekg(10, std::ios_base::cur);
+ state02 = is02.rdstate();
+ pos03 = is02.tellg();
+ test &= pos03 == pos04 + 10;
+ test &= state01 == state02;
+ pos04 = is02.tellg();
+ test &= pos03 == pos04;
+
+ state01 = is03.rdstate();
+ is03.seekg(10, std::ios_base::cur);
+ state02 = is03.rdstate();
+ pos05 = is03.tellg();
+ test &= pos05 == pos06; // as only out buffer
+ test &= state01 == state02;
+ pos06 = is03.tellg();
+ test &= pos05 == pos06;
+
+ // beg
+ state01 = is01.rdstate();
+ is01.seekg(20, std::ios_base::beg);
+ state02 = is01.rdstate();
+ pos01 = is01.tellg();
+ test &= pos01 == pos02 + 10;
+ test &= state01 == state02;
+ pos02 = is01.tellg();
+ test &= pos02 == pos01;
+
+ state01 = is02.rdstate();
+ is02.seekg(20, std::ios_base::beg);
+ state02 = is02.rdstate();
+ pos03 = is02.tellg();
+ test &= pos03 == pos04 + 10;
+ test &= state01 == state02;
+ pos04 = is02.tellg();
+ test &= pos03 == pos04;
+
+ state01 = is03.rdstate();
+ is03.seekg(20, std::ios_base::beg);
+ state02 = is03.rdstate();
+ pos05 = is03.tellg();
+ test &= pos05 == pos06; // as only out buffer
+ test &= state01 == state02;
+ pos06 = is03.tellg();
+ test &= pos05 == pos06;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+// http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00177.html
+void test06()
+{
+ bool test = true;
+
+ const std::string str_00("Red_Garland_Qunitet-Soul_Junction");
+ std::string strtmp;
+ char c_array[str_00.size() + 4];
+
+ std::stringbuf isbuf_00(str_00, std::ios_base::in);
+ std::istream is_00(&isbuf_00);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+ state1 = stateeof | statefail;
+ test &= is_00.gcount() == 0;
+ is_00.read(c_array, str_00.size() + 1);
+ test &= is_00.gcount() == str_00.size();
+ test &= is_00.rdstate() == state1;
+
+ is_00.read(c_array, str_00.size());
+ test &= is_00.rdstate() == state1;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+ test05();
+ test06();
+ return 0;
+}
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istringstream_members.cc b/libstdc++-v3/testsuite/27_io/istringstream_members.cc
new file mode 100644
index 00000000000..6047b650fc5
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istringstream_members.cc
@@ -0,0 +1,86 @@
+// 2000-01-10 bkoz
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.7.2 template class basic_istringstream
+// 27.7.2.2 member functions (istringstream_members)
+
+// stringbuf* rdbuf() const
+
+#include <sstream>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+
+void test01()
+{
+ bool test = true;
+ std::istringstream is01;
+ const std::string str01 = "123";
+ std::string str02;
+ const int i01 = 123;
+ int a,b;
+
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+ // void str(const basic_string&)
+ is01.str(str01);
+ state1 = is01.rdstate();
+ is01 >> a;
+ state2 = is01.rdstate();
+ test &= a = i01;
+ // 22.2.2.1.2 num_get virtual functions
+ // p 13
+ // in any case, if stage 2 processing was terminated by the test for
+ // in == end then err != ios_base::eofbit is performed.
+ test &= state1 != state2;
+ test &= state2 == stateeof;
+
+ is01.str(str01);
+ is01 >> b;
+ test &= b != a;
+ // as is01.good() is false, istream::sentry blocks extraction.
+
+ is01.clear();
+ state1 = is01.rdstate();
+ is01 >> b;
+ state2 = is01.rdstate();
+ test &= b == a;
+ test &= state1 != state2;
+ test &= state2 == stateeof;
+
+ // string str() const
+ str02 = is01.str();
+ test &= str01 == str02;
+
+ #ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream.cc b/libstdc++-v3/testsuite/27_io/ostream.cc
new file mode 100644
index 00000000000..32699254257
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream.cc
@@ -0,0 +1,52 @@
+// 1999-09-20 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 27.6.2.1 basic_ostream
+// NB: This file is for testing ostream with NO OTHER INCLUDES.
+
+// XXX only if using namespaces, as without leads to duplicate symbols
+#if _GLIBCPP_USE_NAMESPACES
+#include <ostream>
+#include <bits/basic_ios.tcc> // XXX Hack, in a perfect world this not needed.
+#include <locale> // XXX As above, needed for ctype/num_get use_facets(...)
+#include <bits/locale_facets.tcc>
+
+namespace test {
+
+ using namespace std;
+ typedef short type_t;
+ template class basic_ostream<type_t, char_traits<type_t> >;
+
+} // test
+#endif
+
+int main() {
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc b/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc
new file mode 100644
index 00000000000..fd31614774e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc
@@ -0,0 +1,303 @@
+// 1999-11-15 Kevin Ediger <kediger@licor.com>
+// test the floating point inserters (facet num_put)
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <iostream>
+#include <iomanip>
+#include <locale>
+#include <sstream>
+#include <limits>
+#include <assert.h>
+
+using namespace std;
+
+#define __TEST_NUMPUT_VERBOSE 1
+
+struct _TestCase
+{
+ double val;
+
+ int precision;
+ int width;
+ char decimal;
+ char fill;
+
+ bool fixed;
+ bool scientific;
+ bool showpos;
+ bool showpoint;
+ bool uppercase;
+ bool internal;
+ bool left;
+ bool right;
+
+ const char* result;
+#if _GLIBCPP_USE_WCHAR_T
+ const wchar_t* wresult;
+#endif
+};
+
+static bool T=true;
+static bool F=false;
+
+static _TestCase testcases[] =
+{
+#if _GLIBCPP_USE_WCHAR_T
+ // standard output (no formatting applied)
+ { 1.2, 6,0,'.',' ', F,F,F,F,F,F,F,F, "1.2",L"1.2" },
+ { 54, 6,0,'.',' ', F,F,F,F,F,F,F,F, "54",L"54" },
+ { -.012, 6,0,'.',' ', F,F,F,F,F,F,F,F, "-0.012",L"-0.012" },
+ { -.00000012, 6,0,'.',' ', F,F,F,F,F,F,F,F, "-1.2e-07",L"-1.2e-07" },
+
+ // fixed formatting
+ { 10.2345, 0,0,'.',' ', T,F,F,F,F,F,F,F, "10",L"10" },
+ { 10.2345, 0,0,'.',' ', T,F,F,T,F,F,F,F, "10.",L"10." },
+ { 10.2345, 1,0,'.',' ', T,F,F,F,F,F,F,F, "10.2",L"10.2" },
+ { 10.2345, 4,0,'.',' ', T,F,F,F,F,F,F,F, "10.2345",L"10.2345" },
+ { 10.2345, 6,0,'.',' ', T,F,T,F,F,F,F,F, "+10.234500",L"+10.234500" },
+ { -10.2345, 6,0,'.',' ', T,F,F,F,F,F,F,F, "-10.234500",L"-10.234500" },
+ { -10.2345, 6,0,',',' ', T,F,F,F,F,F,F,F, "-10,234500",L"-10,234500" },
+
+ // fixed formatting with width
+ { 10.2345, 4,5,'.',' ', T,F,F,F,F,F,F,F, "10.2345",L"10.2345" },
+ { 10.2345, 4,6,'.',' ', T,F,F,F,F,F,F,F, "10.2345",L"10.2345" },
+ { 10.2345, 4,7,'.',' ', T,F,F,F,F,F,F,F, "10.2345",L"10.2345" },
+ { 10.2345, 4,8,'.',' ', T,F,F,F,F,F,F,F, " 10.2345",L" 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,F,F, " 10.2345",L" 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,T,F, "10.2345 ",L"10.2345 " },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,F,T, " 10.2345",L" 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,T,F,F, " 10.2345",L" 10.2345" },
+ { -10.2345, 4,10,'.',' ', T,F,F,F,F,T,F,F, "- 10.2345",L"- 10.2345" },
+ { -10.2345, 4,10,'.','A', T,F,F,F,F,T,F,F, "-AA10.2345",L"-AA10.2345" },
+ { 10.2345, 4,10,'.','#', T,F,T,F,F,T,F,F, "+##10.2345",L"+##10.2345" },
+
+ // scientific formatting
+ { 1.23e+12, 1,0,'.',' ', F,T,F,F,F,F,F,F, "1.2e+12",L"1.2e+12" },
+ { 1.23e+12, 1,0,'.',' ', F,T,F,F,T,F,F,F, "1.2E+12",L"1.2E+12" },
+ { 1.23e+12, 2,0,'.',' ', F,T,F,F,F,F,F,F, "1.23e+12",L"1.23e+12" },
+ { 1.23e+12, 3,0,'.',' ', F,T,F,F,F,F,F,F, "1.230e+12",L"1.230e+12" },
+ { 1.23e+12, 3,0,'.',' ', F,T,T,F,F,F,F,F, "+1.230e+12",L"+1.230e+12" },
+ { -1.23e-12, 3,0,'.',' ', F,T,F,F,F,F,F,F, "-1.230e-12",L"-1.230e-12" },
+ { 1.23e+12, 3,0,',',' ', F,T,F,F,F,F,F,F, "1,230e+12",L"1,230e+12" },
+#else
+ // standard output (no formatting applied)
+ { 1.2, 6,0,'.',' ', F,F,F,F,F,F,F,F, "1.2" },
+ { 54, 6,0,'.',' ', F,F,F,F,F,F,F,F, "54" },
+ { -.012, 6,0,'.',' ', F,F,F,F,F,F,F,F, "-0.012" },
+ { -.00000012, 6,0,'.',' ', F,F,F,F,F,F,F,F, "-1.2e-07" },
+
+ // fixed formatting
+ { 10.2345, 0,0,'.',' ', T,F,F,F,F,F,F,F, "10" },
+ { 10.2345, 0,0,'.',' ', T,F,F,T,F,F,F,F, "10." },
+ { 10.2345, 1,0,'.',' ', T,F,F,F,F,F,F,F, "10.2" },
+ { 10.2345, 4,0,'.',' ', T,F,F,F,F,F,F,F, "10.2345" },
+ { 10.2345, 6,0,'.',' ', T,F,T,F,F,F,F,F, "+10.234500" },
+ { -10.2345, 6,0,'.',' ', T,F,F,F,F,F,F,F, "-10.234500" },
+ { -10.2345, 6,0,',',' ', T,F,F,F,F,F,F,F, "-10,234500" },
+
+ // fixed formatting with width
+ { 10.2345, 4,5,'.',' ', T,F,F,F,F,F,F,F, "10.2345" },
+ { 10.2345, 4,6,'.',' ', T,F,F,F,F,F,F,F, "10.2345" },
+ { 10.2345, 4,7,'.',' ', T,F,F,F,F,F,F,F, "10.2345" },
+ { 10.2345, 4,8,'.',' ', T,F,F,F,F,F,F,F, " 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,F,F, " 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,T,F, "10.2345 " },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,F,T, " 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,T,F,F, " 10.2345" },
+ { -10.2345, 4,10,'.',' ', T,F,F,F,F,T,F,F, "- 10.2345" },
+ { -10.2345, 4,10,'.','A', T,F,F,F,F,T,F,F, "-AA10.2345" },
+ { 10.2345, 4,10,'.','#', T,F,T,F,F,T,F,F, "+##10.2345" },
+
+ // scientific formatting
+ { 1.23e+12, 1,0,'.',' ', F,T,F,F,F,F,F,F, "1.2e+12" },
+ { 1.23e+12, 1,0,'.',' ', F,T,F,F,T,F,F,F, "1.2E+12" },
+ { 1.23e+12, 2,0,'.',' ', F,T,F,F,F,F,F,F, "1.23e+12" },
+ { 1.23e+12, 3,0,'.',' ', F,T,F,F,F,F,F,F, "1.230e+12" },
+ { 1.23e+12, 3,0,'.',' ', F,T,T,F,F,F,F,F, "+1.230e+12" },
+ { -1.23e-12, 3,0,'.',' ', F,T,F,F,F,F,F,F, "-1.230e-12" },
+ { 1.23e+12, 3,0,',',' ', F,T,F,F,F,F,F,F, "1,230e+12" },
+#endif
+};
+
+template<typename _CharT>
+class testpunct : public numpunct<_CharT>
+{
+public:
+ typedef _CharT char_type;
+
+ explicit
+ testpunct(char_type decimal_char) : numpunct<_CharT>()
+ {
+ _M_init(decimal_char, ',', "");
+ }
+};
+
+template<typename _CharT>
+void apply_formatting(const _TestCase & tc, basic_ostream<_CharT> & os)
+{
+ os.precision(tc.precision);
+ os.width(tc.width);
+ os.fill(static_cast<_CharT>(tc.fill));
+ if (tc.fixed)
+ os.setf(ios::fixed);
+ if (tc.scientific)
+ os.setf(ios::scientific);
+ if (tc.showpos)
+ os.setf(ios::showpos);
+ if (tc.showpoint)
+ os.setf(ios::showpoint);
+ if (tc.uppercase)
+ os.setf(ios::uppercase);
+ if (tc.internal)
+ os.setf(ios::internal);
+ if (tc.left)
+ os.setf(ios::left);
+ if (tc.right)
+ os.setf(ios::right);
+}
+
+void test01()
+{
+ for (int j=0; j<sizeof(testcases)/sizeof(testcases[0]); j++)
+ {
+ _TestCase & tc = testcases[j];
+#ifdef __TEST_NUMPUT_VERBOSE
+ cout << "expect: " << tc.result << endl;
+#endif
+ // test double with char type
+ {
+ testpunct<char>* __tp = new testpunct<char>(tc.decimal);
+ ostringstream os;
+ locale __loc(os.getloc(), __tp);
+ os.imbue(__loc);
+ apply_formatting(tc, os);
+ os << tc.val;
+#ifdef __TEST_NUMPUT_VERBOSE
+ cout << "result: " << os.str() << endl;
+#endif
+ assert(os && os.str() == tc.result);
+ }
+ // test long double with char type
+ {
+ testpunct<char>* __tp = new testpunct<char>(tc.decimal);
+ ostringstream os;
+ locale __loc(os.getloc(), __tp);
+ os.imbue(__loc);
+ apply_formatting(tc, os);
+ os << (long double)tc.val;
+#ifdef __TEST_NUMPUT_VERBOSE
+ cout << "result: " << os.str() << endl;
+#endif
+ assert(os && os.str() == tc.result);
+ }
+#if _GLIBCPP_USE_WCHAR_T
+ // test double with wchar_t type
+ {
+ testpunct<wchar_t>* __tp = new testpunct<wchar_t>(tc.decimal);
+ wostringstream os;
+ locale __loc(os.getloc(), __tp);
+ os.imbue(__loc);
+ apply_formatting(tc, os);
+ os << tc.val;
+ assert(os && os.str() == tc.wresult);
+ }
+ // test long double with wchar_t type
+ {
+ testpunct<wchar_t>* __tp = new testpunct<wchar_t>(tc.decimal);
+ wostringstream os;
+ locale __loc(os.getloc(), __tp);
+ os.imbue(__loc);
+ apply_formatting(tc, os);
+ os << (long double)tc.val;
+ assert(os && os.str() == tc.wresult);
+ }
+#endif
+ }
+}
+
+void test02()
+{
+ // make sure we can output a very long float
+ long double val = 1.2345678901234567890123456789e+1000L;
+ int prec = numeric_limits<long double>::digits10;
+
+ ostringstream os;
+ os.precision(prec);
+ os.setf(ios::scientific);
+ os << val;
+
+ char largebuf[512];
+ sprintf(largebuf, "%.*Le", prec, val);
+#ifdef __TEST_NUMPUT_VERBOSE
+ cout << "expect: " << largebuf << endl;
+ cout << "result: " << os.str() << endl;
+#endif
+ assert(os && os.str() == largebuf);
+}
+
+void test03()
+{
+ short s = -1;
+ int i = -1;
+ long l = -1;
+ bool test = true;
+
+ const string str_blank;
+ string str_tmp;
+ stringbuf strbuf;
+ ostream o(&strbuf);
+
+ o << oct << s << ' ' << hex << s;
+ test &= strbuf.str() == "177777 ffff"; // Assuming 2byte-shorts
+ strbuf.str(str_blank);
+
+ o << oct << i << ' ' << hex << i;
+ test &= strbuf.str() == "37777777777 ffffffff";
+ strbuf.str(str_blank);
+
+ o << oct << l << ' ' << hex << l;
+ test &= strbuf.str() == "37777777777 ffffffff";
+ strbuf.str(str_blank);
+
+ o << showpos << hex << showbase << 11;
+ test &= strbuf.str() == "0xb";
+
+ assert(test);
+}
+
+int main()
+{
+ test01();
+ test02();
+#ifdef __TEST_NUMPUT_VERBOSE
+ cout << "Test passed!" << endl;
+#endif
+ return 0;
+}
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_char-1.tst b/libstdc++-v3/testsuite/27_io/ostream_inserter_char-1.tst
new file mode 100644
index 00000000000..0b0acc85640
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_char-1.tst
@@ -0,0 +1,1000 @@
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc b/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc
new file mode 100644
index 00000000000..893631e0ceb
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc
@@ -0,0 +1,271 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 2000, 1999 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <fstream>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+// ofstream
+bool test01()
+{
+ bool test = true;
+ std::string str01;
+ const int size = 1000;
+ const char name_02[] = "testsuite/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();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// ostringstream width() != zero
+// left
+bool test02(void)
+{
+ bool test = 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();
+ test &= 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();
+ test &= 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();
+ test &= tmp == "909909";
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// width() != zero
+// right
+bool test03(void)
+{
+ bool test = 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();
+ test &= 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();
+ test &= 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();
+ test &= tmp == "909909";
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// stringstream and large strings
+bool test04() {
+
+ bool test = true;
+ std::string str_01;
+ const std::string str_02("coltrane playing 'softly as a morning sunrise'");
+ const std::string str_03("coltrane");
+ std::string str_tmp;
+ const int i_max=250;
+
+ std::ostringstream oss_01(std::ios_base::out);
+ std::ostringstream oss_02(str_01, std::ios_base::out);
+
+ std::ios_base::iostate state1, state2, statefail;
+ statefail = std::ios_base::failbit;
+
+ // 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();
+ test &= !oss_02.bad();
+ test &= oss_02.good();
+ test &= str_tmp != str_01;
+ test &= str_tmp.size() == 2390;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// ostringstream and large strings number 2
+bool test05()
+{
+ bool test = 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();
+ test &= str05 == str01;
+ test &= 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();
+ test &= str05 == str01;
+ test &= str10 == str01;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+// ostringstream and positioning, multiple writes
+// http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00326.html
+void test06()
+{
+ bool test = true;
+ const char carray01[] = "mos def & talib kweli are black star";
+
+ // normal
+ std::ostringstream ostr1("mos def");
+ test &= ostr1.str() == "mos def";
+ ostr1 << " & talib kweli"; // should overwrite first part of buffer
+ test &= ostr1.str() == " & talib kweli";
+ ostr1 << " are black star"; // should append to string from above
+ test &= ostr1.str() != carray01;
+ test &= ostr1.str() == " & talib kweli are black star";
+
+ // appending
+ std::ostringstream ostr2("blackalicious",
+ std::ios_base::out | std::ios_base::ate);
+ test &= ostr2.str() == "blackalicious";
+ ostr2 << " NIA "; // should not overwrite first part of buffer
+ test &= ostr2.str() == "blackalicious NIA ";
+ ostr2 << "4: deception (5:19)"; // should append to full string from above
+ test &= ostr2.str() == "blackalicious NIA 4: deception (5:19)";
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+
+int main()
+{
+
+ test02();
+ test03();
+ test04();
+ test05();
+ test06();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_other-1.tst b/libstdc++-v3/testsuite/27_io/ostream_inserter_other-1.tst
new file mode 100644
index 00000000000..cb3c57f7dfd
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_other-1.tst
@@ -0,0 +1,158 @@
+// 990117 bkoz
+// test functionality of basic_filebuf for char_type == char
+// this is a data file for 27filebuf.cc
+
+// Copyright (C) 1997-1999 Cygnus Solutions
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+/mnt/cdrom/sarah_vaughan/sarah_vaughan.allofme
+/mnt/cdrom/sarah_vaughan/sarah_vaughan.speaklow
+
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_01_the_way_i_feel
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_02_seduction_kidnap
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_03_just_a_ny_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_04_butterflies_i_remem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_05_luxury_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_06_my_house
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_07_the_women_gather
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_08_the_life_i_led
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_09_when_i_die
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_10_revolutionary_dreams
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_11_winter_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_12_a_certain_peace_i_nap
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_13_poem_for_a_lady_whose
+
+/mnt/cdrom/marley-songs_of_freedom/disk_1/
+/mnt/cdrom/marley-songs_of_freedom/disk_2/
+/mnt/cdrom/marley-songs_of_freedom/disk_4/
+
+/mnt/cdrom/marley-songs_of_freedom/disk_1/back out
+/mnt/cdrom/marley-songs_of_freedom/disk_1/bend down low
+/mnt/cdrom/marley-songs_of_freedom/disk_1/bus dem shut (pyaka)
+/mnt/cdrom/marley-songs_of_freedom/disk_1/caution
+/mnt/cdrom/marley-songs_of_freedom/disk_1/do it twice
+/mnt/cdrom/marley-songs_of_freedom/disk_1/don't rock the boat
+/mnt/cdrom/marley-songs_of_freedom/disk_1/duppy conqueror
+/mnt/cdrom/marley-songs_of_freedom/disk_1/hammer
+/mnt/cdrom/marley-songs_of_freedom/disk_1/hypocrites
+/mnt/cdrom/marley-songs_of_freedom/disk_1/i'm still waiting
+/mnt/cdrom/marley-songs_of_freedom/disk_1/judge not
+/mnt/cdrom/marley-songs_of_freedom/disk_1/mellow mood
+/mnt/cdrom/marley-songs_of_freedom/disk_1/mr brown
+/mnt/cdrom/marley-songs_of_freedom/disk_1/nice time
+/mnt/cdrom/marley-songs_of_freedom/disk_1/one cup of coffee
+/mnt/cdrom/marley-songs_of_freedom/disk_1/one love_people get ready
+/mnt/cdrom/marley-songs_of_freedom/disk_1/put it on
+/mnt/cdrom/marley-songs_of_freedom/disk_1/simmer down
+/mnt/cdrom/marley-songs_of_freedom/disk_1/small axe
+/mnt/cdrom/marley-songs_of_freedom/disk_1/soul rebel
+/mnt/cdrom/marley-songs_of_freedom/disk_1/soul shake down party
+/mnt/cdrom/marley-songs_of_freedom/disk_1/stir it up (original)
+/mnt/cdrom/marley-songs_of_freedom/disk_1/sun is shining
+/mnt/cdrom/marley-songs_of_freedom/disk_1/thank you lord (original)
+/mnt/cdrom/marley-songs_of_freedom/disk_2/acoustic medley
+/mnt/cdrom/marley-songs_of_freedom/disk_2/burnin' and lootin'
+/mnt/cdrom/marley-songs_of_freedom/disk_2/concrete jungle
+/mnt/cdrom/marley-songs_of_freedom/disk_2/craven choke puppy
+/mnt/cdrom/marley-songs_of_freedom/disk_2/get up stand up
+/mnt/cdrom/marley-songs_of_freedom/disk_2/guava jelly
+/mnt/cdrom/marley-songs_of_freedom/disk_2/high tide or low tide
+/mnt/cdrom/marley-songs_of_freedom/disk_2/i shot the sheriff
+/mnt/cdrom/marley-songs_of_freedom/disk_2/i'm hurting inside
+/mnt/cdrom/marley-songs_of_freedom/disk_2/iron lion zion
+/mnt/cdrom/marley-songs_of_freedom/disk_2/lick samba
+/mnt/cdrom/marley-songs_of_freedom/disk_2/lively up yourself
+/mnt/cdrom/marley-songs_of_freedom/disk_2/natty dread
+/mnt/cdrom/marley-songs_of_freedom/disk_2/no more trouble
+/mnt/cdrom/marley-songs_of_freedom/disk_2/rastaman chant
+/mnt/cdrom/marley-songs_of_freedom/disk_2/screw face
+/mnt/cdrom/marley-songs_of_freedom/disk_2/slave driver
+/mnt/cdrom/marley-songs_of_freedom/disk_2/trenchtown rock
+/mnt/cdrom/marley-songs_of_freedom/disk_4/africa unite
+/mnt/cdrom/marley-songs_of_freedom/disk_4/babylon system
+/mnt/cdrom/marley-songs_of_freedom/disk_4/bad card
+/mnt/cdrom/marley-songs_of_freedom/disk_4/coming in from the cold (12
+/mnt/cdrom/marley-songs_of_freedom/disk_4/could you be loved (12 mix
+/mnt/cdrom/marley-songs_of_freedom/disk_4/forever loving jah
+/mnt/cdrom/marley-songs_of_freedom/disk_4/give thanks and praise
+/mnt/cdrom/marley-songs_of_freedom/disk_4/one drop
+/mnt/cdrom/marley-songs_of_freedom/disk_4/one dub
+/mnt/cdrom/marley-songs_of_freedom/disk_4/rastaman live up
+/mnt/cdrom/marley-songs_of_freedom/disk_4/real situation
+/mnt/cdrom/marley-songs_of_freedom/disk_4/redemption song (live in pi
+/mnt/cdrom/marley-songs_of_freedom/disk_4/ride natty ride (12 mix)
+/mnt/cdrom/marley-songs_of_freedom/disk_4/so much trouble in the worl
+/mnt/cdrom/marley-songs_of_freedom/disk_4/survival
+/mnt/cdrom/marley-songs_of_freedom/disk_4/why should i (previously un
+/mnt/cdrom/marley-songs_of_freedom/disk_4/zimbabwe
+
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_01_pandemonium
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_02_sync_disjecta
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_03_object_unknown
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_04_it's_nice_not
+/mnt/cdrom/dj_spooky_rid-2dim_warefare/djspooky_05_dialectical_tra
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_06_post-human_soph
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_07_quilombo_ex
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_08_rekonstruction
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_09_scientifik
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_10_a_conversation
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_11_peace_in_zaire
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_13_degree_zero
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_14_roman_planeta
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_15_bass_digitalis
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_16_polyphony_of
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_17_riddim_warfare
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_18_the_nerd
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_20_theme_of_the
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_21_twilight_fugue
+
+/mnt/cdrom/stuff_smith_mosaic/disk3/01_desert_sands
+/mnt/cdrom/stuff_smith_mosaic/disk3/02_soft_winds
+/mnt/cdrom/stuff_smith_mosaic/disk3/03_time_and_again
+/mnt/cdrom/stuff_smith_mosaic/disk3/04_it_don't_mean_a_thing
+/mnt/cdrom/stuff_smith_mosaic/disk3/05_in_a_mellotone
+/mnt/cdrom/stuff_smith_mosaic/disk3/06_i_know_that_you_know
+/mnt/cdrom/stuff_smith_mosaic/disk3/07_heat_wave
+/mnt/cdrom/stuff_smith_mosaic/disk3/08_things_ain't_what_they_used_to_be
+/mnt/cdrom/stuff_smith_mosaic/disk3/09_body_and_soul
+
+So I take a break, wander down to the park to stand, then lean into
+the concrete railing demarking the beginnings of space, oceanic
+space. I watch the waves break, and form, and ease back out to sea and
+wrap my arms around myself and hug tightly because it's early in the
+morning and windy, and the sun is late getting out of bed today, which
+is good because if there was brilliant light illuminating all the
+beauty around me I would be shocked, stunned, forced to retreat back
+into my cabana in a daze, blinded by hummingbirds and callilillies and
+un-named red, yellow, and blue flowers. Green envelopes me, waves
+sooth me. I can see the wind flip the top of the waves seaward, right
+before they break. The sea seems so calm from my perch above the fray
+that I wonder if maybe there is just some part of the deepest, most
+abstract ocean where there is a large creature who happily chews
+plankton and wags its tail in gentle, adulating waves that spread and
+move and gracefully glide thousands of miles, to crash upon a beach,
+one after the other, politely waiting for a turn to dance with the
+seashore.
+
+I know: it is what the Mexican schoolchildren call "la vibora de la
+mer," the serpent of the sea.
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_other-2.tst b/libstdc++-v3/testsuite/27_io/ostream_inserter_other-2.tst
new file mode 100644
index 00000000000..cb3c57f7dfd
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_other-2.tst
@@ -0,0 +1,158 @@
+// 990117 bkoz
+// test functionality of basic_filebuf for char_type == char
+// this is a data file for 27filebuf.cc
+
+// Copyright (C) 1997-1999 Cygnus Solutions
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+/mnt/cdrom/sarah_vaughan/sarah_vaughan.allofme
+/mnt/cdrom/sarah_vaughan/sarah_vaughan.speaklow
+
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_01_the_way_i_feel
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_02_seduction_kidnap
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_03_just_a_ny_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_04_butterflies_i_remem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_05_luxury_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_06_my_house
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_07_the_women_gather
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_08_the_life_i_led
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_09_when_i_die
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_10_revolutionary_dreams
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_11_winter_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_12_a_certain_peace_i_nap
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_13_poem_for_a_lady_whose
+
+/mnt/cdrom/marley-songs_of_freedom/disk_1/
+/mnt/cdrom/marley-songs_of_freedom/disk_2/
+/mnt/cdrom/marley-songs_of_freedom/disk_4/
+
+/mnt/cdrom/marley-songs_of_freedom/disk_1/back out
+/mnt/cdrom/marley-songs_of_freedom/disk_1/bend down low
+/mnt/cdrom/marley-songs_of_freedom/disk_1/bus dem shut (pyaka)
+/mnt/cdrom/marley-songs_of_freedom/disk_1/caution
+/mnt/cdrom/marley-songs_of_freedom/disk_1/do it twice
+/mnt/cdrom/marley-songs_of_freedom/disk_1/don't rock the boat
+/mnt/cdrom/marley-songs_of_freedom/disk_1/duppy conqueror
+/mnt/cdrom/marley-songs_of_freedom/disk_1/hammer
+/mnt/cdrom/marley-songs_of_freedom/disk_1/hypocrites
+/mnt/cdrom/marley-songs_of_freedom/disk_1/i'm still waiting
+/mnt/cdrom/marley-songs_of_freedom/disk_1/judge not
+/mnt/cdrom/marley-songs_of_freedom/disk_1/mellow mood
+/mnt/cdrom/marley-songs_of_freedom/disk_1/mr brown
+/mnt/cdrom/marley-songs_of_freedom/disk_1/nice time
+/mnt/cdrom/marley-songs_of_freedom/disk_1/one cup of coffee
+/mnt/cdrom/marley-songs_of_freedom/disk_1/one love_people get ready
+/mnt/cdrom/marley-songs_of_freedom/disk_1/put it on
+/mnt/cdrom/marley-songs_of_freedom/disk_1/simmer down
+/mnt/cdrom/marley-songs_of_freedom/disk_1/small axe
+/mnt/cdrom/marley-songs_of_freedom/disk_1/soul rebel
+/mnt/cdrom/marley-songs_of_freedom/disk_1/soul shake down party
+/mnt/cdrom/marley-songs_of_freedom/disk_1/stir it up (original)
+/mnt/cdrom/marley-songs_of_freedom/disk_1/sun is shining
+/mnt/cdrom/marley-songs_of_freedom/disk_1/thank you lord (original)
+/mnt/cdrom/marley-songs_of_freedom/disk_2/acoustic medley
+/mnt/cdrom/marley-songs_of_freedom/disk_2/burnin' and lootin'
+/mnt/cdrom/marley-songs_of_freedom/disk_2/concrete jungle
+/mnt/cdrom/marley-songs_of_freedom/disk_2/craven choke puppy
+/mnt/cdrom/marley-songs_of_freedom/disk_2/get up stand up
+/mnt/cdrom/marley-songs_of_freedom/disk_2/guava jelly
+/mnt/cdrom/marley-songs_of_freedom/disk_2/high tide or low tide
+/mnt/cdrom/marley-songs_of_freedom/disk_2/i shot the sheriff
+/mnt/cdrom/marley-songs_of_freedom/disk_2/i'm hurting inside
+/mnt/cdrom/marley-songs_of_freedom/disk_2/iron lion zion
+/mnt/cdrom/marley-songs_of_freedom/disk_2/lick samba
+/mnt/cdrom/marley-songs_of_freedom/disk_2/lively up yourself
+/mnt/cdrom/marley-songs_of_freedom/disk_2/natty dread
+/mnt/cdrom/marley-songs_of_freedom/disk_2/no more trouble
+/mnt/cdrom/marley-songs_of_freedom/disk_2/rastaman chant
+/mnt/cdrom/marley-songs_of_freedom/disk_2/screw face
+/mnt/cdrom/marley-songs_of_freedom/disk_2/slave driver
+/mnt/cdrom/marley-songs_of_freedom/disk_2/trenchtown rock
+/mnt/cdrom/marley-songs_of_freedom/disk_4/africa unite
+/mnt/cdrom/marley-songs_of_freedom/disk_4/babylon system
+/mnt/cdrom/marley-songs_of_freedom/disk_4/bad card
+/mnt/cdrom/marley-songs_of_freedom/disk_4/coming in from the cold (12
+/mnt/cdrom/marley-songs_of_freedom/disk_4/could you be loved (12 mix
+/mnt/cdrom/marley-songs_of_freedom/disk_4/forever loving jah
+/mnt/cdrom/marley-songs_of_freedom/disk_4/give thanks and praise
+/mnt/cdrom/marley-songs_of_freedom/disk_4/one drop
+/mnt/cdrom/marley-songs_of_freedom/disk_4/one dub
+/mnt/cdrom/marley-songs_of_freedom/disk_4/rastaman live up
+/mnt/cdrom/marley-songs_of_freedom/disk_4/real situation
+/mnt/cdrom/marley-songs_of_freedom/disk_4/redemption song (live in pi
+/mnt/cdrom/marley-songs_of_freedom/disk_4/ride natty ride (12 mix)
+/mnt/cdrom/marley-songs_of_freedom/disk_4/so much trouble in the worl
+/mnt/cdrom/marley-songs_of_freedom/disk_4/survival
+/mnt/cdrom/marley-songs_of_freedom/disk_4/why should i (previously un
+/mnt/cdrom/marley-songs_of_freedom/disk_4/zimbabwe
+
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_01_pandemonium
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_02_sync_disjecta
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_03_object_unknown
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_04_it's_nice_not
+/mnt/cdrom/dj_spooky_rid-2dim_warefare/djspooky_05_dialectical_tra
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_06_post-human_soph
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_07_quilombo_ex
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_08_rekonstruction
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_09_scientifik
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_10_a_conversation
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_11_peace_in_zaire
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_13_degree_zero
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_14_roman_planeta
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_15_bass_digitalis
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_16_polyphony_of
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_17_riddim_warfare
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_18_the_nerd
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_20_theme_of_the
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_21_twilight_fugue
+
+/mnt/cdrom/stuff_smith_mosaic/disk3/01_desert_sands
+/mnt/cdrom/stuff_smith_mosaic/disk3/02_soft_winds
+/mnt/cdrom/stuff_smith_mosaic/disk3/03_time_and_again
+/mnt/cdrom/stuff_smith_mosaic/disk3/04_it_don't_mean_a_thing
+/mnt/cdrom/stuff_smith_mosaic/disk3/05_in_a_mellotone
+/mnt/cdrom/stuff_smith_mosaic/disk3/06_i_know_that_you_know
+/mnt/cdrom/stuff_smith_mosaic/disk3/07_heat_wave
+/mnt/cdrom/stuff_smith_mosaic/disk3/08_things_ain't_what_they_used_to_be
+/mnt/cdrom/stuff_smith_mosaic/disk3/09_body_and_soul
+
+So I take a break, wander down to the park to stand, then lean into
+the concrete railing demarking the beginnings of space, oceanic
+space. I watch the waves break, and form, and ease back out to sea and
+wrap my arms around myself and hug tightly because it's early in the
+morning and windy, and the sun is late getting out of bed today, which
+is good because if there was brilliant light illuminating all the
+beauty around me I would be shocked, stunned, forced to retreat back
+into my cabana in a daze, blinded by hummingbirds and callilillies and
+un-named red, yellow, and blue flowers. Green envelopes me, waves
+sooth me. I can see the wind flip the top of the waves seaward, right
+before they break. The sea seems so calm from my perch above the fray
+that I wonder if maybe there is just some part of the deepest, most
+abstract ocean where there is a large creature who happily chews
+plankton and wags its tail in gentle, adulating waves that spread and
+move and gracefully glide thousands of miles, to crash upon a beach,
+one after the other, politely waiting for a turn to dance with the
+seashore.
+
+I know: it is what the Mexican schoolchildren call "la vibora de la
+mer," the serpent of the sea.
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc b/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc
new file mode 100644
index 00000000000..cbe99ede2cc
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc
@@ -0,0 +1,100 @@
+// 1999-08-16 bkoz
+// 1999-11-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <ostream>
+#include <sstream>
+#include <fstream>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+const int size = 1000;
+const char name_01[] = "testsuite/ostream_inserter_other-1.tst";
+const char name_02[] = "testsuite/ostream_inserter_other-1.txt";
+const char name_03[] = "testsuite/ostream_inserter_other-2.tst";
+const char name_04[] = "testsuite/ostream_inserter_other-2.txt";
+
+
+// stringstream
+bool test01() {
+ bool test = true;
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+// fstream
+bool test02() {
+ typedef std::ios_base::iostate iostate;
+ bool test = true;
+
+ // basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type* __sb)
+ // filebuf-> NULL
+ std::ifstream f_in1(name_01);
+ std::ofstream f_out1(name_02);
+ std::stringbuf* strbuf01 = NULL;
+ iostate state01 = f_in1.rdstate();
+ f_in1 >> strbuf01;
+ iostate state02 = f_in1.rdstate();
+ test &= state01 != state02;
+ test &= (state02 & std::ios_base::failbit) != 0;
+ state01 = f_out1.rdstate();
+ f_out1 << strbuf01;
+ state02 = f_out1.rdstate();
+ test &= state01 != state02;
+ test &= (state02 & std::ios_base::failbit) != 0;
+
+ // filebuf->filebuf
+ std::ifstream f_in(name_01);
+ std::ofstream f_out(name_02);
+ f_out << f_in.rdbuf();
+ f_in.close();
+ f_out.close();
+
+ // filebuf->stringbuf->filebuf
+ std::ifstream f_in2(name_03);
+ std::ofstream f_out2(name_04); // should be different name
+ std::stringbuf strbuf02;
+ f_in2 >> &strbuf02;
+ f_out2 << &strbuf02;
+ f_in2.close();
+ f_out2.close();
+
+ // no characters inserted
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+ test02();
+
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream_manip.cc b/libstdc++-v3/testsuite/27_io/ostream_manip.cc
new file mode 100644
index 00000000000..c8b9f941a44
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream_manip.cc
@@ -0,0 +1,92 @@
+// 1999-07-22 bkoz
+
+// Copyright (C) 1994, 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.2.7 standard basic_ostream manipulators
+
+#include <istream>
+#include <sstream>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+
+ const char str_lit01[] = " venice ";
+ const std::string str01(" santa barbara ");
+ std::string str02(str_lit01);
+ std::string str04;
+ std::string str05;
+ std::ios_base::iostate flag1, flag2, flag3, flag4, flag5;
+
+ // template<_CharT, _Traits>
+ // basic_ostream<_CharT, _Traits>& endl(basic_ostream<_Char, _Traits>& os)
+ std::ostringstream oss01(str01);
+ std::ostringstream oss02;
+ std::ostringstream::int_type i01, i02;
+ typedef std::ostringstream::traits_type traits_type;
+
+ oss01 << std::endl;
+ str04 = oss01.str();
+ test &= str04.size() == str01.size();
+
+ oss02 << std::endl;
+ str05 = oss02.str();
+ test &= str05.size() == 1;
+
+ // template<_CharT, _Traits>
+ // basic_ostream<_CharT, _Traits>& ends(basic_ostream<_Char, _Traits>& os)
+ oss01 << std::ends;
+ str04 = oss01.str();
+ test &= str04.size() == str01.size();
+ test &= str04[1] == char();
+
+ oss02 << std::ends;
+ str05 = oss02.str();
+ test &= str05.size() == 2;
+ test &= str05[1] == char();
+
+ // template<_CharT, _Traits>
+ // basic_ostream<_CharT, _Traits>& flush(basic_ostream<_Char, _Traits>& os)
+ oss01.flush();
+ str04 = oss01.str();
+ test &= str04.size() == str01.size();
+
+ oss02.flush();
+ str05 = oss02.str();
+ test &= str05.size() == 2;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream_unformatted.cc b/libstdc++-v3/testsuite/27_io/ostream_unformatted.cc
new file mode 100644
index 00000000000..e3d1693cc16
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream_unformatted.cc
@@ -0,0 +1,55 @@
+// 2000-03-23 bkoz
+
+// Copyright (C) 2000 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+//
+
+#include <sstream>
+#include <ostream>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+
+void test01()
+{
+ using namespace std;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+ bool test = true;
+
+ // tellp
+ ostringstream ost;
+ pos_type pos1;
+ pos1 = ost.tellp();
+ test &= pos1 == pos_type(-1);
+ ost << "RZA ";
+ pos1 = ost.tellp();
+ test &= pos1 == pos_type(4);
+ ost << "ghost dog: way of the samurai";
+ pos1 = ost.tellp();
+ test &= pos1 == pos_type(33);
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/27_io/streambuf.cc b/libstdc++-v3/testsuite/27_io/streambuf.cc
new file mode 100644
index 00000000000..bdd4f16b058
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/streambuf.cc
@@ -0,0 +1,257 @@
+// 1999-10-11 bkoz
+
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 27.5.2 template class basic_streambuf
+
+#include <streambuf>
+#include <ostream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+class testbuf : public std::streambuf
+{
+public:
+
+ // Typedefs:
+ typedef std::streambuf::traits_type traits_type;
+ typedef std::streambuf::char_type char_type;
+
+ testbuf(): std::streambuf()
+ { _M_mode = (std::ios_base::in | std::ios_base::out); }
+
+ bool
+ check_pointers()
+ {
+ bool test = true;
+ test &= this->eback() == NULL;
+ test &= this->gptr() == NULL;
+ test &= this->egptr() == NULL;
+ test &= this->pbase() == NULL;
+ test &= this->pptr() == NULL;
+ test &= this->epptr() == NULL;
+ return test;
+ }
+
+ int_type
+ pub_uflow()
+ { return (this->uflow()); }
+
+ int_type
+ pub_overflow(int_type __c = traits_type::eof())
+ { return (this->overflow(__c)); }
+
+ int_type
+ pub_pbackfail(int_type __c)
+ { return (this->pbackfail(__c)); }
+
+ void
+ pub_setg(char* beg, char* cur, char *end)
+ { this->setg(beg, cur, end); }
+
+ void
+ pub_setp(char* beg, char* end)
+ { this->setp(beg, end); }
+
+protected:
+ int_type
+ underflow()
+ {
+ int_type __retval = traits_type::eof();
+ if (this->gptr() < this->egptr())
+ __retval = traits_type::not_eof(0);
+ return __retval;
+ }
+};
+
+void test01()
+{
+ typedef testbuf::traits_type traits_type;
+ typedef testbuf::int_type int_type;
+
+ bool test = true;
+ char* lit01 = "chicago underground trio/possible cube on delmark";
+ testbuf buf01;
+
+ // 27.5.2.1 basic_streambuf ctors
+ // default ctor initializes
+ // - all pointer members to null pointers
+ // - locale to current global locale
+ test &= buf01.check_pointers();
+ test &= buf01.getloc() == std::locale();
+
+ // 27.5.2.3.1 get area
+ // 27.5.2.2.3 get area
+ // 27.5.2.4.3 get area
+ int i01 = 3;
+ buf01.pub_setg(lit01, lit01, (lit01 + i01));
+ test &= i01 == buf01.in_avail();
+
+ test &= buf01.pub_uflow() == lit01[0];
+ test &= buf01.sgetc() == traits_type::to_int_type(lit01[1]);
+ test &= buf01.pub_uflow() == lit01[1];
+ test &= buf01.sgetc() == traits_type::to_int_type(lit01[2]);
+ test &= buf01.pub_uflow() == lit01[2];
+ test &= buf01.sgetc() == traits_type::eof();
+
+ // pbackfail
+ buf01.pub_setg(lit01, lit01, (lit01 + i01));
+ test &= i01 == buf01.in_avail();
+ int_type intt01 = traits_type::to_int_type('b');
+ test &= traits_type::eof() == buf01.pub_pbackfail(intt01);
+
+ // overflow
+ test &= traits_type::eof() == buf01.pub_overflow(intt01);
+ test &= traits_type::eof() == buf01.pub_overflow();
+ test &= buf01.sgetc() == traits_type::to_int_type(lit01[0]);
+
+ // sputn/xsputn
+ char* lit02 = "isotope 217: the unstable molecule on thrill jockey";
+ int i02 = strlen(lit02);
+ char carray[i02 + 1];
+ memset(carray, 0, i02 + 1);
+
+ buf01.pub_setp(carray, (carray + i02));
+ buf01.sputn(lit02, 0);
+ test &= carray[0] == 0;
+ test &= lit02[0] == 'i';
+ buf01.sputn(lit02, 1);
+ test &= lit02[0] == carray[0];
+ test &= lit02[1] == 's';
+ test &= carray[1] == 0;
+ buf01.sputn(lit02 + 1, 10);
+ test &= memcmp(lit02, carray, 10) == 0;
+ buf01.sputn(lit02 + 11, 20);
+ test &= memcmp(lit02, carray, 30) == 0;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+void test02()
+{
+ typedef testbuf::traits_type traits_type;
+ typedef testbuf::int_type int_type;
+
+ bool test = true;
+ char* lit01 = "chicago underground trio/possible cube on delmark";
+ testbuf buf01;
+
+ // 27.5.2.1 basic_streambuf ctors
+ // default ctor initializes
+ // - all pointer members to null pointers
+ // - locale to current global locale
+ test &= buf01.check_pointers();
+ test &= buf01.getloc() == std::locale();
+
+ // 27.5.2.2.5 Put area
+ size_t i01 = traits_type::length(lit01);
+ char carray01[i01];
+ memset(carray01, 0, i01);
+
+ buf01.pub_setg(lit01, lit01, lit01 + i01);
+ buf01.sgetn(carray01, 0);
+ test &= carray01[0] == 0;
+ buf01.sgetn(carray01, 1);
+ test &= carray01[0] == 'c';
+ buf01.sgetn(carray01 + 1, i01 - 1);
+ test &= carray01[0] == 'c';
+ test &= carray01[1] == 'h';
+ test &= carray01[i01 - 1] == 'k';
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+// test03
+// http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00151.html
+template<typename charT, typename traits = std::char_traits<charT> >
+ class basic_nullbuf : public std::basic_streambuf<charT, traits>
+ {
+ protected:
+ virtual int_type
+ overflow(int_type c)
+ { return traits::not_eof(c); }
+ };
+
+typedef basic_nullbuf<char> nullbuf;
+typedef basic_nullbuf<wchar_t> wnullbuf;
+
+template<typename T>
+ char
+ print(const T& x)
+ {
+ nullbuf ob;
+ std::ostream out(&ob);
+ out << x << std::endl;
+ return (!out ? '0' : '1');
+ }
+
+void test03()
+{
+ bool test = true;
+ const std::string control01("11111");
+ std::string test01;
+
+ test01 += print(true);
+ test01 += print(3.14159);
+ test01 += print(10);
+ test01 += print('x');
+ test01 += print("pipo");
+
+ test &= test01 == control01;
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+
+ return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/stringbuf.cc b/libstdc++-v3/testsuite/27_io/stringbuf.cc
new file mode 100644
index 00000000000..5660677b82d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/stringbuf.cc
@@ -0,0 +1,452 @@
+// 981208 bkoz test functionality of basic_stringbuf for char_type == char
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <sstream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+std::string str_01("mykonos. . . or what?");
+std::string str_02("paris, or sainte-maxime?");
+std::string str_03;
+std::stringbuf strb_01(str_01);
+std::stringbuf strb_02(str_02, std::ios_base::in);
+std::stringbuf strb_03(str_03, std::ios_base::out);
+
+
+// test the underlying allocator
+bool test01() {
+ bool test = false;
+ std::allocator<char> alloc_01;
+ std::allocator<char>::size_type size_01 = alloc_01.max_size();
+ std::allocator<char>::pointer p_01 = alloc_01.allocate(32);
+
+ return true;
+}
+
+
+// test the streambuf/stringbuf locale settings
+bool test02() {
+ std::locale loc_tmp;
+ loc_tmp = strb_01.getloc();
+ strb_01.pubimbue(loc_tmp); //This should initialize _M_init to true
+ strb_01.getloc(); //This should just return _M_locale
+
+ return true;
+}
+
+
+// test member functions
+bool test03() {
+ bool test = true;
+ std::string str_tmp;
+
+ //stringbuf::str()
+ test &= strb_01.str() == str_01;
+ test &= strb_02.str() == str_02;
+ test &= strb_03.str() == str_03;
+
+ //stringbuf::str(string&)
+ strb_03.str("none of the above, go to the oberoi in cairo, egypt.");
+ strb_03.str(str_01);
+ std::streamsize d1 = strb_01.in_avail();
+ std::streamsize d2 = strb_03.in_avail();
+ test &= d1; // non-zero
+ test &= !d2; // zero, cuz ios_base::out
+ test &= d1 != d2; //these should be the same
+ test &= str_01.length() == d1;
+ test &= strb_01.str() == strb_03.str(); //ditto
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+// test overloaded virtual functions
+bool test04() {
+ bool test = true;
+ std::string str_tmp;
+ std::stringbuf strb_tmp;
+ std::streamsize strmsz_1, strmsz_2;
+ std::streamoff strmof_1(-1), strmof_2;
+ typedef std::stringbuf::int_type int_type;
+ typedef std::stringbuf::traits_type traits_type;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+
+ // GET
+ // int in_avail()
+ strmof_1 = strb_01.in_avail();
+ strmof_2 = strb_02.in_avail();
+ test &= strmof_1 != strmof_2;
+ test &= strmof_1 == str_01.length();
+ test &= strmof_2 == str_02.length();
+ strmof_1 = strb_03.in_avail();
+ test &= strmof_1 == 0; // zero cuz write-only, or eof()? zero, from showmany
+
+ // int_type sbumpc()
+ // if read_cur not avail, return uflow(), else return *read_cur & increment
+ int_type c1 = strb_01.sbumpc();
+ int_type c2 = strb_02.sbumpc();
+ test &= c1 != c2;
+ test &= c1 == str_01[0];
+ test &= c2 == str_02[0]; //should equal first letter at this point
+ int_type c3 = strb_01.sbumpc();
+ int_type c4 = strb_02.sbumpc();
+ test &= c1 != c2;
+ test &= c1 != c3;
+ test &= c2 != c4;
+ int_type c5 = strb_03.sbumpc();
+ test &= c5 == traits_type::eof();
+
+ // int_type sgetc()
+ // if read_cur not avail, return uflow(), else return *read_cur
+ int_type c6 = strb_01.sgetc();
+ int_type c7 = strb_02.sgetc();
+ test &= c6 != c3;
+ test &= c7 != c4;
+ int_type c8 = strb_01.sgetc();
+ int_type c9 = strb_02.sgetc();
+ test &= c6 == c8;
+ test &= c7 == c9;
+ c5 = strb_03.sgetc();
+ test &= c5 == traits_type::eof();
+
+ // int_type snextc()
+ // calls sbumpc and if sbumpc != eof, return sgetc
+ c6 = strb_01.snextc();
+ c7 = strb_02.snextc();
+ test &= c6 != c8;
+ test &= c7 != c9;
+ test &= c6 == str_01[3];
+ test &= c7 == str_02[3]; //should equal fourth letter at this point
+ c5 = strb_03.snextc();
+ test &= c5 == traits_type::eof();
+
+ // int showmanyc
+ // streamsize sgetn(char_type *s, streamsize n)
+ // streamsize xsgetn(char_type *s, streamsize n)
+ // assign up to n chars to s from input sequence, indexing in_cur as
+ // approp and returning the number of chars assigned
+ strmsz_1 = strb_01.in_avail();
+ strmsz_2 = strb_02.in_avail();
+ test = strmsz_1 != strmsz_2;
+ test &= strmsz_1 != str_01.length();
+ test &= strmsz_2 != str_02.length(); //because now we've moved into string
+ char carray1[11] = "";
+ strmsz_1 = strb_01.sgetn(carray1, 10);
+ char carray2[20] = "";
+ strmsz_2 = strb_02.sgetn(carray2, 10);
+ test &= strmsz_1 == strmsz_2;
+ test &= strmsz_1 == 10;
+ c1 = strb_01.sgetc();
+ c2 = strb_02.sgetc();
+ test &= c6 == c1; //just by co-incidence both o's
+ test &= c7 != c2; // n != i
+ test &= c1 == str_01[13];
+ test &= c2 == str_02[13]; //should equal fourteenth letter at this point
+ strmsz_1 = strb_03.sgetn(carray1, 10);
+ test &= !strmsz_1; //zero
+ strmsz_1 = strb_02.in_avail();
+ strmsz_2 = strb_02.sgetn(carray2, strmsz_1 + 5);
+ test &= strmsz_1 == strmsz_2; //write off the end
+ c4 = strb_02.sgetc(); // should be EOF
+ test &= c4 == traits_type::eof();
+
+ // PUT
+ // int_type sputc(char_type c)
+ // if out_cur not avail, return overflow. Else, stores c at out_cur,
+ // increments out_cur, and returns c as int_type
+ strb_03.str(str_01); //reset
+ std::string::size_type sz1 = strb_03.str().length();
+ c1 = strb_03.sputc('a');
+ std::string::size_type sz2 = strb_03.str().length();
+ test &= sz1 == sz2; //cuz inserting at out_cur, which is at beg to start
+ c2 = strb_03.sputc('b');
+ test &= c1 != c2;
+ test &= strb_03.str() != str_01;
+ c3 = strb_02.sputc('a'); // should be EOF because this is read-only
+ test &= c3 == traits_type::eof();
+
+ // streamsize sputn(const char_typs* s, streamsize n)
+ // write up to n chars to out_cur from s, returning number assigned
+ // NB *sputn will happily put '\0' into your stream if you give it a chance*
+ str_tmp = strb_03.str();
+ sz1 = str_tmp.length();
+ strmsz_1 = strb_03.sputn("racadabras", 10);//"abracadabras or what?"
+ sz2 = strb_03.str().length();
+ test &= sz1 == sz2; //shouldn't have changed length
+ test &= strmsz_1 == 10;
+ test &= str_tmp != strb_03.str();
+ strmsz_2 = strb_03.sputn(", i wanna reach out and", 10);
+ test &= strmsz_1 == strmsz_2; // should re-allocate, copy 10 chars.
+ test &= strmsz_1 == 10;
+ test &= strmsz_2 == 10;
+ sz2 = strb_03.str().length();
+ test &= sz1 != sz2; // need to change length
+ test &= str_tmp != strb_03.str();
+ str_tmp = strb_02.str();
+ strmsz_1 = strb_02.sputn("racadabra", 10);
+ test &= strmsz_1 == 0;
+ test &= str_tmp == strb_02.str();
+
+ // PUTBACK
+ // int_type pbfail(int_type c)
+ // called when gptr() null, gptr() == eback(), or traits::eq(*gptr, c) false
+ // "pending sequence" is:
+ // 1) everything as defined in underflow
+ // 2) + if (traits::eq_int_type(c, traits::eof()), then input
+ // sequence is backed up one char before the pending sequence is
+ // determined.
+ // 3) + if (not 2) then c is prepended. Left unspecified is
+ // whether the input sequence is backedup or modified in any way
+ // returns traits::eof() for failure, unspecified other value for success
+
+ // int_type sputbackc(char_type c)
+ // if in_cur not avail || ! traits::eq(c, gptr() [-1]), return pbfail
+ // otherwise decrements in_cur and returns *gptr()
+ strmsz_1 = strb_01.in_avail();
+ str_tmp = strb_01.str();
+ c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
+ c2 = strb_01.sputbackc('z');//"mykonos. . .zor what?"
+ c3 = strb_01.sgetc();
+ test &= c1 != c2;
+ test &= c3 == c2;
+ test &= strb_01.str() == std::string("mykonos. . .zor what?");
+ test &= str_tmp.size() == strb_01.str().size();
+ //test for _in_cur == _in_beg
+ strb_01.str(str_tmp);
+ strmsz_1 = strb_01.in_avail();
+ c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
+ c2 = strb_01.sputbackc('z');//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ test &= c1 != c2;
+ test &= c3 != c2;
+ test &= c1 == c3;
+ test &= c2 == traits_type::eof();
+ test &= strb_01.str() == str_tmp;
+ test &= str_tmp.size() == strb_01.str().size();
+ // test for replacing char with identical one
+ strb_01.str(str_01); //reset
+ strmsz_1 = strb_01.in_avail();
+ strb_01.sbumpc();
+ strb_01.sbumpc();
+ c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
+ c2 = strb_01.sputbackc('y');//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ test &= c1 != c2;
+ test &= c3 == c2;
+ test &= c1 != c3;
+ test &= strb_01.str() == str_01;
+ test &= str_01.size() == strb_01.str().size();
+ //test for ios_base::out
+ strmsz_2 = strb_03.in_avail();
+ c4 = strb_03.sputbackc('x');
+ test &= c4 == traits_type::eof();
+
+ // int_type sungetc()
+ // if in_cur not avail, return pbackfail(), else decrement and
+ // return to_int_type(*gptr())
+ for (int i = 0; i<12; ++i)
+ strb_01.sbumpc();
+ strmsz_1 = strb_01.in_avail();
+ str_tmp = strb_01.str();
+ c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
+ c2 = strb_01.sungetc();//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ test &= c1 != c2;
+ test &= c3 == c2;
+ test &= c1 != c3;
+ test &= c2 == ' ';
+ test &= strb_01.str() == str_01;
+ test &= str_01.size() == strb_01.str().size();
+ //test for _in_cur == _in_beg
+ strb_01.str(str_tmp);
+ strmsz_1 = strb_01.in_avail();
+ c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
+ c2 = strb_01.sungetc();//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ test &= c1 != c2;
+ test &= c3 != c2;
+ test &= c1 == c3;
+ test &= c2 == traits_type::eof();
+ test &= strb_01.str() == str_01;
+ test &= str_01.size() == strb_01.str().size();
+ // test for replacing char with identical one
+ strb_01.str(str_01); //reset
+ strmsz_1 = strb_01.in_avail();
+ strb_01.sbumpc();
+ strb_01.sbumpc();
+ c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
+ c2 = strb_01.sungetc();//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ test &= c1 != c2;
+ test &= c3 == c2;
+ test &= c1 != c3;
+ test &= strb_01.str() == str_01;
+ test &= str_01.size() == strb_01.str().size();
+ //test for ios_base::out
+ strmsz_2 = strb_03.in_avail();
+ c4 = strb_03.sungetc();
+ test &= c4 == traits_type::eof();
+
+ // BUFFER MANAGEMENT & POSITIONING
+ // sync
+ // pubsync
+ strb_01.pubsync();
+ strb_02.pubsync();
+ strb_03.pubsync();
+
+ // setbuf
+ // pubsetbuf(char_type* s, streamsize n)
+ str_tmp = std::string("naaaah, go to cebu");
+ strb_01.pubsetbuf(const_cast<char*> (str_tmp.c_str()), str_tmp.size());
+ test &= strb_01.str() == str_tmp;
+ strb_01.pubsetbuf(0,0);
+ test &= strb_01.str() == str_tmp;
+
+ // seekoff
+ // pubseekoff(off_type off, ios_base::seekdir way, ios_base::openmode which)
+ // alters the stream position to off
+ pos_type pt_1(off_type(-1));
+ pos_type pt_2(off_type(0));
+ off_type off_1 = 0;
+ off_type off_2 = 0;
+ strb_01.str(str_01); //in|out ("mykonos. . . or what?");
+ strb_02.str(str_02); //in ("paris, or sainte-maxime?");
+ strb_03.str(str_03); //out ("")
+ //IN|OUT
+ //beg
+ pt_1 = strb_01.pubseekoff(2, std::ios_base::beg);
+ off_1 = pt_1._M_position();
+ test &= off_1 >= 0;
+ c1 = strb_01.snextc(); //current in pointer +1
+ test &= c1 == 'o';
+ c2 = strb_01.sputc('x'); //test current out pointer
+ str_tmp = std::string("myxonos. . . or what?");
+ test &= strb_01.str() == str_tmp;
+ //cur
+ pt_1 = strb_01.pubseekoff(2, std::ios_base::cur);
+ off_1 = pt_1._M_position();
+ test &= off_1 == -1; // can't seekoff for in and out + cur in sstreams
+ pt_1 = strb_01.pubseekoff(2, std::ios_base::cur, std::ios_base::in);
+ off_1 = pt_1._M_position();
+ pt_2 = strb_01.pubseekoff(2, std::ios_base::cur, std::ios_base::in);
+ off_2 = pt_2._M_position();
+ test &= off_2 == off_1 + 2;
+ c1 = strb_01.snextc(); //current in pointer + 1
+ test &= c1 == ' ';
+ c2 = strb_01.sputc('x'); //test current out pointer
+ str_tmp = std::string("myxxnos. . . or what?");
+ test &= strb_01.str() == str_tmp;
+ //end
+ pt_2 = strb_01.pubseekoff(2, std::ios_base::end);
+ off_1 = pt_2._M_position();
+ test &= off_1 == -1; // not a valid position
+ test &= strb_01.str() == str_tmp;
+ // end part two (from the filebuf tests)
+ strb_01.pubseekoff(0, std::ios_base::end);
+ strmsz_1 = strb_01.in_avail(); // 0 cuz at the end
+ c1 = strb_01.sgetc();
+ c2 = strb_01.sungetc();
+ strmsz_2 = strb_01.in_avail(); // 1
+ c3 = strb_01.sgetc();
+ test &= c1 != c2;
+ test &= strmsz_2 != strmsz_1;
+ test &= strmsz_2 == 1;
+ // end part three
+ strmsz_1 = strb_01.str().size();
+ strmsz_2 = strb_01.sputn(" ravi shankar meets carlos santana in LoHa", 90);
+ strb_01.pubseekoff(0, std::ios_base::end);
+ strb_01.sputc('<');
+ str_tmp = strb_01.str();
+ test &= str_tmp.size() == strmsz_1 + strmsz_2 + 1;
+ // IN
+ // OUT
+
+ // seekpos
+ // pubseekpos(pos_type sp, ios_base::openmode)
+ // alters the stream position to sp
+ strb_01.str(str_01); //in|out ("mykonos. . . or what?");
+ strb_02.str(str_02); //in ("paris, or sainte-maxime?");
+ strb_03.str(str_03); //out ("")
+ //IN|OUT
+ //beg
+ pt_1 = strb_01.pubseekoff(2, std::ios_base::beg);
+ off_1 = pt_1._M_position();
+ test &= off_1 >= 0;
+ pt_1 = strb_01.pubseekoff(0, std::ios_base::cur, std::ios_base::out);
+ off_1 = pt_1._M_position();
+ c1 = strb_01.snextc(); //current in pointer +1
+ test &= c1 == 'o';
+ c2 = strb_01.sputc('x'); //test current out pointer
+ str_tmp = std::string("myxonos. . . or what?");
+ test &= strb_01.str() == str_tmp;
+ strb_01.pubsync(); //resets pointers
+ pt_2 = strb_01.pubseekpos(pt_1, std::ios_base::in|std::ios_base::out);
+ off_2 = pt_2._M_position();
+ test &= off_1 == off_2;
+ c3 = strb_01.snextc(); //current in pointer +1
+ test &= c1 == c3;
+ c2 = strb_01.sputc('x'); //test current out pointer
+ str_tmp = std::string("myxonos. . . or what?");
+ test &= strb_01.str() == str_tmp;
+
+ // VIRTUALS (indirectly tested)
+ // underflow
+ // if read position avail, returns *gptr()
+
+ // pbackfail(int_type c)
+ // put c back into input sequence
+
+ // overflow
+ // appends c to output seq
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+int main() {
+
+ test01();
+ test02();
+ test03();
+ test04();
+
+ return 0;
+}
+
+
+
+// more candy!!!
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/stringstream.cc b/libstdc++-v3/testsuite/27_io/stringstream.cc
new file mode 100644
index 00000000000..5b77c660502
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/stringstream.cc
@@ -0,0 +1,174 @@
+// 981015 bkoz
+// i,o,stringstream usage
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#include <vector>
+#include <string>
+#include <sstream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+// 01: sanity checks for strings, stringbufs
+std::string test01()
+{
+ bool test = false;
+
+ // Empty string sanity check.
+ std::string str01;
+ std::string::iterator __i_start = str01.begin();
+ char* __p_start = __i_start.base();
+ std::string::iterator __i_end = str01.end();
+ char* __p_end = __i_end.base();
+ std::string::size_type len = str01.size();
+ test = __p_start == __p_end;
+ test &= 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();
+ __p_start = __i_start.base();
+ __i_end = str02.end();
+ __p_end = __i_end.base();
+ len = str02.size();
+ test &= __p_start != __p_end;
+ test &= len != 0;
+
+ // Test an empty ostring stream for sanity.
+ std::ostringstream ostrstream0;
+ std::string str03 = ostrstream0.str();
+ __i_start = str03.begin();
+ __p_start = __i_start.base();
+ __i_end = str03.end();
+ __p_end = __i_end.base();
+ len = str03.size();
+ test &= __p_start == __p_end;
+ test &= len == 0;
+ test &= str01 == str03;
+
+ return str02;
+}
+
+
+bool test02(void) {
+
+ bool test = true;
+
+ //
+ // 1: Automatic formatting of a compound string
+ //
+ int i = 1024;
+ int *pi = &i;
+ double d = 3.14159;
+ double *pd = &d;
+ std::string blank;
+ std::ostringstream ostrst01;
+ std::ostringstream ostrst02(blank);
+
+ // No buffer, so nothing should be added.
+ ostrst01 << "i: " << i << " i's address: " << pi << "\n"
+ << "d: " << d << " d's address: " << pd << std::endl;
+ // Buffer, so this should be ok.
+ ostrst02 << "i: " << i << " i's address: " << pi << "\n"
+ << "d: " << d << " d's address: " << pd << std::endl;
+
+ std::string msg01 = ostrst01.str();
+ std::string msg02 = ostrst02.str();
+ test &= msg01 != msg02;
+ test &= msg02 != blank;
+
+ //
+ // 2: istringstream
+ //
+ // extracts the stored ascii values, placing them in turn in the four vars
+#if 0
+ int i2 = 0;
+ int *pi2 = &i2;
+ double d2 = 0.0;
+ double *pd2 = &d2;
+ std::istringstream istrst01(ostrst02.str());
+
+ istrst01 >> i2 >> pi2 >> d2 >> pd2;
+ //istrst01 >> i2;
+ //istrst01 >> pi2;
+ test &= i2 == i;
+ test &= d2 == d;
+ test &= pd2 == pd;
+ test &= pi2 == pi;
+#endif
+
+ // stringstream
+ std::string str1("");
+ std::string str3("this is a somewhat string");
+ std::stringstream ss1(str1, std::ios_base::in|std::ios_base::out);
+ std::stringstream ss2(str3, std::ios_base::in|std::ios_base::out);
+
+ return test;
+}
+
+// user-reported error
+class derived_oss: public std::ostringstream
+{
+public:
+ derived_oss() : std::ostringstream() {}
+};
+
+bool test03()
+{
+ bool test = true;
+ derived_oss yy;
+ yy << "buena vista social club\n";
+ test &= yy.str() == std::string("buena vista social club\n");
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/ext/headers.cc b/libstdc++-v3/testsuite/ext/headers.cc
new file mode 100644
index 00000000000..d596bf98b96
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/headers.cc
@@ -0,0 +1,33 @@
+// 1999-06-23 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// extension headers
+
+// This should include a list of all headers in the extension
+// subdirectory that are meant to be directly included.
+
+#include <ext/bvector>
+#include <ext/hash_map>
+#include <ext/hash_set>
+#include <ext/rope>
+#include <ext/slist>
+#include <ext/tree>
+
+int main() { }
diff --git a/libstdc++-v3/testsuite/printnow.c b/libstdc++-v3/testsuite/printnow.c
new file mode 100644
index 00000000000..457605f3a51
--- /dev/null
+++ b/libstdc++-v3/testsuite/printnow.c
@@ -0,0 +1,13 @@
+/* Prints the current time_t to stdout. Equivalent to the
+ * nonstandard %s format option to GNU date(1).
+*/
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <time.h>
+
+int main ()
+{
+ printf ("%lu\n", time(NULL));
+ exit(0);
+}