This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
patch: testsuite std namespace safe
- To: libstdc++_list <libstdc++@sourceware.cygnus.com>
- Subject: patch: testsuite std namespace safe
- From: Alfred Minarik <a8601248@unet.univie.ac.at>
- Date: Wed, 14 Jul 1999 12:43:36 +0200
changes to make the testsuit compilable with -fhonor-std
contains direct qualification of library names with std::
notes:
I did not touch multiset.cc as it needs deeper changes
see my mail "Re: libstdc++-2.90.6pre1 on ftp site"
from 07 Jul 1999 for a possible change.
my testresults follow
host: Linux 2.2.10 #1 Sat Jul 3 14:34:33 MEST 1999 i686
compiler: 2.95
compiler flags: -fnew-abi -fhonor-std -g -O2 -DDEBUG_ASSERT
time exec text data total name
4 pass 73492 16741 374786 17_intro/header_ciso646.cc
12 pass 322974 35808 3106937 17_intro/header_fstream.cc
6 pass 323070 35808 3110362 17_intro/header_iomanip.cc
2 pass 80535 16741 465090 17_intro/header_ios.cc
0 pass 73460 16645 377635 17_intro/header_iosfwd.cc
5 pass 323074 36224 3107324 17_intro/header_iostream.cc
5 pass 322974 35808 3106826 17_intro/header_istream.cc
4 pass 322974 35744 3079256 17_intro/header_ostream.cc
8 pass 323170 36448 3227047 17_intro/headers.cc
4 pass 322974 35808 3106902 17_intro/header_sstream.cc
1 pass 80535 16741 465348 17_intro/header_streambuf.cc
9 pass 101350 18080 667919 21_strings/append.cc
4 pass 100518 17664 707953 21_strings/capacity.cc
1 pass 93766 17536 578119 21_strings/char_traits.cc
3 pass 96794 17664 611723 21_strings/compare.cc
3 pass 96326 17824 606706 21_strings/ctor_copy_dtor.cc
2 pass 94326 17824 575134 21_strings/element_access.cc
3 pass 97602 17792 601475 21_strings/find.cc
4 pass 97586 18272 618421 21_strings/insert.cc
12 fail 336994 37024 3264633 21_strings/inserters_extractors.cc
5 pass 98978 17920 638926 21_strings/invariants.cc
18 pass 108790 17664 777763 21_strings/nonmember.cc
2 pass 94830 17509 606123 21_strings/operations.cc
3 pass 96906 17856 616533 21_strings/replace.cc
2 pass 95082 17792 587195 21_strings/substr.cc
6 pass 326670 36352 3248811 23_containers/bitset_ctor.cc
2 fail 0 0 0 23_containers/multiset.cc
1 pass 92862 17248 543131 23_containers/vector_capacity.cc
1 pass 92158 17248 532024 23_containers/vector_cons.cc
9 fail 335714 36384 3222112 24_iterators/istreambuf_iterator.cc
8 pass 101278 17536 723357 24_iterators/iterator.cc
1 fail 0 0 0 26_numerics/modf_float.cc
2 pass 90870 17125 516607 26_numerics/valarray.cc
9 pass 338386 36512 3265107 27_io/boolfmt.cc
9 fail 340238 36256 3211610 27_io/filebuf.cc
6 pass 326594 36192 3152375 27_io/ios_members_static.cc
8 pass 325426 36544 3264611 27_io/iostream_objects.cc
8 fail 335666 36576 3235506 27_io/istringstream_formatted.cc
8 pass 334834 36512 3234313 27_io/octfmt.cc
18 fail 347810 36384 3364142 27_io/stringbuf.cc
10 pass 336562 36512 3254293 27_io/stringstream.cc
6 pass 323842 36640 3296074 ext/headers.cc
Alfred
Index: testsuite/21_strings/append.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/21_strings/append.cc,v
retrieving revision 1.1
diff -c -3 -r1.1 append.cc
*** append.cc 1999/07/09 02:49:38 1.1
--- append.cc 1999/07/14 08:56:20
***************
*** 29,45 ****
bool test01(void)
{
bool test = true;
! typedef string::size_type csize_type;
! typedef string::const_reference cref;
! typedef string::reference ref;
! csize_type npos = string::npos;
csize_type csz01, csz02;
const char str_lit01[] = "point bolivar, texas";
! const string str01(str_lit01);
! const string str02("corpus, ");
! const string str03;
! string str05;
// string& append(const string&)
--- 29,45 ----
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&)
***************
*** 50,56 ****
test &= str05 == "corpus, corpus, point bolivar, texas";
str05.append(str03);
test &= str05 == "corpus, corpus, point bolivar, texas";
! string str06;
str06.append(str05);
test &= str06 == str05;
--- 50,56 ----
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;
***************
*** 63,69 ****
str06.append(str03, csz01 + 1, 0);
test &= false;
}
! catch(out_of_range& fail) {
test &= true;
}
catch(...) {
--- 63,69 ----
str06.append(str03, csz01 + 1, 0);
test &= false;
}
! catch(std::out_of_range& fail) {
test &= true;
}
catch(...) {
***************
*** 75,81 ****
str06.append(str01, csz01 + 1, 0);
test &= false;
}
! catch(out_of_range& fail) {
test &= true;
}
catch(...) {
--- 75,81 ----
str06.append(str01, csz01 + 1, 0);
test &= false;
}
! catch(std::out_of_range& fail) {
test &= true;
}
catch(...) {
***************
*** 83,94 ****
}
str05 = str02;
! str05.append(str01, 0, string::npos);
test &= str05 == "corpus, point bolivar, texas";
test &= str05 != str02;
str06 = str02;
! str06.append(str01, 15, string::npos);
test &= str06 == "corpus, texas";
test &= str02 != str06;
--- 83,94 ----
}
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;
Index: testsuite/21_strings/capacity.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/21_strings/capacity.cc,v
retrieving revision 1.5
diff -c -3 -r1.5 capacity.cc
*** capacity.cc 1999/07/09 02:52:48 1.5
--- capacity.cc 1999/07/14 08:56:22
***************
*** 26,33 ****
#include <assert.h>
#endif
- using namespace std;
-
template<typename T>
struct A { };
--- 26,31 ----
***************
*** 75,81 ****
// 2 non POD types : resize, capacity, reserve
std::basic_string< A<B> > str02;
! typedef basic_string< A<B> >::size_type size_type_o;
size_type_o sz03;
size_type_o sz04;
--- 73,79 ----
// 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;
***************
*** 107,113 ****
// 3 POD types: size, length, max_size, clear(), empty()
bool b01;
! string str011;
b01 = str01.empty();
test &= b01 == true;
sz01 = str01.size();
--- 105,111 ----
// 3 POD types: size, length, max_size, clear(), empty()
bool b01;
! std::string str011;
b01 = str01.empty();
test &= b01 == true;
sz01 = str01.size();
***************
*** 128,136 ****
test &= sz02 > sz01;
// trickster allocator (__USE_MALLOC, luke) issues involved with these:
! string str3 = "8-chars_8-chars_";
const char* p3 = str3.c_str();
! string str4 = str3 + "7-chars";
const char* p4 = str3.c_str();
sz01 = str01.size();
--- 126,134 ----
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();
Index: testsuite/21_strings/char_traits.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/21_strings/char_traits.cc,v
retrieving revision 1.1
diff -c -3 -r1.1 char_traits.cc
*** char_traits.cc 1999/06/06 17:07:42 1.1
--- char_traits.cc 1999/07/14 08:56:22
***************
*** 28,35 ****
int test01(void)
{
bool test = true;
! const string str_01("zuma beach");
! const string str_02("montara and ocean beach");
// 21.1.1 character traits requirements
--- 28,35 ----
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
Index: testsuite/21_strings/compare.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/21_strings/compare.cc,v
retrieving revision 1.3
diff -c -3 -r1.3 compare.cc
*** compare.cc 1999/07/09 02:52:49 1.3
--- compare.cc 1999/07/14 08:56:23
***************
*** 66,74 ****
int test01(void) {
! string str_0("costa rica");
! string str_1("costa marbella");
! string str_2;
//sanity check
test_value(strcmp("costa marbella", "costa rica"), lt);
--- 66,74 ----
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);
Index: testsuite/21_strings/ctor_copy_dtor.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/21_strings/ctor_copy_dtor.cc,v
retrieving revision 1.5
diff -c -3 -r1.5 ctor_copy_dtor.cc
*** ctor_copy_dtor.cc 1999/06/16 01:46:14 1.5
--- ctor_copy_dtor.cc 1999/07/14 08:56:23
***************
*** 30,51 ****
int test01(void)
{
bool test = true;
! typedef string::size_type csize_type;
! typedef string::iterator citerator;
! csize_type npos = string::npos;
csize_type csz01, csz02;
const char str_lit01[] = "rodeo beach, marin";
! const string str01(str_lit01);
! const string str02("baker beach, san francisco");
// basic_string(const string&, size_type pos = 0, siz_type n = npos, alloc)
csz01 = str01.size();
try {
! string str03(str01, csz01 + 1);
test &= false;
}
! catch(out_of_range& fail) {
test &= true;
}
catch(...) {
--- 30,51 ----
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(...) {
***************
*** 53,59 ****
}
try {
! string str03(str01, csz01);
test &= str03.size() == 0;
test &= str03.size() <= str03.capacity();
}
--- 53,59 ----
}
try {
! std::string str03(str01, csz01);
test &= str03.size() == 0;
test &= str03.size() <= str03.capacity();
}
***************
*** 67,76 ****
// NB: As strlen(str_lit01) != csz01, this test is undefined. It
// should not crash, but what gets constructed is a bit arbitrary.
try {
! string str03(str_lit01, csz01 + 1);
test &= true;
}
! catch(length_error& fail) {
test &= true;
}
catch(...) {
--- 67,76 ----
// 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(...) {
***************
*** 80,89 ****
// NB: As strlen(str_lit01) != csz01, this test is undefined. It
// should not crash, but what gets constructed is a bit arbitrary.
try {
! string str04(str_lit01, npos); // the "maverick's" of all string objects.
test &= true;
}
! catch(length_error& fail) {
test &= true;
}
catch(...) {
--- 80,89 ----
// 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(...) {
***************
*** 91,103 ****
}
try {
! 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(bad_alloc& fail) {
test &= true;
}
catch(...) {
--- 91,103 ----
}
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(...) {
***************
*** 106,122 ****
// basic_string(const char* s, const allocator& a = allocator())
! string str04(str_lit01);
test &= str01 == str04;
// basic_string(size_type n, char c, const allocator& a = allocator())
csz01 = str01.max_size();
try {
! string str03(csz01 + 1, 'z');
test &= false;
}
! catch(length_error& fail) {
test &= true;
}
catch(...) {
--- 106,122 ----
// 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(...) {
***************
*** 124,133 ****
}
try {
! string str04(npos, 'b'); // the "maverick's" of all string objects.
test &= false;
}
! catch(length_error& fail) {
test &= true;
}
catch(...) {
--- 124,133 ----
}
try {
! std::string str04(npos, 'b'); // the "maverick's" of all string objects.
test &= false;
}
! catch(std::length_error& fail) {
test &= true;
}
catch(...) {
***************
*** 135,147 ****
}
try {
! 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(bad_alloc& fail) {
test &= true;
}
catch(...) {
--- 135,147 ----
}
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(...) {
***************
*** 151,157 ****
// template<typename _InputIter>
// basic_string(_InputIter begin, _InputIter end, const allocator& a)
! string str06(str01.begin(), str01.end());
test &= str06 == str01;
#ifdef DEBUG_ASSERT
--- 151,157 ----
// 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
Index: testsuite/21_strings/element_access.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/21_strings/element_access.cc,v
retrieving revision 1.3
diff -c -3 -r1.3 element_access.cc
*** element_access.cc 1999/06/09 02:21:00 1.3
--- element_access.cc 1999/07/14 08:56:23
***************
*** 29,43 ****
bool test01(void)
{
bool test = true;
! typedef string::size_type csize_type;
! typedef string::const_reference cref;
! typedef string::reference ref;
! csize_type npos = string::npos;
csize_type csz01, csz02;
! const string str01("tamarindo, costa rica");
! string str02("14th street beach, capitola, california");
! string str03;
// const_reference operator[] (size_type pos) const;
csz01 = str01.size();
--- 29,43 ----
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();
***************
*** 61,67 ****
cref cref4 = str01.at(csz01);
test &= false; // Should not get here, as exception thrown.
}
! catch(out_of_range& fail) {
test &= true;
}
catch(...) {
--- 61,67 ----
cref cref4 = str01.at(csz01);
test &= false; // Should not get here, as exception thrown.
}
! catch(std::out_of_range& fail) {
test &= true;
}
catch(...) {
***************
*** 76,82 ****
ref ref4 = str02.at(csz02);
test &= false; // Should not get here, as exception thrown.
}
! catch(out_of_range& fail) {
test &= true;
}
catch(...) {
--- 76,82 ----
ref ref4 = str02.at(csz02);
test &= false; // Should not get here, as exception thrown.
}
! catch(std::out_of_range& fail) {
test &= true;
}
catch(...) {
Index: testsuite/21_strings/find.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/21_strings/find.cc,v
retrieving revision 1.1
diff -c -3 -r1.1 find.cc
*** find.cc 1999/06/16 01:47:42 1.1
--- find.cc 1999/07/14 08:56:23
***************
*** 29,45 ****
bool test01(void)
{
bool test = true;
! typedef string::size_type csize_type;
! typedef string::const_reference cref;
! typedef string::reference ref;
! csize_type npos = string::npos;
csize_type csz01, csz02;
const char str_lit01[] = "mave";
! const string str01("mavericks, santa cruz");
! string str02(str_lit01);
! string str03("s, s");
! string str04;
// size_type find(const string&, size_type pos = 0) const;
csz01 = str01.find(str01);
--- 29,45 ----
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);
***************
*** 85,91 ****
// size_type find_first_of(const string&, size_type pos = 0) const;
! string str05("xena rulez");
csz01 = str01.find_first_of(str01);
test &= csz01 == 0;
csz01 = str01.find_first_of(str01, 4);
--- 85,91 ----
// 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);
***************
*** 139,152 ****
#if 1
// from tstring.cc, from jason merrill, et. al.
! string x;
! string::size_type pos;
pos = x.find_last_not_of('X');
test &= pos == npos;
pos = x.find_last_not_of("XYZ");
test &= pos == npos;
! string y("a");
pos = y.find_last_not_of('X');
test &= pos == 0;
pos = y.find_last_not_of('a');
--- 139,152 ----
#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');
***************
*** 156,162 ****
pos = y.find_last_not_of("a");
test &= pos == npos;
! string z("ab");
pos = z.find_last_not_of('X');
test &= pos == 1;
pos = z.find_last_not_of("XYZ");
--- 156,162 ----
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");
***************
*** 174,186 ****
pos = z.find_last_of("Xb");
test &= pos == 1;
pos = z.find_last_of("XYZ");
! test &= pos == 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 == string::npos;
#endif
#ifdef DEBUG_ASSERT
--- 174,186 ----
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
Index: testsuite/21_strings/insert.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/21_strings/insert.cc,v
retrieving revision 1.4
diff -c -3 -r1.4 insert.cc
*** insert.cc 1999/07/01 00:49:31 1.4
--- insert.cc 1999/07/14 08:56:23
***************
*** 29,42 ****
int test01(void)
{
bool test = true;
! typedef string::size_type csize_type;
! typedef string::iterator citerator;
! csize_type npos = string::npos;
csize_type csz01, csz02;
! const string str01("rodeo beach, marin");
! const string str02("baker beach, san francisco");
! string str03;
// string& insert(size_type p1, const string& str, size_type p2, size_type n)
// requires:
--- 29,42 ----
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:
***************
*** 58,64 ****
str03.insert(csz01 + 1, str02, 0, 5);
test &= false;
}
! catch(out_of_range& fail) {
test &= true;
}
catch(...) {
--- 58,64 ----
str03.insert(csz01 + 1, str02, 0, 5);
test &= false;
}
! catch(std::out_of_range& fail) {
test &= true;
}
catch(...) {
***************
*** 72,78 ****
str03.insert(0, str02, csz02 + 1, 5);
test &= false;
}
! catch(out_of_range& fail) {
test &= true;
}
catch(...) {
--- 72,78 ----
str03.insert(0, str02, csz02 + 1, 5);
test &= false;
}
! catch(std::out_of_range& fail) {
test &= true;
}
catch(...) {
***************
*** 81,104 ****
csz01 = str01.max_size();
try {
! string str04(csz01, 'b');
str03 = str04;
csz02 = str02.size();
try {
str03.insert(0, str02, 0, 5);
test &= false;
}
! catch(length_error& fail) {
test &= true;
}
catch(...) {
test &= false;
}
}
! catch(bad_alloc& failure){
test &= true;
}
! catch(exception& failure){
test &= false;
}
--- 81,104 ----
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;
}
Index: testsuite/21_strings/inserters_extractors.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/21_strings/inserters_extractors.cc,v
retrieving revision 1.2
diff -c -3 -r1.2 inserters_extractors.cc
*** inserters_extractors.cc 1999/07/06 16:27:28 1.2
--- inserters_extractors.cc 1999/07/14 08:56:24
***************
*** 34,72 ****
bool test01(void)
{
bool test = true;
! typedef string::size_type csize_type;
! typedef string::const_reference cref;
! typedef string::reference ref;
! csize_type npos = 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 string str01(str_lit01);
! const string str02("sailing");
! const string str03("grand");
! const string str04("traverse");
! const string str05;
! string str10;
#if 0
! const string input("str01 str02\n");
! istringstream ins(input);
ins >> str01;
getline(ins, str01, '\n');
! ostringstream outs;
outs << str01;
#endif
// istream& operator>>(istream&, string&)
! istringstream istrs01(str01);
istrs01 >> str10;
test &= str10 == str02;
try {
! istringstream::int_type i01 = istrs01.peek(); //a-boo
! test &= istringstream::traits_type::to_char_type(i01) == 'g';
}
! catch(exception& fail) {
test &= false; // shouldn't throw
}
--- 34,72 ----
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;
#if 0
! const std::string input("str01 str02\n");
! std::istringstream ins(input);
ins >> str01;
getline(ins, str01, '\n');
! std::ostringstream outs;
outs << str01;
#endif
// 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) == 'g';
}
! catch(std::exception& fail) {
test &= false; // shouldn't throw
}
***************
*** 75,81 ****
istrs01 >> str10;
test &= str10 == str04; // sentry picks out the white spaces. .
! istringstream istrs02(str05); // empty
istrs02 >> str10;
test &= str10 == str05;
--- 75,81 ----
istrs01 >> str10;
test &= str10 == str04; // sentry picks out the white spaces. .
! std::istringstream istrs02(str05); // empty
istrs02 >> str10;
test &= str10 == str05;
***************
*** 88,94 ****
test &= istrs01.good();
test &= str10 == " bay";
}
! catch(exception& fail) {
test &= false; // shouldn't throw
}
--- 88,94 ----
test &= istrs01.good();
test &= str10 == " bay";
}
! catch(std::exception& fail) {
test &= false; // shouldn't throw
}
***************
*** 100,106 ****
test &= istrs01.good();
test &= str10 == str05;
}
! catch(exception& fail) {
test &= false; // shouldn't throw
}
--- 100,106 ----
test &= istrs01.good();
test &= str10 == str05;
}
! catch(std::exception& fail) {
test &= false; // shouldn't throw
}
***************
*** 112,118 ****
test &= istrs01.good();
test &= str10 == str05;
}
! catch(exception& fail) {
test &= false; // shouldn't throw
}
--- 112,118 ----
test &= istrs01.good();
test &= str10 == str05;
}
! catch(std::exception& fail) {
test &= false; // shouldn't throw
}
***************
*** 124,130 ****
test &= !istrs01.good();
test &= str10 == "\t from Elk Rapids to the point reminds me of miles";
}
! catch(exception& fail) {
test &= false; // shouldn't throw
}
--- 124,130 ----
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
}
***************
*** 134,150 ****
test &= istrs02.eof();
test &= str10 == str05;
}
! catch(exception& fail) {
test &= false; // shouldn't throw
}
// ostream& operator<<(ostream&, const basic_string&)
! ostringstream ostrs01;
try {
ostrs01 << str01;
test &= ostrs01.str() == str01;
}
! catch(exception& fail) {
test &= false;
}
--- 134,150 ----
test &= istrs02.eof();
test &= str10 == str05;
}
! 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;
}
Index: testsuite/21_strings/invariants.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/21_strings/invariants.cc,v
retrieving revision 1.3
diff -c -3 -r1.3 invariants.cc
*** invariants.cc 1999/07/09 02:52:50 1.3
--- invariants.cc 1999/07/14 08:56:25
***************
*** 32,48 ****
bool test01(void)
{
bool test = true;
! typedef string::size_type csize_type;
! typedef string::iterator siterator;
! typedef string::reverse_iterator sriterator;
! csize_type npos = string::npos;
csize_type csz01, csz02;
siterator it1;
sriterator rit1;
! string str01("montara beach, half moon bay");
! const string str02("ocean beach, san francisco");
! string str03;
// 21.3 p 5
--- 32,48 ----
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
***************
*** 72,78 ****
str03 = str01;
csz01 = str01.size();
! string::reference r1 = str01.at(csz01 - 2);
test &= str03 == str01;
r1 = 'd';
test &= str01[csz01 - 2] == 'd';
--- 72,78 ----
str03 = str01;
csz01 = str01.size();
! std::string::reference r1 = str01.at(csz01 - 2);
test &= str03 == str01;
r1 = 'd';
test &= str01[csz01 - 2] == 'd';
***************
*** 80,86 ****
str03 = str01;
csz01 = str01.size();
! string::reference r2 = str01[csz01 - 3];
test &= str03 == str01;
r2 = 'w';
test &= str01[csz01 - 3] == 'w';
--- 80,86 ----
str03 = str01;
csz01 = str01.size();
! std::string::reference r2 = str01[csz01 - 3];
test &= str03 == str01;
r2 = 'w';
test &= str01[csz01 - 3] == 'w';
***************
*** 115,134 ****
bool test02(void)
{
bool test = true;
! typedef string::size_type csize_type;
! typedef string::iterator siterator;
! typedef string::reverse_iterator sriterator;
! csize_type npos = string::npos;
csize_type csz01, csz02;
siterator it1;
sriterator rit1;
! const string str01("its beach, santa cruz");
! string str02 = str01;
! string str05 = str02; // optional, so that begin below causes a mutate
! string::iterator p = str02.insert(str02.begin(), ' ');
! string str03 = str02;
test &= str03 == str02;
*p = '!';
test &= *str03.c_str() == ' ';
--- 115,134 ----
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() == ' ';
***************
*** 138,153 ****
test &= str02 != str05;
test &= str02 != str03;
! string str10 = str01;
! string::iterator p2 = str10.insert(str10.begin(), 'a');
! string str11 = str10;
*p2 = 'e';
test &= str11 != str10;
! string str06 = str01;
! string str07 = str06; // optional, so that begin below causes a mutate
p = str06.erase(str06.begin());
! string str08 = str06;
test &= str08 == str06;
*p = '!';
test &= *str08.c_str() == 't';
--- 138,153 ----
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';
***************
*** 157,165 ****
test &= str06 != str07;
test &= str06 != str08;
! string str12 = str01;
p2 = str12.erase(str12.begin(), str12.begin() + str12.size() - 1);
! string str13 = str12;
*p2 = 'e';
test &= str12 != str13;
--- 157,165 ----
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;
Index: testsuite/21_strings/nonmember.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/21_strings/nonmember.cc,v
retrieving revision 1.2
diff -c -3 -r1.2 nonmember.cc
*** nonmember.cc 1999/06/25 03:56:10 1.2
--- nonmember.cc 1999/07/14 08:56:25
***************
*** 118,128 ****
int test01(void)
{
bool test = true;
! string str_0("costa rica");
! string str_1("costa marbella");
! string str_2("cost");
! string str_3("costa ricans");
! string str_4;
str_4 = str_0;
//comparisons between string objects
--- 118,128 ----
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
***************
*** 264,274 ****
str_4 = str_0 + "ns";
test &= str_4 == str_3;
! const string str_5(" marbella");
str_4 = "costa" + str_5;
test &= str_4 == str_1;
! string str_6("ns");
str_4 = str_0 + str_6;
test &= str_4 == str_3;
--- 264,274 ----
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;
Index: testsuite/21_strings/operations.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/21_strings/operations.cc,v
retrieving revision 1.1
diff -c -3 -r1.1 operations.cc
*** operations.cc 1999/05/12 00:27:36 1.1
--- operations.cc 1999/07/14 08:56:25
***************
*** 26,44 ****
#include <assert.h>
#endif
- using namespace std;
-
int test01(void)
{
bool test = true;
! string str1;
! string str2;
// Should get this:
// 1:8-chars_8-chars_
// 2:8-chars_8-chars_
! str1 = string("8-chars_") + "8-chars_";
const char* p1 = str1.c_str();
// printf("1:%s\n", str1.c_str());
str2 = str1 + "7-chars";
--- 26,42 ----
#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";
Index: testsuite/21_strings/replace.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/21_strings/replace.cc,v
retrieving revision 1.1
diff -c -3 -r1.1 replace.cc
*** replace.cc 1999/06/16 01:47:42 1.1
--- replace.cc 1999/07/14 08:56:26
***************
*** 29,45 ****
bool test01(void)
{
bool test = true;
! typedef string::size_type csize_type;
! typedef string::const_reference cref;
! typedef string::reference ref;
! csize_type npos = string::npos;
csize_type csz01, csz02;
const char str_lit01[] = "ventura, california";
! const string str01(str_lit01);
! string str02("del mar, california");
! string str03(" and ");
! string str05;
// string& replace(size_type pos, size_type n, const string& string)
// string& replace(size_type pos1, size_type n1, const string& string,
--- 29,45 ----
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,
***************
*** 56,68 ****
#if 1
// with mods, from tstring.cc, from jason merrill, et. al.
! string X = "Hello";
! string x = X;
char ch = x[0];
test &= ch == 'H';
! string z = x.substr(2, 3);
test &= z == "llo";
x.replace(2, 2, "r");
--- 56,68 ----
#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");
Index: testsuite/21_strings/substr.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/21_strings/substr.cc,v
retrieving revision 1.1
diff -c -3 -r1.1 substr.cc
*** substr.cc 1999/06/16 01:47:42 1.1
--- substr.cc 1999/07/14 08:56:26
***************
*** 29,43 ****
bool test01(void)
{
bool test = true;
! typedef string::size_type csize_type;
! typedef string::const_reference cref;
! typedef string::reference ref;
! csize_type npos = string::npos;
csize_type csz01, csz02;
const char str_lit01[] = "rockaway, pacifica";
! const string str01(str_lit01);
! string str02;
// basic_string<charT, _Traits, _Alloc>
// substr(size_type pos = 0, size_type n = npos) const;
--- 29,43 ----
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;
***************
*** 51,57 ****
str02 = str01.substr(csz01 + 1);
test &= false;
}
! catch(out_of_range& fail) {
test &= true;
}
catch(...) {
--- 51,57 ----
str02 = str01.substr(csz01 + 1);
test &= false;
}
! catch(std::out_of_range& fail) {
test &= true;
}
catch(...) {
***************
*** 62,68 ****
str02 = str01.substr(csz01);
test &= str02.size() == 0;
}
! catch(out_of_range& fail) {
test &= false;
}
catch(...) {
--- 62,68 ----
str02 = str01.substr(csz01);
test &= str02.size() == 0;
}
! catch(std::out_of_range& fail) {
test &= false;
}
catch(...) {
Index: testsuite/23_containers/bitset_ctor.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/23_containers/bitset_ctor.cc,v
retrieving revision 1.1
diff -c -3 -r1.1 bitset_ctor.cc
*** bitset_ctor.cc 1999/06/08 17:58:04 1.1
--- bitset_ctor.cc 1999/07/14 08:56:26
***************
*** 32,74 ****
// bitset()
const size_t n1 = 5;
! 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;
! 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)
! string str01("stuff smith sessions");
const size_t n3 = 128;
try {
! bitset<n3> bit03(str01, 5);
}
! catch(invalid_argument& fail) {
test &= true;
}
catch(...) {
test&= false;
}
! string str02("010101000011");
int sz = str02.size();
try {
! bitset<n3> bit03(str02, 0);
! string str03;
for (int i = 0; i < sz; ++i)
str03 += (bit03.test(i) ? '1' : '0');
reverse(str03.begin(), str03.end());
test &= str03 == str02;
}
! catch(invalid_argument& fail) {
test &= false;
}
catch(...) {
--- 32,74 ----
// 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(...) {
Index: testsuite/23_containers/vector_capacity.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/23_containers/vector_capacity.cc,v
retrieving revision 1.1
diff -c -3 -r1.1 vector_capacity.cc
*** vector_capacity.cc 1999/05/12 00:27:37 1.1
--- vector_capacity.cc 1999/07/14 08:56:27
***************
*** 37,43 ****
// non POD types
bool test = true;
std::vector< A<B> > vec01;
! typedef vector< A<B> >::size_type size_type;
size_type sz01 = vec01.capacity();
vec01.reserve(100);
--- 37,43 ----
// 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);
Index: testsuite/23_containers/vector_cons.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/23_containers/vector_cons.cc,v
retrieving revision 1.1
diff -c -3 -r1.1 vector_cons.cc
*** vector_cons.cc 1999/06/29 00:43:15 1.1
--- vector_cons.cc 1999/07/14 08:56:27
***************
*** 37,43 ****
bool test = true;
std::vector< A<B> > vec01;
std::vector< A<B> > vec02(5);
! typedef vector< A<B> >::size_type size_type;
vec01 = vec02;
--- 37,43 ----
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;
Index: testsuite/24_iterators/istreambuf_iterator.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/24_iterators/istreambuf_iterator.cc,v
retrieving revision 1.2
diff -c -3 -r1.2 istreambuf_iterator.cc
*** istreambuf_iterator.cc 1999/07/01 00:49:32 1.2
--- istreambuf_iterator.cc 1999/07/14 08:56:28
***************
*** 29,46 ****
bool test01(void)
{
! typedef istreambuf_iterator<char> cistreambuf_iter;
typedef cistreambuf_iter::streambuf_type cstreambuf_type;
bool test = true;
const char slit01[] = "playa hermosa, liberia, guanacaste";
! string str01(slit01);
! istringstream istrs00(str01);
! istringstream istrs01(str01);
// ctor sanity checks
cistreambuf_iter istrb_it01(istrs00);
cistreambuf_iter istrb_it02;
! string tmp(istrb_it01, istrb_it02);
test &= tmp == str01;
cistreambuf_iter istrb_it03(0);
--- 29,46 ----
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);
***************
*** 102,108 ****
test &= c == slit01[i];
}
! istringstream istrs02(str01);
cistreambuf_iter istrb_it28(istrs02);
for (int i = 0; i < sizeof(slit01) - 3;)
{
--- 102,108 ----
test &= c == slit01[i];
}
! std::istringstream istrs02(str01);
cistreambuf_iter istrb_it28(istrs02);
for (int i = 0; i < sizeof(slit01) - 3;)
{
Index: testsuite/24_iterators/iterator.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/24_iterators/iterator.cc,v
retrieving revision 1.1
diff -c -3 -r1.1 iterator.cc
*** iterator.cc 1999/05/12 00:27:38 1.1
--- iterator.cc 1999/07/14 08:56:29
***************
*** 479,485 ****
++failures;
std::vector<std::string> vs;
! vs.push_back(string("abc"));
std::vector<std::string>::iterator ivs(vs.begin());
if (ivs->c_str()[1] != 'b')
++failures;
--- 479,485 ----
++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;
***************
*** 517,530 ****
int failures(0);
#ifdef ITER24_F1
! extern void f(std::vector<string*>::iterator);
! vector<string*> vs[2];
f(vs); // address of array is not an iterator
failures++;
#endif
#ifdef ITER24_F2
! string s;
char *i = s.begin(); // begin() doesn't return a pointer
failures++;
#endif
--- 517,530 ----
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
Index: testsuite/26_numerics/valarray.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/26_numerics/valarray.cc,v
retrieving revision 1.1
diff -c -3 -r1.1 valarray.cc
*** valarray.cc 1999/05/12 00:27:39 1.1
--- valarray.cc 1999/07/14 08:56:29
***************
*** 4,10 ****
int main()
{
! using std::valarray;
!
! valarray<double> a(20);
}
--- 4,8 ----
int main()
{
! std::valarray<double> a(20);
}
Index: testsuite/27_io/boolfmt.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/27_io/boolfmt.cc,v
retrieving revision 1.1
diff -c -3 -r1.1 boolfmt.cc
*** boolfmt.cc 1999/05/12 00:27:39 1.1
--- boolfmt.cc 1999/07/14 08:56:29
***************
*** 36,70 ****
struct MyNP : std::numpunct<char>
{
! string do_truename() const;
! string do_falsename() const;
};
! string MyNP::do_truename() const { static string s("yea"); return s; }
! string MyNP::do_falsename() const { static string s("nay"); return s; }
void test01()
{
! std::cout << true << " " << false << endl;
std::cout << std::boolalpha;
! std::cout << true << " " << false << endl;
! std::cout << ":" << std::setw(6) << std::internal << true << ":" << endl;
! std::cout << ":" << std::setw(6) << std::left << true << ":" << endl;
! std::cout << ":" << std::setw(6) << std::right << false << ":" << endl;
std::cout << std::noboolalpha;
! std::cout << ":" << std::setw(3) << std::internal << true << ":" << endl;
! std::cout << ":" << std::setw(3) << std::left << true << ":" << endl;
! std::cout << ":" << std::setw(3) << std::right << false << ":" << endl;
! std::cout.imbue(locale(locale(), new MyNP));
std::cout << std::boolalpha;
! std::cout << true << " " << false << endl;
! std::cout << ":" << std::setw(6) << std::internal << true << ":" << endl;
! std::cout << ":" << std::setw(6) << std::left << true << ":" << endl;
! std::cout << ":" << std::setw(6) << std::right << false << ":" << endl;
#ifdef DEBUG_ASSERT
assert (std::cout.good());
--- 36,70 ----
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::cout.imbue(std::locale(std::locale(), new MyNP));
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());
Index: testsuite/27_io/filebuf.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/27_io/filebuf.cc,v
retrieving revision 1.4
diff -c -3 -r1.4 filebuf.cc
*** filebuf.cc 1999/05/18 15:00:25 1.4
--- filebuf.cc 1999/07/14 08:56:31
***************
*** 33,46 ****
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
! filebuf fb_01; // in
! filebuf fb_02; // out
! filebuf fb_03; // in | out
// test the filebuf/stringbuf locale settings
bool test01() {
! 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
--- 33,46 ----
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
! std::filebuf fb_01; // in
! std::filebuf fb_02; // out
! std::filebuf fb_03; // in | out
// 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
***************
*** 59,70 ****
test &= !fb_03.is_open();
// filebuf_type* open(const char* __s, ios_base::openmode __mode)
! fb_01.open(name_01, ios_base::in);
! fb_02.open(name_02, ios_base::in | ios_base::out | 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, ios_base::in | ios_base::out);
! fb_03.open(name_03, ios_base::out | ios_base::trunc);
test &= fb_01.is_open();
test &= fb_02.is_open();
test &= fb_03.is_open();
--- 59,70 ----
test &= !fb_03.is_open();
// filebuf_type* open(const char* __s, ios_base::openmode __mode)
! fb_01.open(name_01, std::ios_base::in);
! 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();
***************
*** 87,102 ****
// test overloaded virtual functions
bool test03() {
! typedef filebuf::int_type int_type;
! typedef filebuf::traits_type traits_type;
! typedef filebuf::pos_type pos_type;
! typedef filebuf::off_type off_type;
typedef size_t size_type;
bool test = true;
! filebuf f_tmp;
! streamsize strmsz_1, strmsz_2;
! streamoff strmof_1, strmof_2;
int i = 0, j = 0, k = 0;
// GET
--- 87,102 ----
// 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
***************
*** 117,125 ****
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, ios_base::in);
! fb_02.open(name_02, ios_base::out | ios_base::trunc);
! fb_03.open(name_03, ios_base::out | ios_base::in | ios_base::trunc);
strmof_1 = fb_01.in_avail();
strmof_2 = fb_02.in_avail();
test &= strmof_1 != strmof_2;
--- 117,125 ----
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;
***************
*** 280,286 ****
test &= strmsz_1 + 1 == strmsz_2;
//test for _in_cur == _in_beg
// fb_03._M_out_beg = "bd23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracada" etc
! fb_03.pubseekoff(10, ios_base::beg, ios_base::in | ios_base::out);
fb_03.sputc('m');
strmsz_1 = fb_03.in_avail();
c1 = fb_03.sgetc();
--- 280,286 ----
test &= strmsz_1 + 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();
***************
*** 323,329 ****
//test for _in_cur == _in_beg
for (int i = 50; i < 32 + 29; ++i)
fb_02.sputc(char(i));
! fb_02.pubseekoff(0, ios_base::beg, ios_base::out);
strmsz_1 = fb_02.in_avail();
c1 = fb_02.sgetc();
c2 = fb_02.sungetc();
--- 323,329 ----
//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();
***************
*** 335,341 ****
test &= c2 == traits_type::eof();
test &= strmsz_1 == strmsz_2;
//test for _in_cur == _in_end
! fb_03.pubseekoff(0, ios_base::end, ios_base::in | ios_base::out);
strmsz_1 = fb_03.in_avail(); // -1 cuz at the end
c1 = fb_03.sgetc();
c2 = fb_03.sungetc();
--- 335,341 ----
test &= c2 == traits_type::eof();
test &= strmsz_1 == strmsz_2;
//test for _in_cur == _in_end
! fb_03.pubseekoff(0, std::ios_base::end, std::ios_base::in | std::ios_base::out);
strmsz_1 = fb_03.in_avail(); // -1 cuz at the end
c1 = fb_03.sgetc();
c2 = fb_03.sungetc();
***************
*** 387,393 ****
// 27filebuf-3.txt = bd23456789:;<=>?...
//beg
strmsz_1 = fb_03.in_avail();
! pt_1 = fb_03.pubseekoff(2, ios_base::beg, ios_base::in | ios_base::out);
strmsz_2 = fb_03.in_avail();
off_1 = pt_1._M_position();
test &= off_1 > 0;
--- 387,393 ----
// 27filebuf-3.txt = bd23456789:;<=>?...
//beg
strmsz_1 = fb_03.in_avail();
! pt_1 = fb_03.pubseekoff(2, std::ios_base::beg, std::ios_base::in | std::ios_base::out);
strmsz_2 = fb_03.in_avail();
off_1 = pt_1._M_position();
test &= off_1 > 0;
***************
*** 402,408 ****
test &= c1 == c3;
//cur
// 27filebuf-3.txt = bd2\n456789:;<=>?...
! pt_2 = fb_03.pubseekoff(2, ios_base::cur, ios_base::in|ios_base::out);
off_2 = pt_2._M_position();
test &= (off_2 == (off_1 + 2 + 1 + 1));
c1 = fb_03.snextc(); //current in pointer +1
--- 402,408 ----
test &= c1 == c3;
//cur
// 27filebuf-3.txt = bd2\n456789:;<=>?...
! pt_2 = fb_03.pubseekoff(2, std::ios_base::cur, std::ios_base::in|std::ios_base::out);
off_2 = pt_2._M_position();
test &= (off_2 == (off_1 + 2 + 1 + 1));
c1 = fb_03.snextc(); //current in pointer +1
***************
*** 415,421 ****
test &= c1 == c3;
//end
// 27filebuf-3.txt = "bd2\n456x\n9"
! pt_2 = fb_03.pubseekoff(0, ios_base::end, ios_base::in|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');
--- 415,421 ----
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');
***************
*** 434,440 ****
// alters the stream position to sp
//IN|OUT
//beg
! pt_1 = fb_03.pubseekoff(78, ios_base::beg, ios_base::in|ios_base::out);
off_1 = pt_1._M_position();
test &= off_1 > 0;
c1 = fb_03.snextc(); //current in pointer +1
--- 434,440 ----
// alters the stream position to sp
//IN|OUT
//beg
! pt_1 = fb_03.pubseekoff(78, std::ios_base::beg, std::ios_base::in|std::ios_base::out);
off_1 = pt_1._M_position();
test &= off_1 > 0;
c1 = fb_03.snextc(); //current in pointer +1
***************
*** 442,453 ****
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, ios_base::in|ios_base::out);
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, ios_base::end);
off_1 = pt_1._M_position();
test &= off_1 > off_2;
fb_03.sputn("\nof the wonderful things he does!!\nok", 36);
--- 442,453 ----
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, std::ios_base::in|std::ios_base::out);
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", 36);
Index: testsuite/27_io/ios_members_static.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/27_io/ios_members_static.cc,v
retrieving revision 1.1
diff -c -3 -r1.1 ios_members_static.cc
*** ios_members_static.cc 1999/05/21 15:34:01 1.1
--- ios_members_static.cc 1999/07/14 08:56:31
***************
*** 25,37 ****
#include <assert.h>
#endif
-
bool test01()
{
bool test = true;
! stringbuf strbuf01;
! ios ios01(&strbuf01);
// 1: basic invocation
test &= ios01.sync_with_stdio();
--- 25,36 ----
#include <assert.h>
#endif
bool test01()
{
bool test = true;
! std::stringbuf strbuf01;
! std::ios ios01(&strbuf01);
// 1: basic invocation
test &= ios01.sync_with_stdio();
Index: testsuite/27_io/istringstream_formatted.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/27_io/istringstream_formatted.cc,v
retrieving revision 1.1
diff -c -3 -r1.1 istringstream_formatted.cc
*** istringstream_formatted.cc 1999/05/12 00:27:40 1.1
--- istringstream_formatted.cc 1999/07/14 08:56:32
***************
*** 24,35 ****
#include <assert.h>
#endif
! string str_01;
! string str_02("true false 0 1 0 -1 -2 -3 -4 -5 5 4 3 2 1 11.11 22.22");
! string str_03("-19,999,999 777,777 -234,234 233 -234 33 1 66,300.25 .315 1.5");
! istringstream iss_01;
! istringstream iss_02(str_02);
! istringstream iss_03(str_03);
bool test01() {
--- 24,35 ----
#include <assert.h>
#endif
! std::string str_01;
! std::string str_02("true false 0 1 0 -1 -2 -3 -4 -5 5 4 3 2 1 11.11 22.22");
! std::string str_03("-19,999,999 777,777 -234,234 233 -234 33 1 66,300.25 .315 1.5");
! std::istringstream iss_01;
! std::istringstream iss_02(str_02);
! std::istringstream iss_03(str_03);
bool test01() {
***************
*** 50,69 ****
long double ld1 = 0;
// process alphanumeric versions of bool values
! ios_base::fmtflags fmt = iss_02.flags();
! bool testfmt = fmt & ios_base::boolalpha;
! iss_02.setf(ios_base::boolalpha);
fmt = iss_02.flags();
! testfmt = fmt & ios_base::boolalpha;
iss_02 >> b1;
test &= b1 == 1;
iss_02 >> b1;
test &= b1 == 0;
// process numeric versions of of bool values
! iss_02.unsetf(ios_base::boolalpha);
fmt = iss_02.flags();
! testfmt = fmt & ios_base::boolalpha;
iss_02 >> b1;
test &= b1 == 0;
iss_02 >> b1;
--- 50,69 ----
long double ld1 = 0;
// process alphanumeric versions of bool values
! std::ios_base::fmtflags fmt = iss_02.flags();
! bool testfmt = fmt & std::ios_base::boolalpha;
! iss_02.setf(std::ios_base::boolalpha);
fmt = iss_02.flags();
! testfmt = fmt & std::ios_base::boolalpha;
iss_02 >> b1;
test &= b1 == 1;
iss_02 >> b1;
test &= b1 == 0;
// process numeric versions of of bool values
! iss_02.unsetf(std::ios_base::boolalpha);
fmt = iss_02.flags();
! testfmt = fmt & std::ios_base::boolalpha;
iss_02 >> b1;
test &= b1 == 0;
iss_02 >> b1;
Index: testsuite/27_io/octfmt.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/27_io/octfmt.cc,v
retrieving revision 1.1
diff -c -3 -r1.1 octfmt.cc
*** octfmt.cc 1999/05/12 00:27:40 1.1
--- octfmt.cc 1999/07/14 08:56:33
***************
*** 33,65 ****
#ifdef DEBUG_ASSERT
#include <assert.h>
#endif
!
struct MyNP : std::numpunct<char>
{
! string do_grouping() const;
char do_thousands_sep() const;
};
! string MyNP::do_grouping() const { static string s("\3"); return s; }
char MyNP::do_thousands_sep() const { return ' '; }
void test01()
{
! std::cout.imbue(locale(locale(), new MyNP));
std::cout << std::oct << std::showbase;
! std::cout << -0123456l << endl;
std::cout << ":" << std::setw(11);
! std::cout << -01234567l << ":" << endl;
std::cout << ":" << std::setw(11) << std::left;
! std::cout << -0123456l << ":" << endl;
std::cout << ":" << std::setw(11) << std::right;
! std::cout << -012345l << ":" << endl;
std::cout << ":" << std::setw(11) << std::internal;
! std::cout << -01234l << ":" << endl;
std::cout << std::hex;
std::cout << std::setfill('0');
--- 33,65 ----
#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');
Index: testsuite/27_io/stringbuf.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/27_io/stringbuf.cc,v
retrieving revision 1.1
diff -c -3 -r1.1 stringbuf.cc
*** stringbuf.cc 1999/05/12 00:27:40 1.1
--- stringbuf.cc 1999/07/14 08:56:34
***************
*** 23,42 ****
#include <assert.h>
#endif
! string str_01("mykonos. . . or what?");
! string str_02("paris, or sainte-maxime?");
! string str_03;
! stringbuf strb_01(str_01);
! stringbuf strb_02(str_02, ios_base::in);
! stringbuf strb_03(str_03, ios_base::out);
// test the underlying allocator
bool test01() {
bool test = false;
! allocator<char> alloc_01;
! allocator<char>::size_type size_01 = alloc_01.max_size();
! allocator<char>::pointer p_01 = alloc_01.allocate(32);
return true;
}
--- 23,42 ----
#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;
}
***************
*** 44,50 ****
// test the streambuf/stringbuf locale settings
bool test02() {
! 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
--- 44,50 ----
// 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
***************
*** 56,62 ****
// test member functions
bool test03() {
bool test = false;
! string str_tmp;
//stringbuf::str()
test = strb_01.str() == str_01;
--- 56,62 ----
// test member functions
bool test03() {
bool test = false;
! std::string str_tmp;
//stringbuf::str()
test = strb_01.str() == str_01;
***************
*** 66,73 ****
//stringbuf::str(string&)
strb_03.str("none of the above, go to the oberoi in cairo, egypt.");
strb_03.str(str_01);
! streamsize d1 = strb_01.in_avail();
! 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
--- 66,73 ----
//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
***************
*** 85,98 ****
// test overloaded virtual functions
bool test04() {
bool test = false;
! string str_tmp;
! stringbuf strb_tmp;
! streamsize strmsz_1, strmsz_2;
! streamoff strmof_1(-1), strmof_2;
! typedef stringbuf::int_type int_type;
! typedef stringbuf::traits_type traits_type;
! typedef stringbuf::pos_type pos_type;
! typedef stringbuf::off_type off_type;
// GET
// int in_avail()
--- 85,98 ----
// test overloaded virtual functions
bool test04() {
bool test = false;
! 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()
***************
*** 178,186 ****
// 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(strb_01.str()); //reset
! string::size_type sz1 = strb_03.str().length();
c1 = strb_03.sputc('a');
! 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;
--- 178,186 ----
// 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(strb_01.str()); //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;
***************
*** 233,239 ****
test &= c1 != c2;
test &= c3 != c2;
test &= c1 == c3;
! test &= strb_01.str() == string("mykonos. . .zor what?");
test &= str_tmp.size() == strb_01.str().size();
//test for _in_cur == _in_beg
strb_01.str(str_tmp);
--- 233,239 ----
test &= c1 != c2;
test &= c3 != c2;
test &= c1 == c3;
! 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);
***************
*** 320,326 ****
// setbuf
// pubsetbuf(char_type* s, streamsize n)
! str_tmp = 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);
--- 320,326 ----
// 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);
***************
*** 338,367 ****
strb_03.str(str_03); //out ("")
//IN|OUT
//beg
! pt_1 = strb_01.pubseekoff(2, ios_base::beg, ios_base::in|ios_base::out);
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 = string("myxonos. . . or what?");
test &= strb_01.str() == str_tmp;
//cur
! pt_1 = strb_01.pubseekoff(2, ios_base::cur, ios_base::in | ios_base::out);
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, ios_base::cur, ios_base::in);
off_1 = pt_1._M_position();
! pt_2 = strb_01.pubseekoff(2, ios_base::cur, 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 = string("myxxnos. . . or what?");
test &= strb_01.str() == str_tmp;
//end
! pt_2 = strb_01.pubseekoff(2, ios_base::end, ios_base::in|ios_base::out);
off_1 = pt_2._M_position();
test &= off_1 == -1;
test &= strb_01.str() == str_tmp;
--- 338,367 ----
strb_03.str(str_03); //out ("")
//IN|OUT
//beg
! pt_1 = strb_01.pubseekoff(2, std::ios_base::beg, std::ios_base::in|std::ios_base::out);
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, std::ios_base::in | std::ios_base::out);
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, std::ios_base::in|std::ios_base::out);
off_1 = pt_2._M_position();
test &= off_1 == -1;
test &= strb_01.str() == str_tmp;
***************
*** 376,398 ****
strb_03.str(str_03); //out ("")
//IN|OUT
//beg
! pt_1 = strb_01.pubseekoff(2, ios_base::beg, ios_base::in|ios_base::out);
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 = string("myxonos. . . or what?");
test &= strb_01.str() == str_tmp;
strb_01.pubsync(); //resets pointers
! pt_2 = strb_01.pubseekpos(pt_1, ios_base::in|ios_base::out);
off_2 = pt_2._M_position();
test &= off_1 == off_2;
c3 = strb_01.snextc(); //current in pointer +1
test &= c1 == 'o';
test &= c1 == c3;
c2 = strb_01.sputc('x'); //test current out pointer
! str_tmp = string("myxonos. . . or what?");
test &= strb_01.str() == str_tmp;
// VIRTUALS (indirectly tested)
--- 376,398 ----
strb_03.str(str_03); //out ("")
//IN|OUT
//beg
! pt_1 = strb_01.pubseekoff(2, std::ios_base::beg, std::ios_base::in|std::ios_base::out);
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;
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 == 'o';
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)
Index: testsuite/27_io/stringstream.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/27_io/stringstream.cc,v
retrieving revision 1.2
diff -c -3 -r1.2 stringstream.cc
*** stringstream.cc 1999/05/17 20:03:35 1.2
--- stringstream.cc 1999/07/14 08:56:35
***************
*** 37,58 ****
#endif
// 01: sanity checks for strings, stringbufs
! string test01()
{
bool test = false;
// Empty string sanity check.
! string str01;
! string::iterator __i_start = str01.begin();
char* __p_start = __i_start.base();
! string::iterator __i_end = str01.end();
char* __p_end = __i_end.base();
! string::size_type len = str01.size();
test = __p_start == __p_end;
test &= len == 0;
// Full string sanity check.
! 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();
--- 37,58 ----
#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();
***************
*** 63,70 ****
test &= len != 0;
// Test an empty ostring stream for sanity.
! ostringstream ostrstream0;
! string str03 = ostrstream0.str();
__i_start = str03.begin();
__p_start = __i_start.base();
__i_end = str03.end();
--- 63,70 ----
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();
***************
*** 88,106 ****
int *pi = &i;
double d = 3.14159;
double *pd = &d;
! string blank;
! ostringstream ostrst01;
! ostringstream ostrst02(blank);
// No buffer, so nothing should be added.
ostrst01 << "i: " << i << " i's address: " << pi << "\n"
! << "d: " << d << " d's address: " << pd << endl;
// Buffer, so this should be ok.
ostrst02 << "i: " << i << " i's address: " << pi << "\n"
! << "d: " << d << " d's address: " << pd << endl;
! string msg01 = ostrst01.str();
! string msg02 = ostrst02.str();
test &= msg01 != msg02;
test &= msg02 != blank;
--- 88,106 ----
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;
***************
*** 113,119 ****
int *pi2 = &i2;
double d2 = 0.0;
double *pd2 = &d2;
! istringstream istrst01(ostrst02.str());
istrst01 >> i2 >> pi2 >> d2 >> pd2;
//istrst01 >> i2;
--- 113,119 ----
int *pi2 = &i2;
double d2 = 0.0;
double *pd2 = &d2;
! std::istringstream istrst01(ostrst02.str());
istrst01 >> i2 >> pi2 >> d2 >> pd2;
//istrst01 >> i2;