Commit 97e0a05a by Anthony Williams Committed by Benjamin Kosnik

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
parent 8173b2d7
// 1999-06-08 bkoz // 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -65,7 +65,7 @@ bool test01(void) ...@@ -65,7 +65,7 @@ bool test01(void)
std::string str03; std::string str03;
for (int i = 0; i < sz; ++i) for (int i = 0; i < sz; ++i)
str03 += (bit03.test(i) ? '1' : '0'); str03 += (bit03.test(i) ? '1' : '0');
reverse(str03.begin(), str03.end()); std::reverse(str03.begin(), str03.end());
test &= str03 == str02; test &= str03 == str02;
} }
catch(std::invalid_argument& fail) { catch(std::invalid_argument& fail) {
......
...@@ -409,7 +409,7 @@ bool test03() { ...@@ -409,7 +409,7 @@ bool test03() {
strmsz_1 = fb_03.in_avail(); strmsz_1 = fb_03.in_avail();
pt_1 = fb_03.pubseekoff(2, std::ios_base::beg); pt_1 = fb_03.pubseekoff(2, std::ios_base::beg);
strmsz_2 = fb_03.in_avail(); strmsz_2 = fb_03.in_avail();
off_1 = pt_1._M_position(); off_1 = pt_1;
test &= off_1 > 0; test &= off_1 > 0;
c1 = fb_03.snextc(); //current in pointer +1 c1 = fb_03.snextc(); //current in pointer +1
test &= c1 == '3'; test &= c1 == '3';
...@@ -423,7 +423,7 @@ bool test03() { ...@@ -423,7 +423,7 @@ bool test03() {
//cur //cur
// 27filebuf-3.txt = bd2\n456789:;<=>?... // 27filebuf-3.txt = bd2\n456789:;<=>?...
pt_2 = fb_03.pubseekoff(2, std::ios_base::cur); 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)); test &= (off_2 == (off_1 + 2 + 1 + 1));
c1 = fb_03.snextc(); //current in pointer +1 c1 = fb_03.snextc(); //current in pointer +1
test &= c1 == '7'; test &= c1 == '7';
...@@ -437,7 +437,7 @@ bool test03() { ...@@ -437,7 +437,7 @@ bool test03() {
// 27filebuf-3.txt = "bd2\n456x\n9" // 27filebuf-3.txt = "bd2\n456x\n9"
pt_2 = fb_03.pubseekoff(0, std::ios_base::end, pt_2 = fb_03.pubseekoff(0, std::ios_base::end,
std::ios_base::in|std::ios_base::out); 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 test &= off_1 > off_2; //weak, but don't know exactly where it ends
c3 = fb_03.sputc('\n'); c3 = fb_03.sputc('\n');
strmsz_1 = fb_03.sputn("because because because. . .", 28); strmsz_1 = fb_03.sputn("because because because. . .", 28);
...@@ -456,7 +456,7 @@ bool test03() { ...@@ -456,7 +456,7 @@ bool test03() {
//IN|OUT //IN|OUT
//beg //beg
pt_1 = fb_03.pubseekoff(78, std::ios_base::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; test &= off_1 > 0;
c1 = fb_03.snextc(); //current in pointer +1 c1 = fb_03.snextc(); //current in pointer +1
test &= c1 == ' '; test &= c1 == ' ';
...@@ -464,12 +464,12 @@ bool test03() { ...@@ -464,12 +464,12 @@ bool test03() {
c3 = fb_03.sgetc(); c3 = fb_03.sgetc();
fb_03.pubsync(); //resets pointers fb_03.pubsync(); //resets pointers
pt_2 = fb_03.pubseekpos(pt_1); pt_2 = fb_03.pubseekpos(pt_1);
off_2 = pt_2._M_position(); off_2 = pt_2;
test &= off_1 == off_2; test &= off_1 == off_2;
c3 = fb_03.snextc(); //current in pointer +1 c3 = fb_03.snextc(); //current in pointer +1
test &= c2 == c3; test &= c2 == c3;
pt_1 = fb_03.pubseekoff(0, std::ios_base::end); 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; test &= off_1 > off_2;
fb_03.sputn("\nof the wonderful things he does!!\nok", 37); fb_03.sputn("\nof the wonderful things he does!!\nok", 37);
fb_03.pubsync(); fb_03.pubsync();
......
...@@ -141,12 +141,24 @@ class testpunct : public numpunct<_CharT> ...@@ -141,12 +141,24 @@ class testpunct : public numpunct<_CharT>
{ {
public: public:
typedef _CharT char_type; typedef _CharT char_type;
const char_type dchar;
explicit explicit
testpunct(char_type decimal_char) : numpunct<_CharT>() testpunct(char_type decimal_char) : numpunct<_CharT>(), dchar(decimal_char)
{ { }
_M_init(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> template<typename _CharT>
......
// 981208 bkoz test functionality of basic_stringbuf for char_type == char // 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -338,7 +338,7 @@ bool test04() { ...@@ -338,7 +338,7 @@ bool test04() {
//IN|OUT //IN|OUT
//beg //beg
pt_1 = strb_01.pubseekoff(2, std::ios_base::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; test &= off_1 >= 0;
c1 = strb_01.snextc(); //current in pointer +1 c1 = strb_01.snextc(); //current in pointer +1
test &= c1 == 'o'; test &= c1 == 'o';
...@@ -347,12 +347,12 @@ bool test04() { ...@@ -347,12 +347,12 @@ bool test04() {
test &= strb_01.str() == str_tmp; test &= strb_01.str() == str_tmp;
//cur //cur
pt_1 = strb_01.pubseekoff(2, std::ios_base::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 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); 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); 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; test &= off_2 == off_1 + 2;
c1 = strb_01.snextc(); //current in pointer + 1 c1 = strb_01.snextc(); //current in pointer + 1
test &= c1 == ' '; test &= c1 == ' ';
...@@ -361,7 +361,7 @@ bool test04() { ...@@ -361,7 +361,7 @@ bool test04() {
test &= strb_01.str() == str_tmp; test &= strb_01.str() == str_tmp;
//end //end
pt_2 = strb_01.pubseekoff(2, std::ios_base::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 &= off_1 == -1; // not a valid position
test &= strb_01.str() == str_tmp; test &= strb_01.str() == str_tmp;
// end part two (from the filebuf tests) // end part two (from the filebuf tests)
...@@ -393,10 +393,10 @@ bool test04() { ...@@ -393,10 +393,10 @@ bool test04() {
//IN|OUT //IN|OUT
//beg //beg
pt_1 = strb_01.pubseekoff(2, std::ios_base::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; test &= off_1 >= 0;
pt_1 = strb_01.pubseekoff(0, std::ios_base::cur, std::ios_base::out); 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 c1 = strb_01.snextc(); //current in pointer +1
test &= c1 == 'o'; test &= c1 == 'o';
c2 = strb_01.sputc('x'); //test current out pointer c2 = strb_01.sputc('x'); //test current out pointer
...@@ -404,7 +404,7 @@ bool test04() { ...@@ -404,7 +404,7 @@ bool test04() {
test &= strb_01.str() == str_tmp; test &= strb_01.str() == str_tmp;
strb_01.pubsync(); //resets pointers strb_01.pubsync(); //resets pointers
pt_2 = strb_01.pubseekpos(pt_1, std::ios_base::in|std::ios_base::out); 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; test &= off_1 == off_2;
c3 = strb_01.snextc(); //current in pointer +1 c3 = strb_01.snextc(); //current in pointer +1
test &= c1 == c3; test &= c1 == c3;
......
...@@ -44,33 +44,27 @@ std::string test01() ...@@ -44,33 +44,27 @@ std::string test01()
// Empty string sanity check. // Empty string sanity check.
std::string str01; std::string str01;
std::string::iterator __i_start = str01.begin(); std::string::iterator __i_start = str01.begin();
char* __p_start = __i_start.base();
std::string::iterator __i_end = str01.end(); std::string::iterator __i_end = str01.end();
char* __p_end = __i_end.base();
std::string::size_type len = str01.size(); std::string::size_type len = str01.size();
test = __p_start == __p_end; test = __i_start == __i_end;
test &= len == 0; test &= len == 0;
// Full string sanity check. // Full string sanity check.
std::string str02("these golden days, i spend waiting for you:\n std::string str02("these golden days, i spend waiting for you:\n
Betty Carter on Verve with I'm Yours and You're Mine."); Betty Carter on Verve with I'm Yours and You're Mine.");
__i_start = str02.begin(); __i_start = str02.begin();
__p_start = __i_start.base();
__i_end = str02.end(); __i_end = str02.end();
__p_end = __i_end.base();
len = str02.size(); len = str02.size();
test &= __p_start != __p_end; test &= __i_start != __i_end;
test &= len != 0; test &= len != 0;
// Test an empty ostring stream for sanity. // Test an empty ostring stream for sanity.
std::ostringstream ostrstream0; std::ostringstream ostrstream0;
std::string str03 = ostrstream0.str(); std::string str03 = ostrstream0.str();
__i_start = str03.begin(); __i_start = str03.begin();
__p_start = __i_start.base();
__i_end = str03.end(); __i_end = str03.end();
__p_end = __i_end.base();
len = str03.size(); len = str03.size();
test &= __p_start == __p_end; test &= __i_start == __i_end;
test &= len == 0; test &= len == 0;
test &= str01 == str03; test &= str01 == str03;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment