mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-10 16:00:55 +08:00
1.cc: New.
2004-12-01 Paolo Carlini <pcarlini@suse.de> * testsuite/27_io/basic_istream/get/wchar_t/1.cc: New. * testsuite/27_io/basic_istream/get/wchar_t/2.cc: Likewise. * testsuite/27_io/basic_istream/get/wchar_t/3.cc: Likewise. * testsuite/27_io/basic_istream/ignore/wchar_t/1.cc: Likewise. * testsuite/27_io/basic_istream/ignore/wchar_t/2.cc: Likewise. * testsuite/27_io/basic_istream/ignore/wchar_t/3.cc: Likewise. * testsuite/27_io/basic_istream/ignore/wchar_t/6360.cc: Likewise. * testsuite/27_io/basic_istream/ignore/wchar_t/7220.cc: Likewise. From-SVN: r91565
This commit is contained in:
parent
386489e361
commit
f8e7ffa673
@ -1,3 +1,14 @@
|
||||
2004-12-01 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* testsuite/27_io/basic_istream/get/wchar_t/1.cc: New.
|
||||
* testsuite/27_io/basic_istream/get/wchar_t/2.cc: Likewise.
|
||||
* testsuite/27_io/basic_istream/get/wchar_t/3.cc: Likewise.
|
||||
* testsuite/27_io/basic_istream/ignore/wchar_t/1.cc: Likewise.
|
||||
* testsuite/27_io/basic_istream/ignore/wchar_t/2.cc: Likewise.
|
||||
* testsuite/27_io/basic_istream/ignore/wchar_t/3.cc: Likewise.
|
||||
* testsuite/27_io/basic_istream/ignore/wchar_t/6360.cc: Likewise.
|
||||
* testsuite/27_io/basic_istream/ignore/wchar_t/7220.cc: Likewise.
|
||||
|
||||
2004-11-29 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* testsuite/21_strings/basic_string/capacity/char/18654.cc: Use
|
||||
|
121
libstdc++-v3/testsuite/27_io/basic_istream/get/wchar_t/1.cc
Normal file
121
libstdc++-v3/testsuite/27_io/basic_istream/get/wchar_t/1.cc
Normal file
@ -0,0 +1,121 @@
|
||||
// Copyright (C) 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
|
||||
// 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 <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test03()
|
||||
{
|
||||
typedef std::char_traits<wchar_t> traits_type;
|
||||
|
||||
bool test __attribute__((unused)) = true;
|
||||
const wchar_t str_lit01[] =
|
||||
L" sun*ra \n\t\t\t & his arkestra, featuring john gilmore: \n"
|
||||
L" "
|
||||
L"jazz in silhouette: images and forecasts of tomorrow";
|
||||
|
||||
std::wstring str01(str_lit01);
|
||||
std::wstring strtmp;
|
||||
|
||||
std::wstringbuf sbuf_03;
|
||||
std::wstringbuf sbuf_04(str01, std::ios_base::in);
|
||||
std::wstringbuf sbuf_05(str01, std::ios_base::in);
|
||||
|
||||
std::wistream is_00(NULL);
|
||||
std::wistream is_04(&sbuf_04);
|
||||
std::wistream is_05(&sbuf_05);
|
||||
std::ios_base::iostate statefail, stateeof;
|
||||
statefail = std::ios_base::failbit;
|
||||
stateeof = std::ios_base::eofbit;
|
||||
wchar_t carray1[400] = L"";
|
||||
|
||||
// int_type get()
|
||||
// istream& get(wchar_t*, streamsize, wchar_t delim)
|
||||
// istream& get(wchar_t*, streamsize)
|
||||
// istream& get(streambuf&, wchar_t delim)
|
||||
// istream& get(streambuf&)
|
||||
is_00.get(carray1, 2);
|
||||
VERIFY( static_cast<bool>(is_00.rdstate() & statefail) );
|
||||
VERIFY( is_00.gcount() == 0 );
|
||||
|
||||
is_04.get(carray1, 4);
|
||||
VERIFY( !(is_04.rdstate() & statefail) );
|
||||
VERIFY( !traits_type::compare(carray1, L" ", 4) );
|
||||
VERIFY( is_04.gcount() == 3 );
|
||||
|
||||
is_04.clear();
|
||||
is_04.get(carray1 + 3, 200);
|
||||
VERIFY( !(is_04.rdstate() & statefail) );
|
||||
VERIFY( !(is_04.rdstate() & stateeof) );
|
||||
VERIFY( !traits_type::compare(carray1, str_lit01, 10) );
|
||||
VERIFY( is_04.gcount() == 7 );
|
||||
|
||||
is_04.clear();
|
||||
is_04.get(carray1, 200);
|
||||
VERIFY( !(is_04.rdstate() & stateeof) );
|
||||
VERIFY( static_cast<bool>(is_04.rdstate() & statefail) ); // delimiter
|
||||
VERIFY( is_04.gcount() == 0 );
|
||||
is_04.clear();
|
||||
is_04.get(carray1, 200, L'[');
|
||||
VERIFY( static_cast<bool>(is_04.rdstate() & stateeof) );
|
||||
VERIFY( !(is_04.rdstate() & statefail) );
|
||||
VERIFY( is_04.gcount() == 125 );
|
||||
is_04.clear();
|
||||
is_04.get(carray1, 200);
|
||||
VERIFY( static_cast<bool>(is_04.rdstate() & stateeof) );
|
||||
VERIFY( static_cast<bool>(is_04.rdstate() & statefail) );
|
||||
VERIFY( is_04.gcount() == 0 );
|
||||
|
||||
std::wstringbuf sbuf_02(std::ios_base::in);
|
||||
is_05.clear();
|
||||
is_05.get(sbuf_02);
|
||||
VERIFY( is_05.gcount() == 0 );
|
||||
VERIFY( static_cast<bool>(is_05.rdstate() & statefail) );
|
||||
VERIFY( !(is_05.rdstate() & stateeof) );
|
||||
|
||||
is_05.clear();
|
||||
is_05.get(sbuf_03);
|
||||
VERIFY( is_05.gcount() == 10 );
|
||||
VERIFY( sbuf_03.str() == L" sun*ra " );
|
||||
VERIFY( !(is_05.rdstate() & statefail) );
|
||||
VERIFY( !(is_05.rdstate() & stateeof) );
|
||||
|
||||
is_05.clear();
|
||||
is_05.get(sbuf_03, L'|');
|
||||
VERIFY( is_05.gcount() == 125 );
|
||||
VERIFY( sbuf_03.str() == str_lit01 );
|
||||
VERIFY( !(is_05.rdstate() & statefail) );
|
||||
VERIFY( static_cast<bool>(is_05.rdstate() & stateeof) );
|
||||
|
||||
is_05.clear();
|
||||
is_05.get(sbuf_03, L'|');
|
||||
VERIFY( is_05.gcount() == 0 );
|
||||
VERIFY( static_cast<bool>(is_05.rdstate() & stateeof) );
|
||||
VERIFY( static_cast<bool>(is_05.rdstate() & statefail) );
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test03();
|
||||
return 0;
|
||||
}
|
56
libstdc++-v3/testsuite/27_io/basic_istream/get/wchar_t/2.cc
Normal file
56
libstdc++-v3/testsuite/27_io/basic_istream/get/wchar_t/2.cc
Normal file
@ -0,0 +1,56 @@
|
||||
// Copyright (C) 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
|
||||
// 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
|
||||
// @require@ %-*.tst %-*.txt
|
||||
// @diff@ %-*.tst %-*.txt
|
||||
|
||||
#include <istream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
//libstdc++/92: Bug in istream::get(basic_streambuf*)
|
||||
// bug reported by bgarcia@laurelnetworks.com
|
||||
// http://gcc.gnu.org/ml/libstdc++-prs/2000-q3/msg00041.html
|
||||
void
|
||||
test07()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
const char* tfn = "istream_unformatted-1.txt";
|
||||
std::wifstream infile;
|
||||
infile.open(tfn);
|
||||
VERIFY( !(!infile) );
|
||||
while (infile)
|
||||
{
|
||||
std::wstring line;
|
||||
std::wostringstream line_ss;
|
||||
while (infile.peek() == L'\n')
|
||||
infile.get();
|
||||
infile.get(*(line_ss.rdbuf()));
|
||||
line = line_ss.str();
|
||||
VERIFY( line == L"1234567890" || line == L"" );
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test07();
|
||||
return 0;
|
||||
}
|
56
libstdc++-v3/testsuite/27_io/basic_istream/get/wchar_t/3.cc
Normal file
56
libstdc++-v3/testsuite/27_io/basic_istream/get/wchar_t/3.cc
Normal file
@ -0,0 +1,56 @@
|
||||
// Copyright (C) 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
|
||||
// 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 <sstream>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// DR 243. get and getline when sentry reports failure.
|
||||
void test01()
|
||||
{
|
||||
using namespace std;
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
wstringbuf strbuf01;
|
||||
wstringbuf strbuf02;
|
||||
wistream istr01(&strbuf01);
|
||||
wistream istr02(&strbuf02);
|
||||
wchar_t buf02[2] = L"*" ;
|
||||
|
||||
istr01.peek();
|
||||
VERIFY( istr01.eof() );
|
||||
|
||||
istr01.get(0, 0);
|
||||
VERIFY( istr01.gcount() == 0 );
|
||||
VERIFY( istr01.fail() );
|
||||
|
||||
istr02.peek();
|
||||
VERIFY( istr02.eof() );
|
||||
|
||||
istr02.get(buf02, 1);
|
||||
VERIFY( istr02.gcount() == 0 );
|
||||
VERIFY( istr02.fail() );
|
||||
VERIFY( buf02[0] == wchar_t() );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
// Copyright (C) 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
|
||||
// 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 <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
typedef std::ios::traits_type traits_type;
|
||||
|
||||
bool test __attribute__((unused)) = true;
|
||||
const std::wstring str_01;
|
||||
const std::wstring str_02(L"soul eyes: john coltrane quartet");
|
||||
std::wstring strtmp;
|
||||
|
||||
std::wstringbuf isbuf_03(str_02, std::ios_base::in);
|
||||
std::wstringbuf isbuf_04(str_02, std::ios_base::in);
|
||||
|
||||
std::wistream is_00(NULL);
|
||||
std::wistream is_03(&isbuf_03);
|
||||
std::wistream 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)
|
||||
wchar_t carray[60] = L"";
|
||||
is_04.read(carray, 9);
|
||||
VERIFY( is_04.peek() == L':' );
|
||||
|
||||
// istream& ignore(streamsize n = 1, int_type delim = traits::eof())
|
||||
state1 = is_04.rdstate();
|
||||
is_04.ignore();
|
||||
VERIFY( is_04.gcount() == 1 );
|
||||
state2 = is_04.rdstate();
|
||||
VERIFY( state1 == state2 );
|
||||
VERIFY( is_04.peek() == L' ' );
|
||||
|
||||
state1 = is_04.rdstate();
|
||||
is_04.ignore(0);
|
||||
VERIFY( is_04.gcount() == 0 );
|
||||
state2 = is_04.rdstate();
|
||||
VERIFY( state1 == state2 );
|
||||
VERIFY( is_04.peek() == L' ' );
|
||||
|
||||
state1 = is_04.rdstate();
|
||||
is_04.ignore(5, traits_type::to_int_type(' '));
|
||||
VERIFY( is_04.gcount() == 1 );
|
||||
state2 = is_04.rdstate();
|
||||
VERIFY( state1 == state2 );
|
||||
VERIFY( is_04.peek() == L'j' );
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
// Copyright (C) 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
|
||||
// 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 <string>
|
||||
#include <fstream>
|
||||
#include <limits>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
wstring
|
||||
prepare(wstring::size_type len, unsigned nchunks, wchar_t delim)
|
||||
{
|
||||
wstring ret;
|
||||
for (unsigned i = 0; i < nchunks; ++i)
|
||||
{
|
||||
for (wstring::size_type j = 0; j < len; ++j)
|
||||
ret.push_back(L'a' + rand() % 26);
|
||||
len *= 2;
|
||||
ret.push_back(delim);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
check(wistream& stream, const wstring& str, unsigned nchunks, wchar_t delim)
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
wstring::size_type index = 0, index_new = 0;
|
||||
unsigned n = 0;
|
||||
|
||||
while (stream.ignore(numeric_limits<streamsize>::max(), delim).good())
|
||||
{
|
||||
index_new = str.find(delim, index);
|
||||
VERIFY( stream.gcount() == index_new - index + 1 );
|
||||
index = index_new + 1;
|
||||
++n;
|
||||
}
|
||||
VERIFY( stream.gcount() == 0 );
|
||||
VERIFY( !stream.fail() );
|
||||
VERIFY( n == nchunks );
|
||||
}
|
||||
|
||||
void test01()
|
||||
{
|
||||
const char filename[] = "wistream_ignore.txt";
|
||||
|
||||
const wchar_t delim = L'|';
|
||||
const unsigned nchunks = 10;
|
||||
const wstring data = prepare(555, nchunks, delim);
|
||||
|
||||
wofstream ofstrm;
|
||||
ofstrm.open(filename);
|
||||
ofstrm.write(data.data(), data.size());
|
||||
ofstrm.close();
|
||||
|
||||
wifstream ifstrm;
|
||||
ifstrm.open(filename);
|
||||
check(ifstrm, data, nchunks, delim);
|
||||
ifstrm.close();
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
// Copyright (C) 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
|
||||
// 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
|
||||
// @require@ %-*.tst %-*.txt
|
||||
// @diff@ %-*.tst %-*.txt
|
||||
|
||||
#include <istream>
|
||||
#include <fstream>
|
||||
#include <limits>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// istream& ignore(streamsize n)
|
||||
void
|
||||
test01()
|
||||
{
|
||||
using namespace std;
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
const char filename[] ="istream_unformatted-1.txt";
|
||||
ios_base::iostate state1, state2;
|
||||
|
||||
wifstream ifstrm;
|
||||
ifstrm.open(filename);
|
||||
|
||||
state1 = ifstrm.rdstate();
|
||||
VERIFY( state1 == ios_base::goodbit );
|
||||
VERIFY( ifstrm.peek() == L'1' );
|
||||
state2 = ifstrm.rdstate();
|
||||
VERIFY( state1 == state2 );
|
||||
|
||||
state1 = ifstrm.rdstate();
|
||||
ifstrm.ignore(1);
|
||||
VERIFY( ifstrm.gcount() == 1 );
|
||||
state2 = ifstrm.rdstate();
|
||||
VERIFY( state1 == state2 );
|
||||
VERIFY( ifstrm.peek() == L'2' );
|
||||
|
||||
state1 = ifstrm.rdstate();
|
||||
ifstrm.ignore(10);
|
||||
VERIFY( ifstrm.gcount() == 10 );
|
||||
state2 = ifstrm.rdstate();
|
||||
VERIFY( state1 == state2 );
|
||||
VERIFY( ifstrm.peek() == L'1' );
|
||||
|
||||
state1 = ifstrm.rdstate();
|
||||
ifstrm.ignore(100);
|
||||
VERIFY( ifstrm.gcount() == 100 );
|
||||
state2 = ifstrm.rdstate();
|
||||
VERIFY( state1 == state2 );
|
||||
VERIFY( ifstrm.peek() == L'2' );
|
||||
|
||||
state1 = ifstrm.rdstate();
|
||||
ifstrm.ignore(1000);
|
||||
VERIFY( ifstrm.gcount() == 1000 );
|
||||
state2 = ifstrm.rdstate();
|
||||
VERIFY( state1 == state2 );
|
||||
VERIFY( ifstrm.peek() == L'1' );
|
||||
|
||||
state1 = ifstrm.rdstate();
|
||||
ifstrm.ignore(10000);
|
||||
VERIFY( ifstrm.gcount() == 10000 );
|
||||
state2 = ifstrm.rdstate();
|
||||
VERIFY( state1 == state2 );
|
||||
VERIFY( ifstrm.peek() == L'2' );
|
||||
|
||||
state1 = ifstrm.rdstate();
|
||||
ifstrm.ignore(numeric_limits<streamsize>::max());
|
||||
VERIFY( ifstrm.gcount() == 5389 );
|
||||
state2 = ifstrm.rdstate();
|
||||
VERIFY( state1 != state2 );
|
||||
VERIFY( state2 == ios_base::eofbit );
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
// Copyright (C) 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
|
||||
// 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 <testsuite_hooks.h>
|
||||
|
||||
// 2002-04-19 PR libstdc++ 6360
|
||||
void
|
||||
test08()
|
||||
{
|
||||
using namespace std;
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
wstringstream ss(L"abcd" L"\xFF" L"1234ina donna coolbrith");
|
||||
wchar_t c;
|
||||
ss >> c;
|
||||
VERIFY( c == L'a' );
|
||||
ss.ignore(8);
|
||||
ss >> c;
|
||||
VERIFY( c == L'i' );
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test08();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
// Copyright (C) 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
|
||||
// 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 <testsuite_hooks.h>
|
||||
|
||||
// libstdc++/70220
|
||||
void
|
||||
test10()
|
||||
{
|
||||
using namespace std;
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef wstring string_type;
|
||||
typedef wstringbuf stringbuf_type;
|
||||
typedef wistream istream_type;
|
||||
|
||||
streamsize n;
|
||||
string_type input(L"abcdefg\n");
|
||||
stringbuf_type sbuf(input);
|
||||
istream_type istr(&sbuf);
|
||||
|
||||
istr.ignore(0);
|
||||
if (istr.gcount() != 0)
|
||||
test = false;
|
||||
VERIFY( test );
|
||||
|
||||
istr.ignore(0, L'b');
|
||||
if (istr.gcount() != 0)
|
||||
test = false;
|
||||
VERIFY( test );
|
||||
|
||||
istr.ignore(); // Advance to next position.
|
||||
istr.ignore(0, L'b');
|
||||
if ((n=istr.gcount()) != 0)
|
||||
test = false;
|
||||
VERIFY( test );
|
||||
|
||||
if (istr.peek() != L'b')
|
||||
test = false;
|
||||
VERIFY( test );
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test10();
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user