Reshuffle 27_io testsuite.

2003-04-09  Benjamin Kosnik  <bkoz@redhat.com>

	Reshuffle 27_io testsuite.  * testsuite/27_io/filebuf.cc,
	filebuf_members-1.tst, filebuf_members-1.txt, filebuf_members.cc,
	filebuf_virtuals-1.tst, filebuf_virtuals-1.txt,
	filebuf_virtuals-2.tst, filebuf_virtuals-3.tst,
	filebuf_virtuals.cc, fpos.cc, fstream.cc, fstream_members.cc,
	ifstream.cc, ifstream_members-1.tst, ifstream_members-1.txt,
	ifstream_members.cc, instantiations.cc, ios.cc,
	ios_base_callbacks.cc, ios_base_members_static-1.tst,
	ios_base_members_static.cc, ios_base_storage.cc,
	ios_base_types.cc, ios_ctor.cc, ios_init.cc,
	ios_manip_basefield.cc, ios_manip_fmtflags.cc, ios_members.cc,
	iostream.cc, iostream_members.cc, istream.cc,
	istream_exception.cc, istream_extractor_char.cc,
	istream_extractor_other-1.tst, istream_extractor_other-1.txt,
	istream_extractor_other-2.tst, istream_extractor_other.cc,
	istream_manip.cc, istream_seeks-1.tst, istream_seeks-1.txt,
	istream_seeks-2.tst, istream_seeks-3.tst, istream_seeks.cc,
	istream_sentry.cc, istream_unformatted-1.tst,
	istream_unformatted-1.txt, istream_unformatted.cc,
	istringstream.cc, istringstream_members.cc,
	narrow_stream_objects.cc, ofstream.cc, ofstream_members-1.tst,
	ofstream_members.cc, ostream.cc, ostream_exception.cc,
	ostream_fail.cc, ostream_inserter_arith.cc,
	ostream_inserter_char-1.tst, ostream_inserter_char-1.txt,
	ostream_inserter_char.cc, ostream_inserter_other-1.tst,
	ostream_inserter_other-2.tst, ostream_inserter_other.cc,
	ostream_manip.cc, ostream_seeks-1.tst, ostream_seeks.cc,
	ostream_sentry.cc, ostream_unformatted.cc, ostringstream.cc,
	ostringstream_members.cc, standard_manipulators.cc, streambuf.cc,
	streambuf_members.cc, stringbuf.cc, stringbuf_members.cc,
	stringbuf_virtuals.cc, stringstream.cc, stringstream_members.cc,
	wide_stream_objects.cc, istream_extractor_arith/01.cc,
	istream_extractor_arith/02.cc, istream_extractor_arith/03.cc,
	istream_extractor_arith/06.cc, istream_extractor_arith/07.cc,
	istream_extractor_arith/08.cc, istream_extractor_arith/09.cc,
	istream_extractor_arith/10.cc, istream_extractor_arith/11.cc,
	istream_extractor_arith/12.cc, istream_extractor_arith/13.cc:
	Split into...
	* 27_io/basic_filebuf/1.cc: New.
	* 27_io/basic_filebuf/2.cc: New.
	* 27_io/basic_filebuf/3.cc: New.
	* 27_io/basic_filebuf/4.cc: New.
	* 27_io/basic_filebuf/close/char/1.cc: New.
	* 27_io/basic_filebuf/close/char/2.cc: New.
	* 27_io/basic_filebuf/close/char/3.cc: New.
	* 27_io/basic_filebuf/close/char/4879.cc: New.
	* 27_io/basic_filebuf/close/char/9964.cc: New.
	* 27_io/basic_filebuf/imbue/char/1.cc: New.
	* 27_io/basic_filebuf/imbue/char/9322.cc: New.
	* 27_io/basic_filebuf/in_avail/char/1.cc: New.
	* 27_io/basic_filebuf/is_open/char/1.cc: New.
	* 27_io/basic_filebuf/open/char/1.cc: New.
	* 27_io/basic_filebuf/open/char/2.cc: New.
	* 27_io/basic_filebuf/open/char/3.cc: New.
	* 27_io/basic_filebuf/open/char/9507.cc: New.
	* 27_io/basic_filebuf/overflow/char/1.cc: New.
	* 27_io/basic_filebuf/overflow/char/3599.cc: New.
	* 27_io/basic_filebuf/overflow/char/9169.cc: New.
	* 27_io/basic_filebuf/overflow/char/9182-2.cc: New.
	* 27_io/basic_filebuf/overflow/char/9988.cc: New.
	* 27_io/basic_filebuf/sbumpc/char/1.cc: New.
	* 27_io/basic_filebuf/sbumpc/char/9825.cc: New.
	* 27_io/basic_filebuf/seekoff/char/1.cc: New.
	* 27_io/basic_filebuf/seekoff/char/2.cc: New.
	* 27_io/basic_filebuf/seekpos/char/1.cc: New.
	* 27_io/basic_filebuf/seekpos/char/2.cc: New.
	* 27_io/basic_filebuf/setbuf/char/1.cc: New.
	* 27_io/basic_filebuf/setbuf/char/2.cc: New.
	* 27_io/basic_filebuf/setbuf/char/3.cc: New.
	* 27_io/basic_filebuf/sgetc/char/1.cc: New.
	* 27_io/basic_filebuf/sgetn/char/1.cc: New.
	* 27_io/basic_filebuf/sgetn/char/2.cc: New.
	* 27_io/basic_filebuf/snextc/char/1.cc: New.
	* 27_io/basic_filebuf/sputbackc/char/1.cc: New.
	* 27_io/basic_filebuf/sputbackc/char/9425.cc: New.
	* 27_io/basic_filebuf/sputc/char/1.cc: New.
	* 27_io/basic_filebuf/sputc/char/1057.cc: New.
	* 27_io/basic_filebuf/sputc/char/9701-2.cc: New.
	* 27_io/basic_filebuf/sputn/char/1.cc: New.
	* 27_io/basic_filebuf/sputn/char/1057.cc: New.
	* 27_io/basic_filebuf/sputn/char/9701-1.cc: New.
	* 27_io/basic_filebuf/sungetc/char/1.cc: New.
	* 27_io/basic_filebuf/sync/char/1057.cc: New.
	* 27_io/basic_filebuf/sync/char/9182-1.cc: New.
	* 27_io/basic_filebuf/underflow/char/10097.cc: New.
	* 27_io/basic_fstream/1.cc: New.
	* 27_io/basic_fstream/2.cc: New.
	* 27_io/basic_fstream/3.cc: New.
	* 27_io/basic_fstream/4.cc: New.
	* 27_io/basic_fstream/rdbuf/char/2832.cc: New.
	* 27_io/basic_ifstream/1.cc: New.
	* 27_io/basic_ifstream/2.cc: New.
	* 27_io/basic_ifstream/3.cc: New.
	* 27_io/basic_ifstream/4.cc: New.
	* 27_io/basic_ifstream/cons/char/1.cc: New.
	* 27_io/basic_ifstream/open/char/1.cc: New.
	* 27_io/basic_ifstream/rdbuf/char/2832.cc: New.
	* 27_io/basic_ios/1.cc: New.
	* 27_io/basic_ios/2.cc: New.
	* 27_io/basic_ios/3.cc: New.
	* 27_io/basic_ios/4.cc: New.
	* 27_io/basic_ios/clear/char/1.cc: New.
	* 27_io/basic_ios/cons/char/1.cc: New.
	* 27_io/basic_ios/cons/char/2.cc: New.
	* 27_io/basic_ios/cons/char/3.cc: New.
	* 27_io/basic_ios/copyfmt/char/1.cc: New.
	* 27_io/basic_ios/copyfmt/char/2.cc: New.
	* 27_io/basic_ios/exceptions/char/1.cc: New.
	* 27_io/basic_ios/locales/char/1.cc: New.
	* 27_io/basic_iostream/1.cc: New.
	* 27_io/basic_iostream/2.cc: New.
	* 27_io/basic_iostream/3.cc: New.
	* 27_io/basic_iostream/4.cc: New.
	* 27_io/basic_istream/1.cc: New.
	* 27_io/basic_istream/2.cc: New.
	* 27_io/basic_istream/3.cc: New.
	* 27_io/basic_istream/4.cc: New.
	* 27_io/basic_istream/exceptions/char/9561.cc: New.
	* 27_io/basic_istream/extractors_arithmetic/char/01.cc: New.
	* 27_io/basic_istream/extractors_arithmetic/char/02.cc: New.
	* 27_io/basic_istream/extractors_arithmetic/char/03.cc: New.
	* 27_io/basic_istream/extractors_arithmetic/char/06.cc: New.
	* 27_io/basic_istream/extractors_arithmetic/char/07.cc: New.
	* 27_io/basic_istream/extractors_arithmetic/char/08.cc: New.
	* 27_io/basic_istream/extractors_arithmetic/char/09.cc: New.
	* 27_io/basic_istream/extractors_arithmetic/char/10.cc: New.
	* 27_io/basic_istream/extractors_arithmetic/char/11.cc: New.
	* 27_io/basic_istream/extractors_arithmetic/char/12.cc: New.
	* 27_io/basic_istream/extractors_arithmetic/char/13.cc: New.
	* 27_io/basic_istream/extractors_character/char/1.cc: New.
	* 27_io/basic_istream/extractors_character/char/2.cc: New.
	* 27_io/basic_istream/extractors_character/char/3.cc: New.
	* 27_io/basic_istream/extractors_character/char/9826.cc: New.
	* 27_io/basic_istream/extractors_other/char/1.cc: New.
	* 27_io/basic_istream/extractors_other/char/2.cc: New.
	* 27_io/basic_istream/extractors_other/char/3.cc: New.
	* 27_io/basic_istream/extractors_other/char/9318-in.cc: New.
	* 27_io/basic_istream/extractors_other/char/9424-in.cc: New.
	* 27_io/basic_istream/get/char/1.cc: New.
	* 27_io/basic_istream/get/char/2.cc: New.
	* 27_io/basic_istream/getline/char/1.cc: New.
	* 27_io/basic_istream/getline/char/2.cc: New.
	* 27_io/basic_istream/getline/char/3.cc: New.
	* 27_io/basic_istream/ignore/char/1.cc: New.
	* 27_io/basic_istream/ignore/char/6360.cc: New.
	* 27_io/basic_istream/ignore/char/7220.cc: New.
	* 27_io/basic_istream/peek/char/1.cc: New.
	* 27_io/basic_istream/peek/char/6414.cc: New.
	* 27_io/basic_istream/putback/char/1.cc: New.
	* 27_io/basic_istream/read/char/1.cc: New.
	* 27_io/basic_istream/read/char/2.cc: New.
	* 27_io/basic_istream/read/char/3.cc: New.
	* 27_io/basic_istream/readsome/char/6746-1.cc: New.
	* 27_io/basic_istream/readsome/char/6746-2.cc: New.
	* 27_io/basic_istream/readsome/char/8258.cc: New.
	* 27_io/basic_istream/seekg/char/2346-fstream.cc: New.
	* 27_io/basic_istream/seekg/char/2346-sstream.cc: New.
	* 27_io/basic_istream/seekg/char/8348-1.cc: New.
	* 27_io/basic_istream/seekg/char/8348-2.cc: New.
	* 27_io/basic_istream/seekg/char/fstream.cc: New.
	* 27_io/basic_istream/seekg/char/sstream.cc: New.
	* 27_io/basic_istream/sentry/char/1.cc: New.
	* 27_io/basic_istream/sentry/char/2.cc: New.
	* 27_io/basic_istream/sentry/char/3.cc: New.
	* 27_io/basic_istream/sentry/char/3983-fstream.cc: New.
	* 27_io/basic_istream/sentry/char/3983-sstream.cc: New.
	* 27_io/basic_istream/tellg/char/1.cc: New.
	* 27_io/basic_istream/tellg/char/8348.cc: New.
	* 27_io/basic_istream/tellg/char/fstream.cc: New.
	* 27_io/basic_istream/tellg/char/sstream.cc: New.
	* 27_io/basic_istream/ws/char/1.cc: New.
	* 27_io/basic_istringstream/1.cc: New.
	* 27_io/basic_istringstream/2.cc: New.
	* 27_io/basic_istringstream/3.cc: New.
	* 27_io/basic_istringstream/4.cc: New.
	* 27_io/basic_istringstream/rdbuf/char/2832.cc: New.
	* 27_io/basic_istringstream/str/char/1.cc: New.
	* 27_io/basic_ofstream/1.cc: New.
	* 27_io/basic_ofstream/2.cc: New.
	* 27_io/basic_ofstream/3.cc: New.
	* 27_io/basic_ofstream/4.cc: New.
	* 27_io/basic_ofstream/cons/char/2.cc: New.
	* 27_io/basic_ofstream/open/char/1.cc: New.
	* 27_io/basic_ofstream/rdbuf/char/2832.cc: New.
	* 27_io/basic_ostream/1.cc: New.
	* 27_io/basic_ostream/2.cc: New.
	* 27_io/basic_ostream/3.cc: New.
	* 27_io/basic_ostream/4.cc: New.
	* 27_io/basic_ostream/cons/char/9827.cc: New.
	* 27_io/basic_ostream/endl/char/1.cc: New.
	* 27_io/basic_ostream/ends/char/1.cc: New.
	* 27_io/basic_ostream/ends/char/2.cc: New.
	* 27_io/basic_ostream/exceptions/char/9561.cc: New.
	* 27_io/basic_ostream/flush/char/1.cc: New.
	* 27_io/basic_ostream/inserters_arithmetic/char/1.cc: New.
	* 27_io/basic_ostream/inserters_arithmetic/char/2.cc: New.
	* 27_io/basic_ostream/inserters_arithmetic/char/3.cc: New.
	* 27_io/basic_ostream/inserters_arithmetic/char/4.cc: New.
	* 27_io/basic_ostream/inserters_arithmetic/char/4402.cc: New.
	* 27_io/basic_ostream/inserters_arithmetic/char/5.cc: New.
	* 27_io/basic_ostream/inserters_arithmetic/char/6.cc: New.
	* 27_io/basic_ostream/inserters_arithmetic/wchar_t/1.cc: New.
	* 27_io/basic_ostream/inserters_character/char/1.cc: New.
	* 27_io/basic_ostream/inserters_character/char/2.cc: New.
	* 27_io/basic_ostream/inserters_character/char/3.cc: New.
	* 27_io/basic_ostream/inserters_character/char/4.cc: New.
	* 27_io/basic_ostream/inserters_character/char/5.cc: New.
	* 27_io/basic_ostream/inserters_character/char/6.cc: New.
	* 27_io/basic_ostream/inserters_character/char/8.cc: New.
	* 27_io/basic_ostream/inserters_character/wchar_t/7.cc: New.
	* 27_io/basic_ostream/inserters_character/wchar_t/8.cc: New.
	* 27_io/basic_ostream/inserters_other/char/1.cc: New.
	* 27_io/basic_ostream/inserters_other/char/2.cc: New.
	* 27_io/basic_ostream/inserters_other/char/3.cc: New.
	* 27_io/basic_ostream/inserters_other/char/4.cc: New.
	* 27_io/basic_ostream/inserters_other/char/9318-out.cc: New.
	* 27_io/basic_ostream/inserters_other/char/9424-out.cc: New.
	* 27_io/basic_ostream/sentry/char/1.cc: New.
	* 27_io/basic_ostream/sentry/char/2.cc: New.
	* 27_io/basic_ostream/sentry/char/3983-fstream.cc: New.
	* 27_io/basic_ostream/sentry/char/3983-sstream.cc: New.
	* 27_io/basic_ostream/tellp/char/1.cc: New.
	* 27_io/basic_ostream/tellp/char/2.cc: New.
	* 27_io/basic_ostringstream/1.cc: New.
	* 27_io/basic_ostringstream/2.cc: New.
	* 27_io/basic_ostringstream/3.cc: New.
	* 27_io/basic_ostringstream/4.cc: New.
	* 27_io/basic_ostringstream/cons/char/3.cc: New.
	* 27_io/basic_ostringstream/rdbuf/char/2832.cc: New.
	* 27_io/basic_ostringstream/str/char/1.cc: New.
	* 27_io/basic_ostringstream/str/char/2.cc: New.
	* 27_io/basic_streambuf/1.cc: New.
	* 27_io/basic_streambuf/2.cc: New.
	* 27_io/basic_streambuf/3.cc: New.
	* 27_io/basic_streambuf/cons/char/1.cc: New.
	* 27_io/basic_streambuf/imbue/char/1.cc: New.
	* 27_io/basic_streambuf/imbue/char/9322.cc: New.
	* 27_io/basic_streambuf/overflow/char/1.cc: New.
	* 27_io/basic_streambuf/overflow/char/2.cc: New.
	* 27_io/basic_streambuf/overflow/char/3599.cc: New.
	* 27_io/basic_streambuf/sgetc/char/1.cc: New.
	* 27_io/basic_streambuf/sgetn/char/1.cc: New.
	* 27_io/basic_streambuf/sputbackc/char/9538.cc: New.
	* 27_io/basic_streambuf/sputc/char/1057.cc: New.
	* 27_io/basic_streambuf/sputn/char/1.cc: New.
	* 27_io/basic_streambuf/sputn/char/1057.cc: New.
	* 27_io/basic_streambuf/sync/char/1057.cc: New.
	* 27_io/basic_stringbuf/1.cc: New.
	* 27_io/basic_stringbuf/2.cc: New.
	* 27_io/basic_stringbuf/3.cc: New.
	* 27_io/basic_stringbuf/4.cc: New.
	* 27_io/basic_stringbuf/5.cc: New.
	* 27_io/basic_stringbuf/imbue/char/1.cc: New.
	* 27_io/basic_stringbuf/imbue/char/9322.cc: New.
	* 27_io/basic_stringbuf/in_avail/char/1.cc: New.
	* 27_io/basic_stringbuf/overflow/char/2.cc: New.
	* 27_io/basic_stringbuf/overflow/char/3599.cc: New.
	* 27_io/basic_stringbuf/overflow/char/9988.cc: New.
	* 27_io/basic_stringbuf/sbumpc/char/1.cc: New.
	* 27_io/basic_stringbuf/sbumpc/char/9825.cc: New.
	* 27_io/basic_stringbuf/seekoff/char/1.cc: New.
	* 27_io/basic_stringbuf/seekoff/char/2.cc: New.
	* 27_io/basic_stringbuf/seekpos/char/1.cc: New.
	* 27_io/basic_stringbuf/seekpos/char/2.cc: New.
	* 27_io/basic_stringbuf/setbuf/char/1.cc: New.
	* 27_io/basic_stringbuf/setbuf/char/2.cc: New.
	* 27_io/basic_stringbuf/setbuf/char/3.cc: New.
	* 27_io/basic_stringbuf/sgetc/char/1.cc: New.
	* 27_io/basic_stringbuf/sgetn/char/1.cc: New.
	* 27_io/basic_stringbuf/snextc/char/1.cc: New.
	* 27_io/basic_stringbuf/sputbackc/char/1.cc: New.
	* 27_io/basic_stringbuf/sputbackc/char/9425.cc: New.
	* 27_io/basic_stringbuf/sputc/char/1.cc: New.
	* 27_io/basic_stringbuf/sputc/char/1057.cc: New.
	* 27_io/basic_stringbuf/sputc/char/9404-1.cc: New.
	* 27_io/basic_stringbuf/sputn/char/1.cc: New.
	* 27_io/basic_stringbuf/sputn/char/1057.cc: New.
	* 27_io/basic_stringbuf/sputn/char/9404-2.cc: New.
	* 27_io/basic_stringbuf/str/char/1.cc: New.
	* 27_io/basic_stringbuf/str/char/2.cc: New.
	* 27_io/basic_stringbuf/str/char/3.cc: New.
	* 27_io/basic_stringbuf/str/char/3955.cc: New.
	* 27_io/basic_stringbuf/sungetc/char/1.cc: New.
	* 27_io/basic_stringbuf/sync/char/1057.cc: New.
	* 27_io/basic_stringstream/1.cc: New.
	* 27_io/basic_stringstream/2.cc: New.
	* 27_io/basic_stringstream/3.cc: New.
	* 27_io/basic_stringstream/4.cc: New.
	* 27_io/basic_stringstream/rdbuf/char/2832.cc: New.
	* 27_io/basic_stringstream/str/char/1.cc: New.
	* 27_io/basic_stringstream/str/char/2.cc: New.
	* 27_io/basic_stringstream/str/char/3.cc: New.
	* 27_io/basic_stringstream/str/char/4.cc: New.
	* 27_io/fpos/1.cc: New.
	* 27_io/fpos/2.cc: New.
	* 27_io/fpos/3.cc: New.
	* 27_io/ios_base/callbacks/1.cc: New.
	* 27_io/ios_base/state/1.cc: New.
	* 27_io/ios_base/storage/1.cc: New.
	* 27_io/ios_base/storage/2.cc: New.
	* 27_io/ios_base/storage/3.cc: New.
	* 27_io/ios_base/sync_with_stdio/1.cc: New.
	* 27_io/ios_base/sync_with_stdio/2.cc: New.
	* 27_io/manipulators/adjustfield/char/1.cc: New.
	* 27_io/manipulators/adjustfield/char/2.cc: New.
	* 27_io/manipulators/basefield/char/1.cc: New.
	* 27_io/manipulators/standard/char/1.cc: New.
	* 27_io/manipulators/standard/char/2.cc: New.
	* 27_io/objects/char/1.cc: New.
	* 27_io/objects/char/2.cc: New.
	* 27_io/objects/char/2523-1_xin.cc: New.
	* 27_io/objects/char/2523-1_xin.in: New.
	* 27_io/objects/char/2523-2_xin.cc: New.
	* 27_io/objects/char/2523-2_xin.in: New.
	* 27_io/objects/char/3045.cc: New.
	* 27_io/objects/char/3647.cc: New.
	* 27_io/objects/char/3_xin.cc: New.
	* 27_io/objects/char/3_xin.in: New.
	* 27_io/objects/char/4_xin.cc: New.
	* 27_io/objects/char/4_xin.in: New.
	* 27_io/objects/char/5268.cc: New.
	* 27_io/objects/char/5280_xin.cc: New.
	* 27_io/objects/char/5280_xin.in: New.
	* 27_io/objects/char/6548_xin.cc: New.
	* 27_io/objects/char/6548_xin.in: New.
	* 27_io/objects/char/6648-1_xin.cc: New.
	* 27_io/objects/char/6648-1_xin.in: New.
	* 27_io/objects/char/6648-2_xin.cc: New.
	* 27_io/objects/char/6648-2_xin.in: New.
	* 27_io/objects/char/7744_xin.cc: New.
	* 27_io/objects/char/7744_xin.in: New.
	* 27_io/objects/wchar_t/1.cc: New.
	* 27_io/types/1.cc: New.
	* 27_io/types/2.cc: New.
	* data/filebuf_members-1.tst: New.
	* data/filebuf_members-1.txt: New.
	* data/filebuf_virtuals-1.tst: New.
	* data/filebuf_virtuals-1.txt: New.
	* data/filebuf_virtuals-2.tst: New.
	* data/filebuf_virtuals-3.tst: New.
	* data/ifstream_members-1.tst: New.
	* data/ifstream_members-1.txt: New.
	* data/ios_base_members_static-1.tst: New.
	* data/istream_extractor_other-1.tst: New.
	* data/istream_extractor_other-1.txt: New.
	* data/istream_extractor_other-2.tst: New.
	* data/istream_seeks-1.tst: New.
	* data/istream_seeks-1.txt: New.
	* data/istream_seeks-2.tst: New.
	* data/istream_seeks-3.tst: New.
	* data/istream_unformatted-1.tst: New.
	* data/istream_unformatted-1.txt: New.
	* data/ofstream_members-1.tst: New.
	* data/ostream_inserter_char-1.tst: New.
	* data/ostream_inserter_char-1.txt: New.
	* data/ostream_inserter_other-1.tst: New.
	* data/ostream_inserter_other-2.tst: New.
	* data/ostream_seeks-1.tst: New.

2003-04-09  Benjamin Kosnik  <bkoz@redhat.com>

	* include/bits/sstream.tcc (basic_stringbuf::seekpos): Remove
	requirement that __mode must be strict input or output.

	* include/std/std_streambuf.h (basic_streambuf::setp): Set
	_M_out_lim.

	* include/std/std_sstream.h (basic_strinbuf::str): Zero length
	output string shouldn't core.
	(basic_stringbuf::_M_really_sync): Add base argument. Remove rturn
	type.
	* include/bits/sstream.tcc: Adjust _M_really_sync bits here.

	* include/bits/istream.tcc (basic_istream::putback): Set gcount to
	zero.

2003-04-09  Benjamin Kosnik  <bkoz@redhat.com>

	* testsuite/data: New directory.
	* testsuite/lib/libstdc++-v3-dg.exp (libstdc++-v3-init): Modify
	to copy files from the testsuite data directory.
	(libstdc++-v3-list-sourcefiles): Add another test list filter, for
	testfiles containing _xin, which now means this is an interactive
	test and should be run with the interactive dejagnu hooks.
	* testsuite/Makefile.am: Remove testsuite_* files.
	* testsuite/Makefile.in: Regenerate.

From-SVN: r65421
This commit is contained in:
Benjamin Kosnik 2003-04-10 07:15:40 +00:00 committed by Benjamin Kosnik
parent a2cf38ee5d
commit 23cac88566
343 changed files with 18851 additions and 6531 deletions

View File

@ -1,3 +1,392 @@
2003-04-09 Benjamin Kosnik <bkoz@redhat.com>
Reshuffle 27_io testsuite. * testsuite/27_io/filebuf.cc,
filebuf_members-1.tst, filebuf_members-1.txt, filebuf_members.cc,
filebuf_virtuals-1.tst, filebuf_virtuals-1.txt,
filebuf_virtuals-2.tst, filebuf_virtuals-3.tst,
filebuf_virtuals.cc, fpos.cc, fstream.cc, fstream_members.cc,
ifstream.cc, ifstream_members-1.tst, ifstream_members-1.txt,
ifstream_members.cc, instantiations.cc, ios.cc,
ios_base_callbacks.cc, ios_base_members_static-1.tst,
ios_base_members_static.cc, ios_base_storage.cc,
ios_base_types.cc, ios_ctor.cc, ios_init.cc,
ios_manip_basefield.cc, ios_manip_fmtflags.cc, ios_members.cc,
iostream.cc, iostream_members.cc, istream.cc,
istream_exception.cc, istream_extractor_char.cc,
istream_extractor_other-1.tst, istream_extractor_other-1.txt,
istream_extractor_other-2.tst, istream_extractor_other.cc,
istream_manip.cc, istream_seeks-1.tst, istream_seeks-1.txt,
istream_seeks-2.tst, istream_seeks-3.tst, istream_seeks.cc,
istream_sentry.cc, istream_unformatted-1.tst,
istream_unformatted-1.txt, istream_unformatted.cc,
istringstream.cc, istringstream_members.cc,
narrow_stream_objects.cc, ofstream.cc, ofstream_members-1.tst,
ofstream_members.cc, ostream.cc, ostream_exception.cc,
ostream_fail.cc, ostream_inserter_arith.cc,
ostream_inserter_char-1.tst, ostream_inserter_char-1.txt,
ostream_inserter_char.cc, ostream_inserter_other-1.tst,
ostream_inserter_other-2.tst, ostream_inserter_other.cc,
ostream_manip.cc, ostream_seeks-1.tst, ostream_seeks.cc,
ostream_sentry.cc, ostream_unformatted.cc, ostringstream.cc,
ostringstream_members.cc, standard_manipulators.cc, streambuf.cc,
streambuf_members.cc, stringbuf.cc, stringbuf_members.cc,
stringbuf_virtuals.cc, stringstream.cc, stringstream_members.cc,
wide_stream_objects.cc, istream_extractor_arith/01.cc,
istream_extractor_arith/02.cc, istream_extractor_arith/03.cc,
istream_extractor_arith/06.cc, istream_extractor_arith/07.cc,
istream_extractor_arith/08.cc, istream_extractor_arith/09.cc,
istream_extractor_arith/10.cc, istream_extractor_arith/11.cc,
istream_extractor_arith/12.cc, istream_extractor_arith/13.cc:
Split into...
* 27_io/basic_filebuf/1.cc: New.
* 27_io/basic_filebuf/2.cc: New.
* 27_io/basic_filebuf/3.cc: New.
* 27_io/basic_filebuf/4.cc: New.
* 27_io/basic_filebuf/close/char/1.cc: New.
* 27_io/basic_filebuf/close/char/2.cc: New.
* 27_io/basic_filebuf/close/char/3.cc: New.
* 27_io/basic_filebuf/close/char/4879.cc: New.
* 27_io/basic_filebuf/close/char/9964.cc: New.
* 27_io/basic_filebuf/imbue/char/1.cc: New.
* 27_io/basic_filebuf/imbue/char/9322.cc: New.
* 27_io/basic_filebuf/in_avail/char/1.cc: New.
* 27_io/basic_filebuf/is_open/char/1.cc: New.
* 27_io/basic_filebuf/open/char/1.cc: New.
* 27_io/basic_filebuf/open/char/2.cc: New.
* 27_io/basic_filebuf/open/char/3.cc: New.
* 27_io/basic_filebuf/open/char/9507.cc: New.
* 27_io/basic_filebuf/overflow/char/1.cc: New.
* 27_io/basic_filebuf/overflow/char/3599.cc: New.
* 27_io/basic_filebuf/overflow/char/9169.cc: New.
* 27_io/basic_filebuf/overflow/char/9182-2.cc: New.
* 27_io/basic_filebuf/overflow/char/9988.cc: New.
* 27_io/basic_filebuf/sbumpc/char/1.cc: New.
* 27_io/basic_filebuf/sbumpc/char/9825.cc: New.
* 27_io/basic_filebuf/seekoff/char/1.cc: New.
* 27_io/basic_filebuf/seekoff/char/2.cc: New.
* 27_io/basic_filebuf/seekpos/char/1.cc: New.
* 27_io/basic_filebuf/seekpos/char/2.cc: New.
* 27_io/basic_filebuf/setbuf/char/1.cc: New.
* 27_io/basic_filebuf/setbuf/char/2.cc: New.
* 27_io/basic_filebuf/setbuf/char/3.cc: New.
* 27_io/basic_filebuf/sgetc/char/1.cc: New.
* 27_io/basic_filebuf/sgetn/char/1.cc: New.
* 27_io/basic_filebuf/sgetn/char/2.cc: New.
* 27_io/basic_filebuf/snextc/char/1.cc: New.
* 27_io/basic_filebuf/sputbackc/char/1.cc: New.
* 27_io/basic_filebuf/sputbackc/char/9425.cc: New.
* 27_io/basic_filebuf/sputc/char/1.cc: New.
* 27_io/basic_filebuf/sputc/char/1057.cc: New.
* 27_io/basic_filebuf/sputc/char/9701-2.cc: New.
* 27_io/basic_filebuf/sputn/char/1.cc: New.
* 27_io/basic_filebuf/sputn/char/1057.cc: New.
* 27_io/basic_filebuf/sputn/char/9701-1.cc: New.
* 27_io/basic_filebuf/sungetc/char/1.cc: New.
* 27_io/basic_filebuf/sync/char/1057.cc: New.
* 27_io/basic_filebuf/sync/char/9182-1.cc: New.
* 27_io/basic_filebuf/underflow/char/10097.cc: New.
* 27_io/basic_fstream/1.cc: New.
* 27_io/basic_fstream/2.cc: New.
* 27_io/basic_fstream/3.cc: New.
* 27_io/basic_fstream/4.cc: New.
* 27_io/basic_fstream/rdbuf/char/2832.cc: New.
* 27_io/basic_ifstream/1.cc: New.
* 27_io/basic_ifstream/2.cc: New.
* 27_io/basic_ifstream/3.cc: New.
* 27_io/basic_ifstream/4.cc: New.
* 27_io/basic_ifstream/cons/char/1.cc: New.
* 27_io/basic_ifstream/open/char/1.cc: New.
* 27_io/basic_ifstream/rdbuf/char/2832.cc: New.
* 27_io/basic_ios/1.cc: New.
* 27_io/basic_ios/2.cc: New.
* 27_io/basic_ios/3.cc: New.
* 27_io/basic_ios/4.cc: New.
* 27_io/basic_ios/clear/char/1.cc: New.
* 27_io/basic_ios/cons/char/1.cc: New.
* 27_io/basic_ios/cons/char/2.cc: New.
* 27_io/basic_ios/cons/char/3.cc: New.
* 27_io/basic_ios/copyfmt/char/1.cc: New.
* 27_io/basic_ios/copyfmt/char/2.cc: New.
* 27_io/basic_ios/exceptions/char/1.cc: New.
* 27_io/basic_ios/locales/char/1.cc: New.
* 27_io/basic_iostream/1.cc: New.
* 27_io/basic_iostream/2.cc: New.
* 27_io/basic_iostream/3.cc: New.
* 27_io/basic_iostream/4.cc: New.
* 27_io/basic_istream/1.cc: New.
* 27_io/basic_istream/2.cc: New.
* 27_io/basic_istream/3.cc: New.
* 27_io/basic_istream/4.cc: New.
* 27_io/basic_istream/exceptions/char/9561.cc: New.
* 27_io/basic_istream/extractors_arithmetic/char/01.cc: New.
* 27_io/basic_istream/extractors_arithmetic/char/02.cc: New.
* 27_io/basic_istream/extractors_arithmetic/char/03.cc: New.
* 27_io/basic_istream/extractors_arithmetic/char/06.cc: New.
* 27_io/basic_istream/extractors_arithmetic/char/07.cc: New.
* 27_io/basic_istream/extractors_arithmetic/char/08.cc: New.
* 27_io/basic_istream/extractors_arithmetic/char/09.cc: New.
* 27_io/basic_istream/extractors_arithmetic/char/10.cc: New.
* 27_io/basic_istream/extractors_arithmetic/char/11.cc: New.
* 27_io/basic_istream/extractors_arithmetic/char/12.cc: New.
* 27_io/basic_istream/extractors_arithmetic/char/13.cc: New.
* 27_io/basic_istream/extractors_character/char/1.cc: New.
* 27_io/basic_istream/extractors_character/char/2.cc: New.
* 27_io/basic_istream/extractors_character/char/3.cc: New.
* 27_io/basic_istream/extractors_character/char/9826.cc: New.
* 27_io/basic_istream/extractors_other/char/1.cc: New.
* 27_io/basic_istream/extractors_other/char/2.cc: New.
* 27_io/basic_istream/extractors_other/char/3.cc: New.
* 27_io/basic_istream/extractors_other/char/9318-in.cc: New.
* 27_io/basic_istream/extractors_other/char/9424-in.cc: New.
* 27_io/basic_istream/get/char/1.cc: New.
* 27_io/basic_istream/get/char/2.cc: New.
* 27_io/basic_istream/getline/char/1.cc: New.
* 27_io/basic_istream/getline/char/2.cc: New.
* 27_io/basic_istream/getline/char/3.cc: New.
* 27_io/basic_istream/ignore/char/1.cc: New.
* 27_io/basic_istream/ignore/char/6360.cc: New.
* 27_io/basic_istream/ignore/char/7220.cc: New.
* 27_io/basic_istream/peek/char/1.cc: New.
* 27_io/basic_istream/peek/char/6414.cc: New.
* 27_io/basic_istream/putback/char/1.cc: New.
* 27_io/basic_istream/read/char/1.cc: New.
* 27_io/basic_istream/read/char/2.cc: New.
* 27_io/basic_istream/read/char/3.cc: New.
* 27_io/basic_istream/readsome/char/6746-1.cc: New.
* 27_io/basic_istream/readsome/char/6746-2.cc: New.
* 27_io/basic_istream/readsome/char/8258.cc: New.
* 27_io/basic_istream/seekg/char/2346-fstream.cc: New.
* 27_io/basic_istream/seekg/char/2346-sstream.cc: New.
* 27_io/basic_istream/seekg/char/8348-1.cc: New.
* 27_io/basic_istream/seekg/char/8348-2.cc: New.
* 27_io/basic_istream/seekg/char/fstream.cc: New.
* 27_io/basic_istream/seekg/char/sstream.cc: New.
* 27_io/basic_istream/sentry/char/1.cc: New.
* 27_io/basic_istream/sentry/char/2.cc: New.
* 27_io/basic_istream/sentry/char/3.cc: New.
* 27_io/basic_istream/sentry/char/3983-fstream.cc: New.
* 27_io/basic_istream/sentry/char/3983-sstream.cc: New.
* 27_io/basic_istream/tellg/char/1.cc: New.
* 27_io/basic_istream/tellg/char/8348.cc: New.
* 27_io/basic_istream/tellg/char/fstream.cc: New.
* 27_io/basic_istream/tellg/char/sstream.cc: New.
* 27_io/basic_istream/ws/char/1.cc: New.
* 27_io/basic_istringstream/1.cc: New.
* 27_io/basic_istringstream/2.cc: New.
* 27_io/basic_istringstream/3.cc: New.
* 27_io/basic_istringstream/4.cc: New.
* 27_io/basic_istringstream/rdbuf/char/2832.cc: New.
* 27_io/basic_istringstream/str/char/1.cc: New.
* 27_io/basic_ofstream/1.cc: New.
* 27_io/basic_ofstream/2.cc: New.
* 27_io/basic_ofstream/3.cc: New.
* 27_io/basic_ofstream/4.cc: New.
* 27_io/basic_ofstream/cons/char/2.cc: New.
* 27_io/basic_ofstream/open/char/1.cc: New.
* 27_io/basic_ofstream/rdbuf/char/2832.cc: New.
* 27_io/basic_ostream/1.cc: New.
* 27_io/basic_ostream/2.cc: New.
* 27_io/basic_ostream/3.cc: New.
* 27_io/basic_ostream/4.cc: New.
* 27_io/basic_ostream/cons/char/9827.cc: New.
* 27_io/basic_ostream/endl/char/1.cc: New.
* 27_io/basic_ostream/ends/char/1.cc: New.
* 27_io/basic_ostream/ends/char/2.cc: New.
* 27_io/basic_ostream/exceptions/char/9561.cc: New.
* 27_io/basic_ostream/flush/char/1.cc: New.
* 27_io/basic_ostream/inserters_arithmetic/char/1.cc: New.
* 27_io/basic_ostream/inserters_arithmetic/char/2.cc: New.
* 27_io/basic_ostream/inserters_arithmetic/char/3.cc: New.
* 27_io/basic_ostream/inserters_arithmetic/char/4.cc: New.
* 27_io/basic_ostream/inserters_arithmetic/char/4402.cc: New.
* 27_io/basic_ostream/inserters_arithmetic/char/5.cc: New.
* 27_io/basic_ostream/inserters_arithmetic/char/6.cc: New.
* 27_io/basic_ostream/inserters_arithmetic/wchar_t/1.cc: New.
* 27_io/basic_ostream/inserters_character/char/1.cc: New.
* 27_io/basic_ostream/inserters_character/char/2.cc: New.
* 27_io/basic_ostream/inserters_character/char/3.cc: New.
* 27_io/basic_ostream/inserters_character/char/4.cc: New.
* 27_io/basic_ostream/inserters_character/char/5.cc: New.
* 27_io/basic_ostream/inserters_character/char/6.cc: New.
* 27_io/basic_ostream/inserters_character/char/8.cc: New.
* 27_io/basic_ostream/inserters_character/wchar_t/7.cc: New.
* 27_io/basic_ostream/inserters_character/wchar_t/8.cc: New.
* 27_io/basic_ostream/inserters_other/char/1.cc: New.
* 27_io/basic_ostream/inserters_other/char/2.cc: New.
* 27_io/basic_ostream/inserters_other/char/3.cc: New.
* 27_io/basic_ostream/inserters_other/char/4.cc: New.
* 27_io/basic_ostream/inserters_other/char/9318-out.cc: New.
* 27_io/basic_ostream/inserters_other/char/9424-out.cc: New.
* 27_io/basic_ostream/sentry/char/1.cc: New.
* 27_io/basic_ostream/sentry/char/2.cc: New.
* 27_io/basic_ostream/sentry/char/3983-fstream.cc: New.
* 27_io/basic_ostream/sentry/char/3983-sstream.cc: New.
* 27_io/basic_ostream/tellp/char/1.cc: New.
* 27_io/basic_ostream/tellp/char/2.cc: New.
* 27_io/basic_ostringstream/1.cc: New.
* 27_io/basic_ostringstream/2.cc: New.
* 27_io/basic_ostringstream/3.cc: New.
* 27_io/basic_ostringstream/4.cc: New.
* 27_io/basic_ostringstream/cons/char/3.cc: New.
* 27_io/basic_ostringstream/rdbuf/char/2832.cc: New.
* 27_io/basic_ostringstream/str/char/1.cc: New.
* 27_io/basic_ostringstream/str/char/2.cc: New.
* 27_io/basic_streambuf/1.cc: New.
* 27_io/basic_streambuf/2.cc: New.
* 27_io/basic_streambuf/3.cc: New.
* 27_io/basic_streambuf/cons/char/1.cc: New.
* 27_io/basic_streambuf/imbue/char/1.cc: New.
* 27_io/basic_streambuf/imbue/char/9322.cc: New.
* 27_io/basic_streambuf/overflow/char/1.cc: New.
* 27_io/basic_streambuf/overflow/char/2.cc: New.
* 27_io/basic_streambuf/overflow/char/3599.cc: New.
* 27_io/basic_streambuf/sgetc/char/1.cc: New.
* 27_io/basic_streambuf/sgetn/char/1.cc: New.
* 27_io/basic_streambuf/sputbackc/char/9538.cc: New.
* 27_io/basic_streambuf/sputc/char/1057.cc: New.
* 27_io/basic_streambuf/sputn/char/1.cc: New.
* 27_io/basic_streambuf/sputn/char/1057.cc: New.
* 27_io/basic_streambuf/sync/char/1057.cc: New.
* 27_io/basic_stringbuf/1.cc: New.
* 27_io/basic_stringbuf/2.cc: New.
* 27_io/basic_stringbuf/3.cc: New.
* 27_io/basic_stringbuf/4.cc: New.
* 27_io/basic_stringbuf/5.cc: New.
* 27_io/basic_stringbuf/imbue/char/1.cc: New.
* 27_io/basic_stringbuf/imbue/char/9322.cc: New.
* 27_io/basic_stringbuf/in_avail/char/1.cc: New.
* 27_io/basic_stringbuf/overflow/char/2.cc: New.
* 27_io/basic_stringbuf/overflow/char/3599.cc: New.
* 27_io/basic_stringbuf/overflow/char/9988.cc: New.
* 27_io/basic_stringbuf/sbumpc/char/1.cc: New.
* 27_io/basic_stringbuf/sbumpc/char/9825.cc: New.
* 27_io/basic_stringbuf/seekoff/char/1.cc: New.
* 27_io/basic_stringbuf/seekoff/char/2.cc: New.
* 27_io/basic_stringbuf/seekpos/char/1.cc: New.
* 27_io/basic_stringbuf/seekpos/char/2.cc: New.
* 27_io/basic_stringbuf/setbuf/char/1.cc: New.
* 27_io/basic_stringbuf/setbuf/char/2.cc: New.
* 27_io/basic_stringbuf/setbuf/char/3.cc: New.
* 27_io/basic_stringbuf/sgetc/char/1.cc: New.
* 27_io/basic_stringbuf/sgetn/char/1.cc: New.
* 27_io/basic_stringbuf/snextc/char/1.cc: New.
* 27_io/basic_stringbuf/sputbackc/char/1.cc: New.
* 27_io/basic_stringbuf/sputbackc/char/9425.cc: New.
* 27_io/basic_stringbuf/sputc/char/1.cc: New.
* 27_io/basic_stringbuf/sputc/char/1057.cc: New.
* 27_io/basic_stringbuf/sputc/char/9404-1.cc: New.
* 27_io/basic_stringbuf/sputn/char/1.cc: New.
* 27_io/basic_stringbuf/sputn/char/1057.cc: New.
* 27_io/basic_stringbuf/sputn/char/9404-2.cc: New.
* 27_io/basic_stringbuf/str/char/1.cc: New.
* 27_io/basic_stringbuf/str/char/2.cc: New.
* 27_io/basic_stringbuf/str/char/3.cc: New.
* 27_io/basic_stringbuf/str/char/3955.cc: New.
* 27_io/basic_stringbuf/sungetc/char/1.cc: New.
* 27_io/basic_stringbuf/sync/char/1057.cc: New.
* 27_io/basic_stringstream/1.cc: New.
* 27_io/basic_stringstream/2.cc: New.
* 27_io/basic_stringstream/3.cc: New.
* 27_io/basic_stringstream/4.cc: New.
* 27_io/basic_stringstream/rdbuf/char/2832.cc: New.
* 27_io/basic_stringstream/str/char/1.cc: New.
* 27_io/basic_stringstream/str/char/2.cc: New.
* 27_io/basic_stringstream/str/char/3.cc: New.
* 27_io/basic_stringstream/str/char/4.cc: New.
* 27_io/fpos/1.cc: New.
* 27_io/fpos/2.cc: New.
* 27_io/fpos/3.cc: New.
* 27_io/ios_base/callbacks/1.cc: New.
* 27_io/ios_base/state/1.cc: New.
* 27_io/ios_base/storage/1.cc: New.
* 27_io/ios_base/storage/2.cc: New.
* 27_io/ios_base/storage/3.cc: New.
* 27_io/ios_base/sync_with_stdio/1.cc: New.
* 27_io/ios_base/sync_with_stdio/2.cc: New.
* 27_io/manipulators/adjustfield/char/1.cc: New.
* 27_io/manipulators/adjustfield/char/2.cc: New.
* 27_io/manipulators/basefield/char/1.cc: New.
* 27_io/manipulators/standard/char/1.cc: New.
* 27_io/manipulators/standard/char/2.cc: New.
* 27_io/objects/char/1.cc: New.
* 27_io/objects/char/2.cc: New.
* 27_io/objects/char/2523-1_xin.cc: New.
* 27_io/objects/char/2523-1_xin.in: New.
* 27_io/objects/char/2523-2_xin.cc: New.
* 27_io/objects/char/2523-2_xin.in: New.
* 27_io/objects/char/3045.cc: New.
* 27_io/objects/char/3647.cc: New.
* 27_io/objects/char/3_xin.cc: New.
* 27_io/objects/char/3_xin.in: New.
* 27_io/objects/char/4_xin.cc: New.
* 27_io/objects/char/4_xin.in: New.
* 27_io/objects/char/5268.cc: New.
* 27_io/objects/char/5280_xin.cc: New.
* 27_io/objects/char/5280_xin.in: New.
* 27_io/objects/char/6548_xin.cc: New.
* 27_io/objects/char/6548_xin.in: New.
* 27_io/objects/char/6648-1_xin.cc: New.
* 27_io/objects/char/6648-1_xin.in: New.
* 27_io/objects/char/6648-2_xin.cc: New.
* 27_io/objects/char/6648-2_xin.in: New.
* 27_io/objects/char/7744_xin.cc: New.
* 27_io/objects/char/7744_xin.in: New.
* 27_io/objects/wchar_t/1.cc: New.
* 27_io/types/1.cc: New.
* 27_io/types/2.cc: New.
* data/filebuf_members-1.tst: New.
* data/filebuf_members-1.txt: New.
* data/filebuf_virtuals-1.tst: New.
* data/filebuf_virtuals-1.txt: New.
* data/filebuf_virtuals-2.tst: New.
* data/filebuf_virtuals-3.tst: New.
* data/ifstream_members-1.tst: New.
* data/ifstream_members-1.txt: New.
* data/ios_base_members_static-1.tst: New.
* data/istream_extractor_other-1.tst: New.
* data/istream_extractor_other-1.txt: New.
* data/istream_extractor_other-2.tst: New.
* data/istream_seeks-1.tst: New.
* data/istream_seeks-1.txt: New.
* data/istream_seeks-2.tst: New.
* data/istream_seeks-3.tst: New.
* data/istream_unformatted-1.tst: New.
* data/istream_unformatted-1.txt: New.
* data/ofstream_members-1.tst: New.
* data/ostream_inserter_char-1.tst: New.
* data/ostream_inserter_char-1.txt: New.
* data/ostream_inserter_other-1.tst: New.
* data/ostream_inserter_other-2.tst: New.
* data/ostream_seeks-1.tst: New.
2003-04-09 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/sstream.tcc (basic_stringbuf::seekpos): Remove
requirement that __mode must be strict input or output.
* include/std/std_streambuf.h (basic_streambuf::setp): Set
_M_out_lim.
* include/std/std_sstream.h (basic_strinbuf::str): Zero length
output string shouldn't core.
(basic_stringbuf::_M_really_sync): Add base argument. Remove rturn
type.
* include/bits/sstream.tcc: Adjust _M_really_sync bits here.
* include/bits/istream.tcc (basic_istream::putback): Set gcount to
zero.
2003-04-09 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/data: New directory.
* testsuite/lib/libstdc++-v3-dg.exp (libstdc++-v3-init): Modify
to copy files from the testsuite data directory.
(libstdc++-v3-list-sourcefiles): Add another test list filter, for
testfiles containing _xin, which now means this is an interactive
test and should be run with the interactive dejagnu hooks.
* testsuite/Makefile.am: Remove testsuite_* files.
* testsuite/Makefile.in: Regenerate.
2003-04-09 Zack Weinberg <zack@codesourcery.com>
* docs/html/install.html: Document complete list of locales

View File

@ -841,6 +841,7 @@ namespace std
basic_istream<_CharT, _Traits>::
putback(char_type __c)
{
_M_gcount = 0;
sentry __cerb(*this, true);
if (__cerb)
{

View File

@ -83,29 +83,30 @@ namespace std
bool __testout = this->_M_mode & ios_base::out;
if (__builtin_expect(!__testout, false))
return traits_type::eof();
bool __testeof = traits_type::eq_int_type(__c, traits_type::eof());
if (__builtin_expect(__testeof, false))
return traits_type::not_eof(__c);
// In virtue of DR 169 (TC) we are allowed to grow more than
// one char the first time and also...
__size_type __len =
std::max(__size_type(_M_string.capacity() + 1), this->_M_buf_size_opt);
bool __testwrite = this->_M_out_cur < this->_M_out_end;
if (__builtin_expect(!__testwrite && __len > _M_string.max_size(), false))
__size_type __len = std::max(__size_type(_M_string.capacity() + 1),
this->_M_buf_size_opt);
bool __testput = this->_M_out_cur < this->_M_out_end;
if (__builtin_expect(!__testput && __len > _M_string.max_size(), false))
return traits_type::eof();
// Try to append __c into output sequence in one of two ways.
// Order these tests done in is unspecified by the standard.
if (!__testwrite)
if (!__testput)
{
// Force-allocate, re-sync.
_M_string = this->str();
// ... the next times. That's easy to implement thanks to the
// ... the next time. That's easy to implement thanks to the
// exponential growth policy builtin into basic_string.
_M_string.reserve(__len);
_M_really_sync(this->_M_in_cur - this->_M_in_beg,
_M_really_sync(const_cast<char_type*>(_M_string.data()),
this->_M_in_cur - this->_M_in_beg,
this->_M_out_cur - this->_M_out_beg);
}
return this->sputc(traits_type::to_char_type(__c));
@ -187,21 +188,18 @@ namespace std
char_type* __end = NULL;
bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
bool __testboth = __testin && __testout;
__testin &= !(__mode & ios_base::out);
__testout &= !(__mode & ios_base::in);
// NB: Ordered.
bool __testposi = false;
bool __testposo = false;
if (__testin || __testboth)
if (__testin)
{
__beg = this->eback();
__end = this->egptr();
if (0 <= __pos && __pos <= __end - __beg)
__testposi = true;
}
if (__testout || __testboth)
if (__testout)
{
__beg = this->pbase();
__end = this->epptr();

View File

@ -394,9 +394,7 @@ namespace std
*/
void
_M_set_indeterminate(void)
{
_M_set_determinate(off_type(0));
}
{ _M_set_determinate(off_type(0)); }
/**
* @if maint

View File

@ -133,20 +133,23 @@ namespace std
__string_type
str() const
{
__string_type __ret = _M_string;
if (this->_M_mode & ios_base::out)
{
// This is the deal: _M_string.size() is a value that
// represents the size of the initial string that makes
// _M_string, and may not be the correct size of the
// current stringbuf internal buffer.
// represents the size of the initial string used to
// created the buffer, and may not be the correct size of
// the current stringbuf internal buffer.
__size_type __len = _M_string.size();
if (this->_M_out_lim > this->_M_out_beg)
__len = std::max(__size_type(this->_M_out_lim
- this->_M_out_beg), __len);
return __string_type(this->_M_out_beg, this->_M_out_beg + __len);
__size_type __nlen = this->_M_out_lim - this->_M_out_beg;
if (__nlen)
{
__len = std::max(__nlen, __len);
__ret = __string_type(this->_M_out_beg,
this->_M_out_beg + __len);
}
}
else
return _M_string;
return __ret;
}
/**
@ -180,10 +183,11 @@ namespace std
// suit particular needs.
this->_M_buf_size_opt = 512;
this->_M_mode = __mode;
__size_type __len = 0;
if (this->_M_mode & (ios_base::ate | ios_base::app))
_M_really_sync(0, _M_string.size());
else
_M_really_sync(0, 0);
__len = _M_string.size();
_M_really_sync(const_cast<char_type*>(_M_string.data()), 0, __len);
}
// Overridden virtual functions:
@ -221,8 +225,18 @@ namespace std
{
if (__s && __n)
{
// This is implementation-defined behavior, and assumes
// that an external char_type array of length (__s + __n)
// exists and has been pre-allocated. If this is not the
// case, things will quickly blow up.
// Step 1: Destroy the current internal array.
_M_string = __string_type(__s, __n);
_M_really_sync(0, 0);
// Step 2: Use the external array.
this->_M_buf = __s;
this->_M_buf_size_opt = this->_M_buf_size = __n;
_M_really_sync(__s, 0, 0);
}
return this;
}
@ -248,10 +262,9 @@ namespace std
* @doctodo
* @endif
*/
virtual int
_M_really_sync(__size_type __i, __size_type __o)
virtual void
_M_really_sync(char_type* __base, __size_type __i, __size_type __o)
{
char_type* __base = const_cast<char_type*>(_M_string.data());
bool __testin = this->_M_mode & ios_base::in;
bool __testout = this->_M_mode & ios_base::out;
__size_type __len = _M_string.size();
@ -266,7 +279,6 @@ namespace std
this->_M_out_lim = __base + __len;
this->_M_out_cur += __o;
}
return 0;
}
};

View File

@ -210,7 +210,7 @@ namespace std
char_type* _M_out_cur; // Current put area.
char_type* _M_out_end; // End of put area.
char_type* _M_out_lim; // Right limit of used put area.
char_type* _M_out_lim; // End limit of used put area.
//@}
@ -651,7 +651,7 @@ namespace std
setp(char_type* __pbeg, char_type* __pend)
{
_M_out_beg = _M_out_cur = __pbeg;
_M_out_end = __pend;
_M_out_end = _M_out_lim = __pend;
if (!(_M_mode & ios_base::out) && __pbeg && __pend)
_M_mode = _M_mode | ios_base::out;
}

View File

@ -0,0 +1,50 @@
// 1999-01-17 bkoz test functionality of basic_filebuf for char_type == char
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.1 - Template class basic_filebuf
// NB: This file is for testing basic_filebuf with NO OTHER INCLUDES.
#include <fstream>
// { dg-do compile }
// libstdc++/7216
void test01()
{
// Check for required typedefs
typedef std::filebuf test_type;
typedef test_type::char_type char_type;
typedef test_type::traits_type traits_type;
typedef test_type::int_type int_type;
typedef test_type::pos_type pos_type;
typedef test_type::off_type off_type;
}
// more surf!!!

View File

@ -0,0 +1,51 @@
// 1999-01-17 bkoz test functionality of basic_filebuf for char_type == char
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.1 - Template class basic_filebuf
// NB: This file is for testing basic_filebuf with NO OTHER INCLUDES.
#include <fstream>
#include <testsuite_hooks.h>
// { dg-do compile }
// test05
// libstdc++/1886
// should be able to instantiate basic_filebuf for non-standard types.
namespace test
{
using namespace std;
using __gnu_cxx_test::pod_char;
typedef short type_t;
template class basic_filebuf<type_t, char_traits<type_t> >;
template class basic_filebuf<pod_char, char_traits<pod_char> >;
} // test
// more surf!!!

View File

@ -25,36 +25,8 @@
#include <fstream>
#include <testsuite_hooks.h>
// { dg-do compile }
// libstdc++/7216
void test01()
{
// Check for required typedefs
typedef std::filebuf test_type;
typedef test_type::char_type char_type;
typedef test_type::traits_type traits_type;
typedef test_type::int_type int_type;
typedef test_type::pos_type pos_type;
typedef test_type::off_type off_type;
}
// test05
// libstdc++/1886
// should be able to instantiate basic_filebuf for non-standard types.
namespace test
{
using namespace std;
using __gnu_cxx_test::pod_char;
typedef short type_t;
template class basic_filebuf<type_t, char_traits<type_t> >;
template class basic_filebuf<pod_char, char_traits<pod_char> >;
} // test
// test07
// libstdc++/2020
// should be able to use custom char_type
// should be able to use custom char_type, custom traits type
class gnu_char_type
{
unsigned long character;
@ -79,10 +51,72 @@ public:
operator unsigned long() const { return character; }
};
// char_traits specialization
struct gnu_char_traits
{
typedef gnu_char_type char_type;
typedef long int_type;
typedef long pos_type;
typedef unsigned long off_type;
typedef long state_type;
static void
assign(char_type& __c1, const char_type& __c2) { }
static bool
eq(const char_type& __c1, const char_type& __c2) { return true; }
static bool
lt(const char_type& __c1, const char_type& __c2) { return true; }
static int
compare(const char_type* __s1, const char_type* __s2, size_t __n)
{ return 0; }
static size_t
length(const char_type* __s) { return 0; }
static const char_type*
find(const char_type* __s, size_t __n, const char_type& __a)
{ return __s; }
static char_type*
move(char_type* __s1, const char_type* __s2, size_t __n)
{ return __s1; }
static char_type*
copy(char_type* __s1, const char_type* __s2, size_t __n)
{ return __s1; }
static char_type*
assign(char_type* __s, size_t __n, char_type __a)
{ return __s; }
static char_type
to_char_type(const int_type& __c)
{ return char_type(); }
static int_type
to_int_type(const char_type& __c)
{ return int_type(); }
static bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return true; }
static int_type
eof()
{ return int_type(); }
static int_type
not_eof(const int_type& __c)
{ return int_type(); }
};
void test07()
{
bool test = true;
typedef std::basic_filebuf<gnu_char_type> gnu_filebuf;
typedef std::basic_filebuf<gnu_char_type, gnu_char_traits> gnu_filebuf;
try
{ gnu_filebuf obj; }
@ -102,7 +136,6 @@ template
int main()
{
test01();
test07();
return 0;
}
@ -110,12 +143,3 @@ int main()
// more surf!!!

View File

@ -0,0 +1,49 @@
// 2003-03-26 B enjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.1 - Template class basic_filebuf
#include <fstream>
void test01()
{
// Check for required base class.
typedef std::filebuf test_type;
typedef std::streambuf base_type;
const test_type& obj = test_type();
const base_type* base = &obj;
}
int main()
{
test01();
return 0;
}
// more surf!!!

View File

@ -0,0 +1,86 @@
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.3 filebuf member functions
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %-*.txt
// various tests for filebuf::open() and filebuf::close() including
// the non-portable functionality in the libstdc++-v3 IO library
#include <fstream>
#include <testsuite_hooks.h>
const char name_01[] = "filebuf_members-1.tst";
const char name_02[] = "filebuf_members-1.txt";
// Test member functions.
void test_01()
{
bool test = true;
const char* name_03 = "filebuf_members-3"; // empty file, need to create
std::filebuf fb_01; // in
std::filebuf fb_02; // out
std::filebuf fb_03; // in | out
// bool is_open()
VERIFY( !fb_01.is_open() );
VERIFY( !fb_02.is_open() );
VERIFY( !fb_03.is_open() );
// filebuf_type* open(const char* __s, ios_base::openmode __mode)
fb_01.open(name_01, std::ios_base::in | std::ios_base::ate);
VERIFY( fb_01.is_open() );
// 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_02, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
VERIFY( fb_02.is_open() );
fb_03.open(name_03, std::ios_base::out | std::ios_base::trunc);
VERIFY( fb_03.is_open() );
// filebuf_type* close()
std::filebuf* f;
f = fb_01.close();
VERIFY( f != NULL );
VERIFY( !fb_01.is_open() );
f = fb_02.close();
VERIFY( f != NULL );
VERIFY( !fb_02.is_open() );
f = fb_03.close();
VERIFY( f != NULL );
VERIFY( !fb_03.is_open() );
f = fb_03.close();
VERIFY( f == NULL );
VERIFY( !fb_03.is_open() );
}
int
main()
{
test_01();
return 0;
}

View File

@ -0,0 +1,79 @@
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.3 filebuf member functions
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %-*.txt
// various tests for filebuf::open() and filebuf::close() including
// the non-portable functionality in the libstdc++-v3 IO library
#include <fstream>
#include <ext/stdio_filebuf.h>
#include <testsuite_hooks.h>
// Verify that std::filebuf doesn't close files that it didn't open
// when using the following std::filebuf ctor:
//
// std::filebuf(__c_file_type* __f,
// ios_base::openmode __mode,
// int_type __s);
//
// Thanks to "George T. Talbot" <george@moberg.com> for uncovering
// this bug/situation.
const char name_01[] = "filebuf_virtuals-1.txt"; // file with data in it
const char name_02[] = "filebuf_virtuals-2.txt"; // empty file, need to create
void test_02()
{
bool test = true;
int close_num;
// read (ext)
FILE* f2 = fopen(name_01, "r");
VERIFY( f2 != NULL );
if (f2)
{
__gnu_cxx::stdio_filebuf<char> fb(f2, std::ios_base::in, 512);
close_num = fclose(f2);
}
VERIFY( close_num == 0 );
// read (standard)
FILE* f = fopen(name_01, "r");
VERIFY( f != NULL );
if (f)
{
std::ifstream ifstream1(name_01);
VERIFY( ifstream1.is_open() );
std::ios_base::iostate st01 = ifstream1.rdstate();
VERIFY( st01 == std::ios_base::goodbit );
close_num = fclose(f);
}
VERIFY( close_num == 0 );
}
int
main()
{
test_02();
return 0;
}

View File

@ -0,0 +1,106 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <locale>
#include <testsuite_hooks.h>
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %*.txt
// NB: This test assumes that _M_buf_size == 40, and not the usual
// buffer_size length of BUFSIZ (8192), so that overflow/underflow can be
// simulated a bit more readily.
// NRB (Nota Really Bene): setting it to 40 breaks the test, as intended.
const int buffer_size = 8192;
//const int buffer_size = 40;
const char carray_01[] = "santa cruz or sandiego?";
const char carray_02[] = "memphis, new orleans, and savanah";
const char name_01[] = "filebuf_virtuals-1.txt"; // file with data in it
const char name_02[] = "filebuf_virtuals-2.txt"; // empty file, need to create
const char name_03[] = "filebuf_virtuals-3.txt"; // empty file, need to create
const char name_04[] = "filebuf_virtuals-4.txt"; // empty file, need to create
const char name_05[] = "filebuf_virtuals-5.txt"; // empty file, need to create
const char name_06[] = "filebuf_virtuals-6.txt"; // empty file, need to create
const char name_07[] = "filebuf_virtuals-7.txt"; // empty file, need to create
const char name_08[] = "filebuf_virtuals-8.txt"; // empty file, need to create
class derived_filebuf: public std::filebuf
{
public:
void
set_size(int_type __size) { _M_buf_size_opt = __size; }
};
derived_filebuf fb_01; // in
derived_filebuf fb_02; // out
derived_filebuf fb_03; // in | out
// Initialize filebufs to be the same size regardless of platform.
void test03()
{
fb_01.set_size(buffer_size);
fb_02.set_size(buffer_size);
fb_03.set_size(buffer_size);
}
// Test overloaded virtual functions.
void test05()
{
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;
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);
// NB Have to close these suckers. . .
// filebuf_type* close()
fb_01.close();
fb_02.close();
fb_03.close();
VERIFY( !fb_01.is_open() );
VERIFY( !fb_02.is_open() );
VERIFY( !fb_03.is_open() );
}
main()
{
test03();
test05();
return 0;
}

View File

@ -0,0 +1,97 @@
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.3 filebuf member functions
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %-*.txt
// various tests for filebuf::open() and filebuf::close() including
// the non-portable functionality in the libstdc++-v3 IO library
#include <fstream>
#include <iostream>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <testsuite_hooks.h>
// libstdc++/2913, libstdc++/4879
// John Fardo <jfardo@laurelnetworks.com>, Brad Garcia <garsh@attbi.com>
void
test_04()
{
bool test = true;
const char* name = "tmp_fifo1";
signal(SIGPIPE, SIG_IGN);
unlink(name);
if (0 != mkfifo(name, S_IRWXU))
{
std::cerr << "failed to create fifo" << std::endl;
exit(-1);
}
int fval = fork();
if (fval == -1)
{
std::cerr << "failed to fork" << std::endl;
unlink(name);
exit(-1);
}
else if (fval == 0)
{
std::ifstream ifs(name);
sleep(1);
ifs.close();
exit(0);
}
std::ofstream ofs(name);
sleep(2);
ofs.put('t');
/*
* ISO/IED 14882:1998(E) 27.8.1.10.4
*
* void close();
*
* Effects: Calls rdbuf()->close() and, if that function fails
* (returns a null pointer), calls setstate(failbit)...
*/
ofs.close();
if (!(ofs.rdstate() & std::ios::failbit))
{
test = false;
VERIFY( test );
unlink(name);
exit(-1);
}
unlink(name);
}
int
main()
{
test_04();
return 0;
}

View File

@ -0,0 +1,77 @@
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.3 filebuf member functions
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %-*.txt
// various tests for filebuf::open() and filebuf::close() including
// the non-portable functionality in the libstdc++-v3 IO library
#include <fstream>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <testsuite_hooks.h>
// libstdc++/9964
void test_07()
{
using namespace std;
bool test = true;
const char* name = "tmp_fifo3";
signal(SIGPIPE, SIG_IGN);
unlink(name);
mkfifo(name, S_IRWXU);
int child = fork();
VERIFY( child != -1 );
if (child == 0)
{
filebuf fbin;
fbin.open(name, ios_base::in);
sleep(1);
fbin.close();
exit(0);
}
filebuf fb;
filebuf* ret = fb.open(name, ios_base::out | ios_base::trunc);
VERIFY( ret != NULL );
VERIFY( fb.is_open() );
sleep(2);
fb.sputc('a');
ret = fb.close();
VERIFY( ret == NULL );
VERIFY( !fb.is_open() );
}
int
main()
{
test_07();
return 0;
}

View File

@ -0,0 +1,45 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == char
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
#include <fstream>
#include <testsuite_hooks.h>
std::filebuf fbuf;
// test the filebuf locale settings
void test02()
{
std::locale loc_c = std::locale::classic();
loc_c = fbuf.getloc();
fbuf.pubimbue(loc_c); //This should initialize _M_init to true
std::locale loc_tmp = fbuf.getloc();
VERIFY( loc_tmp == loc_c );
}
int main()
{
test02();
return 0;
}
// more candy!!!

View File

@ -0,0 +1,53 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <locale>
#include <testsuite_hooks.h>
// libstdc++/9322
void test07()
{
using std::locale;
bool test = true;
locale loc;
std::filebuf ob;
VERIFY( ob.getloc() == loc );
locale::global(locale("en_US"));
VERIFY( ob.getloc() == loc );
locale loc_de ("de_DE");
locale ret = ob.pubimbue(loc_de);
VERIFY( ob.getloc() == loc_de );
VERIFY( ret == loc );
locale::global(loc);
VERIFY( ob.getloc() == loc_de );
}
main()
{
__gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test07);
return 0;
}

View File

@ -0,0 +1,114 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <locale>
#include <testsuite_hooks.h>
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %*.txt
// NB: This test assumes that _M_buf_size == 40, and not the usual
// buffer_size length of BUFSIZ (8192), so that overflow/underflow can be
// simulated a bit more readily.
// NRB (Nota Really Bene): setting it to 40 breaks the test, as intended.
const int buffer_size = 8192;
//const int buffer_size = 40;
const char carray_01[] = "santa cruz or sandiego?";
const char carray_02[] = "memphis, new orleans, and savanah";
const char name_01[] = "filebuf_virtuals-1.txt"; // file with data in it
const char name_02[] = "filebuf_virtuals-2.txt"; // empty file, need to create
const char name_03[] = "filebuf_virtuals-3.txt"; // empty file, need to create
const char name_04[] = "filebuf_virtuals-4.txt"; // empty file, need to create
const char name_05[] = "filebuf_virtuals-5.txt"; // empty file, need to create
const char name_06[] = "filebuf_virtuals-6.txt"; // empty file, need to create
const char name_07[] = "filebuf_virtuals-7.txt"; // empty file, need to create
const char name_08[] = "filebuf_virtuals-8.txt"; // empty file, need to create
class derived_filebuf: public std::filebuf
{
public:
void
set_size(int_type __size) { _M_buf_size_opt = __size; }
};
derived_filebuf fb_01; // in
derived_filebuf fb_02; // out
derived_filebuf fb_03; // in | out
// Initialize filebufs to be the same size regardless of platform.
void test03()
{
fb_01.set_size(buffer_size);
fb_02.set_size(buffer_size);
fb_03.set_size(buffer_size);
}
// Test overloaded virtual functions.
void test05()
{
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
// int in_avail()
// if a read position is available, return _M_in_end - _M_in_cur.
// else return showmanyc.
strmof_1 = fb_01.in_avail();
strmof_2 = fb_02.in_avail();
VERIFY( strmof_1 == -1 );
VERIFY( strmof_1 == strmof_2 ); //fail because not open
strmof_1 = fb_03.in_avail();
VERIFY( 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();
VERIFY( strmof_1 != strmof_2 );
VERIFY( strmof_1 >= 0 );
VERIFY( strmof_2 == -1 ); // empty file
strmof_1 = fb_03.in_avail();
VERIFY( strmof_1 == 0 ); // empty file
}
main()
{
test03();
test05();
return 0;
}

View File

@ -0,0 +1,72 @@
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.3 filebuf member functions
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %-*.txt
// various tests for filebuf::open() and filebuf::close() including
// the non-portable functionality in the libstdc++-v3 IO library
#include <fstream>
#include <testsuite_hooks.h>
const char name_01[] = "filebuf_members-1.tst";
const char name_02[] = "filebuf_members-1.txt";
// Test member functions.
void test_01()
{
bool test = true;
const char* name_03 = "filebuf_members-3"; // empty file, need to create
std::filebuf fb_01; // in
std::filebuf fb_02; // out
std::filebuf fb_03; // in | out
// bool is_open()
VERIFY( !fb_01.is_open() );
VERIFY( !fb_02.is_open() );
VERIFY( !fb_03.is_open() );
// filebuf_type* open(const char* __s, ios_base::openmode __mode)
fb_01.open(name_01, std::ios_base::in | std::ios_base::ate);
fb_02.open(name_02, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
fb_03.open(name_03, std::ios_base::out | std::ios_base::trunc);
VERIFY( fb_01.is_open() );
VERIFY( fb_02.is_open() );
VERIFY( fb_03.is_open() );
// filebuf_type* close()
fb_01.close();
fb_02.close();
fb_03.close();
VERIFY( !fb_01.is_open() );
VERIFY( !fb_02.is_open() );
VERIFY( !fb_03.is_open() );
}
int
main()
{
test_01();
return 0;
}

View File

@ -0,0 +1,73 @@
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.3 filebuf member functions
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %-*.txt
// various tests for filebuf::open() and filebuf::close() including
// the non-portable functionality in the libstdc++-v3 IO library
#include <fstream>
#include <testsuite_hooks.h>
const char name_01[] = "filebuf_members-1.tst";
const char name_02[] = "filebuf_members-1.txt";
// Test member functions.
void test_01()
{
bool test = true;
const char* name_03 = "filebuf_members-3"; // empty file, need to create
std::filebuf fb_01; // in
std::filebuf fb_02; // out
std::filebuf fb_03; // in | out
// bool is_open()
VERIFY( !fb_01.is_open() );
VERIFY( !fb_02.is_open() );
VERIFY( !fb_03.is_open() );
// filebuf_type* open(const char* __s, ios_base::openmode __mode)
fb_01.open(name_01, std::ios_base::in | std::ios_base::ate);
VERIFY( fb_01.is_open() );
// Try to open two different files without closing the first:
// Should keep the old file attached, and disregard attempt to overthrow.
std::filebuf* f = fb_02.open(name_02, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
VERIFY( f != NULL );
VERIFY( fb_02.is_open() );
f = fb_02.open(name_03, std::ios_base::in | std::ios_base::out);
VERIFY( f == NULL );
VERIFY( fb_02.is_open() );
fb_03.open(name_03, std::ios_base::out | std::ios_base::trunc);
VERIFY( fb_03.is_open() );
}
int
main()
{
test_01();
return 0;
}

View File

@ -0,0 +1,58 @@
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.3 filebuf member functions
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %-*.txt
// various tests for filebuf::open() and filebuf::close() including
// the non-portable functionality in the libstdc++-v3 IO library
#include <fstream>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ext/stdio_filebuf.h>
#include <testsuite_hooks.h>
const char name_01[] = "filebuf_virtuals-1.txt"; // file with data in it
void test_03()
{
bool test = true;
int first_fd = ::open(name_01, O_RDONLY);
VERIFY( first_fd != -1 );
FILE* first_file = ::fdopen(first_fd, "r");
VERIFY( first_file != NULL );
__gnu_cxx::stdio_filebuf<char> fb(first_file, std::ios_base::in);
int second_fd = fb.fd();
VERIFY( first_fd == second_fd );
}
int
main()
{
test_03();
return 0;
}

View File

@ -0,0 +1,53 @@
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.3 filebuf member functions
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %-*.txt
// various tests for filebuf::open() and filebuf::close() including
// the non-portable functionality in the libstdc++-v3 IO library
#include <fstream>
#include <testsuite_hooks.h>
// Charles Leggett <CGLeggett@lbl.gov>
void test_05()
{
bool test = true;
const char* name = "tmp_file5";
std::fstream scratch_file;
scratch_file.open(name, std::ios::out);
scratch_file.close();
scratch_file.open(name, std::ios::in);
if (!scratch_file)
VERIFY( false );
scratch_file.close();
}
int
main()
{
test_05();
return 0;
}

View File

@ -0,0 +1,67 @@
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.3 filebuf member functions
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %-*.txt
// various tests for filebuf::open() and filebuf::close() including
// the non-portable functionality in the libstdc++-v3 IO library
#include <fstream>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <testsuite_hooks.h>
// libstdc++/9507
void test_06()
{
bool test = true;
const char* name = "tmp_fifo2";
signal(SIGPIPE, SIG_IGN);
unlink(name);
mkfifo(name, S_IRWXU);
if (!fork())
{
std::filebuf fbuf;
fbuf.open(name, std::ios_base::in);
fbuf.sgetc();
fbuf.close();
exit(0);
}
std::filebuf fbuf;
std::filebuf* r = fbuf.open(name, std::ios_base::out | std::ios_base::ate);
VERIFY( !fbuf.is_open() );
VERIFY( r == NULL );
}
int
main()
{
test_06();
return 0;
}

View File

@ -0,0 +1,78 @@
// 1999-10-11 bkoz
// Copyright (C) 1999, 2000, 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#include <fstream>
#include <ostream>
#include <testsuite_hooks.h>
// test03
// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00151.html
template<typename charT, typename traits = std::char_traits<charT> >
class basic_nullbuf : public std::basic_filebuf<charT, traits>
{
protected:
typedef typename
std::basic_filebuf<charT, traits>::int_type int_type;
virtual int_type
overflow(int_type c)
{ return traits::not_eof(c); }
};
typedef basic_nullbuf<char> nullbuf;
template<typename T>
char
print(const T& x)
{
nullbuf ob;
std::ostream out(&ob);
out << x << std::endl;
return (!out ? '0' : '1');
}
void test03()
{
bool test = true;
const std::string control01("11111");
std::string test01;
test01 += print(true);
test01 += print(3.14159);
test01 += print(10);
test01 += print('x');
test01 += print("pipo");
VERIFY( test01 == control01 );
}
int main()
{
test03();
return 0;
}

View File

@ -0,0 +1,66 @@
// 1999-10-11 bkoz
// Copyright (C) 1999, 2000, 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#include <fstream>
#include <ostream>
#include <testsuite_hooks.h>
// libstdc++/3599
class testbuf : public std::filebuf
{
public:
typedef std::filebuf::traits_type traits_type;
testbuf() : std::filebuf() { }
protected:
int_type
overflow(int_type c = traits_type::eof())
{ return traits_type::not_eof(0); }
};
void
test07()
{
bool test = true;
testbuf ob;
std::ostream out(&ob);
out << "gasp";
VERIFY(out.good());
out << std::endl;
VERIFY(out.good());
}
int main()
{
test07();
return 0;
}

View File

@ -0,0 +1,72 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <locale>
#include <testsuite_hooks.h>
const char name_04[] = "filebuf_virtuals-4.txt"; // empty file, need to create
class Cvt_to_upper : public std::codecvt<char, char, mbstate_t>
{
bool do_always_noconv() const throw()
{
return false;
}
};
// libstdc++/9169
// filebuf output fails if codecvt<>::out returns noconv
void test10()
{
using namespace std;
bool test = true;
locale c_loc = locale::classic();
locale loc(c_loc, new Cvt_to_upper);
string str("abcdefghijklmnopqrstuvwxyz");
string tmp;
{
ofstream out;
out.imbue(loc);
out.open(name_04);
copy(str.begin(), str.end(), ostreambuf_iterator<char>(out));
}
{
ifstream in;
in.open(name_04);
copy(istreambuf_iterator<char>(in), istreambuf_iterator<char>(),
back_inserter(tmp));
}
VERIFY( tmp.size() == str.size() );
VERIFY( tmp == str );
}
main()
{
test10();
return 0;
}

View File

@ -0,0 +1,72 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <locale>
#include <testsuite_hooks.h>
const char name_07[] = "filebuf_virtuals-7.txt"; // empty file, need to create
class errorcvt : public std::codecvt<char, char, mbstate_t>
{
protected:
std::codecvt_base::result
do_out(mbstate_t&, const char* from, const char*,
const char*& from_next, char* to, char*,
char*& to_next) const
{
from_next = from;
to_next = to;
return std::codecvt<char, char, mbstate_t>::error;
}
virtual bool do_always_noconv() const throw()
{
return false;
}
};
// libstdc++/9182
// basic_filebuf<>::sync and overflow do not write out any characters
// if codecvt<>::out returns error
void test14()
{
using namespace std;
bool test = true;
locale loc = locale::classic();
loc = locale(loc, new errorcvt);
filebuf fbuf1;
fbuf1.pubimbue(loc);
fbuf1.pubsetbuf(0, 0);
fbuf1.open(name_07, ios_base::out | ios_base::trunc);
streamsize n = fbuf1.sputn("onne", 4);
VERIFY( n == 0 );
fbuf1.close();
}
main()
{
test14();
return 0;
}

View File

@ -0,0 +1,69 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <testsuite_hooks.h>
const char name_08[] = "filebuf_virtuals-8.txt"; // empty file, need to create
class OverBuf : public std::filebuf
{
public:
int_type pub_overflow(int_type c = traits_type::eof())
{ return std::filebuf::overflow(c); }
};
// libstdc++/9988
// filebuf::overflow writes EOF to file
void test15()
{
using namespace std;
bool test = true;
OverBuf fb;
fb.open(name_08, ios_base::out | ios_base::trunc);
fb.sputc('a');
fb.pub_overflow('b');
fb.pub_overflow();
fb.sputc('c');
fb.close();
filebuf fbin;
fbin.open(name_08, ios_base::in);
filebuf::int_type c;
c = fbin.sbumpc();
VERIFY( c == 'a' );
c = fbin.sbumpc();
VERIFY( c == 'b' );
c = fbin.sbumpc();
VERIFY( c == 'c' );
c = fbin.sbumpc();
VERIFY( c == filebuf::traits_type::eof() );
fbin.close();
}
main()
{
test15();
return 0;
}

View File

@ -0,0 +1,106 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <testsuite_hooks.h>
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %*.txt
// NB: This test assumes that _M_buf_size == 40, and not the usual
// buffer_size length of BUFSIZ (8192), so that overflow/underflow can be
// simulated a bit more readily.
// NRB (Nota Really Bene): setting it to 40 breaks the test, as intended.
const int buffer_size = 8192;
//const int buffer_size = 40;
const char name_01[] = "filebuf_virtuals-1.txt"; // file with data in it
const char name_02[] = "filebuf_virtuals-2.txt"; // empty file, need to create
const char name_03[] = "filebuf_virtuals-3.txt"; // empty file, need to create
class derived_filebuf: public std::filebuf
{
public:
void
set_size(int_type __size) { _M_buf_size_opt = __size; }
};
derived_filebuf fb_01; // in
derived_filebuf fb_02; // out
derived_filebuf fb_03; // in | out
// Initialize filebufs to be the same size regardless of platform.
void test03()
{
fb_01.set_size(buffer_size);
fb_02.set_size(buffer_size);
fb_03.set_size(buffer_size);
}
// Test overloaded virtual functions.
void test05()
{
using namespace std;
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
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();
strmof_1 = fb_03.in_avail();
// int_type sbumpc()
// if read_cur not avail returns uflow(), else return *read_cur & increment
int_type c1 = fb_01.sbumpc();
int_type c2 = fb_02.sbumpc();
VERIFY( c1 != c2 );
VERIFY( c1 == '/' );
VERIFY( c2 == -1 );
int_type c3 = fb_01.sbumpc();
int_type c4 = fb_02.sbumpc();
VERIFY( c3 != c4 );
VERIFY( c1 == c3 ); // fluke, both happen to be '/'
VERIFY( c2 == c4 );
int_type c5 = fb_03.sbumpc();
VERIFY( c5 == traits_type::eof() );
// XXX should do some kind of test to make sure that internal
// buffers point to the same thing, to check consistancy.
}
main()
{
test03();
test05();
return 0;
}

View File

@ -0,0 +1,55 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <testsuite_hooks.h>
const char name_06[] = "filebuf_virtuals-6.txt"; // empty file, need to create
// libstdc++/9825
// filebuf::sputbackc breaks sbumpc
void test12()
{
using namespace std;
bool test = true;
filebuf fbuf;
fbuf.open(name_06, ios_base::in|ios_base::out|ios_base::trunc);
fbuf.sputn("crazy bees!", 11);
fbuf.pubseekoff(0, ios_base::beg);
fbuf.sbumpc();
fbuf.sputbackc('x');
filebuf::int_type c = fbuf.sbumpc();
VERIFY( c == 'x' );
c = fbuf.sbumpc();
VERIFY( c == 'r' );
c = fbuf.sbumpc();
VERIFY( c == 'a' );
fbuf.close();
}
main()
{
test12();
return 0;
}

View File

@ -0,0 +1,137 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <testsuite_hooks.h>
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %*.txt
// NB: This test assumes that _M_buf_size == 40, and not the usual
// buffer_size length of BUFSIZ (8192), so that overflow/underflow can be
// simulated a bit more readily.
// NRB (Nota Really Bene): setting it to 40 breaks the test, as intended.
const int buffer_size = 8192;
//const int buffer_size = 40;
const char name_01[] = "filebuf_virtuals-1.txt"; // empty file, need to create
class derived_filebuf: public std::filebuf
{
public:
void
set_size(int_type __size) { _M_buf_size_opt = __size; }
};
derived_filebuf fb_03; // in | out
// Initialize filebufs to be the same size regardless of platform.
void test03()
{
fb_03.set_size(buffer_size);
}
// Test overloaded virtual functions.
void test05()
{
using namespace std;
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;
fb_03.open(name_01, ios_base::out | ios_base::in);
int_type c1;
int_type c2;
int_type c3;
// seekoff
// pubseekoff(off_type off, ios_base::seekdir way, ios_base::openmode which)
// alters the stream position to off
pos_type pt_1(off_type(-1));
pos_type pt_2(off_type(0));
off_type off_1 = 0;
off_type off_2 = 0;
//IN|OUT
// 27filebuf-3.txt = bd23456789:;<=>?...
//beg
strmsz_1 = fb_03.in_avail();
pt_1 = fb_03.pubseekoff(2, ios_base::beg);
strmsz_2 = fb_03.in_avail();
off_1 = pt_1;
VERIFY( off_1 > 0 );
c1 = fb_03.snextc(); //current in pointer +1
VERIFY( c1 == '9' );
c2 = fb_03.sputc('\n'); //current in pointer +1
c3 = fb_03.sgetc();
VERIFY( c2 != c3 );
VERIFY( c3 == '9' );
fb_03.pubsync();
c1 = fb_03.sgetc();
VERIFY( c1 == c3 );
//cur
// 27filebuf-3.txt = bd2\n456789:;<=>?...
pt_2 = fb_03.pubseekoff(2, ios_base::cur);
off_2 = pt_2;
VERIFY( (off_2 == (off_1 + 2 + 1 + 1)) );
c1 = fb_03.snextc(); //current in pointer +1
VERIFY( c1 == '1' );
c2 = fb_03.sputc('x'); //test current out pointer
c3 = fb_03.sputc('\n');
c1 = fb_03.sgetc();
fb_03.pubsync();
c3 = fb_03.sgetc();
VERIFY( 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;
VERIFY( 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);
VERIFY( strmsz_1 == 28 );
c1 = fb_03.sungetc();
// Defect? retval of sungetc is not necessarily the character ungotten.
// So re-get it.
c1 = fb_03.sgetc();
fb_03.pubsync();
c3 = fb_03.sgetc();
VERIFY( c1 == c3 );
// IN
// OUT
}
main()
{
test03();
test05();
return 0;
}

View File

@ -0,0 +1,65 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.7.1.3 Overridden virtual functions
#include <fstream>
#include <testsuite_hooks.h>
void test02(std::filebuf& in, bool pass)
{
bool test = true;
using namespace std;
typedef streambuf::pos_type pos_type;
typedef streambuf::off_type off_type;
pos_type bad = pos_type(off_type(-1));
pos_type p = 0;
// seekoff
p = in.pubseekoff(0, ios_base::beg, ios_base::in);
if (pass)
VERIFY( p != bad );
p = in.pubseekoff(0, ios_base::beg, ios_base::out);
VERIFY( p == bad );
p = in.pubseekoff(0, ios_base::beg);
if (pass)
VERIFY( p != bad );
}
const char name_01[] = "filebuf_virtuals-1.tst"; // file with data in it
const char name_03[] = "filebuf_members-1.tst"; // empty file
int main()
{
using namespace std;
// movie star, submarine scientist!
filebuf in1;
in1.open(name_01, ios_base::in);
filebuf in2;
filebuf in3;
in3.open(name_03, ios_base::in);
test02(in1, true);
test02(in2, false);
test02(in3, true);
return 0;
}

View File

@ -0,0 +1,127 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <testsuite_hooks.h>
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %*.txt
// NB: This test assumes that _M_buf_size == 40, and not the usual
// buffer_size length of BUFSIZ (8192), so that overflow/underflow can be
// simulated a bit more readily.
// NRB (Nota Really Bene): setting it to 40 breaks the test, as intended.
const int buffer_size = 8192;
//const int buffer_size = 40;
const char name_01[] = "filebuf_virtuals-1.txt"; // file with data in it
class derived_filebuf: public std::filebuf
{
public:
void
set_size(int_type __size) { _M_buf_size_opt = __size; }
};
derived_filebuf fb_03; // in | out
// Initialize filebufs to be the same size regardless of platform.
void test03()
{
fb_03.set_size(buffer_size);
}
// Test overloaded virtual functions.
void test05()
{
using namespace std;
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;
fb_03.open(name_01, ios_base::out | ios_base::in);
int_type c1;
int_type c2;
int_type c3;
// seekpos
// pubseekpos(pos_type sp, ios_base::openmode)
// alters the stream position to sp
pos_type pt_1(off_type(-1));
pos_type pt_2(off_type(0));
off_type off_1 = 0;
off_type off_2 = 0;
//IN|OUT
//beg
pt_1 = fb_03.pubseekoff(78, ios_base::beg);
off_1 = pt_1;
VERIFY( off_1 > 0 );
c1 = fb_03.snextc(); //current in pointer +1
VERIFY( c1 == 't' );
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);
off_2 = pt_2;
VERIFY( off_1 == off_2 );
c3 = fb_03.snextc(); //current in pointer +1
VERIFY( c2 == c3 );
pt_1 = fb_03.pubseekoff(0, ios_base::end);
off_1 = pt_1;
VERIFY( off_1 > off_2 );
fb_03.sputn("\nof the wonderful things he does!!\nok", 37);
fb_03.pubsync();
// IN
// OUT
// VIRTUALS (indirectly tested)
// underflow
// if read position avail, returns *gptr()
// pbackfail(int_type c)
// put c back into input sequence
// overflow
// appends c to output seq
// NB Have to close these suckers. . .
// filebuf_type* close()
fb_03.close();
VERIFY( !fb_03.is_open() );
}
main()
{
test03();
test05();
return 0;
}

View File

@ -0,0 +1,65 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.7.1.3 Overridden virtual functions
#include <fstream>
#include <testsuite_hooks.h>
void test02(std::filebuf& in, bool pass)
{
bool test = true;
using namespace std;
typedef streambuf::pos_type pos_type;
typedef streambuf::off_type off_type;
pos_type bad = pos_type(off_type(-1));
pos_type p = 0;
// seekpos
p = in.pubseekpos(0, ios_base::in);
if (pass)
VERIFY( p != bad );
p = in.pubseekpos(0, ios_base::out);
VERIFY( p == bad );
p = in.pubseekpos(0);
if (pass)
VERIFY( p != bad );
}
const char name_01[] = "filebuf_virtuals-1.tst"; // file with data in it
const char name_03[] = "filebuf_members-1.tst"; // empty file
int main()
{
using namespace std;
// movie star, submarine scientist!
filebuf in1;
in1.open(name_01, ios_base::in);
filebuf in2;
filebuf in3;
in3.open(name_03, ios_base::in);
test02(in1, true);
test02(in2, false);
test02(in3, true);
return 0;
}

View File

@ -0,0 +1,90 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <testsuite_hooks.h>
class testbuf : public std::filebuf
{
public:
// Typedefs:
typedef std::filebuf base_type;
typedef base_type::traits_type traits_type;
typedef base_type::char_type char_type;
testbuf(): base_type()
{ _M_mode = (std::ios_base::in | std::ios_base::out); }
bool
check_pointers()
{
bool test = true;
test = (this->pbase() == NULL);
test &= (this->pptr() == NULL);
return test;
}
};
const char name_01[] = "filebuf_virtuals-1.txt";
// Test overloaded virtual functions.
void test05()
{
using namespace std;
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;
int_type c1;
{
testbuf f_tmp;
// setbuf
// pubsetbuf(char_type* s, streamsize n)
f_tmp.pubsetbuf(0,0);
VERIFY( f_tmp.check_pointers() );
}
{
testbuf f_tmp;
f_tmp.open(name_01, ios_base::out | ios_base::in);
int_type c1 = f_tmp.sbumpc();
// setbuf
// pubsetbuf(char_type* s, streamsize n)
f_tmp.pubsetbuf(0, 0);
VERIFY( !f_tmp.check_pointers() );
}
}
main()
{
test05();
return 0;
}

View File

@ -0,0 +1,45 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <testsuite_hooks.h>
void test01()
{
using namespace std;
bool test = true;
char buf[512];
const char* strlit = "how to tell a story and other essays: mark twain";
const size_t strlitsize = std::strlen(strlit);
filebuf fbuf;
fbuf.open("tmp_setbuf2", ios_base::out);
fbuf.pubsetbuf(buf, 512);
fbuf.sputn(strlit, strlitsize);
VERIFY( std::strncmp(strlit, buf, strlitsize) == 0 );
}
main()
{
test01();
return 0;
}

View File

@ -0,0 +1,46 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <testsuite_hooks.h>
void test02()
{
using namespace std;
bool test = true;
char buf[512];
const char* strlit = "how to tell a story and other essays: mark twain";
const size_t strlitsize = std::strlen(strlit);
filebuf fbuf01;
fbuf01.open("tmp", ios_base::out);
fbuf01.pubsetbuf(buf, strlitsize);
fbuf01.sputn(strlit, strlitsize);
VERIFY( std::strncmp(strlit, buf, strlitsize) == 0 );
}
main()
{
test02();
return 0;
}

View File

@ -0,0 +1,120 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <locale>
#include <testsuite_hooks.h>
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %*.txt
// NB: This test assumes that _M_buf_size == 40, and not the usual
// buffer_size length of BUFSIZ (8192), so that overflow/underflow can be
// simulated a bit more readily.
// NRB (Nota Really Bene): setting it to 40 breaks the test, as intended.
const int buffer_size = 8192;
//const int buffer_size = 40;
const char carray_01[] = "santa cruz or sandiego?";
const char carray_02[] = "memphis, new orleans, and savanah";
const char name_01[] = "filebuf_virtuals-1.txt"; // file with data in it
const char name_02[] = "filebuf_virtuals-2.txt"; // empty file, need to create
const char name_03[] = "filebuf_virtuals-3.txt"; // empty file, need to create
const char name_04[] = "filebuf_virtuals-4.txt"; // empty file, need to create
const char name_05[] = "filebuf_virtuals-5.txt"; // empty file, need to create
const char name_06[] = "filebuf_virtuals-6.txt"; // empty file, need to create
const char name_07[] = "filebuf_virtuals-7.txt"; // empty file, need to create
const char name_08[] = "filebuf_virtuals-8.txt"; // empty file, need to create
class derived_filebuf: public std::filebuf
{
public:
void
set_size(int_type __size) { _M_buf_size_opt = __size; }
};
derived_filebuf fb_01; // in
derived_filebuf fb_02; // out
derived_filebuf fb_03; // in | out
// Initialize filebufs to be the same size regardless of platform.
void test03()
{
fb_01.set_size(buffer_size);
fb_02.set_size(buffer_size);
fb_03.set_size(buffer_size);
}
// Test overloaded virtual functions.
void test05()
{
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
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();
strmof_1 = fb_03.in_avail();
int_type c1 = fb_01.sbumpc();
int_type c2 = fb_02.sbumpc();
int_type c3 = fb_01.sbumpc();
int_type c4 = fb_02.sbumpc();
int_type c5 = fb_03.sbumpc();
// int_type sgetc()
// if read_cur not avail, return uflow(), else return *read_cur
int_type c6 = fb_01.sgetc();
int_type c7 = fb_02.sgetc();
VERIFY( c6 != c3 );
VERIFY( c7 == c4 ); // both -1
int_type c8 = fb_01.sgetc();
int_type c9 = fb_02.sgetc();
VERIFY( c6 == c8 );
VERIFY( c7 == c9 );
c5 = fb_03.sgetc();
VERIFY( c5 == traits_type::eof() );
}
main()
{
test03();
test05();
return 0;
}

View File

@ -0,0 +1,145 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <testsuite_hooks.h>
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %*.txt
// NB: This test assumes that _M_buf_size == 40, and not the usual
// buffer_size length of BUFSIZ (8192), so that overflow/underflow can be
// simulated a bit more readily.
// NRB (Nota Really Bene): setting it to 40 breaks the test, as intended.
const int buffer_size = 8192;
//const int buffer_size = 40;
const char name_01[] = "filebuf_virtuals-1.txt"; // file with data in it
const char name_02[] = "filebuf_virtuals-2.txt"; // empty file, need to create
const char name_03[] = "filebuf_virtuals-3.txt"; // empty file, need to create
class derived_filebuf: public std::filebuf
{
public:
void
set_size(int_type __size) { _M_buf_size_opt = __size; }
};
derived_filebuf fb_01; // in
derived_filebuf fb_02; // out
derived_filebuf fb_03; // in | out
// Initialize filebufs to be the same size regardless of platform.
void test03()
{
fb_01.set_size(buffer_size);
fb_02.set_size(buffer_size);
fb_03.set_size(buffer_size);
}
// Test overloaded virtual functions.
void test05()
{
using namespace std;
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
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();
strmof_1 = fb_03.in_avail();
int_type c1 = fb_01.sbumpc();
int_type c2 = fb_02.sbumpc();
int_type c3 = fb_01.sbumpc();
int_type c4 = fb_02.sbumpc();
int_type c5 = fb_03.sbumpc();
int_type c6 = fb_01.sgetc();
int_type c7 = fb_02.sgetc();
int_type c8 = fb_01.sgetc();
int_type c9 = fb_02.sgetc();
c5 = fb_03.sgetc();
// int_type snextc()
// calls sbumpc and if sbumpc != eof, return sgetc
c6 = fb_01.snextc();
c7 = fb_02.snextc();
c6 = fb_01.snextc();
c7 = fb_02.snextc();
c5 = fb_03.snextc();
// streamsize sgetn(char_type *s, streamsize n)
// streamsize xsgetn(char_type *s, streamsize n)
// assign up to n chars to s from input sequence, indexing in_cur as
// approp and returning the number of chars assigned
strmsz_1 = fb_01.in_avail();
strmsz_2 = fb_02.in_avail();
test = strmsz_1 != strmsz_2;
char carray1[13] = "";
strmsz_1 = fb_01.sgetn(carray1, 10);
char carray2[buffer_size] = "";
strmsz_2 = fb_02.sgetn(carray2, 10);
VERIFY( strmsz_1 != strmsz_2 );
VERIFY( strmsz_1 == 10 );
VERIFY( strmsz_2 == 0 );
c1 = fb_01.sgetc();
c2 = fb_02.sgetc();
VERIFY( c1 == '\n' );
VERIFY( c7 == c2 ); // n != i
strmsz_1 = fb_03.sgetn(carray1, 10);
VERIFY( !strmsz_1 ); //zero
strmsz_1 = fb_01.in_avail();
strmsz_2 = fb_01.sgetn(carray2, strmsz_1 + 5);
VERIFY( strmsz_1 == strmsz_2 - 5 );
c4 = fb_01.sgetc(); // buffer should have underflowed from above.
VERIFY( c4 == 'i' );
strmsz_1 = fb_01.in_avail();
VERIFY( strmsz_1 > 0 );
strmsz_2 = fb_01.sgetn(carray2, strmsz_1 + 5);
VERIFY( strmsz_1 == strmsz_2 ); //at the end of the actual file
strmsz_1 = fb_02.in_avail();
strmsz_2 = fb_02.sgetn(carray2, strmsz_1 + 5);
VERIFY( strmsz_1 == -1 );
VERIFY( strmsz_2 == 0 );
c4 = fb_02.sgetc(); // should be EOF
VERIFY( c4 == traits_type::eof() );
}
main()
{
test03();
test05();
return 0;
}

View File

@ -0,0 +1,46 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <testsuite_hooks.h>
const char name_01[] = "filebuf_virtuals-1.tst"; // empty file, need to create
void test06()
{
using namespace std;
bool test = true;
char buffer[] = "xxxxxxxxxx";
typedef filebuf::int_type int_type;
filebuf fbuf01;
fbuf01.open(name_01, ios_base::in);
int_type len1 = fbuf01.sgetn(buffer, sizeof(buffer));
VERIFY( len1 == sizeof(buffer) );
VERIFY( buffer[0] == '/' );
}
main()
{
test06();
return 0;
}

View File

@ -0,0 +1,116 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <testsuite_hooks.h>
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %*.txt
// NB: This test assumes that _M_buf_size == 40, and not the usual
// buffer_size length of BUFSIZ (8192), so that overflow/underflow can be
// simulated a bit more readily.
// NRB (Nota Really Bene): setting it to 40 breaks the test, as intended.
const int buffer_size = 8192;
//const int buffer_size = 40;
const char name_01[] = "filebuf_virtuals-1.txt"; // file with data in it
const char name_02[] = "filebuf_virtuals-2.txt"; // empty file, need to create
const char name_03[] = "filebuf_virtuals-3.txt"; // empty file, need to create
class derived_filebuf: public std::filebuf
{
public:
void
set_size(int_type __size) { _M_buf_size_opt = __size; }
};
derived_filebuf fb_01; // in
derived_filebuf fb_02; // out
derived_filebuf fb_03; // in | out
// Initialize filebufs to be the same size regardless of platform.
void test03()
{
fb_01.set_size(buffer_size);
fb_02.set_size(buffer_size);
fb_03.set_size(buffer_size);
}
// Test overloaded virtual functions.
void test05()
{
using namespace std;
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
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();
strmof_1 = fb_03.in_avail();
int_type c1 = fb_01.sbumpc();
int_type c2 = fb_02.sbumpc();
int_type c3 = fb_01.sbumpc();
int_type c4 = fb_02.sbumpc();
int_type c5 = fb_03.sbumpc();
int_type c6 = fb_01.sgetc();
int_type c7 = fb_02.sgetc();
int_type c8 = fb_01.sgetc();
int_type c9 = fb_02.sgetc();
c5 = fb_03.sgetc();
// int_type snextc()
// calls sbumpc and if sbumpc != eof, return sgetc
c6 = fb_01.snextc();
c7 = fb_02.snextc();
VERIFY( c6 != c8 );
VERIFY( c7 == c9 ); // -1
VERIFY( c6 == '\n' );
c6 = fb_01.snextc();
c7 = fb_02.snextc();
VERIFY( c6 != c8 );
VERIFY( c7 == c9 ); // -1
VERIFY( c6 == '9' );
c5 = fb_03.snextc();
VERIFY( c5 == traits_type::eof() );
}
main()
{
test03();
test05();
return 0;
}

View File

@ -0,0 +1,168 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <locale>
#include <testsuite_hooks.h>
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %*.txt
// NB: This test assumes that _M_buf_size == 40, and not the usual
// buffer_size length of BUFSIZ (8192), so that overflow/underflow can be
// simulated a bit more readily.
// NRB (Nota Really Bene): setting it to 40 breaks the test, as intended.
const int buffer_size = 8192;
//const int buffer_size = 40;
const char carray_01[] = "santa cruz or sandiego?";
const char carray_02[] = "memphis, new orleans, and savanah";
const char name_01[] = "filebuf_virtuals-1.txt"; // file with data in it
const char name_02[] = "filebuf_virtuals-2.txt"; // empty file, need to create
const char name_03[] = "filebuf_virtuals-3.txt"; // empty file, need to create
const char name_04[] = "filebuf_virtuals-4.txt"; // empty file, need to create
const char name_05[] = "filebuf_virtuals-5.txt"; // empty file, need to create
const char name_06[] = "filebuf_virtuals-6.txt"; // empty file, need to create
const char name_07[] = "filebuf_virtuals-7.txt"; // empty file, need to create
const char name_08[] = "filebuf_virtuals-8.txt"; // empty file, need to create
class derived_filebuf: public std::filebuf
{
public:
void
set_size(int_type __size) { _M_buf_size_opt = __size; }
};
derived_filebuf fb_01; // in
derived_filebuf fb_02; // out
derived_filebuf fb_03; // in | out
// Initialize filebufs to be the same size regardless of platform.
void test03()
{
fb_01.set_size(buffer_size);
fb_02.set_size(buffer_size);
fb_03.set_size(buffer_size);
}
// Test overloaded virtual functions.
void test05()
{
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;
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);
int_type c1 = fb_01.sbumpc();
int_type c2 = fb_02.sbumpc();
int_type c3 = fb_01.sbumpc();
int_type c4 = fb_02.sbumpc();
int_type c5 = fb_03.sbumpc();
int_type c6 = fb_01.sgetc();
int_type c7 = fb_02.sgetc();
int_type c8 = fb_01.sgetc();
int_type c9 = fb_02.sgetc();
// PUT
strmsz_1 = fb_03.sputn("racadabras", 10);//"abracadabras or what?"
strmsz_2 = fb_03.sputn(", i wanna reach out and", 10);
strmsz_1 = fb_02.sputn("racadabras", 10);
strmsz_1 = fb_01.sputn("racadabra", 10);
// PUTBACK
// int_type pbfail(int_type c)
// called when gptr() null, gptr() == eback(), or traits::eq(*gptr, c) false
// "pending sequence" is:
// 1) everything as defined in underflow
// 2) + if (traits::eq_int_type(c, traits::eof()), then input
// sequence is backed up one char before the pending sequence is
// determined.
// 3) + if (not 2) then c is prepended. Left unspecified is
// whether the input sequence is backedup or modified in any way
// returns traits::eof() for failure, unspecified other value for success
// int_type sputbackc(char_type c)
// if in_cur not avail || ! traits::eq(c, gptr() [-1]), return pbfail
// otherwise decrements in_cur and returns *gptr()
c1 = fb_03.sgetc(); // -1
c2 = fb_03.sputbackc('z');
strmsz_2 = fb_03.in_avail();
c3 = fb_03.sgetc();
VERIFY( c3 == c2 );
VERIFY( c1 != c3 );
VERIFY( 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();
fb_03.snextc();
c2 = fb_03.sputbackc('z');
strmsz_2 = fb_03.in_avail();
c3 = fb_03.sgetc();
VERIFY( c1 != c2 );
VERIFY( c3 == c2 );
VERIFY( c1 != c3 );
VERIFY( c2 == 'z' );
// VERIFY( strmsz_1 == strmsz_2 );
// test for replacing char with identical one
fb_03.snextc();
fb_03.sputc('u');
fb_03.sputc('v');
fb_03.sputc('a');
strmsz_1 = fb_03.in_avail();
c2 = fb_03.sputbackc('a');
strmsz_2 = fb_03.in_avail();
c3 = fb_03.sgetc();
VERIFY( c3 == c2 );
VERIFY( strmsz_1 + 1 == strmsz_2 );
//test for ios_base::out
c1 = fb_02.sgetc(); // undefined
c2 = fb_02.sputbackc('a');
VERIFY( c1 == c2 );
VERIFY( c1 == -1 );
}
main()
{
test03();
test05();
return 0;
}

View File

@ -0,0 +1,48 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <testsuite_hooks.h>
const char name_01[] = "filebuf_virtuals-1.txt"; // file with data in it
// libstdc++/9439, libstdc++/9425
// basic_filebuf<>::pbackfail calls basic_filebuf<>::seekoff, but
// fails to check the return value
void test09()
{
using namespace std;
bool test = true;
filebuf fbuf;
fbuf.open(name_01, ios_base::in);
filebuf::int_type r = fbuf.sputbackc('a');
fbuf.close();
VERIFY( r == filebuf::traits_type::eof() );
}
main()
{
test09();
return 0;
}

View File

@ -0,0 +1,137 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <locale>
#include <testsuite_hooks.h>
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %*.txt
// NB: This test assumes that _M_buf_size == 40, and not the usual
// buffer_size length of BUFSIZ (8192), so that overflow/underflow can be
// simulated a bit more readily.
// NRB (Nota Really Bene): setting it to 40 breaks the test, as intended.
const int buffer_size = 8192;
//const int buffer_size = 40;
const char carray_01[] = "santa cruz or sandiego?";
const char carray_02[] = "memphis, new orleans, and savanah";
const char name_01[] = "filebuf_virtuals-1.txt"; // file with data in it
const char name_02[] = "filebuf_virtuals-2.txt"; // empty file, need to create
const char name_03[] = "filebuf_virtuals-3.txt"; // empty file, need to create
const char name_04[] = "filebuf_virtuals-4.txt"; // empty file, need to create
const char name_05[] = "filebuf_virtuals-5.txt"; // empty file, need to create
const char name_06[] = "filebuf_virtuals-6.txt"; // empty file, need to create
const char name_07[] = "filebuf_virtuals-7.txt"; // empty file, need to create
const char name_08[] = "filebuf_virtuals-8.txt"; // empty file, need to create
class derived_filebuf: public std::filebuf
{
public:
void
set_size(int_type __size) { _M_buf_size_opt = __size; }
};
derived_filebuf fb_01; // in
derived_filebuf fb_02; // out
derived_filebuf fb_03; // in | out
// Initialize filebufs to be the same size regardless of platform.
void test03()
{
fb_01.set_size(buffer_size);
fb_02.set_size(buffer_size);
fb_03.set_size(buffer_size);
}
// Test overloaded virtual functions.
void test05()
{
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;
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);
int_type c1 = fb_01.sbumpc();
int_type c2 = fb_02.sbumpc();
int_type c3 = fb_01.sbumpc();
int_type c4 = fb_02.sbumpc();
int_type c5 = fb_03.sbumpc();
int_type c6 = fb_01.sgetc();
int_type c7 = fb_02.sgetc();
int_type c8 = fb_01.sgetc();
int_type c9 = fb_02.sgetc();
// PUT
// int_type sputc(char_type c)
// if out_cur not avail, return overflow(traits_type::to_int_type(c))
// else, stores c at out_cur,
// increments out_cur, and returns c as int_type
// strmsz_1 = fb_03.in_avail(); // XXX valid for in|out??
c1 = fb_02.sputc('a');
c2 = fb_03.sputc('b');
VERIFY( c1 != c2 );
c1 = fb_02.sputc('c');
c2 = fb_03.sputc('d');
VERIFY( c1 != c2 );
// strmsz_2 = fb_03.in_avail();
// VERIFY( strmsz_1 != strmsz_2 );
for (int i = 50; i <= 90; ++i)
c2 = fb_02.sputc(char(i));
// 27filebuf-2.txt == ac23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX
// fb_02._M_out_cur = '2'
strmsz_1 = fb_03.in_avail();
for (int i = 50; i <= 90; ++i)
c2 = fb_03.sputc(char(i));
strmsz_2 = fb_03.in_avail();
// VERIFY( strmsz_1 != strmsz_2 );
// VERIFY( strmsz_1 > 0 );
// VERIFY( strmsz_2 > 0 );
// 27filebuf-2.txt == bd23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX
// fb_02._M_out_cur = '2'
c3 = fb_01.sputc('a'); // should be EOF because this is read-only
VERIFY( c3 == traits_type::eof() );
}
main()
{
test03();
test05();
return 0;
}

View File

@ -0,0 +1,61 @@
// 1999-10-11 bkoz
// Copyright (C) 1999, 2000, 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// 27.5.2 template class basic_streambuf
#include <string>
#include <fstream>
#include <testsuite_hooks.h>
class nullsetpbuf : public std::filebuf
{
char foo[64];
public:
nullsetpbuf()
{
setp(foo, foo + 64);
setp(NULL, NULL);
}
};
// libstdc++/1057
void test05()
{
std::string text1 = "abcdefghijklmn";
nullsetpbuf nsp;
// Immediate crash as sputc writes to null pointer
nsp.sputc('a');
}
int main()
{
test05();
return 0;
}

View File

@ -0,0 +1,71 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <testsuite_hooks.h>
const char name_05[] = "filebuf_virtuals-5.txt"; // empty file, need to create
bool over_called;
class Derived_filebuf : public std::filebuf
{
public:
int_type overflow(int_type c)
{
over_called = true;
return std::filebuf::overflow(c);
}
const char_type* pub_epptr() const
{ return epptr(); }
const char_type* pub_pptr() const
{ return pptr(); }
};
// libstdc++/9701 (partial)
void test11()
{
bool test = true;
bool over_expected;
// sputc
Derived_filebuf dfbuf_01;
dfbuf_01.open(name_05, std::ios_base::out);
over_called = false;
dfbuf_01.sputc('i');
VERIFY( !over_called );
over_expected = dfbuf_01.pub_epptr() == dfbuf_01.pub_pptr();
over_called = false;
dfbuf_01.sputc('v');
VERIFY( (!over_expected && !over_called)
|| (over_expected && over_called) );
dfbuf_01.close();
}
main()
{
test11();
return 0;
}

View File

@ -0,0 +1,125 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <locale>
#include <testsuite_hooks.h>
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %*.txt
// NB: This test assumes that _M_buf_size == 40, and not the usual
// buffer_size length of BUFSIZ (8192), so that overflow/underflow can be
// simulated a bit more readily.
// NRB (Nota Really Bene): setting it to 40 breaks the test, as intended.
const int buffer_size = 8192;
//const int buffer_size = 40;
const char carray_01[] = "santa cruz or sandiego?";
const char carray_02[] = "memphis, new orleans, and savanah";
const char name_01[] = "filebuf_virtuals-1.txt"; // file with data in it
const char name_02[] = "filebuf_virtuals-2.txt"; // empty file, need to create
const char name_03[] = "filebuf_virtuals-3.txt"; // empty file, need to create
const char name_04[] = "filebuf_virtuals-4.txt"; // empty file, need to create
const char name_05[] = "filebuf_virtuals-5.txt"; // empty file, need to create
const char name_06[] = "filebuf_virtuals-6.txt"; // empty file, need to create
const char name_07[] = "filebuf_virtuals-7.txt"; // empty file, need to create
const char name_08[] = "filebuf_virtuals-8.txt"; // empty file, need to create
class derived_filebuf: public std::filebuf
{
public:
void
set_size(int_type __size) { _M_buf_size_opt = __size; }
};
derived_filebuf fb_01; // in
derived_filebuf fb_02; // out
derived_filebuf fb_03; // in | out
// Initialize filebufs to be the same size regardless of platform.
void test03()
{
fb_01.set_size(buffer_size);
fb_02.set_size(buffer_size);
fb_03.set_size(buffer_size);
}
// Test overloaded virtual functions.
void test05()
{
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;
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);
int_type c1 = fb_01.sbumpc();
int_type c2 = fb_02.sbumpc();
int_type c3 = fb_01.sbumpc();
int_type c4 = fb_02.sbumpc();
int_type c5 = fb_03.sbumpc();
int_type c6 = fb_01.sgetc();
int_type c7 = fb_02.sgetc();
int_type c8 = fb_01.sgetc();
int_type c9 = fb_02.sgetc();
// PUT
// streamsize sputn(const char_typs* s, streamsize n)
// write up to n chars to out_cur from s, returning number assigned
// NB *sputn will happily put '\0' into your stream if you give it a chance*
strmsz_1 = fb_03.sputn("racadabras", 10);//"abracadabras or what?"
VERIFY( strmsz_1 == 10 );
strmsz_2 = fb_03.sputn(", i wanna reach out and", 10);
VERIFY( strmsz_2 == 10 );
VERIFY( strmsz_1 == strmsz_2 );
// fb_03._M_out_beg = "YZracadabras, i wanna FGHIJKLMNOPQRSTUVW"
// fb_03._M_out_cur = "FGHIJKLMNOPQRSTUVW"
strmsz_1 = fb_02.sputn("racadabras", 10);
VERIFY( strmsz_1 == 10 );
// fb_02._M_out_beg = "YZracadabras<=>?@ABCDEFGHIJKLMNOPQRSTUVW"
// fb_02._M_out_cur = "<=>?@ABCDEFGHIJKLMNOPQRSTUVW"
strmsz_1 = fb_01.sputn("racadabra", 10);
VERIFY( strmsz_1 == 0 );
}
main()
{
test03();
test05();
return 0;
}

View File

@ -0,0 +1,61 @@
// 1999-10-11 bkoz
// Copyright (C) 1999, 2000, 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// 27.5.2 template class basic_streambuf
#include <string>
#include <fstream>
#include <testsuite_hooks.h>
class nullsetpbuf : public std::filebuf
{
char foo[64];
public:
nullsetpbuf()
{
setp(foo, foo + 64);
setp(NULL, NULL);
}
};
// libstdc++/1057
void test05()
{
std::string text1 = "abcdefghijklmn";
nullsetpbuf nsp;
// Immediate crash as xsputn writes to null pointer
nsp.sputn(text1.c_str(), text1.length());
}
int main()
{
test05();
return 0;
}

View File

@ -0,0 +1,75 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <testsuite_hooks.h>
const char name_05[] = "filebuf_virtuals-5.txt"; // empty file, need to create
bool over_called;
class Derived_filebuf : public std::filebuf
{
public:
int_type overflow(int_type c)
{
over_called = true;
return std::filebuf::overflow(c);
}
const char_type* pub_epptr() const
{
return epptr();
}
const char_type* pub_pptr() const
{
return pptr();
}
};
// libstdc++/9701 (partial)
void test11()
{
bool test = true;
bool over_expected;
// sputn
Derived_filebuf dfbuf_02;
dfbuf_02.open(name_05, std::ios_base::out);
over_called = false;
dfbuf_02.sputn("sonne's", 7);
VERIFY( !over_called );
over_expected = dfbuf_02.pub_epptr() == dfbuf_02.pub_pptr();
over_called = false;
dfbuf_02.sputn(" peak", 5);
VERIFY( (!over_expected && !over_called)
|| (over_expected && over_called) );
dfbuf_02.close();
}
main()
{
test11();
return 0;
}

View File

@ -0,0 +1,191 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <locale>
#include <testsuite_hooks.h>
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %*.txt
// NB: This test assumes that _M_buf_size == 40, and not the usual
// buffer_size length of BUFSIZ (8192), so that overflow/underflow can be
// simulated a bit more readily.
// NRB (Nota Really Bene): setting it to 40 breaks the test, as intended.
const int buffer_size = 8192;
//const int buffer_size = 40;
const char carray_01[] = "santa cruz or sandiego?";
const char carray_02[] = "memphis, new orleans, and savanah";
const char name_01[] = "filebuf_virtuals-1.txt"; // file with data in it
const char name_02[] = "filebuf_virtuals-2.txt"; // empty file, need to create
const char name_03[] = "filebuf_virtuals-3.txt"; // empty file, need to create
const char name_04[] = "filebuf_virtuals-4.txt"; // empty file, need to create
const char name_05[] = "filebuf_virtuals-5.txt"; // empty file, need to create
const char name_06[] = "filebuf_virtuals-6.txt"; // empty file, need to create
const char name_07[] = "filebuf_virtuals-7.txt"; // empty file, need to create
const char name_08[] = "filebuf_virtuals-8.txt"; // empty file, need to create
class derived_filebuf: public std::filebuf
{
public:
void
set_size(int_type __size) { _M_buf_size_opt = __size; }
};
derived_filebuf fb_01; // in
derived_filebuf fb_02; // out
derived_filebuf fb_03; // in | out
// Initialize filebufs to be the same size regardless of platform.
void test03()
{
fb_01.set_size(buffer_size);
fb_02.set_size(buffer_size);
fb_03.set_size(buffer_size);
}
// Test overloaded virtual functions.
void test05()
{
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;
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);
int_type c1 = fb_01.sbumpc();
int_type c2 = fb_02.sbumpc();
int_type c3 = fb_01.sbumpc();
int_type c4 = fb_02.sbumpc();
int_type c5 = fb_03.sbumpc();
int_type c6 = fb_01.sgetc();
int_type c7 = fb_02.sgetc();
int_type c8 = fb_01.sgetc();
int_type c9 = fb_02.sgetc();
// PUT
strmsz_1 = fb_03.sputn("racadabras", 10);//"abracadabras or what?"
strmsz_2 = fb_03.sputn(", i wanna reach out and", 10);
strmsz_1 = fb_02.sputn("racadabras", 10);
strmsz_1 = fb_01.sputn("racadabra", 10);
// PUTBACK
// int_type pbfail(int_type c)
// called when gptr() null, gptr() == eback(), or traits::eq(*gptr, c) false
// "pending sequence" is:
// 1) everything as defined in underflow
// 2) + if (traits::eq_int_type(c, traits::eof()), then input
// sequence is backed up one char before the pending sequence is
// determined.
// 3) + if (not 2) then c is prepended. Left unspecified is
// whether the input sequence is backedup or modified in any way
// returns traits::eof() for failure, unspecified other value for success
// int_type sputbackc(char_type c)
// if in_cur not avail || ! traits::eq(c, gptr() [-1]), return pbfail
// otherwise decrements in_cur and returns *gptr()
c1 = fb_03.sgetc(); // -1
c2 = fb_03.sputbackc('z');
strmsz_2 = fb_03.in_avail();
c3 = fb_03.sgetc();
//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();
fb_03.snextc();
c2 = fb_03.sputbackc('z');
strmsz_2 = fb_03.in_avail();
c3 = fb_03.sgetc();
fb_03.snextc();
fb_03.sputc('u');
fb_03.sputc('v');
fb_03.sputc('a');
strmsz_1 = fb_03.in_avail();
c2 = fb_03.sputbackc('a');
strmsz_2 = fb_03.in_avail();
c3 = fb_03.sgetc();
//test for ios_base::out
c1 = fb_02.sgetc(); // undefined
c2 = fb_02.sputbackc('a');
// int_type sungetc()
// if in_cur not avail, return pbackfail(), else decrement and
// return to_int_type(*gptr())
// fb_03._M_out_beg = "uvaacadabras, i wannaZ[\\]^_`abcdefghijkl"
// fb_03._M_out_cur = "aacadabras, i wannaZ[\\]^_`abcdefghijkl"
strmsz_1 = fb_03.in_avail();
c2 = fb_03.sungetc(); // delete the 'a'
strmsz_2 = fb_03.in_avail();
VERIFY( c2 == 'v' ); // VERIFY( c2 != traits_type::eof() );
VERIFY( strmsz_1 + 1 == strmsz_2 );
//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);
c1 = fb_02.sgetc();
strmsz_1 = fb_02.in_avail();
c2 = fb_02.sungetc();
c3 = fb_02.sgetc();
strmsz_2 = fb_02.in_avail();
VERIFY( c1 == c2 );
VERIFY( c2 == c3 );
VERIFY( c1 == traits_type::eof() );
VERIFY( strmsz_1 == strmsz_2 );
//test for _in_cur == _in_end
fb_03.pubseekoff(0, std::ios_base::end);
strmsz_1 = fb_03.in_avail(); // -1 cuz at the end
c1 = fb_03.sgetc();
c2 = fb_03.sungetc();
strmsz_2 = fb_03.in_avail(); // 1
c3 = fb_03.sgetc();
VERIFY( c1 != c2 );
// VERIFY( c2 == c3 || c2 == traits_type::not_eof(int(c3)) );
VERIFY( strmsz_2 != strmsz_1 );
VERIFY( strmsz_2 == 1 );
//test for ios_base::out
}
main()
{
test03();
test05();
return 0;
}

View File

@ -0,0 +1,112 @@
// 1999-10-11 bkoz
// Copyright (C) 1999, 2000, 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// 27.5.2 template class basic_streambuf
#include <fstream>
#include <testsuite_hooks.h>
class setpbuf : public std::filebuf
{
char buffer[4];
std::string result;
public:
std::string&
get_result()
{ return result; }
setpbuf()
{
this->open("tmp_1057", std::ios_base::out | std::ios_base::trunc);
char foo [32];
setp(foo, foo + 32);
setp(buffer, buffer + 4);
}
~setpbuf()
{
sync();
close();
}
virtual int_type
overflow(int_type n)
{
if (sync() != 0)
return traits_type::eof();
result += traits_type::to_char_type(n);
return n;
}
virtual int
sync()
{
result.append(pbase(), pptr());
setp(buffer, buffer + 4);
return 0;
}
};
// libstdc++/1057
void test04()
{
bool test = true;
std::string text = "abcdefghijklmn";
// 01
setpbuf sp1;
// Here xsputn writes over sp1.result
sp1.sputn(text.c_str(), text.length());
// This crashes when result is accessed
sp1.pubsync();
VERIFY( sp1.get_result() == text );
// 02
setpbuf sp2;
for (std::string::size_type i = 0; i < text.length(); ++i)
{
// sputc also writes over result
sp2.sputc(text[i]);
}
// Crash here
sp2.pubsync();
VERIFY( sp2.get_result() == text );
}
int main()
{
test04();
return 0;
}

View File

@ -0,0 +1,72 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <locale>
#include <testsuite_hooks.h>
const char name_07[] = "filebuf_virtuals-7.txt"; // empty file, need to create
class errorcvt : public std::codecvt<char, char, mbstate_t>
{
protected:
std::codecvt_base::result
do_out(mbstate_t&, const char* from, const char*,
const char*& from_next, char* to, char*,
char*& to_next) const
{
from_next = from;
to_next = to;
return std::codecvt<char, char, mbstate_t>::error;
}
virtual bool do_always_noconv() const throw()
{
return false;
}
};
// libstdc++/9182
// basic_filebuf<>::sync and overflow do not write out any characters
// if codecvt<>::out returns error
void test13()
{
using namespace std;
bool test = true;
locale loc = locale::classic();
loc = locale(loc, new errorcvt);
filebuf fbuf1;
fbuf1.pubimbue(loc);
fbuf1.open(name_07, ios_base::out | ios_base::trunc);
fbuf1.sputn("ison", 4);
int r = fbuf1.pubsync();
VERIFY( r == -1 );
fbuf1.close();
}
main()
{
test13();
return 0;
}

View File

@ -0,0 +1,101 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.4 Overridden virtual functions
#include <fstream>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <testsuite_hooks.h>
class UnderBuf : public std::filebuf
{
public:
int_type
pub_underflow()
{ return underflow(); }
std::streamsize
pub_showmanyc()
{ return showmanyc(); }
};
// libstdc++/10097
// filebuf::underflow drops characters.
void test16()
{
using namespace std;
bool test = true;
const char* name = "tmp_fifo1";
signal(SIGPIPE, SIG_IGN);
unlink(name);
if (0 != mkfifo(name, S_IRWXU))
{
VERIFY( false );
}
int fval = fork();
if (fval == -1)
{
unlink(name);
VERIFY( false );
}
else if (fval == 0)
{
filebuf fbout;
fbout.open(name, ios_base::out);
fbout.sputn("0123456789", 10);
fbout.pubsync();
sleep(2);
fbout.close();
exit(0);
}
UnderBuf fb;
fb.open(name, ios_base::in);
sleep(1);
fb.sgetc();
streamsize n = fb.pub_showmanyc();
while (n > 0)
{
--n;
UnderBuf::int_type c = fb.pub_underflow();
VERIFY( c != UnderBuf::traits_type::eof() );
fb.sbumpc();
}
fb.close();
}
main()
{
test16();
return 0;
}

View File

@ -46,18 +46,3 @@ void test01()
typedef test_type::pos_type pos_type;
typedef test_type::off_type off_type;
}
namespace test
{
using namespace std;
using __gnu_cxx_test::pod_char;
typedef short type_t;
template class basic_fstream<type_t, char_traits<type_t> >;
template class basic_fstream<pod_char, char_traits<pod_char> >;
} // test
int main()
{
test01();
return 0;
}

View File

@ -0,0 +1,46 @@
// 2002-07-25 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// 27.8.1.11 - Template class basic_fstream
// NB: This file is for testing basic_fstream with NO OTHER INCLUDES.
#include <fstream>
#include <testsuite_hooks.h>
// { dg-do compile }
namespace test
{
using namespace std;
using __gnu_cxx_test::pod_char;
typedef short type_t;
template class basic_fstream<type_t, char_traits<type_t> >;
template class basic_fstream<pod_char, char_traits<pod_char> >;
} // test

View File

@ -0,0 +1,149 @@
// 1999-01-17 bkoz test functionality of basic_filebuf for char_type == char
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.1 - Template class basic_filebuf
// NB: This file is for testing basic_filebuf with NO OTHER INCLUDES.
#include <fstream>
#include <testsuite_hooks.h>
// { dg-do compile }
// libstdc++/2020
// should be able to use custom char_type, custom traits type
class gnu_char_type
{
unsigned long character;
public:
// operator ==
bool
operator==(const gnu_char_type& __lhs)
{ return character == __lhs.character; }
// operator <
bool
operator<(const gnu_char_type& __lhs)
{ return character < __lhs.character; }
// default ctor
gnu_char_type() { }
// to_char_type
gnu_char_type(const unsigned long& __l) : character(__l) { }
// to_int_type
operator unsigned long() const { return character; }
};
// char_traits specialization
struct gnu_char_traits
{
typedef gnu_char_type char_type;
typedef long int_type;
typedef long pos_type;
typedef unsigned long off_type;
typedef long state_type;
static void
assign(char_type& __c1, const char_type& __c2) { }
static bool
eq(const char_type& __c1, const char_type& __c2) { return true; }
static bool
lt(const char_type& __c1, const char_type& __c2) { return true; }
static int
compare(const char_type* __s1, const char_type* __s2, size_t __n)
{ return 0; }
static size_t
length(const char_type* __s) { return 0; }
static const char_type*
find(const char_type* __s, size_t __n, const char_type& __a)
{ return __s; }
static char_type*
move(char_type* __s1, const char_type* __s2, size_t __n)
{ return __s1; }
static char_type*
copy(char_type* __s1, const char_type* __s2, size_t __n)
{ return __s1; }
static char_type*
assign(char_type* __s, size_t __n, char_type __a)
{ return __s; }
static char_type
to_char_type(const int_type& __c)
{ return char_type(); }
static int_type
to_int_type(const char_type& __c)
{ return int_type(); }
static bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return true; }
static int_type
eof()
{ return int_type(); }
static int_type
not_eof(const int_type& __c)
{ return int_type(); }
};
void test07()
{
bool test = true;
typedef std::basic_fstream<gnu_char_type, gnu_char_traits> gnu_fstr;
try
{
gnu_fstr obj;
}
catch(std::exception& obj)
{
test = false;
VERIFY( test );
}
}
#if !__GXX_WEAK__
// Explicitly instantiate for systems with no COMDAT or weak support.
template
std::basic_streambuf<gnu_char_type>::int_type
std::basic_streambuf<gnu_char_type>::_S_pback_size;
#endif
int main()
{
test07();
return 0;
}
// more surf!!!

View File

@ -0,0 +1,50 @@
// 2003-03-26 B enjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.1 - Template class basic_filebuf
#include <iostream>
#include <fstream>
void test01()
{
// Check for required base class.
typedef std::fstream test_type;
typedef std::iostream base_type;
const test_type& obj = test_type();
const base_type* base = &obj;
}
int main()
{
test01();
return 0;
}
// more surf!!!

View File

@ -45,16 +45,3 @@ void test01()
typedef test_type::pos_type pos_type;
typedef test_type::off_type off_type;
}
namespace test
{
using namespace std;
typedef short type_t;
template class basic_ifstream<type_t, char_traits<type_t> >;
} // test
int main()
{
test01();
return 0;
}

View File

@ -0,0 +1,42 @@
// 2002-07-25 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2002 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// 27.8.1.5 - Template class basic_ifstream
// NB: This file is for testing basic_ifstream with NO OTHER INCLUDES.
#include <fstream>
// { dg-do compile }
namespace test
{
using namespace std;
typedef short type_t;
template class basic_ifstream<type_t, char_traits<type_t> >;
} // test

View File

@ -0,0 +1,149 @@
// 1999-01-17 bkoz test functionality of basic_filebuf for char_type == char
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.1 - Template class basic_filebuf
// NB: This file is for testing basic_filebuf with NO OTHER INCLUDES.
#include <fstream>
#include <testsuite_hooks.h>
// { dg-do compile }
// libstdc++/2020
// should be able to use custom char_type, custom traits type
class gnu_char_type
{
unsigned long character;
public:
// operator ==
bool
operator==(const gnu_char_type& __lhs)
{ return character == __lhs.character; }
// operator <
bool
operator<(const gnu_char_type& __lhs)
{ return character < __lhs.character; }
// default ctor
gnu_char_type() { }
// to_char_type
gnu_char_type(const unsigned long& __l) : character(__l) { }
// to_int_type
operator unsigned long() const { return character; }
};
// char_traits specialization
struct gnu_char_traits
{
typedef gnu_char_type char_type;
typedef long int_type;
typedef long pos_type;
typedef unsigned long off_type;
typedef long state_type;
static void
assign(char_type& __c1, const char_type& __c2) { }
static bool
eq(const char_type& __c1, const char_type& __c2) { return true; }
static bool
lt(const char_type& __c1, const char_type& __c2) { return true; }
static int
compare(const char_type* __s1, const char_type* __s2, size_t __n)
{ return 0; }
static size_t
length(const char_type* __s) { return 0; }
static const char_type*
find(const char_type* __s, size_t __n, const char_type& __a)
{ return __s; }
static char_type*
move(char_type* __s1, const char_type* __s2, size_t __n)
{ return __s1; }
static char_type*
copy(char_type* __s1, const char_type* __s2, size_t __n)
{ return __s1; }
static char_type*
assign(char_type* __s, size_t __n, char_type __a)
{ return __s; }
static char_type
to_char_type(const int_type& __c)
{ return char_type(); }
static int_type
to_int_type(const char_type& __c)
{ return int_type(); }
static bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return true; }
static int_type
eof()
{ return int_type(); }
static int_type
not_eof(const int_type& __c)
{ return int_type(); }
};
void test07()
{
bool test = true;
typedef std::basic_ifstream<gnu_char_type, gnu_char_traits> gnu_ifstr;
try
{
gnu_ifstr obj;
}
catch(std::exception& obj)
{
test = false;
VERIFY( test );
}
}
#if !__GXX_WEAK__
// Explicitly instantiate for systems with no COMDAT or weak support.
template
std::basic_streambuf<gnu_char_type>::int_type
std::basic_streambuf<gnu_char_type>::_S_pback_size;
#endif
int main()
{
test07();
return 0;
}
// more surf!!!

View File

@ -0,0 +1,50 @@
// 2003-03-26 B enjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.1 - Template class basic_filebuf
#include <istream>
#include <fstream>
void test01()
{
// Check for required base class.
typedef std::ifstream test_type;
typedef std::istream base_type;
const test_type& obj = test_type();
const base_type* base = &obj;
}
int main()
{
test01();
return 0;
}
// more surf!!!

View File

@ -0,0 +1,49 @@
// Copyright (C) 2000, 2001, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.7 ifstream member functions
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %-*.txt
#include <istream>
#include <fstream>
#include <testsuite_hooks.h>
const char name_01[] = "ifstream_members-1.tst";
// http://gcc.gnu.org/ml/libstdc++/2000-07/msg00004.html
void test02()
{
bool test = true;
const int more_than_max_open_files = 8200;
for (int i = 0; ++i < more_than_max_open_files;)
{
std::ifstream ifs(name_01);
VERIFY( static_cast<bool>(ifs) );
}
}
int main()
{
test02();
return 0;
}

View File

@ -0,0 +1,57 @@
// Copyright (C) 2000, 2001, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.7 ifstream member functions
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %-*.txt
#include <istream>
#include <fstream>
#include <testsuite_hooks.h>
const char name_01[] = "ifstream_members-1.tst";
// http://gcc.gnu.org/ml/libstdc++/2000-06/msg00136.html
void test01()
{
bool test = true;
std::ifstream ifs1;
ifs1.close();
// false as expected:
VERIFY( !ifs1.is_open() );
// this is now true:
VERIFY( !(ifs1) );
ifs1.open(name_01);
VERIFY( ifs1.is_open() );
// fail bit still true
VERIFY( !(ifs1) );
VERIFY( ifs1.rdstate() == std::ios_base::failbit );
ifs1.close();
}
int main()
{
test01();
return 0;
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2000, 2001 Free Software Foundation, Inc.
// Copyright (C) 2000, 2001, 2003 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
@ -27,52 +27,6 @@
const char name_01[] = "ifstream_members-1.tst";
const char name_02[] = "ifstream_members-1.txt";
// http://gcc.gnu.org/ml/libstdc++/2000-06/msg00136.html
bool test00()
{
bool test = true;
std::ifstream ifs1;
ifs1.close();
// false as expected:
VERIFY( !ifs1.is_open() );
// this is now true:
VERIFY( !(ifs1) );
ifs1.open(name_01);
VERIFY( ifs1.is_open() );
// fail bit still true
VERIFY( !(ifs1) );
VERIFY( ifs1.rdstate() == std::ios_base::failbit );
ifs1.close();
#ifdef DEBUG_ASSERT
assert(test);
#endif
return test;
}
// http://gcc.gnu.org/ml/libstdc++/2000-07/msg00004.html
bool test01()
{
bool test = true;
const int more_than_max_open_files = 8200;
for(int i = 0; ++i < more_than_max_open_files;)
{
std::ifstream ifs(name_01);
VERIFY( static_cast<bool>(ifs) );
}
#ifdef DEBUG_ASSERT
assert(test);
#endif
return test;
}
void
redirect_buffer(std::ios& stream, std::streambuf* new_buf)
{ stream.rdbuf(new_buf); }
@ -82,7 +36,7 @@ active_buffer(std::ios& stream)
{ return stream.rdbuf(); }
// libstdc++/2832
void test02()
void test03()
{
bool test = true;
const char* strlit01 = "fuck war";
@ -112,10 +66,7 @@ void test02()
int main()
{
test00();
test01();
test02();
test03();
return 0;
}

View File

@ -45,16 +45,3 @@ void test01()
typedef test_type::pos_type pos_type;
typedef test_type::off_type off_type;
}
namespace test
{
using namespace std;
typedef short type_t;
template class basic_ios<type_t, char_traits<type_t> >;
} // test
int main()
{
test01();
return 0;
}

View File

@ -0,0 +1,42 @@
// 2002-07-25 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2002 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// 27.4.4 - Template class basic_ios
// NB: This file is for testing basic_ios with NO OTHER INCLUDES.
#include <ios>
// { dg-do compile }
namespace test
{
using namespace std;
typedef short type_t;
template class basic_ios<type_t, char_traits<type_t> >;
} // test

View File

@ -0,0 +1,147 @@
// 1999-01-17 bkoz test functionality of basic_filebuf for char_type == char
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.1 - Template class basic_filebuf
// NB: This file is for testing basic_filebuf with NO OTHER INCLUDES.
#include <ios>
#include <testsuite_hooks.h>
// libstdc++/2020
// should be able to use custom char_type, custom traits type
class gnu_char_type
{
unsigned long character;
public:
// operator ==
bool
operator==(const gnu_char_type& __lhs)
{ return character == __lhs.character; }
// operator <
bool
operator<(const gnu_char_type& __lhs)
{ return character < __lhs.character; }
// default ctor
gnu_char_type() { }
// to_char_type
gnu_char_type(const unsigned long& __l) : character(__l) { }
// to_int_type
operator unsigned long() const { return character; }
};
// char_traits specialization
struct gnu_char_traits
{
typedef gnu_char_type char_type;
typedef long int_type;
typedef long pos_type;
typedef unsigned long off_type;
typedef long state_type;
static void
assign(char_type& __c1, const char_type& __c2) { }
static bool
eq(const char_type& __c1, const char_type& __c2) { return true; }
static bool
lt(const char_type& __c1, const char_type& __c2) { return true; }
static int
compare(const char_type* __s1, const char_type* __s2, size_t __n)
{ return 0; }
static size_t
length(const char_type* __s) { return 0; }
static const char_type*
find(const char_type* __s, size_t __n, const char_type& __a)
{ return __s; }
static char_type*
move(char_type* __s1, const char_type* __s2, size_t __n)
{ return __s1; }
static char_type*
copy(char_type* __s1, const char_type* __s2, size_t __n)
{ return __s1; }
static char_type*
assign(char_type* __s, size_t __n, char_type __a)
{ return __s; }
static char_type
to_char_type(const int_type& __c)
{ return char_type(); }
static int_type
to_int_type(const char_type& __c)
{ return int_type(); }
static bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return true; }
static int_type
eof()
{ return int_type(); }
static int_type
not_eof(const int_type& __c)
{ return int_type(); }
};
class gnu_ios: public std::basic_ios<gnu_char_type, gnu_char_traits>
{ };
void test07()
{
bool test = true;
try
{ gnu_ios obj; }
catch(std::exception& obj)
{
test = false;
VERIFY( test );
}
}
#if !__GXX_WEAK__
// Explicitly instantiate for systems with no COMDAT or weak support.
template
std::basic_streambuf<gnu_char_type>::int_type
std::basic_streambuf<gnu_char_type>::_S_pback_size;
#endif
int main()
{
test07();
return 0;
}
// more surf!!!

View File

@ -0,0 +1,52 @@
// 2003-03-26 B enjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.1 - Template class basic_filebuf
#include <ios>
#include <sstream>
void test01()
{
// Check for required base class.
typedef std::ios test_type;
typedef std::ios_base base_type;
std::stringbuf buf;
const test_type& obj = test_type(&buf);
const base_type* base = &obj;
}
int main()
{
test01();
return 0;
}
// more surf!!!

View File

@ -0,0 +1,81 @@
// 1999-09-20 bkoz
// Copyright (C) 1999, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// 27.4.4.2 basic_ios member functions
// NB: Don't include any other headers in this file.
#include <ios>
#include <testsuite_hooks.h>
// 27.4.4.3 basic_ios iostate flags function
void test01()
{
bool test = true;
typedef std::ios_base::fmtflags fmtflags;
typedef std::ios_base::iostate iostate;
using std::ios_base;
iostate iostate02, iostate03;
const iostate iostate01 = std::ios_base::badbit | std::ios_base::eofbit;
const iostate iostate04 = std::ios_base::badbit;
std::ios ios_01(NULL);
std::ios::char_type ct01;
std::ios::char_type ct02('x');;
// bool fail() const
VERIFY( ios_01.fail() );
// bool operator!() const
VERIFY( !ios_01 );
// iostate rdstate() const
iostate03 = ios_01.rdstate();
VERIFY( static_cast<bool>(iostate03 & std::ios_base::badbit) );
// void clear(iostate state = goodbit)
try {
ios_01.clear(std::ios_base::eofbit);
iostate02 = ios_01.rdstate();
VERIFY( static_cast<bool>(iostate02 & iostate01) );
}
catch(std::ios_base::failure& fail) {
VERIFY( false );
}
catch(...) {
VERIFY( false );
}
}
int main()
{
test01();
return 0;
}

View File

@ -1,6 +1,6 @@
// 1999-07-23 bkoz
// Copyright (C) 1999 Free Software Foundation, Inc.
// Copyright (C) 1999, 2003 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
@ -79,13 +79,10 @@ void test01()
VERIFY( ios_01.precision() == 6 );
VERIFY( ios_01.fill() == ios_01.widen(' ') );
VERIFY( ios_01.getloc() == glocale );
#ifdef DEBUG_ASSERT
assert(test);
#endif
}
int main() {
int main()
{
test01();
return 0;
}

View File

@ -0,0 +1,61 @@
// 2001-06-05 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// 27.4.2.1.6 class ios_base::init
#include <ios>
#include <testsuite_hooks.h>
// Non-required instantiations don't have the required facets inbued,
// by default, into the locale object.
// See 27.4.4.1
class gnu_ios: public std::basic_ios<char> { };
void test01()
{
bool test = true;
// 01: Doesn't call basic_ios::init, which uses ctype<char_type>..
// This should be unambiguously correct.
try
{
gnu_ios gios;
}
catch(...)
{
test = false;
}
VERIFY( test );
}
int main()
{
test01();
return 0;
}

View File

@ -1,6 +1,6 @@
// 2001-06-05 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003 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
@ -29,9 +29,7 @@
// 27.4.2.1.6 class ios_base::init
#include <fstream>
#include <sstream>
#include <iostream>
#include <testsuite_hooks.h>
// char_traits specialization
@ -115,163 +113,20 @@ namespace std
static int_type
eof() { return static_cast<int_type>(-1); }
static int_type
not_eof(const int_type& __c)
{ return eq_int_type(__c, eof()) ? int_type(0) : __c; }
};
template<>
struct char_traits<unsigned char>
{
typedef unsigned char char_type;
// Unsigned as wint_t in unsigned.
typedef unsigned long int_type;
typedef streampos pos_type;
typedef streamoff off_type;
typedef mbstate_t state_type;
static void
assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; }
static bool
eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; }
static bool
lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; }
static int
compare(const char_type* __s1, const char_type* __s2, size_t __n)
{
for (size_t __i = 0; __i < __n; ++__i)
if (!eq(__s1[__i], __s2[__i]))
return lt(__s1[__i], __s2[__i]) ? -1 : 1;
return 0;
}
static size_t
length(const char_type* __s)
{
const char_type* __p = __s;
while (__p && *__p)
++__p;
return (__p - __s);
}
static const char_type*
find(const char_type* __s, size_t __n, const char_type& __a)
{
for (const char_type* __p = __s; size_t(__p - __s) < __n; ++__p)
if (*__p == __a) return __p;
return 0;
}
static char_type*
move(char_type* __s1, const char_type* __s2, size_t __n)
{ return (char_type*) memmove(__s1, __s2, __n * sizeof(char_type)); }
static char_type*
copy(char_type* __s1, const char_type* __s2, size_t __n)
{ return (char_type*) memcpy(__s1, __s2, __n * sizeof(char_type)); }
static char_type*
assign(char_type* __s, size_t __n, char_type __a)
{
for (char_type* __p = __s; __p < __s + __n; ++__p)
assign(*__p, __a);
return __s;
}
static char_type
to_char_type(const int_type& __c)
{ return char_type(); }
static int_type
to_int_type(const char_type& __c) { return int_type(); }
static bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; }
static int_type
eof() { return static_cast<int_type>(-1); }
static int_type
not_eof(const int_type& __c)
{ return eq_int_type(__c, eof()) ? int_type(0) : __c; }
};
} // namespace std
class gnu_filebuf: public std::filebuf
{
int i;
public:
gnu_filebuf(int j = 1): i(j) { }
~gnu_filebuf() { --i; }
int get_i() { return i;}
};
const int initial = 4;
gnu_filebuf buf(initial);
// libstdc++/3045, in a vague way.
void test01()
{
bool test = true;
int k1;
// 1 normal
k1 = buf.get_i();
VERIFY( k1 == initial );
{
std::cout.rdbuf(&buf);
}
k1 = buf.get_i();
VERIFY( k1 == initial );
// 2 syncd off
k1 = buf.get_i();
VERIFY( k1 == initial );
{
std::cout.rdbuf(&buf);
std::ios_base::sync_with_stdio(false); // make sure doesn't clobber buf
}
k1 = buf.get_i();
VERIFY( k1 == initial );
// 3 callling init
k1 = buf.get_i();
VERIFY( k1 == initial );
{
std::cout.rdbuf(&buf);
std::ios_base::Init make_sure_initialized;
}
k1 = buf.get_i();
VERIFY( k1 == initial );
}
// Non-required instantiations don't have the required facets inbued,
// by default, into the locale object.
// See 27.4.4.1
class gnu_ios: public std::basic_ios<char> { };
void test02()
{
bool test = true;
// 01: Doesn't call basic_ios::init, which uses ctype<char_type>..
// This should be unambiguously correct.
try
{
gnu_ios gios;
}
catch(...)
{
test = false;
}
// 02: Calls basic_ios::init, which may call ctype<char_type>...
try
{
@ -302,80 +157,6 @@ void test02()
VERIFY( test );
}
// libstdc++/3983
void test03()
{
using namespace std;
bool test = true;
// input streams
basic_istringstream<unsigned char> iss_uc;
unsigned char arr[6] = { 'a', 'b', 'c', 'd', 'e' };
// Sentry uses locale info, so have to try one formatted input.
try
{
int i;
iss_uc >> i;
}
catch (bad_cast& obj)
{ }
catch (exception& obj)
{ test = false; }
try
{
iss_uc >> arr;
}
catch (bad_cast& obj)
{ }
catch (exception& obj)
{ test = false; }
try
{
iss_uc >> ws;
}
catch (bad_cast& obj)
{ }
catch (exception& obj)
{ test = false; }
try
{
basic_string<unsigned char> s_uc(arr);
iss_uc >> s_uc;
}
catch (bad_cast& obj)
{ }
catch (exception& obj)
{ test = false; }
// output streams
basic_ostringstream<unsigned char> oss_uc;
try
{
bool b = true;
oss_uc << b;
}
catch (bad_cast& obj)
{ }
catch (exception& obj)
{ test = false; }
VERIFY( test );
}
// libstdc++/5268
int test04()
{
std::stringbuf b1;
std::cout.rdbuf( &b1 );
std::cout << "hello\n";
return 0;
}
#if !__GXX_WEAK__
// Explicitly instantiate for systems with no COMDAT or weak support.
template
@ -385,21 +166,10 @@ template
template
unsigned short
std::basic_string<unsigned short>::_Rep::_S_terminal;
template
std::basic_string<unsigned char>::size_type
std::basic_string<unsigned char>::_Rep::_S_max_size;
template
unsigned char
std::basic_string<unsigned char>::_Rep::_S_terminal;
#endif
int main()
{
test01();
test02();
test03();
test04();
return 0;
}

View File

@ -0,0 +1,87 @@
// 1999-09-20 bkoz
// Copyright (C) 1999, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// 27.4.4.2 basic_ios member functions
// NB: Don't include any other headers in this file.
#include <ios>
#include <testsuite_hooks.h>
// 27.4.4.3 basic_ios iostate flags function
void test02()
{
bool test = true;
typedef std::ios_base::fmtflags fmtflags;
typedef std::ios_base::iostate iostate;
using std::ios_base;
iostate iostate02, iostate03;
const iostate iostate01 = std::ios_base::badbit | std::ios_base::eofbit;
const iostate iostate04 = std::ios_base::badbit;
// basic_ios& copyfmt(const basic_ios& rhs)
{
std::ios ios_01(NULL);
std::ios ios_02(NULL);
ios_01.exceptions(std::ios_base::eofbit);
ios_02.exceptions(std::ios_base::eofbit);
try {
ios_01.copyfmt(ios_02);
}
catch(...) {
VERIFY( false );
}
}
{
std::ios ios_01(NULL);
std::ios ios_02(NULL);
ios_01.clear(std::ios_base::eofbit);
ios_02.exceptions(std::ios_base::eofbit);
try {
ios_01.copyfmt(ios_02);
VERIFY( false );
}
catch(std::ios_base::failure& fail) {
VERIFY( true );
}
catch(...) {
VERIFY( false );
}
}
}
int main()
{
test02();
return 0;
}

View File

@ -0,0 +1,73 @@
// 1999-09-20 bkoz
// Copyright (C) 1999, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// 27.4.4.2 basic_ios member functions
// NB: Don't include any other headers in this file.
#include <ios>
#include <testsuite_hooks.h>
// copyfmt and locales.
void test03()
{
bool test = true;
using namespace std;
typedef std::ios_base::fmtflags fmtflags;
typedef std::ios_base::iostate iostate;
locale loc_c = locale::classic();
locale loc_de("de_DE");
std::ios ios_01(NULL);
std::ios ios_02(NULL);
ios_01.imbue(loc_c);
ios_02.imbue(loc_de);
ios_02.setstate(ios_base::badbit);
VERIFY( loc_c == ios_01.getloc() );
VERIFY( loc_de == ios_02.getloc() );
iostate ios1 = ios_01.rdstate();
iostate ios2 = ios_02.rdstate();
streambuf* sb1 = ios_01.rdbuf();
streambuf* sb2 = ios_02.rdbuf();
ios_01.copyfmt(ios_02);
VERIFY( loc_de == ios_01.getloc() );
VERIFY( ios_01.getloc() == ios_02.getloc() );
VERIFY( ios1 == ios_01.rdstate() );
VERIFY( ios2 == ios_02.rdstate() );
VERIFY( sb1 == ios_01.rdbuf() );
VERIFY( sb2 == ios_02.rdbuf() );
}
int main()
{
__gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03);
return 0;
}

View File

@ -0,0 +1,88 @@
// 1999-09-20 bkoz
// Copyright (C) 1999, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// 27.4.4.2 basic_ios member functions
// NB: Don't include any other headers in this file.
#include <ios>
#include <testsuite_hooks.h>
void test01()
{
bool test = true;
typedef std::ios_base::fmtflags fmtflags;
typedef std::ios_base::iostate iostate;
using std::ios_base;
iostate iostate02, iostate03;
const iostate iostate01 = std::ios_base::badbit | std::ios_base::eofbit;
const iostate iostate04 = std::ios_base::badbit;
// iostate exceptions() const
{
std::ios ios_01(NULL);
VERIFY( ios_01.exceptions() == std::ios_base::goodbit );
}
// void exceptions(iostate except)
{
std::ios ios_01(NULL);
try {
ios_01.exceptions(std::ios_base::eofbit);
}
catch(...) {
VERIFY( false );
}
iostate02 = ios_01.exceptions();
VERIFY( static_cast<bool>(iostate02 & std::ios_base::eofbit) );
}
{
std::ios ios_01(NULL);
ios_01.clear(std::ios_base::eofbit);
try {
ios_01.exceptions(std::ios_base::eofbit);
VERIFY( false );
}
catch(std::ios_base::failure& fail) {
iostate02 = ios_01.exceptions();
VERIFY( static_cast<bool>(iostate02 & std::ios_base::eofbit) );
}
catch(...) {
VERIFY( false );
}
}
}
int main()
{
test01();
return 0;
}

View File

@ -0,0 +1,66 @@
// 1999-09-20 bkoz
// Copyright (C) 1999, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// 27.4.4.2 basic_ios member functions
// NB: Don't include any other headers in this file.
#include <ios>
#include <testsuite_hooks.h>
void test01()
{
bool test = true;
std::ios_base::fmtflags flag02, flag03;
const std::ios_base::fmtflags flag01 = std::ios_base::skipws
| std::ios_base::dec;
const std::locale c_loc = std::locale::classic();
std::ios ios_01(NULL);
std::ios::char_type ct01;
std::ios::char_type ct02('x');;
// 27.4.2.3 locales
ios_01.imbue(c_loc);
// char narrow(char_type c, char dfault) const;
char c1 = ios_01.narrow(ct02, 0);
VERIFY( c1 == 'x' );
// char_type widen(char c) const;
ct01 = ios_01.widen('c');
VERIFY( ct01 == 'c' );
}
int main()
{
test01();
return 0;
}

View File

@ -45,16 +45,3 @@ void test01()
typedef test_type::pos_type pos_type;
typedef test_type::off_type off_type;
}
namespace test
{
using namespace std;
typedef short type_t;
template class basic_iostream<type_t, char_traits<type_t> >;
} // test
int main()
{
test01();
return 0;
}

View File

@ -0,0 +1,42 @@
// 2002-01-08 bkoz
// Copyright (C) 2002 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// 27.6.1.5 - Template class basic_iostream
// NB: This file is for testing iostream with NO OTHER INCLUDES.
// { dg-do compile }
#include <istream>
namespace test
{
using namespace std;
typedef short type_t;
template class basic_iostream<type_t, char_traits<type_t> >;
} // test

View File

@ -0,0 +1,149 @@
// 1999-01-17 bkoz test functionality of basic_filebuf for char_type == char
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.1 - Template class basic_filebuf
// NB: This file is for testing basic_filebuf with NO OTHER INCLUDES.
#include <iostream>
#include <testsuite_hooks.h>
// { dg-do compile }
// libstdc++/2020
// should be able to use custom char_type, custom traits type
class gnu_char_type
{
unsigned long character;
public:
// operator ==
bool
operator==(const gnu_char_type& __lhs)
{ return character == __lhs.character; }
// operator <
bool
operator<(const gnu_char_type& __lhs)
{ return character < __lhs.character; }
// default ctor
gnu_char_type() { }
// to_char_type
gnu_char_type(const unsigned long& __l) : character(__l) { }
// to_int_type
operator unsigned long() const { return character; }
};
// char_traits specialization
struct gnu_char_traits
{
typedef gnu_char_type char_type;
typedef long int_type;
typedef long pos_type;
typedef unsigned long off_type;
typedef long state_type;
static void
assign(char_type& __c1, const char_type& __c2) { }
static bool
eq(const char_type& __c1, const char_type& __c2) { return true; }
static bool
lt(const char_type& __c1, const char_type& __c2) { return true; }
static int
compare(const char_type* __s1, const char_type* __s2, size_t __n)
{ return 0; }
static size_t
length(const char_type* __s) { return 0; }
static const char_type*
find(const char_type* __s, size_t __n, const char_type& __a)
{ return __s; }
static char_type*
move(char_type* __s1, const char_type* __s2, size_t __n)
{ return __s1; }
static char_type*
copy(char_type* __s1, const char_type* __s2, size_t __n)
{ return __s1; }
static char_type*
assign(char_type* __s, size_t __n, char_type __a)
{ return __s; }
static char_type
to_char_type(const int_type& __c)
{ return char_type(); }
static int_type
to_int_type(const char_type& __c)
{ return int_type(); }
static bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return true; }
static int_type
eof()
{ return int_type(); }
static int_type
not_eof(const int_type& __c)
{ return int_type(); }
};
void test07()
{
bool test = true;
typedef std::basic_iostream<gnu_char_type, gnu_char_traits> gnu_iostr;
try
{
gnu_iostr obj(NULL);
}
catch(std::exception& obj)
{
test = false;
VERIFY( test );
}
}
#if !__GXX_WEAK__
// Explicitly instantiate for systems with no COMDAT or weak support.
template
std::basic_streambuf<gnu_char_type>::int_type
std::basic_streambuf<gnu_char_type>::_S_pback_size;
#endif
int main()
{
test07();
return 0;
}
// more surf!!!

View File

@ -0,0 +1,54 @@
// 2003-03-26 B enjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.1 - Template class basic_filebuf
#include <iostream>
#include <sstream>
void test01()
{
// Check for required base class.
typedef std::iostream test_type;
typedef std::istream base_type1;
typedef std::ostream base_type2;
std::stringbuf buf;
const test_type& obj = test_type(&buf);
const base_type1* base1 = &obj;
const base_type2* base2 = &obj;
}
int main()
{
test01();
return 0;
}
// more surf!!!

View File

@ -46,18 +46,3 @@ void test01()
typedef test_type::pos_type pos_type;
typedef test_type::off_type off_type;
}
namespace test
{
using namespace std;
using __gnu_cxx_test::pod_char;
typedef short type_t;
template class basic_istream<type_t, char_traits<type_t> >;
template class basic_istream<pod_char, char_traits<pod_char> >;
} // test
int main()
{
test01();
return 0;
}

View File

@ -0,0 +1,45 @@
// 1999-09-20 bkoz
// Copyright (C) 1999, 2000, 2001, 2002, 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// 27.6.1.1 basic_istream
// NB: This file is for testing istream with NO OTHER INCLUDES.
#include <istream>
#include <testsuite_hooks.h>
// { dg-do compile }
namespace test
{
using namespace std;
using __gnu_cxx_test::pod_char;
typedef short type_t;
template class basic_istream<type_t, char_traits<type_t> >;
template class basic_istream<pod_char, char_traits<pod_char> >;
} // test

View File

@ -0,0 +1,147 @@
// 1999-01-17 bkoz test functionality of basic_filebuf for char_type == char
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.1 - Template class basic_filebuf
// NB: This file is for testing basic_filebuf with NO OTHER INCLUDES.
#include <istream>
#include <testsuite_hooks.h>
// { dg-do compile }
// libstdc++/2020
// should be able to use custom char_type, custom traits type
class gnu_char_type
{
unsigned long character;
public:
// operator ==
bool
operator==(const gnu_char_type& __lhs)
{ return character == __lhs.character; }
// operator <
bool
operator<(const gnu_char_type& __lhs)
{ return character < __lhs.character; }
// default ctor
gnu_char_type() { }
// to_char_type
gnu_char_type(const unsigned long& __l) : character(__l) { }
// to_int_type
operator unsigned long() const { return character; }
};
// char_traits specialization
struct gnu_char_traits
{
typedef gnu_char_type char_type;
typedef long int_type;
typedef long pos_type;
typedef unsigned long off_type;
typedef long state_type;
static void
assign(char_type& __c1, const char_type& __c2) { }
static bool
eq(const char_type& __c1, const char_type& __c2) { return true; }
static bool
lt(const char_type& __c1, const char_type& __c2) { return true; }
static int
compare(const char_type* __s1, const char_type* __s2, size_t __n)
{ return 0; }
static size_t
length(const char_type* __s) { return 0; }
static const char_type*
find(const char_type* __s, size_t __n, const char_type& __a)
{ return __s; }
static char_type*
move(char_type* __s1, const char_type* __s2, size_t __n)
{ return __s1; }
static char_type*
copy(char_type* __s1, const char_type* __s2, size_t __n)
{ return __s1; }
static char_type*
assign(char_type* __s, size_t __n, char_type __a)
{ return __s; }
static char_type
to_char_type(const int_type& __c)
{ return char_type(); }
static int_type
to_int_type(const char_type& __c)
{ return int_type(); }
static bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return true; }
static int_type
eof()
{ return int_type(); }
static int_type
not_eof(const int_type& __c)
{ return int_type(); }
};
void test07()
{
bool test = true;
typedef std::basic_istream<gnu_char_type, gnu_char_traits> gnu_istr;
try
{ gnu_istr obj(NULL); }
catch(std::exception& obj)
{
test = false;
VERIFY( test );
}
}
#if !__GXX_WEAK__
// Explicitly instantiate for systems with no COMDAT or weak support.
template
std::basic_streambuf<gnu_char_type>::int_type
std::basic_streambuf<gnu_char_type>::_S_pback_size;
#endif
int main()
{
test07();
return 0;
}
// more surf!!!

View File

@ -0,0 +1,52 @@
// 2003-03-26 B enjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2003 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.8.1.1 - Template class basic_filebuf
#include <istream>
#include <sstream>
void test01()
{
// Check for required base class.
typedef std::istream test_type;
typedef std::ios base_type;
std::stringbuf buf;
const test_type& obj = test_type(&buf);
const base_type* base = &obj;
}
int main()
{
test01();
return 0;
}
// more surf!!!

View File

@ -1,6 +1,6 @@
// 1999-07-26 bkoz
// Copyright (C) 1999 Free Software Foundation
// Copyright (C) 1999, 2003 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
@ -24,8 +24,8 @@
#include <sstream>
#include <testsuite_hooks.h>
bool test01() {
void test01()
{
bool test = true;
std::string str_01;
const std::string str_02("coltrane playing 'softly as a morning sunrise'");
@ -74,7 +74,6 @@ bool test01() {
VERIFY( state1 == state2 );
VERIFY( !static_cast<bool>(state2 & statefail) );
// template<_CharT, _Traits>
// basic_istream& operator>>(istream&, unsigned char*)
unsigned char array2[n];
@ -88,9 +87,8 @@ bool test01() {
VERIFY( array2[6] == 'y' );
int1 = is_02.peek(); // should be ' '
VERIFY( int1 == ' ' );
// template<_CharT, _Traits>
// template<_CharT, _Traits>
// basic_istream& operator>>(istream&, signed char*)
signed char array3[n];
state1 = is_02.rdstate();
@ -102,128 +100,10 @@ bool test01() {
VERIFY( array3[1] == 's' );
int1 = is_02.peek(); // should be ' '
VERIFY( int1 == ' ' );
// testing with width() control enabled.
is_02.width(8);
state1 = is_02.rdstate();
is_02 >> array1; // should snake a
state2 = is_02.rdstate();
VERIFY( state1 == state2 );
VERIFY( !ctraits_type::compare(array1, "a", 2) );
is_02.width(1);
state1 = is_02.rdstate();
is_02 >> array1; // should snake nothing, set failbit
state2 = is_02.rdstate();
VERIFY( state1 != state2 );
VERIFY( state2 == statefail );
VERIFY( array1[0] == '\0' );
is_02.width(8);
is_02.clear();
state1 = is_02.rdstate();
VERIFY( !state1 );
is_02 >> array1; // should snake "morning"
state2 = is_02.rdstate();
VERIFY( state1 == state2 );
VERIFY( !ctraits_type::compare(array1, "morning", 8) );
// testing for correct exception setting
const std::string str_04(" impulse!!");
std::stringbuf isbuf_03(str_04, std::ios_base::in);
std::stringbuf isbuf_04(str_04, std::ios_base::in);
std::istream is_03(&isbuf_03);
std::istream is_04(&isbuf_04);
is_03 >> array1;
VERIFY( !ctraits_type::compare(array1,"impulse!!", 10) );
VERIFY( is_03.rdstate() == std::ios_base::eofbit );
is_04.width(9);
is_04 >> array1;
VERIFY( ! std::ios::traits_type::compare(array1,"impulse!", 9) );
VERIFY( !is_04.rdstate() );
#ifdef DEBUG_ASSERT
assert(test);
#endif
return test;
}
bool test02() {
typedef std::ios::traits_type ctraits_type;
bool test = true;
std::string str_01;
const std::string str_02("or coltrane playing tunji with jimmy garrison");
const std::string str_03("coltrane");
std::stringbuf isbuf_01(std::ios_base::in);
std::stringbuf isbuf_02(str_02, std::ios_base::in);
std::istream is_01(NULL);
std::istream is_02(&isbuf_02);
std::ios_base::iostate state1, state2, statefail;
statefail = std::ios_base::failbit;
// template<_CharT, _Traits>
// basic_istream& operator>>(istream&, _CharT&)
char c1 = 'c', c2 = 'c';
state1 = is_01.rdstate();
is_01 >> c1;
state2 = is_01.rdstate();
VERIFY( state1 != state2 );
VERIFY( c1 == c2 );
VERIFY( static_cast<bool>(state2 & statefail) );
state1 = is_02.rdstate();
is_02 >> c1;
state2 = is_02.rdstate();
VERIFY( state1 == state2 );
VERIFY( c1 == 'o' );
is_02 >> c1;
is_02 >> c1;
VERIFY( c1 == 'c' );
VERIFY( !static_cast<bool>(state2 & statefail) );
// template<_CharT, _Traits>
// basic_istream& operator>>(istream&, unsigned char&)
unsigned char uc1 = 'c';
state1 = is_02.rdstate();
is_02 >> uc1;
state2 = is_02.rdstate();
VERIFY( state1 == state2 );
VERIFY( uc1 == 'o' );
is_02 >> uc1;
is_02 >> uc1;
VERIFY( uc1 == 't' );
// template<_CharT, _Traits>
// basic_istream& operator>>(istream&, signed char&)
signed char sc1 = 'c';
state1 = is_02.rdstate();
is_02 >> sc1;
state2 = is_02.rdstate();
VERIFY( state1 == state2 );
VERIFY( sc1 == 'r' );
is_02 >> sc1;
is_02 >> sc1;
VERIFY( sc1 == 'n' );
#ifdef DEBUG_ASSERT
assert(test);
#endif
return test;
}
int main()
{
test01();
test02();
return 0;
}

View File

@ -0,0 +1,92 @@
// 1999-07-26 bkoz
// Copyright (C) 1999, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.6.1.2.3 character extractors
#include <istream>
#include <sstream>
#include <testsuite_hooks.h>
void test02()
{
typedef std::ios::traits_type ctraits_type;
bool test = true;
std::string str_01;
const std::string str_02("or coltrane playing tunji with jimmy garrison");
const std::string str_03("coltrane");
std::stringbuf isbuf_01(std::ios_base::in);
std::stringbuf isbuf_02(str_02, std::ios_base::in);
std::istream is_01(NULL);
std::istream is_02(&isbuf_02);
std::ios_base::iostate state1, state2, statefail;
statefail = std::ios_base::failbit;
// template<_CharT, _Traits>
// basic_istream& operator>>(istream&, _CharT&)
char c1 = 'c', c2 = 'c';
state1 = is_01.rdstate();
is_01 >> c1;
state2 = is_01.rdstate();
VERIFY( state1 != state2 );
VERIFY( c1 == c2 );
VERIFY( static_cast<bool>(state2 & statefail) );
state1 = is_02.rdstate();
is_02 >> c1;
state2 = is_02.rdstate();
VERIFY( state1 == state2 );
VERIFY( c1 == 'o' );
is_02 >> c1;
is_02 >> c1;
VERIFY( c1 == 'c' );
VERIFY( !static_cast<bool>(state2 & statefail) );
// template<_CharT, _Traits>
// basic_istream& operator>>(istream&, unsigned char&)
unsigned char uc1 = 'c';
state1 = is_02.rdstate();
is_02 >> uc1;
state2 = is_02.rdstate();
VERIFY( state1 == state2 );
VERIFY( uc1 == 'o' );
is_02 >> uc1;
is_02 >> uc1;
VERIFY( uc1 == 't' );
// template<_CharT, _Traits>
// basic_istream& operator>>(istream&, signed char&)
signed char sc1 = 'c';
state1 = is_02.rdstate();
is_02 >> sc1;
state2 = is_02.rdstate();
VERIFY( state1 == state2 );
VERIFY( sc1 == 'r' );
is_02 >> sc1;
is_02 >> sc1;
VERIFY( sc1 == 'n' );
}
int main()
{
test02();
return 0;
}

View File

@ -0,0 +1,95 @@
// 1999-07-26 bkoz
// Copyright (C) 1999, 2003 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.6.1.2.3 character extractors
#include <istream>
#include <sstream>
#include <testsuite_hooks.h>
void test01()
{
bool test = true;
std::string str_01;
const std::string str_02("coltrane playing 'softly as a morning sunrise'");
const std::string str_03("coltrane");
std::stringbuf isbuf_01(std::ios_base::in);
std::stringbuf isbuf_02(str_02, std::ios_base::in);
std::istream is_01(NULL);
std::istream is_02(&isbuf_02);
std::ios_base::iostate state1, state2, statefail;
statefail = std::ios_base::failbit;
// template<_CharT, _Traits>
// basic_istream& operator>>(istream&, _CharT*)
int n = 20;
char array1[n];
typedef std::ios::traits_type ctraits_type;
ctraits_type::int_type i1, i2;
// testing with width() control enabled.
is_02.width(8);
state1 = is_02.rdstate();
is_02 >> array1; // should snake "coltran"
state2 = is_02.rdstate();
VERIFY( state1 == state2 );
VERIFY( !ctraits_type::compare(array1, "coltran", 7) );
is_02.width(1);
state1 = is_02.rdstate();
is_02 >> array1; // should snake nothing, set failbit
state2 = is_02.rdstate();
VERIFY( state1 != state2 );
VERIFY( state2 == statefail );
VERIFY( array1[0] == '\0' );
is_02.width(8);
is_02.clear();
state1 = is_02.rdstate();
VERIFY( !state1 );
is_02 >> array1; // should snake "e"
state2 = is_02.rdstate();
VERIFY( state1 == state2 );
VERIFY( !ctraits_type::compare(array1, "e", 1) );
// testing for correct exception setting
const std::string str_04(" impulse!!");
std::stringbuf isbuf_03(str_04, std::ios_base::in);
std::stringbuf isbuf_04(str_04, std::ios_base::in);
std::istream is_03(&isbuf_03);
std::istream is_04(&isbuf_04);
is_03 >> array1;
VERIFY( !ctraits_type::compare(array1,"impulse!!", 10) );
VERIFY( is_03.rdstate() == std::ios_base::eofbit );
is_04.width(9);
is_04 >> array1;
VERIFY( ! std::ios::traits_type::compare(array1,"impulse!", 9) );
VERIFY( !is_04.rdstate() );
}
int main()
{
test01();
return 0;
}

Some files were not shown because too many files have changed in this diff Show More