aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/27_io
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/27_io')
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/putback/char/1.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2346-fstream.cc89
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2346-sstream.cc80
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/1.cc7
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/1.cc10
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/2.cc8
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/cons/char/1.cc61
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/cons/wchar_t/1.cc61
8 files changed, 21 insertions, 299 deletions
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/putback/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/putback/char/1.cc
index 870d57aa355..b3c64f60d4d 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/putback/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/putback/char/1.cc
@@ -49,11 +49,11 @@ test01()
is_04.ignore(30);
is_04.clear();
state1 = is_04.rdstate();
- is_04.putback('|');
+ is_04.putback('t');
VERIFY( is_04.gcount() == 0 ); // DR 60
state2 = is_04.rdstate();
VERIFY( state1 == state2 );
- VERIFY( is_04.peek() == '|' );
+ VERIFY( is_04.peek() == 't' );
// istream& unget()
is_04.clear();
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2346-fstream.cc b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2346-fstream.cc
deleted file mode 100644
index 72686f1b699..00000000000
--- a/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2346-fstream.cc
+++ /dev/null
@@ -1,89 +0,0 @@
-// 2000-06-29 bkoz
-
-// Copyright (C) 2000, 2001, 2002, 2003 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
-// NB: ostream has a particular "seeks" category. Adopt this for istreams too.
-// @require@ %-*.tst %-*.txt
-// @diff@ %-*.tst %-*.txt
-
-#include <istream>
-#include <fstream>
-#include <testsuite_hooks.h>
-
-const char* s = " lootpack, peanut butter wolf, rob swift, madlib, quasimoto";
-const int times = 10;
-
-void write_rewind(std::iostream& stream)
-{
- for (int j = 0; j < times; j++)
- {
- bool test __attribute__((unused)) = true;
- std::streampos begin = stream.tellg();
-
- for (int i = 0; i < times; ++i)
- stream << j << '-' << i << s << '\n';
-
- stream.seekg(begin);
- std::streampos end = stream.tellg();
- std::streampos badpos = std::streampos(std::streambuf::off_type(-1));
- }
-}
-
-void check_contents(std::iostream& stream)
-{
- bool test __attribute__((unused)) = true;
-
- stream.clear();
- stream.seekg(0, std::ios::beg);
- int i = 0;
- int loop = times * times + 2;
- while (i < loop)
- {
- stream.ignore(80, '\n');
- if (stream.good())
- ++i;
- else
- break;
- }
- VERIFY( i == times );
-}
-
-// fstream
-// libstdc++/2346
-void test02()
-{
- std::fstream ofstrm;
- ofstrm.open("istream_seeks-3.txt", std::ios::out);
- if (!ofstrm)
- std::abort();
- write_rewind(ofstrm);
- ofstrm.close();
-
- std::fstream ifstrm;
- ifstrm.open("istream_seeks-3.txt", std::ios::in);
- check_contents(ifstrm);
- ifstrm.close();
-}
-
-int main()
-{
- test02();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2346-sstream.cc b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2346-sstream.cc
deleted file mode 100644
index 60e43c9a78b..00000000000
--- a/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2346-sstream.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-// 2000-06-29 bkoz
-
-// Copyright (C) 2000, 2001, 2002, 2003 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
-// NB: ostream has a particular "seeks" category. Adopt this for istreams too.
-
-#include <istream>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-const char* s = " lootpack, peanut butter wolf, rob swift, madlib, quasimoto";
-const int times = 10;
-
-void write_rewind(std::iostream& stream)
-{
- for (int j = 0; j < times; j++)
- {
- bool test __attribute__((unused)) = true;
- std::streampos begin = stream.tellg();
-
- for (int i = 0; i < times; ++i)
- stream << j << '-' << i << s << '\n';
-
- stream.seekg(begin);
- std::streampos end = stream.tellg();
- std::streampos badpos = std::streampos(std::streambuf::off_type(-1));
- }
-}
-
-void check_contents(std::iostream& stream)
-{
- bool test __attribute__((unused)) = true;
-
- stream.clear();
- stream.seekg(0, std::ios::beg);
- int i = 0;
- int loop = times * times + 2;
- while (i < loop)
- {
- stream.ignore(80, '\n');
- if (stream.good())
- ++i;
- else
- break;
- }
- VERIFY( i == times );
-}
-
-// stringstream
-// libstdc++/2346
-void test03()
-{
- std::stringstream sstrm;
-
- write_rewind(sstrm);
- check_contents(sstrm);
-}
-
-int main()
-{
- test03();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/1.cc
index d213d040a11..4bbe40be919 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/1.cc
@@ -31,20 +31,23 @@
void test01()
{
using namespace std;
+ typedef ios::off_type off_type;
typedef ios::pos_type pos_type;
bool test __attribute__((unused)) = true;
const char str_lit01[] = "istream_seeks-1.tst";
// in
- // test default ctors leave things in the same positions...
istringstream ist1;
pos_type p3 = ist1.tellg();
ifstream ifs1;
pos_type p4 = ifs1.tellg();
- VERIFY( p3 == p4 );
+ // N.B. We implement the resolution of DR 453 and
+ // istringstream::tellg() doesn't fail.
+ VERIFY( p3 == pos_type(off_type(0)) );
+ VERIFY( p4 == pos_type(off_type(-1)) );
// in
// test ctors leave things in the same positions...
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/1.cc
index 5c8caced6f3..27506636b03 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/1.cc
@@ -1,6 +1,6 @@
// 2000-06-29 bkoz
-// Copyright (C) 2000, 2003 Free Software Foundation
+// Copyright (C) 2000, 2003, 2004 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -25,24 +25,26 @@
#include <fstream>
#include <testsuite_hooks.h>
-
void test01()
{
using namespace std;
+ typedef ios::off_type off_type;
typedef ios::pos_type pos_type;
bool test __attribute__((unused)) = true;
const char str_lit01[] = "ostream_seeks-1.txt";
// out
- // test default ctors leave things in the same positions...
ostringstream ost1;
pos_type p1 = ost1.tellp();
ofstream ofs1;
pos_type p2 = ofs1.tellp();
- VERIFY( p1 == p2 );
+ // N.B. We implement the resolution of DR 453 and
+ // ostringstream::tellp() doesn't fail.
+ VERIFY( p1 == pos_type(off_type(0)) );
+ VERIFY( p2 == pos_type(off_type(-1)) );
// out
// test ctors leave things in the same positions...
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/2.cc
index f82df5d4bb0..acdc3b4cc75 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/2.cc
@@ -1,6 +1,6 @@
// 2000-03-23 bkoz
-// Copyright (C) 2000, 2003 Free Software Foundation
+// Copyright (C) 2000, 2003, 2004 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -33,13 +33,13 @@ void test01()
ostringstream ost;
pos_type pos1;
pos1 = ost.tellp();
- VERIFY( pos1 == pos_type(-1) );
+ VERIFY( pos1 == pos_type(off_type(0)) );
ost << "RZA ";
pos1 = ost.tellp();
- VERIFY( pos1 == pos_type(4) );
+ VERIFY( pos1 == pos_type(off_type(4)) );
ost << "ghost dog: way of the samurai";
pos1 = ost.tellp();
- VERIFY( pos1 == pos_type(33) );
+ VERIFY( pos1 == pos_type(off_type(33)) );
}
int main()
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/cons/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/cons/char/1.cc
index 9400a599bfc..76a344cfe23 100644
--- a/libstdc++-v3/testsuite/27_io/basic_streambuf/cons/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/cons/char/1.cc
@@ -31,69 +31,12 @@
#include <streambuf>
#include <testsuite_hooks.h>
-
-class testbuf : public std::streambuf
-{
-public:
-
- // Typedefs:
- typedef std::streambuf::traits_type traits_type;
- typedef std::streambuf::char_type char_type;
-
- testbuf(): std::streambuf()
- { }
-
- bool
- check_pointers()
- {
- bool test __attribute__((unused)) = true;
- VERIFY( this->eback() == NULL );
- VERIFY( this->gptr() == NULL );
- VERIFY( this->egptr() == NULL );
- VERIFY( this->pbase() == NULL );
- VERIFY( this->pptr() == NULL );
- VERIFY( 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;
- }
-};
+#include <testsuite_io.h>
void test01()
{
- typedef testbuf::traits_type traits_type;
- typedef testbuf::int_type int_type;
-
bool test __attribute__((unused)) = true;
- testbuf buf01;
+ __gnu_test::constraint_streambuf buf01;
// 27.5.2.1 basic_streambuf ctors
// default ctor initializes
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/cons/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/cons/wchar_t/1.cc
index a97b35f4d11..1721e4a820a 100644
--- a/libstdc++-v3/testsuite/27_io/basic_streambuf/cons/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/cons/wchar_t/1.cc
@@ -32,69 +32,12 @@
#include <streambuf>
#include <testsuite_hooks.h>
-
-class testbuf : public std::wstreambuf
-{
-public:
-
- // Typedefs:
- typedef std::wstreambuf::traits_type traits_type;
- typedef std::wstreambuf::char_type char_type;
-
- testbuf(): std::wstreambuf()
- { }
-
- bool
- check_pointers()
- {
- bool test __attribute__((unused)) = true;
- VERIFY( this->eback() == NULL );
- VERIFY( this->gptr() == NULL );
- VERIFY( this->egptr() == NULL );
- VERIFY( this->pbase() == NULL );
- VERIFY( this->pptr() == NULL );
- VERIFY( 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(wchar_t* beg, wchar_t* cur, wchar_t* end)
- { this->setg(beg, cur, end); }
-
- void
- pub_setp(wchar_t* beg, wchar_t* 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;
- }
-};
+#include <testsuite_io.h>
void test01()
{
- typedef testbuf::traits_type traits_type;
- typedef testbuf::int_type int_type;
-
bool test __attribute__((unused)) = true;
- testbuf buf01;
+ __gnu_test::constraint_wstreambuf buf01;
// 27.5.2.1 basic_streambuf ctors
// default ctor initializes