diff options
author | Dan Albert <danalbert@google.com> | 2015-06-17 11:09:54 -0700 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2015-06-17 14:15:22 -0700 |
commit | f378ebf14df0952eae870c9865bab8326aa8f137 (patch) | |
tree | 31794503eb2a8c64ea5f313b93100f1163afcffb /gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors | |
parent | 2c58169824949d3a597d9fa81931e001ef9b1bd0 (diff) | |
download | toolchain_gcc-f378ebf14df0952eae870c9865bab8326aa8f137.tar.gz toolchain_gcc-f378ebf14df0952eae870c9865bab8326aa8f137.tar.bz2 toolchain_gcc-f378ebf14df0952eae870c9865bab8326aa8f137.zip |
Delete old versions of GCC.
Change-Id: I710f125d905290e1024cbd67f48299861790c66c
Diffstat (limited to 'gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors')
22 files changed, 0 insertions, 1694 deletions
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/1.cc deleted file mode 100644 index 9b3ed4c3c..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/1.cc +++ /dev/null @@ -1,165 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 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> -#include <testsuite_hooks.h> - -bool test01(void) -{ - bool test __attribute__((unused)) = true; - typedef std::string::size_type csize_type; - typedef std::string::const_reference cref; - typedef std::string::reference ref; - - const std::string str01("sailing grand traverse bay\n" - "\t\t\t from Elk Rapids to the point reminds me of miles"); - 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; - VERIFY( str10 == str02 ); - try - { - std::istringstream::int_type i01 = istrs01.peek(); //a-boo - VERIFY( std::istringstream::traits_type::to_char_type(i01) == ' ' ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - istrs01.clear(); - istrs01 >> str10; - VERIFY( str10 == str03 ); - istrs01.clear(); - istrs01 >> str10; - VERIFY( str10 == str04 ); // sentry picks out the white spaces. . - - std::istringstream istrs02(str05); // empty - istrs02 >> str10; - VERIFY( str10 == str04 ); - - // istream& getline(istream&, string&, char) - // istream& getline(istream&, string&) - try - { - istrs01.clear(); - getline(istrs01, str10); - VERIFY( !istrs01.fail() ); - VERIFY( !istrs01.eof() ); - VERIFY( istrs01.good() ); - VERIFY( str10 == " bay" ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - try - { - istrs01.clear(); - getline(istrs01, str10,'\t'); - VERIFY( !istrs01.fail() ); - VERIFY( !istrs01.eof() ); - VERIFY( istrs01.good() ); - VERIFY( str10 == str05 ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - try - { - istrs01.clear(); - getline(istrs01, str10,'\t'); - VERIFY( !istrs01.fail() ); - VERIFY( !istrs01.eof() ); - VERIFY( istrs01.good() ); - VERIFY( str10 == str05 ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - try - { - istrs01.clear(); - getline(istrs01, str10, '.'); - VERIFY( !istrs01.fail() ); - VERIFY( istrs01.eof() ); - VERIFY( !istrs01.good() ); - VERIFY( str10 == "\t from Elk Rapids to the point reminds me of miles" ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - try - { - getline(istrs02, str10); - VERIFY( istrs02.fail() ); - VERIFY( istrs02.eof() ); - VERIFY( str10 =="\t from Elk Rapids to the point reminds me of miles" ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - // ostream& operator<<(ostream&, const basic_string&) - std::ostringstream ostrs01; - try - { - ostrs01 << str01; - VERIFY( ostrs01.str() == str01 ); - } - catch(std::exception& fail) - { - VERIFY( false ); - } - - std::string hello_world; - std::cout << hello_world; - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/10.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/10.cc deleted file mode 100644 index f2722fe96..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/10.cc +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 21.3.7.9 inserters and extractors - -// { dg-require-fileio "" } - -#include <istream> -#include <string> -#include <fstream> -#include <cstdlib> -#include <testsuite_hooks.h> - -using namespace std; - -string prepare(string::size_type len, unsigned nchunks, char delim) -{ - string ret; - for (unsigned i = 0; i < nchunks; ++i) - { - for (string::size_type j = 0; j < len; ++j) - ret.push_back('a' + rand() % 26); - len *= 2; - ret.push_back(delim); - } - return ret; -} - -void check(istream& stream, const string& str, unsigned nchunks, char delim) -{ - bool test __attribute__((unused)) = true; - - string chunk; - string::size_type index = 0, index_new = 0; - unsigned n = 0; - - while (getline(stream, chunk, delim)) - { - index_new = str.find(delim, index); - VERIFY( !str.compare(index, index_new - index, chunk) ); - index = index_new + 1; - ++n; - } - VERIFY( stream.eof() ); - VERIFY( n == nchunks ); -} - -// istream& getline(istream&, string&, char) -void test01() -{ - const char filename[] = "inserters_extractors-2.txt"; - - const char delim = '|'; - const unsigned nchunks = 10; - const string data = prepare(777, nchunks, delim); - - ofstream ofstrm; - ofstrm.open(filename); - ofstrm.write(data.data(), data.size()); - ofstrm.close(); - - ifstream ifstrm; - ifstrm.open(filename); - check(ifstrm, data, nchunks, delim); - ifstrm.close(); -} - -int main() -{ - test01(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/11.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/11.cc deleted file mode 100644 index 662311a88..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/11.cc +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 21.3.7.9 inserters and extractors - -// { dg-require-fileio "" } - -#include <istream> -#include <string> -#include <fstream> -#include <cstdlib> -#include <testsuite_hooks.h> - -using namespace std; - -string prepare(string::size_type len, unsigned nchunks) -{ - string ret; - for (unsigned i = 0; i < nchunks; ++i) - { - for (string::size_type j = 0; j < len; ++j) - ret.push_back('a' + rand() % 26); - len *= 2; - ret.push_back(' '); - } - return ret; -} - -void check(istream& stream, const string& str, unsigned nchunks) -{ - bool test __attribute__((unused)) = true; - - string chunk; - string::size_type index = 0, index_new = 0; - unsigned n = 0; - - while (stream >> chunk) - { - index_new = str.find(' ', index); - VERIFY( !str.compare(index, index_new - index, chunk) ); - index = index_new + 1; - ++n; - } - VERIFY( stream.eof() ); - VERIFY( n == nchunks ); -} - -// istream& operator>>(istream&, string&) -void test01() -{ - const char filename[] = "inserters_extractors-3.txt"; - - const unsigned nchunks = 10; - const string data = prepare(666, nchunks); - - ofstream ofstrm; - ofstrm.open(filename); - ofstrm.write(data.data(), data.size()); - ofstrm.close(); - - ifstream ifstrm; - ifstrm.open(filename); - check(ifstrm, data, nchunks); - ifstrm.close(); -} - -int main() -{ - test01(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/28277.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/28277.cc deleted file mode 100644 index dfcacc089..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/28277.cc +++ /dev/null @@ -1,54 +0,0 @@ -// 2006-10-12 Paolo Carlini <pcarlini@suse.de> - -// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// { dg-options "-DWIDTH=200000" { target simulator } } - -// 21.3.7.9 inserters and extractors - -#include <ostream> -#include <sstream> -#include <testsuite_hooks.h> - -#ifndef WIDTH -#define WIDTH 20000000 -#endif - -// libstdc++/28277 -void test01() -{ - using namespace std; - bool test __attribute__((unused)) = true; - - ostringstream oss_01; - const string str_01(50, 'a'); - - oss_01.width(WIDTH); - const streamsize width = oss_01.width(); - - oss_01 << str_01; - - VERIFY( oss_01.good() ); - VERIFY( oss_01.str().size() == string::size_type(width) ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/4.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/4.cc deleted file mode 100644 index cb1713bc8..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/4.cc +++ /dev/null @@ -1,65 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 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 <sstream> -#include <testsuite_hooks.h> - -// testing basic_stringbuf::xsputn via stress testing with large strings -// based on a bug report libstdc++ 9 -void test04(std::size_t size) -{ - bool test __attribute__((unused)) = true; - std::string str(size, 's'); - std::size_t expected_size = 2 * (size + 1); - std::ostringstream oss(str); - - // sanity checks - VERIFY( str.size() == size ); - VERIFY( oss.good() ); - - // stress test - oss << str << std::endl; - if (!oss.good()) - test = false; - - oss << str << std::endl; - if (!oss.good()) - test = false; - - VERIFY( str.size() == size ); - VERIFY( oss.good() ); - std::string str_tmp = oss.str(); - VERIFY( str_tmp.size() == expected_size ); -} - -int main() -{ - test04(1); // expected_size == 4 - test04(1000); // expected_size == 2002 - test04(10000); // expected_size == 20002 - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/5.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/5.cc deleted file mode 100644 index 109627325..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/5.cc +++ /dev/null @@ -1,88 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 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. - -// { dg-require-fileio "" } - -#include <string> -#include <fstream> -#include <iostream> -#include <testsuite_hooks.h> - -// testing basic_filebuf::xsputn via stress testing with large strings -// based on a bug report libstdc++ 9 -// mode == out -void test05(std::size_t size) -{ - bool test __attribute__((unused)) = true; - const char filename[] = "inserters_extractors-1.txt"; - const char fillc = 'f'; - std::ofstream ofs(filename); - std::string str(size, fillc); - - // sanity checks - VERIFY( str.size() == size ); - VERIFY( ofs.good() ); - - // stress test - ofs << str << std::endl; - if (!ofs.good()) - test = false; - - ofs << str << std::endl; - if (!ofs.good()) - test = false; - - VERIFY( str.size() == size ); - VERIFY( ofs.good() ); - - ofs.close(); - - // sanity check on the written file - std::ifstream ifs(filename); - std::size_t count = 0; - char c; - while (count <= (2 * size) + 4) - { - ifs >> c; - if (ifs.good() && c == fillc) - { - ++count; - c = '0'; - } - else - break; - } - - VERIFY( count == 2 * size ); -} - -int main() -{ - test05(1); - test05(1000); - test05(10000); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/6.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/6.cc deleted file mode 100644 index cc0e5d673..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/6.cc +++ /dev/null @@ -1,61 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 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 <sstream> -#include <testsuite_hooks.h> - -// istringstream/stringbuf extractor properly size buffer based on -// actual, not allocated contents (string.size() vs. string.capacity()). -// http://gcc.gnu.org/ml/libstdc++/1999-q4/msg00049.html -void test06(void) -{ - bool test __attribute__((unused)) = 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(); - VERIFY( i01 - 1 == i03 ); - VERIFY( i02 >= i04 ); - - std::istringstream is(str01); - std::string str02; - is >> str02 >> std::ws; - size_type i05 = str02.size(); - size_type i06 = str02.capacity(); - VERIFY( i05 == i03 ); - VERIFY( i06 <= i04 ); -} - -int main() -{ - test06(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/7.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/7.cc deleted file mode 100644 index c8ae3c580..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/7.cc +++ /dev/null @@ -1,53 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 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 <sstream> -#include <testsuite_hooks.h> - -// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00085.html -// istream::operator>>(string) -// sets failbit -// NB: this is a defect in the standard. -void test07(void) -{ - bool test __attribute__((unused)) = true; - const std::string name("z6.cc"); - std::istringstream iss (name); - int i = 0; - std::string s; - while (iss >> s) - ++i; - - VERIFY( i < 3 ); - VERIFY( static_cast<bool>(iss.rdstate() & std::ios_base::failbit) ); -} - -int main() -{ - test07(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/8.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/8.cc deleted file mode 100644 index 4e008a369..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/8.cc +++ /dev/null @@ -1,53 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 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 <sstream> -#include <iomanip> -#include <testsuite_hooks.h> - -// libstdc++/1019 -void test08() -{ - using namespace std; - - bool test __attribute__((unused)) = true; - istringstream istrm("enero:2001"); - int year; - char sep; - string month; - - istrm >> setw(5) >> month >> sep >> year; - VERIFY( month.size() == 5 ); - VERIFY( sep == ':' ); - VERIFY( year == 2001 ); -} - -int main() -{ - test08(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/9.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/9.cc deleted file mode 100644 index 29d3e7704..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/9.cc +++ /dev/null @@ -1,56 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 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 <sstream> -#include <iomanip> -#include <testsuite_hooks.h> - -// libstdc++/2830 -void test09() -{ - bool test __attribute__((unused)) = true; - std::string blanks( 3, '\0'); - std::string foo = "peace"; - foo += blanks; - foo += "& love"; - - std::ostringstream oss1; - oss1 << foo; - VERIFY( oss1.str() == foo ); - - std::ostringstream oss2; - oss2.width(20); - oss2 << foo; - VERIFY( oss2.str() != foo ); - VERIFY( oss2.str().size() == 20 ); -} - -int main() -{ - test09(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/pod/10081-in.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/pod/10081-in.cc deleted file mode 100644 index 142977c0c..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/pod/10081-in.cc +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - - -// 27.6.1.1.2 class basic_istream::sentry - -#include <string> -#include <istream> -#include <sstream> -#include <locale> -#include <typeinfo> -#include <testsuite_hooks.h> -#include <testsuite_character.h> - -void test01() -{ - using namespace std; - using __gnu_test::pod_ushort; - typedef basic_string<pod_ushort> string_type; - typedef basic_stringbuf<pod_ushort> stringbuf_type; - typedef basic_istream<pod_ushort> istream_type; - - bool test __attribute__((unused)) = true; - - string_type str; - stringbuf_type strbuf01; - istream_type stream(&strbuf01); - - try - { - stream >> str; - } - catch (std::bad_cast& obj) - { - // Ok, throws bad_cast because locale has no ctype facet. - } - catch (...) - { - VERIFY( false ); - } - - const std::locale loc(std::locale::classic(), new std::ctype<pod_ushort>); - stream.imbue(loc); - try - { - stream >> str; - } - catch (...) - { - VERIFY( false ); - } -} - -#if !__GXX_WEAK__ -// Explicitly instantiate for systems with no COMDAT or weak support. -template - const std::basic_string<__gnu_test::pod_ushort>::size_type - std::basic_string<__gnu_test::pod_ushort>::_Rep::_S_max_size; - -template - const __gnu_test::pod_ushort - std::basic_string<__gnu_test::pod_ushort>::_Rep::_S_terminal; -#endif - -int main() -{ - test01(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/pod/10081-out.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/pod/10081-out.cc deleted file mode 100644 index 50c9ec738..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/pod/10081-out.cc +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - - -// 27.6.1.1.2 class basic_istream::sentry - -#include <string> -#include <ostream> -#include <sstream> -#include <locale> -#include <typeinfo> -#include <testsuite_hooks.h> -#include <testsuite_character.h> - -void test01() -{ - using namespace std; - using __gnu_test::pod_ushort; - typedef basic_string<pod_ushort> string_type; - typedef basic_stringbuf<pod_ushort> stringbuf_type; - typedef basic_ostream<pod_ushort> ostream_type; - - bool test __attribute__((unused)) = true; - - string_type str; - stringbuf_type strbuf01; - ostream_type stream(&strbuf01); - - try - { - stream << str; - } - catch (std::bad_cast& obj) - { - // Ok, throws bad_cast because locale has no ctype facet. - } - catch (...) - { - VERIFY( false ); - } - - const std::locale loc(std::locale::classic(), new std::ctype<pod_ushort>); - stream.imbue(loc); - try - { - stream << str; - } - catch (...) - { - VERIFY( false ); - } -} - -#if !__GXX_WEAK__ -// Explicitly instantiate for systems with no COMDAT or weak support. -template - const std::basic_string<__gnu_test::pod_ushort>::size_type - std::basic_string<__gnu_test::pod_ushort>::_Rep::_S_max_size; - -template - const __gnu_test::pod_ushort - std::basic_string<__gnu_test::pod_ushort>::_Rep::_S_terminal; -#endif - -int main() -{ - test01(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/1.cc deleted file mode 100644 index a98201f67..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/1.cc +++ /dev/null @@ -1,165 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 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> -#include <testsuite_hooks.h> - -bool test01(void) -{ - bool test __attribute__((unused)) = true; - typedef std::wstring::size_type csize_type; - typedef std::wstring::const_reference cref; - typedef std::wstring::reference ref; - - const std::wstring str01(L"sailing grand traverse bay\n" - L"\t\t\t from Elk Rapids to the point reminds me of miles"); - const std::wstring str02(L"sailing"); - const std::wstring str03(L"grand"); - const std::wstring str04(L"traverse"); - const std::wstring str05; - std::wstring str10; - - // istream& operator>>(istream&, string&) - std::wistringstream istrs01(str01); - istrs01 >> str10; - VERIFY( str10 == str02 ); - try - { - std::wistringstream::int_type i01 = istrs01.peek(); //a-boo - VERIFY( std::wistringstream::traits_type::to_char_type(i01) == L' ' ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - istrs01.clear(); - istrs01 >> str10; - VERIFY( str10 == str03 ); - istrs01.clear(); - istrs01 >> str10; - VERIFY( str10 == str04 ); // sentry picks out the white spaces. . - - std::wistringstream istrs02(str05); // empty - istrs02 >> str10; - VERIFY( str10 == str04 ); - - // istream& getline(istream&, string&, char) - // istream& getline(istream&, string&) - try - { - istrs01.clear(); - getline(istrs01, str10); - VERIFY( !istrs01.fail() ); - VERIFY( !istrs01.eof() ); - VERIFY( istrs01.good() ); - VERIFY( str10 == L" bay" ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - try - { - istrs01.clear(); - getline(istrs01, str10, L'\t'); - VERIFY( !istrs01.fail() ); - VERIFY( !istrs01.eof() ); - VERIFY( istrs01.good() ); - VERIFY( str10 == str05 ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - try - { - istrs01.clear(); - getline(istrs01, str10, L'\t'); - VERIFY( !istrs01.fail() ); - VERIFY( !istrs01.eof() ); - VERIFY( istrs01.good() ); - VERIFY( str10 == str05 ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - try - { - istrs01.clear(); - getline(istrs01, str10, L'.'); - VERIFY( !istrs01.fail() ); - VERIFY( istrs01.eof() ); - VERIFY( !istrs01.good() ); - VERIFY( str10 == L"\t from Elk Rapids to the point reminds me of miles" ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - try - { - getline(istrs02, str10); - VERIFY( istrs02.fail() ); - VERIFY( istrs02.eof() ); - VERIFY( str10 == L"\t from Elk Rapids to the point reminds me of miles" ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - // ostream& operator<<(ostream&, const basic_string&) - std::wostringstream ostrs01; - try - { - ostrs01 << str01; - VERIFY( ostrs01.str() == str01 ); - } - catch(std::exception& fail) - { - VERIFY( false ); - } - - std::wstring hello_world; - std::wcout << hello_world; - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/10.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/10.cc deleted file mode 100644 index 0883e13c3..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/10.cc +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 21.3.7.9 inserters and extractors - -#include <istream> -#include <string> -#include <fstream> -#include <cstdlib> -#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 chunk; - wstring::size_type index = 0, index_new = 0; - unsigned n = 0; - - while (getline(stream, chunk, delim)) - { - index_new = str.find(delim, index); - VERIFY( !str.compare(index, index_new - index, chunk) ); - index = index_new + 1; - ++n; - } - VERIFY( stream.eof() ); - VERIFY( n == nchunks ); -} - -// istream& getline(istream&, string&, char) -void test01() -{ - const char filename[] = "inserters_extractors-2.txt"; - - const wchar_t delim = L'|'; - const unsigned nchunks = 10; - const wstring data = prepare(777, 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; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/11.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/11.cc deleted file mode 100644 index 2f174cad4..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/11.cc +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 21.3.7.9 inserters and extractors - -#include <istream> -#include <string> -#include <fstream> -#include <cstdlib> -#include <testsuite_hooks.h> - -using namespace std; - -wstring prepare(wstring::size_type len, unsigned nchunks) -{ - 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(L' '); - } - return ret; -} - -void check(wistream& stream, const wstring& str, unsigned nchunks) -{ - bool test __attribute__((unused)) = true; - - wstring chunk; - wstring::size_type index = 0, index_new = 0; - unsigned n = 0; - - while (stream >> chunk) - { - index_new = str.find(L' ', index); - VERIFY( !str.compare(index, index_new - index, chunk) ); - index = index_new + 1; - ++n; - } - VERIFY( stream.eof() ); - VERIFY( n == nchunks ); -} - -// istream& operator>>(istream&, string&) -void test01() -{ - const char filename[] = "inserters_extractors-3.txt"; - - const unsigned nchunks = 10; - const wstring data = prepare(666, nchunks); - - wofstream ofstrm; - ofstrm.open(filename); - ofstrm.write(data.data(), data.size()); - ofstrm.close(); - - wifstream ifstrm; - ifstrm.open(filename); - check(ifstrm, data, nchunks); - ifstrm.close(); -} - -int main() -{ - test01(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/28277.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/28277.cc deleted file mode 100644 index 51c26fd80..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/28277.cc +++ /dev/null @@ -1,54 +0,0 @@ -// 2006-10-12 Paolo Carlini <pcarlini@suse.de> - -// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// { dg-options "-DWIDTH=500000" { target simulator } } - -// 21.3.7.9 inserters and extractors - -#include <ostream> -#include <sstream> -#include <testsuite_hooks.h> - -#ifndef WIDTH -#define WIDTH 50000000 -#endif - -// libstdc++/28277 -void test01() -{ - using namespace std; - bool test __attribute__((unused)) = true; - - wostringstream oss_01; - const wstring str_01(50, L'a'); - - oss_01.width(WIDTH); - const streamsize width = oss_01.width(); - - oss_01 << str_01; - - VERIFY( oss_01.good() ); - VERIFY( oss_01.str().size() == wstring::size_type(width) ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/4.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/4.cc deleted file mode 100644 index 78bdf5132..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/4.cc +++ /dev/null @@ -1,65 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 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 <sstream> -#include <testsuite_hooks.h> - -// testing basic_stringbuf::xsputn via stress testing with large strings -// based on a bug report libstdc++ 9 -void test04(std::size_t size) -{ - bool test __attribute__((unused)) = true; - std::wstring str(size, L's'); - std::size_t expected_size = 2 * (size + 1); - std::wostringstream oss(str); - - // sanity checks - VERIFY( str.size() == size ); - VERIFY( oss.good() ); - - // stress test - oss << str << std::endl; - if (!oss.good()) - test = false; - - oss << str << std::endl; - if (!oss.good()) - test = false; - - VERIFY( str.size() == size ); - VERIFY( oss.good() ); - std::wstring str_tmp = oss.str(); - VERIFY( str_tmp.size() == expected_size ); -} - -int main() -{ - test04(1); // expected_size == 4 - test04(1000); // expected_size == 2002 - test04(10000); // expected_size == 20002 - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/5.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/5.cc deleted file mode 100644 index d9657a4c7..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/5.cc +++ /dev/null @@ -1,86 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 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 <fstream> -#include <iostream> -#include <testsuite_hooks.h> - -// testing basic_filebuf::xsputn via stress testing with large strings -// based on a bug report libstdc++ 9 -// mode == out -void test05(std::size_t size) -{ - bool test __attribute__((unused)) = true; - const char filename[] = "inserters_extractors-1.txt"; - const wchar_t fillc = L'f'; - std::wofstream ofs(filename); - std::wstring str(size, fillc); - - // sanity checks - VERIFY( str.size() == size ); - VERIFY( ofs.good() ); - - // stress test - ofs << str << std::endl; - if (!ofs.good()) - test = false; - - ofs << str << std::endl; - if (!ofs.good()) - test = false; - - VERIFY( str.size() == size ); - VERIFY( ofs.good() ); - - ofs.close(); - - // sanity check on the written file - std::wifstream ifs(filename); - std::size_t count = 0; - wchar_t c; - while (count <= (2 * size) + 4) - { - ifs >> c; - if (ifs.good() && c == fillc) - { - ++count; - c = '0'; - } - else - break; - } - - VERIFY( count == 2 * size ); -} - -int main() -{ - test05(1); - test05(1000); - test05(10000); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/6.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/6.cc deleted file mode 100644 index e49f61fb0..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/6.cc +++ /dev/null @@ -1,61 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 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 <sstream> -#include <testsuite_hooks.h> - -// istringstream/stringbuf extractor properly size buffer based on -// actual, not allocated contents (string.size() vs. string.capacity()). -// http://gcc.gnu.org/ml/libstdc++/1999-q4/msg00049.html -void test06(void) -{ - bool test __attribute__((unused)) = true; - - typedef std::wstring::size_type size_type; - std::wstring str01(L"@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(); - VERIFY( i01 - 1 == i03 ); - VERIFY( i02 >= i04 ); - - std::wistringstream is(str01); - std::wstring str02; - is >> str02 >> std::ws; - size_type i05 = str02.size(); - size_type i06 = str02.capacity(); - VERIFY( i05 == i03 ); - VERIFY( i06 <= i04 ); -} - -int main() -{ - test06(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/7.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/7.cc deleted file mode 100644 index 4032e389d..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/7.cc +++ /dev/null @@ -1,53 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 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 <sstream> -#include <testsuite_hooks.h> - -// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00085.html -// istream::operator>>(string) -// sets failbit -// NB: this is a defect in the standard. -void test07(void) -{ - bool test __attribute__((unused)) = true; - const std::wstring name(L"z6.cc"); - std::wistringstream iss(name); - int i = 0; - std::wstring s; - while (iss >> s) - ++i; - - VERIFY( i < 3 ); - VERIFY( static_cast<bool>(iss.rdstate() & std::ios_base::failbit) ); -} - -int main() -{ - test07(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/8.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/8.cc deleted file mode 100644 index 58dc00eca..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/8.cc +++ /dev/null @@ -1,53 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 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 <sstream> -#include <iomanip> -#include <testsuite_hooks.h> - -// libstdc++/1019 -void test08() -{ - using namespace std; - - bool test __attribute__((unused)) = true; - wistringstream istrm(L"enero:2001"); - int year; - wchar_t sep; - wstring month; - - istrm >> setw(5) >> month >> sep >> year; - VERIFY( month.size() == 5 ); - VERIFY( sep == ':' ); - VERIFY( year == 2001 ); -} - -int main() -{ - test08(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/9.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/9.cc deleted file mode 100644 index d7fa9467d..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/9.cc +++ /dev/null @@ -1,56 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 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 <sstream> -#include <iomanip> -#include <testsuite_hooks.h> - -// libstdc++/2830 -void test09() -{ - bool test __attribute__((unused)) = true; - std::wstring blanks(3, L'\0'); - std::wstring foo = L"peace"; - foo += blanks; - foo += L"& love"; - - std::wostringstream oss1; - oss1 << foo; - VERIFY( oss1.str() == foo ); - - std::wostringstream oss2; - oss2.width(20); - oss2 << foo; - VERIFY( oss2.str() != foo ); - VERIFY( oss2.str().size() == 20 ); -} - -int main() -{ - test09(); - return 0; -} |