bitset_ctor.cc: Qualify reverse wth std::.

2000-06-13  Anthony Williams  <anthony@anthonyw.cjb.net>

	* testsuite/23_containers/bitset_ctor.cc: Qualify reverse wth std::.

	* testsuite/27_io/filebuf.cc: Changed calls to
	fpos<>._M_position() to implicit calls to operator streamoff().
	* testsuite/27_io/iostream_objects.cc: Removed #include <ciso646>,
	as not needed. Revert, as part of standard.
	* testsuite/27_io/ostream_inserter_arith.cc: Replaced explicit
	call to numpunct<>._M_init() with overrides of the appropriate
	virtual functions.

	* testsuite/27_io/stringstream.cc: Removed unnecessary char *
	pointers from test01, so no need to call base(), which isn't
	guaranteed to be implemented as iterators may themselves be pointers
	* testsuite/27_io/stringbuf.cc: Removed unnecessary calls to
	_M_position() - use implicit conversion to streamoff instead

From-SVN: r34535
This commit is contained in:
Anthony Williams 2000-06-13 23:48:29 +00:00 committed by Benjamin Kosnik
parent 8173b2d78a
commit 97e0a05a9d
5 changed files with 36 additions and 30 deletions

View File

@ -1,6 +1,6 @@
// 1999-06-08 bkoz
// Copyright (C) 1999 Free Software Foundation, Inc.
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -65,7 +65,7 @@ bool test01(void)
std::string str03;
for (int i = 0; i < sz; ++i)
str03 += (bit03.test(i) ? '1' : '0');
reverse(str03.begin(), str03.end());
std::reverse(str03.begin(), str03.end());
test &= str03 == str02;
}
catch(std::invalid_argument& fail) {

View File

@ -409,7 +409,7 @@ bool test03() {
strmsz_1 = fb_03.in_avail();
pt_1 = fb_03.pubseekoff(2, std::ios_base::beg);
strmsz_2 = fb_03.in_avail();
off_1 = pt_1._M_position();
off_1 = pt_1;
test &= off_1 > 0;
c1 = fb_03.snextc(); //current in pointer +1
test &= c1 == '3';
@ -423,7 +423,7 @@ bool test03() {
//cur
// 27filebuf-3.txt = bd2\n456789:;<=>?...
pt_2 = fb_03.pubseekoff(2, std::ios_base::cur);
off_2 = pt_2._M_position();
off_2 = pt_2;
test &= (off_2 == (off_1 + 2 + 1 + 1));
c1 = fb_03.snextc(); //current in pointer +1
test &= c1 == '7';
@ -437,7 +437,7 @@ bool test03() {
// 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();
off_1 = pt_2;
test &= off_1 > off_2; //weak, but don't know exactly where it ends
c3 = fb_03.sputc('\n');
strmsz_1 = fb_03.sputn("because because because. . .", 28);
@ -456,7 +456,7 @@ bool test03() {
//IN|OUT
//beg
pt_1 = fb_03.pubseekoff(78, std::ios_base::beg);
off_1 = pt_1._M_position();
off_1 = pt_1;
test &= off_1 > 0;
c1 = fb_03.snextc(); //current in pointer +1
test &= c1 == ' ';
@ -464,12 +464,12 @@ bool test03() {
c3 = fb_03.sgetc();
fb_03.pubsync(); //resets pointers
pt_2 = fb_03.pubseekpos(pt_1);
off_2 = pt_2._M_position();
off_2 = pt_2;
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();
off_1 = pt_1;
test &= off_1 > off_2;
fb_03.sputn("\nof the wonderful things he does!!\nok", 37);
fb_03.pubsync();

View File

@ -141,12 +141,24 @@ class testpunct : public numpunct<_CharT>
{
public:
typedef _CharT char_type;
const char_type dchar;
explicit
testpunct(char_type decimal_char) : numpunct<_CharT>()
{
_M_init(decimal_char, ',', "");
}
testpunct(char_type decimal_char) : numpunct<_CharT>(), dchar(decimal_char)
{ }
protected:
char_type
do_decimal_point() const
{ return dchar; }
char_type
do_thousands_sep() const
{ return ','; }
string
do_grouping() const
{ return string(); }
};
template<typename _CharT>

View File

@ -1,6 +1,6 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == char
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -338,7 +338,7 @@ bool test04() {
//IN|OUT
//beg
pt_1 = strb_01.pubseekoff(2, std::ios_base::beg);
off_1 = pt_1._M_position();
off_1 = pt_1;
test &= off_1 >= 0;
c1 = strb_01.snextc(); //current in pointer +1
test &= c1 == 'o';
@ -347,12 +347,12 @@ bool test04() {
test &= strb_01.str() == str_tmp;
//cur
pt_1 = strb_01.pubseekoff(2, std::ios_base::cur);
off_1 = pt_1._M_position();
off_1 = pt_1;
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();
off_1 = pt_1;
pt_2 = strb_01.pubseekoff(2, std::ios_base::cur, std::ios_base::in);
off_2 = pt_2._M_position();
off_2 = pt_2;
test &= off_2 == off_1 + 2;
c1 = strb_01.snextc(); //current in pointer + 1
test &= c1 == ' ';
@ -361,7 +361,7 @@ bool test04() {
test &= strb_01.str() == str_tmp;
//end
pt_2 = strb_01.pubseekoff(2, std::ios_base::end);
off_1 = pt_2._M_position();
off_1 = pt_2;
test &= off_1 == -1; // not a valid position
test &= strb_01.str() == str_tmp;
// end part two (from the filebuf tests)
@ -393,10 +393,10 @@ bool test04() {
//IN|OUT
//beg
pt_1 = strb_01.pubseekoff(2, std::ios_base::beg);
off_1 = pt_1._M_position();
off_1 = pt_1;
test &= off_1 >= 0;
pt_1 = strb_01.pubseekoff(0, std::ios_base::cur, std::ios_base::out);
off_1 = pt_1._M_position();
off_1 = pt_1;
c1 = strb_01.snextc(); //current in pointer +1
test &= c1 == 'o';
c2 = strb_01.sputc('x'); //test current out pointer
@ -404,7 +404,7 @@ bool test04() {
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();
off_2 = pt_2;
test &= off_1 == off_2;
c3 = strb_01.snextc(); //current in pointer +1
test &= c1 == c3;

View File

@ -44,33 +44,27 @@ std::string test01()
// 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 = __i_start == __i_end;
test &= len == 0;
// Full string sanity check.
std::string str02("these golden days, i spend waiting for you:\n
Betty Carter on Verve with I'm Yours and You're Mine.");
__i_start = str02.begin();
__p_start = __i_start.base();
__i_end = str02.end();
__p_end = __i_end.base();
len = str02.size();
test &= __p_start != __p_end;
test &= __i_start != __i_end;
test &= len != 0;
// Test an empty ostring stream for sanity.
std::ostringstream ostrstream0;
std::string str03 = ostrstream0.str();
__i_start = str03.begin();
__p_start = __i_start.base();
__i_end = str03.end();
__p_end = __i_end.base();
len = str03.size();
test &= __p_start == __p_end;
test &= __i_start == __i_end;
test &= len == 0;
test &= str01 == str03;