summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/27_io
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-10 07:15:40 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-10 07:15:40 +0000
commita2febbfb2b290b8238dcba21e7df3788c2bb86ab (patch)
tree823d62ecd4e9deb5f5c0e8076859542770c5b74e /libstdc++-v3/testsuite/27_io
parent9ad336b6fd76757cf36ba98fc668c29c4ba759f1 (diff)
downloadgcc-a2febbfb2b290b8238dcba21e7df3788c2bb86ab.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65421 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/27_io')
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/1.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/2.cc51
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/3.cc (renamed from libstdc++-v3/testsuite/27_io/filebuf.cc)104
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/4.cc49
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/1.cc86
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/2.cc79
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/3.cc106
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc97
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc77
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/1.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/9322.cc53
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/in_avail/char/1.cc114
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/is_open/char/1.cc72
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/1.cc73
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/2.cc58
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/3.cc53
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc67
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/1.cc78
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/3599.cc66
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/9169.cc72
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/9182-2.cc72
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/9988.cc69
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sbumpc/char/1.cc106
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sbumpc/char/9825.cc55
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1.cc137
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2.cc65
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1.cc127
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2.cc65
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/1.cc90
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/2.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/3.cc46
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sgetc/char/1.cc120
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/1.cc145
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/2.cc46
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/snextc/char/1.cc116
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sputbackc/char/1.cc168
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sputbackc/char/9425.cc48
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/1.cc137
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/1057.cc61
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/9701-2.cc71
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/1.cc125
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/1057.cc61
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/9701-1.cc75
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sungetc/char/1.cc191
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sync/char/1057.cc112
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sync/char/9182-1.cc72
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc101
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_fstream/1.cc (renamed from libstdc++-v3/testsuite/27_io/fstream.cc)15
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_fstream/2.cc46
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_fstream/3.cc149
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_fstream/4.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_fstream/rdbuf/char/2832.cc (renamed from libstdc++-v3/testsuite/27_io/fstream_members.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ifstream/1.cc (renamed from libstdc++-v3/testsuite/27_io/ifstream.cc)13
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ifstream/2.cc42
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ifstream/3.cc149
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ifstream/4.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/1.cc49
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ifstream/open/char/1.cc57
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ifstream/rdbuf/char/2832.cc (renamed from libstdc++-v3/testsuite/27_io/ifstream_members.cc)55
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/1.cc (renamed from libstdc++-v3/testsuite/27_io/ios.cc)13
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/2.cc42
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/3.cc147
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/4.cc52
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/clear/char/1.cc81
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/cons/char/1.cc (renamed from libstdc++-v3/testsuite/27_io/ios_ctor.cc)9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/cons/char/2.cc61
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/cons/char/3.cc (renamed from libstdc++-v3/testsuite/27_io/ios_init.cc)232
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc87
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/2.cc73
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc88
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/locales/char/1.cc66
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_iostream/1.cc (renamed from libstdc++-v3/testsuite/27_io/iostream.cc)13
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_iostream/2.cc42
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_iostream/3.cc149
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_iostream/4.cc54
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/1.cc (renamed from libstdc++-v3/testsuite/27_io/istream.cc)15
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/2.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/3.cc147
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/4.cc52
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/exceptions/char/9561.cc (renamed from libstdc++-v3/testsuite/27_io/istream_exception.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/01.cc (renamed from libstdc++-v3/testsuite/27_io/istream_extractor_arith/01.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/02.cc (renamed from libstdc++-v3/testsuite/27_io/istream_extractor_arith/02.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/03.cc (renamed from libstdc++-v3/testsuite/27_io/istream_extractor_arith/03.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/06.cc (renamed from libstdc++-v3/testsuite/27_io/istream_extractor_arith/06.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/07.cc (renamed from libstdc++-v3/testsuite/27_io/istream_extractor_arith/07.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/08.cc (renamed from libstdc++-v3/testsuite/27_io/istream_extractor_arith/08.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/09.cc (renamed from libstdc++-v3/testsuite/27_io/istream_extractor_arith/09.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc (renamed from libstdc++-v3/testsuite/27_io/istream_extractor_arith/10.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/11.cc (renamed from libstdc++-v3/testsuite/27_io/istream_extractor_arith/11.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/12.cc (renamed from libstdc++-v3/testsuite/27_io/istream_extractor_arith/12.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/13.cc (renamed from libstdc++-v3/testsuite/27_io/istream_extractor_arith/13.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/1.cc (renamed from libstdc++-v3/testsuite/27_io/istream_extractor_char.cc)130
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/2.cc92
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/3.cc95
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/9826.cc (renamed from libstdc++-v3/testsuite/27_io/stringstream.cc)22
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/1.cc (renamed from libstdc++-v3/testsuite/27_io/istream_extractor_other.cc)71
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/2.cc61
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/3.cc56
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/9318-in.cc73
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/9424-in.cc113
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/get/char/1.cc128
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/get/char/2.cc59
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/getline/char/1.cc125
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/getline/char/2.cc103
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/getline/char/3.cc64
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/1.cc84
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/6360.cc52
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/7220.cc73
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/peek/char/1.cc98
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/peek/char/6414.cc51
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/putback/char/1.cc80
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/read/char/1.cc79
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/read/char/2.cc63
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/read/char/3.cc51
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/readsome/char/6746-1.cc60
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/readsome/char/6746-2.cc60
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/readsome/char/8258.cc53
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2346-fstream.cc90
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2346-sstream.cc83
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/8348-1.cc55
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/8348-2.cc55
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/fstream.cc127
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/sstream.cc135
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/1.cc (renamed from libstdc++-v3/testsuite/27_io/istream_sentry.cc)37
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/2.cc60
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/3.cc53
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/3983-fstream.cc189
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/3983-sstream.cc189
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/1.cc64
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/8348.cc79
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/fstream.cc87
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/sstream.cc93
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/ws/char/1.cc (renamed from libstdc++-v3/testsuite/27_io/istream_manip.cc)10
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istringstream/1.cc (renamed from libstdc++-v3/testsuite/27_io/istringstream.cc)13
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istringstream/2.cc42
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istringstream/3.cc149
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istringstream/4.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istringstream/rdbuf/char/2832.cc (renamed from libstdc++-v3/testsuite/27_io/istringstream_members.cc)54
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istringstream/str/char/1.cc80
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ofstream/1.cc (renamed from libstdc++-v3/testsuite/27_io/ofstream.cc)13
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ofstream/2.cc42
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ofstream/3.cc149
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ofstream/4.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ofstream/cons/char/2.cc49
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/1.cc58
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ofstream/rdbuf/char/2832.cc (renamed from libstdc++-v3/testsuite/27_io/ofstream_members.cc)57
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/1.cc (renamed from libstdc++-v3/testsuite/27_io/ostream.cc)15
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/2.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/3.cc149
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/4.cc52
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/cons/char/9827.cc (renamed from libstdc++-v3/testsuite/27_io/ostream_fail.cc)11
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/endl/char/1.cc59
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/ends/char/1.cc61
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/ends/char/2.cc (renamed from libstdc++-v3/testsuite/27_io/ostream_manip.cc)65
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/exceptions/char/9561.cc (renamed from libstdc++-v3/testsuite/27_io/ostream_exception.cc)1
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/flush/char/1.cc59
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/1.cc194
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/2.cc58
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/3.cc69
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/4.cc51
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/4402.cc74
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/5.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/6.cc54
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/1.cc189
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/1.cc59
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/2.cc69
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/3.cc68
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/4.cc61
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/5.cc78
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/6.cc59
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/8.cc49
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/7.cc92
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/8.cc60
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/1.cc82
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/2.cc70
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/3.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/4.cc (renamed from libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc)129
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/9318-out.cc73
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/9424-out.cc113
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/1.cc53
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/2.cc (renamed from libstdc++-v3/testsuite/27_io/ostream_sentry.cc)14
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/3983-fstream.cc160
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/3983-sstream.cc160
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/1.cc62
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/2.cc (renamed from libstdc++-v3/testsuite/27_io/ostream_unformatted.cc)7
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/1.cc (renamed from libstdc++-v3/testsuite/27_io/ostringstream.cc)13
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/2.cc42
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/3.cc149
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/4.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/char/3.cc64
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/rdbuf/char/2832.cc (renamed from libstdc++-v3/testsuite/27_io/ostringstream_members.cc)83
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/1.cc54
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/2.cc46
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/1.cc (renamed from libstdc++-v3/testsuite/27_io/streambuf.cc)15
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/2.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/3.cc147
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/cons/char/1.cc111
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/imbue/char/1.cc52
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/imbue/char/9322.cc72
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/1.cc116
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/2.cc80
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/3599.cc68
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/char/1.cc118
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sgetn/char/1.cc126
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sputbackc/char/9538.cc65
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sputc/char/1057.cc61
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1.cc124
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1057.cc61
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sync/char/1057.cc108
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/1.cc (renamed from libstdc++-v3/testsuite/27_io/stringbuf.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/2.cc51
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/3.cc145
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/4.cc47
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/5.cc49
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/imbue/char/1.cc46
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/imbue/char/9322.cc53
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/in_avail/char/1.cc65
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/char/2.cc80
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/char/3599.cc66
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/char/9988.cc63
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/1.cc74
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/9825.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc124
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/2.cc59
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/1.cc98
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/2.cc60
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/char/1.cc72
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/char/2.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/char/3.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetc/char/1.cc78
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/char/1.cc108
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/char/1.cc84
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/char/1.cc122
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/char/9425.cc43
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/1.cc75
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/1057.cc61
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/9404-1.cc73
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/1.cc87
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/1057.cc61
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/9404-2.cc73
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/1.cc74
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/2.cc55
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/3.cc43
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/3955.cc44
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sungetc/char/1.cc151
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sync/char/1057.cc108
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringstream/1.cc48
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringstream/2.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringstream/3.cc149
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringstream/4.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringstream/rdbuf/char/2832.cc70
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringstream/str/char/1.cc77
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringstream/str/char/2.cc76
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringstream/str/char/3.cc65
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringstream/str/char/4.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf_members-1.tst0
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf_members-1.txt0
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf_members.cc276
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf_virtuals-1.tst158
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf_virtuals-1.txt158
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf_virtuals-2.tst1
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf_virtuals-3.tst7
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf_virtuals.cc892
-rw-r--r--libstdc++-v3/testsuite/27_io/fpos/1.cc71
-rw-r--r--libstdc++-v3/testsuite/27_io/fpos/2.cc (renamed from libstdc++-v3/testsuite/27_io/fpos.cc)80
-rw-r--r--libstdc++-v3/testsuite/27_io/fpos/3.cc72
-rw-r--r--libstdc++-v3/testsuite/27_io/ifstream_members-1.tst0
-rw-r--r--libstdc++-v3/testsuite/27_io/ifstream_members-1.txt0
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/callbacks/1.cc (renamed from libstdc++-v3/testsuite/27_io/ios_base_callbacks.cc)11
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/state/1.cc62
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/storage/1.cc54
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc (renamed from libstdc++-v3/testsuite/27_io/ios_base_storage.cc)33
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/storage/3.cc52
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/1.cc58
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/2.cc (renamed from libstdc++-v3/testsuite/27_io/ios_base_members_static.cc)32
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base_members_static-1.tst2
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_members.cc173
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_other-1.tst65
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_other-1.txt65
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_other-2.tst65
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_seeks-1.tst7
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_seeks-1.txt7
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_seeks-2.tst0
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_seeks-3.tst10
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_seeks.cc405
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_unformatted-1.tst1500
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_unformatted-1.txt1500
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_unformatted.cc639
-rw-r--r--libstdc++-v3/testsuite/27_io/manipulators/adjustfield/char/1.cc (renamed from libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc)29
-rw-r--r--libstdc++-v3/testsuite/27_io/manipulators/adjustfield/char/2.cc59
-rw-r--r--libstdc++-v3/testsuite/27_io/manipulators/basefield/char/1.cc (renamed from libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc)33
-rw-r--r--libstdc++-v3/testsuite/27_io/manipulators/standard/char/1.cc (renamed from libstdc++-v3/testsuite/27_io/standard_manipulators.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/manipulators/standard/char/2.cc (renamed from libstdc++-v3/testsuite/27_io/instantiations.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/narrow_stream_objects.cc239
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/1.cc98
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/2.cc47
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/2523-1_xin.cc89
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/2523-1_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/2523-2_xin.cc39
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/2523-2_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/3045.cc86
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/3647.cc (renamed from libstdc++-v3/testsuite/27_io/iostream_members.cc)0
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/3_xin.cc42
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/3_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/4_xin.cc39
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/4_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/5268.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/5280_xin.cc48
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/5280_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/6548_xin.cc39
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/6548_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/6648-1_xin.cc38
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/6648-1_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/6648-2_xin.cc35
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/6648-2_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/7744_xin.cc42
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/7744_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/1.cc (renamed from libstdc++-v3/testsuite/27_io/wide_stream_objects.cc)18
-rw-r--r--libstdc++-v3/testsuite/27_io/ofstream_members-1.tst0
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc409
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_char-1.tst1000
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_char-1.txt1000
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc342
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_other-1.tst158
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_other-2.tst158
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_seeks-1.tst0
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_seeks.cc301
-rw-r--r--libstdc++-v3/testsuite/27_io/streambuf_members.cc536
-rw-r--r--libstdc++-v3/testsuite/27_io/stringbuf_members.cc517
-rw-r--r--libstdc++-v3/testsuite/27_io/stringbuf_virtuals.cc167
-rw-r--r--libstdc++-v3/testsuite/27_io/stringstream_members.cc202
-rw-r--r--libstdc++-v3/testsuite/27_io/types/1.cc (renamed from libstdc++-v3/testsuite/27_io/ios_base_types.cc)1
-rw-r--r--libstdc++-v3/testsuite/27_io/types/2.cc40
333 files changed, 18320 insertions, 12318 deletions
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/1.cc
new file mode 100644
index 00000000000..f0267286ae9
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/1.cc
@@ -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!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/2.cc
new file mode 100644
index 00000000000..af92af0ff11
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/2.cc
@@ -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!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/filebuf.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/3.cc
index ab873be82b5..a67d5961897 100644
--- a/libstdc++-v3/testsuite/27_io/filebuf.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/3.cc
@@ -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!!!
-
-
-
-
-
-
-
-
-
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/4.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/4.cc
new file mode 100644
index 00000000000..9516cb2eccb
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/4.cc
@@ -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!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/1.cc
new file mode 100644
index 00000000000..5b2f484a0f9
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/1.cc
@@ -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;
+}
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/2.cc
new file mode 100644
index 00000000000..b0ebd5817c6
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/2.cc
@@ -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;
+}
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/3.cc
new file mode 100644
index 00000000000..d7c1286f0ff
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/3.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc
new file mode 100644
index 00000000000..b72be5ce0a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc
@@ -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;
+}
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc
new file mode 100644
index 00000000000..32c388dceb8
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/1.cc
new file mode 100644
index 00000000000..7893e93ce1a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/1.cc
@@ -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!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/9322.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/9322.cc
new file mode 100644
index 00000000000..e584f461bb7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/9322.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/in_avail/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/in_avail/char/1.cc
new file mode 100644
index 00000000000..eca4951004f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/in_avail/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/is_open/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/is_open/char/1.cc
new file mode 100644
index 00000000000..4b4c022a1c2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/is_open/char/1.cc
@@ -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;
+}
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/1.cc
new file mode 100644
index 00000000000..424d4b63eb5
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/1.cc
@@ -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;
+}
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/2.cc
new file mode 100644
index 00000000000..cf0ffa94c87
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/2.cc
@@ -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;
+}
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/3.cc
new file mode 100644
index 00000000000..c08817f7eab
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/3.cc
@@ -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;
+}
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc
new file mode 100644
index 00000000000..860f36943f0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc
@@ -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;
+}
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/1.cc
new file mode 100644
index 00000000000..fd960e45511
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/3599.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/3599.cc
new file mode 100644
index 00000000000..795c58ccf3e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/3599.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/9169.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/9169.cc
new file mode 100644
index 00000000000..18ed29d328c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/9169.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/9182-2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/9182-2.cc
new file mode 100644
index 00000000000..b752bce8a49
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/9182-2.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/9988.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/9988.cc
new file mode 100644
index 00000000000..2c8d078f0e4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/char/9988.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sbumpc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sbumpc/char/1.cc
new file mode 100644
index 00000000000..5a27cdd592c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sbumpc/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sbumpc/char/9825.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sbumpc/char/9825.cc
new file mode 100644
index 00000000000..8e419432ad8
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sbumpc/char/9825.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1.cc
new file mode 100644
index 00000000000..cb64d106bb5
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2.cc
new file mode 100644
index 00000000000..fa185521d33
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1.cc
new file mode 100644
index 00000000000..65a91c458f0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2.cc
new file mode 100644
index 00000000000..d32dc4bab63
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/1.cc
new file mode 100644
index 00000000000..d4f9e4c15dc
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/2.cc
new file mode 100644
index 00000000000..6261c999c37
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/2.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/3.cc
new file mode 100644
index 00000000000..2927991c060
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/3.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sgetc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sgetc/char/1.cc
new file mode 100644
index 00000000000..34f53553949
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sgetc/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/1.cc
new file mode 100644
index 00000000000..1f0fd4c1d8e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/2.cc
new file mode 100644
index 00000000000..6ed16712b88
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/2.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/snextc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/snextc/char/1.cc
new file mode 100644
index 00000000000..9dcfcb5ac47
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/snextc/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sputbackc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputbackc/char/1.cc
new file mode 100644
index 00000000000..62dc70ee191
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputbackc/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sputbackc/char/9425.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputbackc/char/9425.cc
new file mode 100644
index 00000000000..b5e470f332a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputbackc/char/9425.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/1.cc
new file mode 100644
index 00000000000..db386f72212
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/1057.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/1057.cc
new file mode 100644
index 00000000000..d794458c3d3
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/1057.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/9701-2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/9701-2.cc
new file mode 100644
index 00000000000..e0358ef5252
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/9701-2.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/1.cc
new file mode 100644
index 00000000000..38acef66baa
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/1057.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/1057.cc
new file mode 100644
index 00000000000..b6cf1e7db90
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/1057.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/9701-1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/9701-1.cc
new file mode 100644
index 00000000000..3c350a4d360
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/9701-1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sungetc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sungetc/char/1.cc
new file mode 100644
index 00000000000..92af72810b2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sungetc/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sync/char/1057.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sync/char/1057.cc
new file mode 100644
index 00000000000..02feef5a6e8
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sync/char/1057.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sync/char/9182-1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sync/char/9182-1.cc
new file mode 100644
index 00000000000..a0411e2fff3
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sync/char/9182-1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc
new file mode 100644
index 00000000000..1b900f9e5d9
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/fstream.cc b/libstdc++-v3/testsuite/27_io/basic_fstream/1.cc
index c37be6bbfcb..28713fbdd28 100644
--- a/libstdc++-v3/testsuite/27_io/fstream.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_fstream/1.cc
@@ -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;
-}
diff --git a/libstdc++-v3/testsuite/27_io/basic_fstream/2.cc b/libstdc++-v3/testsuite/27_io/basic_fstream/2.cc
new file mode 100644
index 00000000000..3faf03f4dcf
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_fstream/2.cc
@@ -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
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_fstream/3.cc b/libstdc++-v3/testsuite/27_io/basic_fstream/3.cc
new file mode 100644
index 00000000000..a9eb1137a26
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_fstream/3.cc
@@ -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!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_fstream/4.cc b/libstdc++-v3/testsuite/27_io/basic_fstream/4.cc
new file mode 100644
index 00000000000..a7f46d61d8a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_fstream/4.cc
@@ -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!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/fstream_members.cc b/libstdc++-v3/testsuite/27_io/basic_fstream/rdbuf/char/2832.cc
index 136252b8efb..136252b8efb 100644
--- a/libstdc++-v3/testsuite/27_io/fstream_members.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_fstream/rdbuf/char/2832.cc
diff --git a/libstdc++-v3/testsuite/27_io/ifstream.cc b/libstdc++-v3/testsuite/27_io/basic_ifstream/1.cc
index 9bc38a8e697..176333cc9f1 100644
--- a/libstdc++-v3/testsuite/27_io/ifstream.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ifstream/1.cc
@@ -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;
-}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ifstream/2.cc b/libstdc++-v3/testsuite/27_io/basic_ifstream/2.cc
new file mode 100644
index 00000000000..6fb71a575ad
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ifstream/2.cc
@@ -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
diff --git a/libstdc++-v3/testsuite/27_io/basic_ifstream/3.cc b/libstdc++-v3/testsuite/27_io/basic_ifstream/3.cc
new file mode 100644
index 00000000000..c1d2544dc35
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ifstream/3.cc
@@ -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!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_ifstream/4.cc b/libstdc++-v3/testsuite/27_io/basic_ifstream/4.cc
new file mode 100644
index 00000000000..08827c3aec6
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ifstream/4.cc
@@ -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!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/1.cc
new file mode 100644
index 00000000000..e211d0cc643
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/1.cc
@@ -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;
+}
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_ifstream/open/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ifstream/open/char/1.cc
new file mode 100644
index 00000000000..5a8b6f8b3a4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ifstream/open/char/1.cc
@@ -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;
+}
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ifstream_members.cc b/libstdc++-v3/testsuite/27_io/basic_ifstream/rdbuf/char/2832.cc
index ad21fe5c8d1..947a77dce2b 100644
--- a/libstdc++-v3/testsuite/27_io/ifstream_members.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ifstream/rdbuf/char/2832.cc
@@ -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;
}
diff --git a/libstdc++-v3/testsuite/27_io/ios.cc b/libstdc++-v3/testsuite/27_io/basic_ios/1.cc
index c1249381ac4..1b8de870501 100644
--- a/libstdc++-v3/testsuite/27_io/ios.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/1.cc
@@ -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;
-}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/2.cc b/libstdc++-v3/testsuite/27_io/basic_ios/2.cc
new file mode 100644
index 00000000000..56e2bd8ed69
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/2.cc
@@ -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
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/3.cc b/libstdc++-v3/testsuite/27_io/basic_ios/3.cc
new file mode 100644
index 00000000000..fa9e8b1804e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/3.cc
@@ -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!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/4.cc b/libstdc++-v3/testsuite/27_io/basic_ios/4.cc
new file mode 100644
index 00000000000..b527499dcb4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/4.cc
@@ -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!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/clear/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/clear/char/1.cc
new file mode 100644
index 00000000000..6629371ed03
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/clear/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_ctor.cc b/libstdc++-v3/testsuite/27_io/basic_ios/cons/char/1.cc
index 5736aebaa35..2c8993afd7e 100644
--- a/libstdc++-v3/testsuite/27_io/ios_ctor.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/cons/char/1.cc
@@ -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;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/cons/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ios/cons/char/2.cc
new file mode 100644
index 00000000000..84808f8b14f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/cons/char/2.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_init.cc b/libstdc++-v3/testsuite/27_io/basic_ios/cons/char/3.cc
index 33a52de9470..a0f7afa4287 100644
--- a/libstdc++-v3/testsuite/27_io/ios_init.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/cons/char/3.cc
@@ -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
@@ -119,159 +117,16 @@ namespace std
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;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc
new file mode 100644
index 00000000000..191cbb60830
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/2.cc
new file mode 100644
index 00000000000..03d45154e35
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/2.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc
new file mode 100644
index 00000000000..f593b90259d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/locales/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/locales/char/1.cc
new file mode 100644
index 00000000000..a95bd99c4dc
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/locales/char/1.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/iostream.cc b/libstdc++-v3/testsuite/27_io/basic_iostream/1.cc
index 943819bf82f..dfd9c0552b8 100644
--- a/libstdc++-v3/testsuite/27_io/iostream.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_iostream/1.cc
@@ -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;
-}
diff --git a/libstdc++-v3/testsuite/27_io/basic_iostream/2.cc b/libstdc++-v3/testsuite/27_io/basic_iostream/2.cc
new file mode 100644
index 00000000000..b77ec4f79f2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_iostream/2.cc
@@ -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
diff --git a/libstdc++-v3/testsuite/27_io/basic_iostream/3.cc b/libstdc++-v3/testsuite/27_io/basic_iostream/3.cc
new file mode 100644
index 00000000000..9cad3051aeb
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_iostream/3.cc
@@ -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!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_iostream/4.cc b/libstdc++-v3/testsuite/27_io/basic_iostream/4.cc
new file mode 100644
index 00000000000..dbcf8303746
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_iostream/4.cc
@@ -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!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream.cc b/libstdc++-v3/testsuite/27_io/basic_istream/1.cc
index c8146ea9236..3338af8279b 100644
--- a/libstdc++-v3/testsuite/27_io/istream.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/1.cc
@@ -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;
-}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/2.cc
new file mode 100644
index 00000000000..40ec332923d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/2.cc
@@ -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
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/3.cc b/libstdc++-v3/testsuite/27_io/basic_istream/3.cc
new file mode 100644
index 00000000000..1a7a04c703c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/3.cc
@@ -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!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/4.cc b/libstdc++-v3/testsuite/27_io/basic_istream/4.cc
new file mode 100644
index 00000000000..4282fef84b2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/4.cc
@@ -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!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_exception.cc b/libstdc++-v3/testsuite/27_io/basic_istream/exceptions/char/9561.cc
index 055c4fb02c5..055c4fb02c5 100644
--- a/libstdc++-v3/testsuite/27_io/istream_exception.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/exceptions/char/9561.cc
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/01.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/01.cc
index b2fdd2691e7..b2fdd2691e7 100644
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/01.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/01.cc
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/02.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/02.cc
index 374fbd8e0c7..374fbd8e0c7 100644
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/02.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/02.cc
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/03.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/03.cc
index 869d828b091..869d828b091 100644
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/03.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/03.cc
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/06.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/06.cc
index de92bcd52cb..de92bcd52cb 100644
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/06.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/06.cc
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/07.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/07.cc
index 118668ea1d9..118668ea1d9 100644
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/07.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/07.cc
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/08.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/08.cc
index f8491612ddf..f8491612ddf 100644
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/08.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/08.cc
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/09.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/09.cc
index 37e175e6f7c..37e175e6f7c 100644
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/09.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/09.cc
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/10.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc
index bc67190533f..bc67190533f 100644
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/10.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/11.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/11.cc
index 309875dfc54..309875dfc54 100644
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/11.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/11.cc
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/12.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/12.cc
index 64795c05812..64795c05812 100644
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/12.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/12.cc
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/13.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/13.cc
index 935d456f448..935d456f448 100644
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/13.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/13.cc
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_char.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/1.cc
index 87ab77d88a0..0a235bbe819 100644
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_char.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/1.cc
@@ -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;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/2.cc
new file mode 100644
index 00000000000..d48072cd329
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/2.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/3.cc
new file mode 100644
index 00000000000..1ab02a1990e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/3.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/stringstream.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/9826.cc
index a9778952d90..9d59395bde4 100644
--- a/libstdc++-v3/testsuite/27_io/stringstream.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/9826.cc
@@ -35,27 +35,6 @@
// { dg-do compile }
-// libstdc++/7216
-void test01()
-{
- // Check for required typedefs
- typedef std::stringstream 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;
-}
-
-namespace test
-{
- using namespace std;
- using __gnu_cxx_test::pod_char;
- typedef short type_t;
- template class basic_stringstream<type_t, char_traits<type_t> >;
- template class basic_stringstream<pod_char, char_traits<pod_char> >;
-} // test
-
// libstdc++/9826
void test02()
{
@@ -75,7 +54,6 @@ void test02()
int main()
{
- test01();
test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/1.cc
index fbf8f4293c6..c2afc80348c 100644
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/1.cc
@@ -1,6 +1,6 @@
// 1999-07-28 bkoz
-// Copyright (C) 1999, 2001 Free Software Foundation
+// Copyright (C) 1999, 2001, 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
@@ -27,10 +27,9 @@
#include <fstream>
#include <testsuite_hooks.h>
-
// stringbufs.
-bool test01() {
-
+void test01()
+{
typedef std::ios::traits_type ctraits_type;
bool test = true;
@@ -135,74 +134,10 @@ bool test01() {
VERIFY( strtmp == str_02 ); // as only an "in" buffer
VERIFY( isbuf_03.sgetc() == 'a' );
VERIFY( is_04.peek() == ctraits_type::eof() );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return test;
-}
-
-// filebufs.
-bool test02() {
-
- bool test = true;
- typedef std::ios::traits_type ctraits_type;
- const char name_01[] = "istream_extractor_other-1.txt"; //read
- const char name_02[] = "istream_extractor_other-2.txt"; //write
-
- std::filebuf fbin, fbout;
- fbin.open(name_01, std::ios_base::in);
- fbout.open(name_02, std::ios_base::out | std::ios_base::trunc);
- VERIFY( fbin.is_open() );
- VERIFY( fbout.is_open() );
-
- if (test)
- {
- std::istream is(&fbin);
- is.unsetf(std::ios_base::skipws);
- is >> &fbout;
- }
-
- fbout.close();
- fbin.close();
- VERIFY( !fbin.is_open() );
- VERIFY( !fbout.is_open() );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return test;
-}
-
-void test03()
-{
- using namespace std;
- bool test = true;
-
- // template<_CharT, _Traits>
- // basic_istream& operator>>(ios_base& (*pf) (ios_base&))
- {
- int i = 0;
- std::istringstream iss(" 43");
- iss >> std::noskipws >> i;
- std::ios::iostate i3 = iss.rdstate();
- VERIFY ( !iss ); //should set failbit
- }
-
- // template<_CharT, _Traits>
- // basic_istream& operator>>(basic_ios& (*pf) (basic_ios&))
-
- // template<_CharT, _Traits>
- // basic_istream& operator>>(basic_istream& (*pf) (basic_istream&))
}
-
int main()
{
test01();
- test02();
- test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/2.cc
new file mode 100644
index 00000000000..3492a1e1158
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/2.cc
@@ -0,0 +1,61 @@
+// 1999-07-28 bkoz
+
+// Copyright (C) 1999, 2001, 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 basic_istream::operator>>
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// filebufs.
+void test02()
+{
+ bool test = true;
+ typedef std::ios::traits_type ctraits_type;
+ const char name_01[] = "istream_extractor_other-1.txt"; //read
+ const char name_02[] = "istream_extractor_other-2.txt"; //write
+
+ std::filebuf fbin, fbout;
+ fbin.open(name_01, std::ios_base::in);
+ fbout.open(name_02, std::ios_base::out | std::ios_base::trunc);
+ VERIFY( fbin.is_open() );
+ VERIFY( fbout.is_open() );
+
+ if (test)
+ {
+ std::istream is(&fbin);
+ is.unsetf(std::ios_base::skipws);
+ is >> &fbout;
+ }
+
+ fbout.close();
+ fbin.close();
+ VERIFY( !fbin.is_open() );
+ VERIFY( !fbout.is_open() );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/3.cc
new file mode 100644
index 00000000000..9182033937d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/3.cc
@@ -0,0 +1,56 @@
+// 1999-07-28 bkoz
+
+// Copyright (C) 1999, 2001, 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 basic_istream::operator>>
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(ios_base& (*pf) (ios_base&))
+ {
+ int i = 0;
+ std::istringstream iss(" 43");
+ iss >> std::noskipws >> i;
+ std::ios::iostate i3 = iss.rdstate();
+ VERIFY ( !iss ); //should set failbit
+ }
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(basic_ios& (*pf) (basic_ios&))
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(basic_istream& (*pf) (basic_istream&))
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/9318-in.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/9318-in.cc
new file mode 100644
index 00000000000..6251a381575
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/9318-in.cc
@@ -0,0 +1,73 @@
+// 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 <cstring> // for memset, memcmp
+#include <streambuf>
+#include <sstream>
+#include <ostream>
+#include <testsuite_hooks.h>
+
+// libstdc++/9318
+class Outbuf : public std::streambuf
+{
+public:
+ typedef std::streambuf::traits_type traits_type;
+
+ std::string result() const { return str; }
+
+protected:
+ virtual int_type overflow(int_type c = traits_type::eof())
+ {
+ if (!traits_type::eq_int_type(c, traits_type::eof()))
+ str.push_back(traits_type::to_char_type(c));
+ return traits_type::not_eof(c);
+ }
+
+private:
+ std::string str;
+};
+
+void test09()
+{
+ bool test = true;
+
+ std::istringstream stream("Bad Moon Rising");
+ Outbuf buf;
+ stream >> &buf;
+
+ VERIFY( buf.result() == "Bad Moon Rising" );
+}
+
+int main()
+{
+ test09();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/9424-in.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/9424-in.cc
new file mode 100644
index 00000000000..3c9266b498b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/9424-in.cc
@@ -0,0 +1,113 @@
+// 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 <cstring> // for memset, memcmp
+#include <streambuf>
+#include <sstream>
+#include <ostream>
+#include <testsuite_hooks.h>
+
+// libstdc++/9424
+class Outbuf_2 : public std::streambuf
+{
+ char buf[1];
+
+public:
+ Outbuf_2()
+ {
+ setp(buf, buf + 1);
+ }
+
+ int_type overflow(int_type c)
+ {
+ int_type eof = traits_type::eof();
+
+ if (pptr() < epptr())
+ {
+ if (traits_type::eq_int_type(c, eof))
+ return traits_type::not_eof(c);
+
+ *pptr() = traits_type::to_char_type(c);
+ pbump(1);
+ return c;
+ }
+
+ return eof;
+ }
+};
+
+class Inbuf_2 : public std::streambuf
+{
+ static const char buf[];
+ const char* current;
+ int size;
+
+public:
+ Inbuf_2()
+ {
+ current = buf;
+ size = std::strlen(buf);
+ }
+
+ int_type underflow()
+ {
+ if (current < buf + size)
+ return traits_type::to_int_type(*current);
+ return traits_type::eof();
+ }
+
+ int_type uflow()
+ {
+ if (current < buf + size)
+ return traits_type::to_int_type(*current++);
+ return traits_type::eof();
+ }
+};
+
+const char Inbuf_2::buf[] = "Atteivlis";
+
+void test11()
+{
+ bool test = true;
+
+ Inbuf_2 inbuf1;
+ std::istream is(&inbuf1);
+ Outbuf_2 outbuf1;
+ is >> &outbuf1;
+ VERIFY( inbuf1.sgetc() == 't' );
+ VERIFY( is.good() );
+}
+
+int main()
+{
+ test11();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/get/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/get/char/1.cc
new file mode 100644
index 00000000000..446b6d9c94c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/get/char/1.cc
@@ -0,0 +1,128 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.3 unformatted input functions
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <cstring> // for strncmp,...
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+void
+test03()
+{
+ typedef std::char_traits<char> traits_type;
+
+ bool test = true;
+ const char str_lit01[] =
+ " sun*ra \n\t\t\t & his arkestra, featuring john gilmore: \n"
+ " "
+ "jazz in silhouette: images and forecasts of tomorrow";
+
+ std::string str01(str_lit01);
+ std::string strtmp;
+
+ std::stringbuf sbuf_03;
+ std::stringbuf sbuf_04(str01, std::ios_base::in);
+ std::stringbuf sbuf_05(str01, std::ios_base::in);
+
+ std::istream is_00(NULL);
+ std::istream is_04(&sbuf_04);
+ std::istream is_05(&sbuf_05);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+ std::streamsize count1, count2;
+ char carray1[400] = "";
+
+ // int_type get()
+ // istream& get(char*, streamsize, char delim)
+ // istream& get(char*, streamsize)
+ // istream& get(streambuf&, char delim)
+ // istream& get(streambuf&)
+ is_00.get(carray1, 2);
+ VERIFY( static_cast<bool>(is_00.rdstate() & statefail) );
+ VERIFY( is_00.gcount() == 0 );
+
+ is_04.get(carray1, 4);
+ VERIFY( !(is_04.rdstate() & statefail) );
+ VERIFY( !traits_type::compare(carray1, " ", 4) );
+ VERIFY( is_04.gcount() == 3 );
+
+ is_04.clear();
+ is_04.get(carray1 + 3, 200);
+ VERIFY( !(is_04.rdstate() & statefail) );
+ VERIFY( !(is_04.rdstate() & stateeof) );
+ VERIFY( !traits_type::compare(carray1, str_lit01, 10) );
+ VERIFY( is_04.gcount() == 7 );
+
+ is_04.clear();
+ is_04.get(carray1, 200);
+ VERIFY( !(is_04.rdstate() & stateeof) );
+ VERIFY( static_cast<bool>(is_04.rdstate() & statefail) ); // delimiter
+ VERIFY( is_04.gcount() == 0 );
+ is_04.clear();
+ is_04.get(carray1, 200, '[');
+ VERIFY( static_cast<bool>(is_04.rdstate() & stateeof) );
+ VERIFY( !(is_04.rdstate() & statefail) );
+ VERIFY( is_04.gcount() == 125 );
+ is_04.clear();
+ is_04.get(carray1, 200);
+ VERIFY( static_cast<bool>(is_04.rdstate() & stateeof) );
+ VERIFY( static_cast<bool>(is_04.rdstate() & statefail) );
+ VERIFY( is_04.gcount() == 0 );
+
+ std::stringbuf sbuf_02(std::ios_base::in);
+ is_05.clear();
+ is_05.get(sbuf_02);
+ VERIFY( is_05.gcount() == 0 );
+ VERIFY( static_cast<bool>(is_05.rdstate() & statefail) );
+ VERIFY( !(is_05.rdstate() & stateeof) );
+
+ is_05.clear();
+ is_05.get(sbuf_03);
+ VERIFY( is_05.gcount() == 10 );
+ VERIFY( sbuf_03.str() == " sun*ra " );
+ VERIFY( !(is_05.rdstate() & statefail) );
+ VERIFY( !(is_05.rdstate() & stateeof) );
+
+ is_05.clear();
+ is_05.get(sbuf_03, '|');
+ VERIFY( is_05.gcount() == 125 );
+ VERIFY( sbuf_03.str() == str_lit01 );
+ VERIFY( !(is_05.rdstate() & statefail) );
+ VERIFY( static_cast<bool>(is_05.rdstate() & stateeof) );
+
+ is_05.clear();
+ is_05.get(sbuf_03, '|');
+ VERIFY( is_05.gcount() == 0 );
+ VERIFY( static_cast<bool>(is_05.rdstate() & stateeof) );
+ VERIFY( static_cast<bool>(is_05.rdstate() & statefail) );
+}
+
+int
+main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/get/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/get/char/2.cc
new file mode 100644
index 00000000000..fa351444fb4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/get/char/2.cc
@@ -0,0 +1,59 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.3 unformatted input functions
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <cstring> // for strncmp,...
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+//libstdc++/92: Bug in istream::get(basic_streambuf*)
+// bug reported by bgarcia@laurelnetworks.com
+// http://gcc.gnu.org/ml/libstdc++-prs/2000-q3/msg00041.html
+void
+test07()
+{
+ bool test = true;
+ const char* tfn = "istream_unformatted-1.txt";
+ std::ifstream infile;
+ infile.open(tfn);
+ VERIFY( !(!infile) );
+ while (infile)
+ {
+ std::string line;
+ std::ostringstream line_ss;
+ while (infile.peek() == '\n')
+ infile.get();
+ infile.get(*(line_ss.rdbuf()));
+ line = line_ss.str();
+ VERIFY( line == "1234567890" || line == "" );
+ }
+}
+
+int
+main()
+{
+ test07();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/getline/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/getline/char/1.cc
new file mode 100644
index 00000000000..6df68c78460
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/getline/char/1.cc
@@ -0,0 +1,125 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.3 unformatted input functions
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <cstring> // for strncmp,...
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+void
+test02()
+{
+ typedef std::char_traits<char> traits_type;
+
+ bool test = true;
+ const char str_lit01[] = "\t\t\t sun*ra \n"
+ " "
+ "and his myth science arkestra present\n"
+ " "
+ "angles and demons @ play\n"
+ " "
+ "the nubians of plutonia";
+ std::string str01(str_lit01);
+ std::string strtmp;
+
+ std::stringbuf sbuf_04(str01, std::ios_base::in);
+
+ std::istream is_00(NULL);
+ std::istream is_04(&sbuf_04);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+ std::streamsize count1, count2;
+ char carray1[400] = "";
+
+ // istream& getline(char* s, streamsize n, char delim)
+ // istream& getline(char* s, streamsize n)
+ state1 = is_00.rdstate();
+ is_00.getline(carray1, 20, '*');
+ state2 = is_00.rdstate();
+ // make sure failbit was set, since we couldn't extract
+ // from the NULL streambuf...
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+
+ VERIFY( is_04.gcount() == 0 );
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 1, '\t'); // extracts, throws away
+ state2 = is_04.rdstate();
+ VERIFY( is_04.gcount() == 1 );
+ VERIFY( state1 == state2 );
+ VERIFY( state1 == 0 );
+ VERIFY( !traits_type::compare("", carray1, 1) );
+
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 20, '*');
+ state2 = is_04.rdstate();
+ VERIFY( is_04.gcount() == 10 );
+ VERIFY( state1 == state2 );
+ VERIFY( state1 == 0 );
+ VERIFY( !traits_type::compare("\t\t sun", carray1, 10) );
+
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 20);
+ state2 = is_04.rdstate();
+ VERIFY( is_04.gcount() == 4 );
+ VERIFY( state1 == state2 );
+ VERIFY( state1 == 0 );
+ VERIFY( !traits_type::compare("ra ", carray1, 4) );
+
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 65);
+ state2 = is_04.rdstate();
+ VERIFY( is_04.gcount() == 64 );
+ VERIFY( state1 != state2 );
+ VERIFY( state2 == statefail );
+ VERIFY( !traits_type::compare(
+ " and his myth science arkestra presen",
+ carray1, 65) );
+
+ is_04.clear();
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 120, '|');
+ state2 = is_04.rdstate();
+ VERIFY( is_04.gcount() == 106 );
+ VERIFY( state1 != state2 );
+ VERIFY( state2 == stateeof );
+
+ is_04.clear();
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 100, '|');
+ state2 = is_04.rdstate();
+ VERIFY( is_04.gcount() == 0 );
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & stateeof) );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+}
+
+int
+main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/getline/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/getline/char/2.cc
new file mode 100644
index 00000000000..53b14a985f5
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/getline/char/2.cc
@@ -0,0 +1,103 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.3 unformatted input functions
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <cstring> // for strncmp,...
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// [patch] bits/istream.tcc - getline(char_type*,streamsize,char_type)
+// http://gcc.gnu.org/ml/libstdc++/2000-07/msg00003.html
+void
+test05()
+{
+ const char* charray = "\n"
+"a\n"
+"aa\n"
+"aaa\n"
+"aaaa\n"
+"aaaaa\n"
+"aaaaaa\n"
+"aaaaaaa\n"
+"aaaaaaaa\n"
+"aaaaaaaaa\n"
+"aaaaaaaaaa\n"
+"aaaaaaaaaaa\n"
+"aaaaaaaaaaaa\n"
+"aaaaaaaaaaaaa\n"
+"aaaaaaaaaaaaaa\n";
+
+ bool test = true;
+ const std::streamsize it = 5;
+ std::streamsize br = 0;
+ char tmp[it];
+ std::stringbuf sb(charray, std::ios_base::in);
+ std::istream ifs(&sb);
+ std::streamsize blen = std::strlen(charray);
+ VERIFY(!(!ifs));
+ while(ifs.getline(tmp, it) || ifs.gcount())
+ {
+ br += ifs.gcount();
+ if(ifs.eof())
+ {
+ // Just sanity checks to make sure we've extracted the same
+ // number of chars that were in the streambuf
+ VERIFY(br == blen);
+ // Also, we should only set the failbit if we could
+ // _extract_ no chars from the stream, i.e. the first read
+ // returned EOF.
+ VERIFY(ifs.fail() && ifs.gcount() == 0);
+ }
+ else if(ifs.fail())
+ {
+ // delimiter not read
+ //
+ // either
+ // -> extracted no characters
+ // or
+ // -> n - 1 characters are stored
+ ifs.clear(ifs.rdstate() & ~std::ios::failbit);
+ VERIFY((ifs.gcount() == 0) || (std::strlen(tmp) == it - 1));
+ VERIFY(!(!ifs));
+ continue;
+ }
+ else
+ {
+ // delimiter was read.
+ //
+ // -> strlen(__s) < n - 1
+ // -> delimiter was seen -> gcount() > strlen(__s)
+ VERIFY(ifs.gcount() == std::strlen(tmp) + 1);
+ continue;
+ }
+ }
+}
+
+int
+main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/getline/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_istream/getline/char/3.cc
new file mode 100644
index 00000000000..f4627ef7e29
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/getline/char/3.cc
@@ -0,0 +1,64 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.3 unformatted input functions
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <cstring> // for strncmp,...
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// [bug] istream::getline(char*,streamsize) still broken
+// http://gcc.gnu.org/ml/libstdc++/2000-07/msg00126.html
+// brent verner <brent at rcfile dot org
+void
+test06()
+{
+ using namespace std;
+
+ bool test = true;
+ const streamsize it = 5;
+ char tmp[it];
+ const char* str_lit = "abcd\n";
+
+ stringbuf strbuf(str_lit, std::ios_base::in);
+ istream istr(&strbuf);
+
+ istr.getline(tmp,it);
+ VERIFY( istr.gcount() == it ); // extracted whole string
+ VERIFY( strlen(tmp) == 4 ); // stored all but '\n'
+ VERIFY( !istr.eof() ); // extracted up to but not eof
+ VERIFY( !istr.fail() ); // failbit not set
+
+ char c = 'z';
+ istr.get(c);
+ VERIFY( c == 'z' );
+ VERIFY( istr.eof() );
+}
+
+int
+main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/1.cc
new file mode 100644
index 00000000000..cc6a9a564dc
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/1.cc
@@ -0,0 +1,84 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.3 unformatted input functions
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <cstring> // for strncmp,...
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ typedef std::ios::traits_type traits_type;
+
+ bool test = true;
+ const std::string str_01;
+ const std::string str_02("soul eyes: john coltrane quartet");
+ std::string strtmp;
+
+ std::stringbuf isbuf_03(str_02, std::ios_base::in);
+ std::stringbuf isbuf_04(str_02, std::ios_base::in);
+
+ std::istream is_00(NULL);
+ std::istream is_03(&isbuf_03);
+ std::istream is_04(&isbuf_04);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+ // istream& read(char_type* s, streamsize n)
+ char carray[60] = "";
+ is_04.read(carray, 9);
+ VERIFY( is_04.peek() == ':' );
+
+ // istream& ignore(streamsize n = 1, int_type delim = traits::eof())
+ state1 = is_04.rdstate();
+ is_04.ignore();
+ VERIFY( is_04.gcount() == 1 );
+ state2 = is_04.rdstate();
+ VERIFY( state1 == state2 );
+ VERIFY( is_04.peek() == ' ' );
+
+ state1 = is_04.rdstate();
+ is_04.ignore(0);
+ VERIFY( is_04.gcount() == 0 );
+ state2 = is_04.rdstate();
+ VERIFY( state1 == state2 );
+ VERIFY( is_04.peek() == ' ' );
+
+ state1 = is_04.rdstate();
+ is_04.ignore(5, traits_type::to_int_type(' '));
+ VERIFY( is_04.gcount() == 1 );
+ state2 = is_04.rdstate();
+ VERIFY( state1 == state2 );
+ VERIFY( is_04.peek() == 'j' );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/6360.cc b/libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/6360.cc
new file mode 100644
index 00000000000..8e79620aafe
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/6360.cc
@@ -0,0 +1,52 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.3 unformatted input functions
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <cstring> // for strncmp,...
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// 2002-04-19 PR libstdc++ 6360
+void
+test08()
+{
+ using namespace std;
+ bool test = true;
+
+ stringstream ss("abcd" "\xFF" "1234ina donna coolbrith");
+ char c;
+ ss >> c;
+ VERIFY( c == 'a' );
+ ss.ignore(8);
+ ss >> c;
+ VERIFY( c == 'i' );
+}
+
+int
+main()
+{
+ test08();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/7220.cc b/libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/7220.cc
new file mode 100644
index 00000000000..87ac36ab659
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/7220.cc
@@ -0,0 +1,73 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.3 unformatted input functions
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <cstring> // for strncmp,...
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/70220
+void
+test10()
+{
+ using namespace std;
+ bool test = true;
+ typedef string string_type;
+ typedef stringbuf stringbuf_type;
+ typedef istream istream_type;
+
+ int res = 0;
+ streamsize n;
+ string_type input("abcdefg\n");
+ stringbuf_type sbuf(input);
+ istream_type istr(&sbuf);
+
+ istr.ignore(0);
+ if (istr.gcount() != 0)
+ test = false;
+ VERIFY( test );
+
+ istr.ignore(0, 'b');
+ if (istr.gcount() != 0)
+ test = false;
+ VERIFY( test );
+
+ istr.ignore(); // Advance to next position.
+ istr.ignore(0, 'b');
+ if ((n=istr.gcount()) != 0)
+ test = false;
+ VERIFY( test );
+
+ if (istr.peek() != 'b')
+ test = false;
+ VERIFY( test );
+}
+
+int
+main()
+{
+ test10();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/peek/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/peek/char/1.cc
new file mode 100644
index 00000000000..53317ede0db
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/peek/char/1.cc
@@ -0,0 +1,98 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.3 unformatted input functions
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <cstring> // for strncmp,...
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ typedef std::ios::traits_type traits_type;
+
+ bool test = true;
+ const std::string str_01;
+ const std::string str_02("soul eyes: john coltrane quartet");
+ std::string strtmp;
+
+ std::stringbuf isbuf_03(str_02, std::ios_base::in);
+ std::stringbuf isbuf_04(str_02, std::ios_base::in);
+
+ std::istream is_00(NULL);
+ std::istream is_03(&isbuf_03);
+ std::istream is_04(&isbuf_04);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+ char carray[60] = "";
+
+ // istream& ignore(streamsize n = 1, int_type delim = traits::eof())
+ is_04.read(carray, 9);
+ VERIFY( is_04.peek() == ':' );
+
+ state1 = is_04.rdstate();
+ is_04.ignore();
+ VERIFY( is_04.gcount() == 1 );
+ state2 = is_04.rdstate();
+ VERIFY( state1 == state2 );
+ VERIFY( is_04.peek() == ' ' );
+
+ state1 = is_04.rdstate();
+ is_04.ignore(0);
+ VERIFY( is_04.gcount() == 0 );
+ state2 = is_04.rdstate();
+ VERIFY( state1 == state2 );
+ VERIFY( is_04.peek() == ' ' );
+
+ state1 = is_04.rdstate();
+ is_04.ignore(5, traits_type::to_int_type(' '));
+ VERIFY( is_04.gcount() == 1 );
+ state2 = is_04.rdstate();
+ VERIFY( state1 == state2 );
+ VERIFY( is_04.peek() == 'j' );
+
+ // int_type peek()
+ state1 = is_04.rdstate();
+ VERIFY( is_04.peek() == 'j' );
+ VERIFY( is_04.gcount() == 0 );
+ state2 = is_04.rdstate();
+ VERIFY( state1 == state2 );
+
+ is_04.ignore(30);
+ state1 = is_04.rdstate();
+ VERIFY( is_04.peek() == traits_type::eof() );
+ VERIFY( is_04.gcount() == 0 );
+ state2 = is_04.rdstate();
+ VERIFY( state1 != state2 );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/peek/char/6414.cc b/libstdc++-v3/testsuite/27_io/basic_istream/peek/char/6414.cc
new file mode 100644
index 00000000000..4fbd5cc8499
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/peek/char/6414.cc
@@ -0,0 +1,51 @@
+// 2000-06-29 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 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.3 unformatted input functions
+// NB: ostream has a particular "seeks" category. Adopt this for istreams too.
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// fstreams
+void test04(void)
+{
+ bool test = true;
+ std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
+ const char str_lit01[] = "istream_seeks-1.txt";
+ std::ifstream if01(str_lit01, std::ios_base::in | std::ios_base::out);
+
+ // libstdc++/6414
+ if01.seekg(0, std::ios_base::beg);
+ pos01 = if01.tellg();
+ if01.peek();
+ pos02 = if01.tellg();
+ VERIFY( pos02 == pos01 );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/putback/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/putback/char/1.cc
new file mode 100644
index 00000000000..17b55d8e9a0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/putback/char/1.cc
@@ -0,0 +1,80 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.3 unformatted input functions
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <cstring> // for strncmp,...
+#include <istream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ typedef std::ios::traits_type traits_type;
+
+ bool test = true;
+ const std::string str_01;
+ const std::string str_02("soul eyes: john coltrane quartet");
+ std::string strtmp;
+
+ std::stringbuf isbuf_03(str_02, std::ios_base::in);
+ std::stringbuf isbuf_04(str_02, std::ios_base::in);
+
+ std::istream is_00(NULL);
+ std::istream is_03(&isbuf_03);
+ std::istream is_04(&isbuf_04);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+ char carray[60] = "";
+
+ // istream& putback(char c)
+ is_04.ignore(30);
+ is_04.clear();
+ state1 = is_04.rdstate();
+ is_04.putback('|');
+ VERIFY( is_04.gcount() == 0 );
+ state2 = is_04.rdstate();
+ VERIFY( state1 == state2 );
+ VERIFY( is_04.peek() == '|' );
+
+ // istream& unget()
+ is_04.clear();
+ state1 = is_04.rdstate();
+ is_04.unget();
+ VERIFY( is_04.gcount() == 0 );
+ state2 = is_04.rdstate();
+ VERIFY( state1 == state2 );
+ VERIFY( is_04.peek() == 'r' );
+
+ // int sync()
+ int i = is_00.sync();
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/read/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/read/char/1.cc
new file mode 100644
index 00000000000..e79e4a206c0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/read/char/1.cc
@@ -0,0 +1,79 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.3 unformatted input functions
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <cstring> // for strncmp,...
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ typedef std::ios::traits_type traits_type;
+
+ bool test = true;
+ const std::string str_01;
+ const std::string str_02("soul eyes: john coltrane quartet");
+ std::string strtmp;
+
+ std::stringbuf isbuf_03(str_02, std::ios_base::in);
+ std::stringbuf isbuf_04(str_02, std::ios_base::in);
+
+ std::istream is_00(NULL);
+ std::istream is_03(&isbuf_03);
+ std::istream is_04(&isbuf_04);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+ // istream& read(char_type* s, streamsize n)
+ char carray[60] = "";
+ state1 = is_04.rdstate();
+ is_04.read(carray, 0);
+ state2 = is_04.rdstate();
+ VERIFY( state1 == state2 );
+
+ state1 = is_04.rdstate();
+ is_04.read(carray, 9);
+ state2 = is_04.rdstate();
+ VERIFY( state1 == state2 );
+ VERIFY( !std::strncmp(carray, "soul eyes", 9) );
+ VERIFY( is_04.peek() == ':' );
+
+ state1 = is_03.rdstate();
+ is_03.read(carray, 60);
+ state2 = is_03.rdstate();
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & stateeof) );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+ VERIFY( !std::strncmp(carray, "soul eyes: john coltrane quartet", 35) );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/read/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/read/char/2.cc
new file mode 100644
index 00000000000..4133e1a8588
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/read/char/2.cc
@@ -0,0 +1,63 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.3 unformatted input functions
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <cstring> // for strncmp,...
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// Jim Parsons <parsons at clearway dot com>
+// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00177.html
+void
+test04()
+{
+ bool test = true;
+
+ const std::string str_00("Red_Garland_Qunitet-Soul_Junction");
+ std::string strtmp;
+ char c_array[str_00.size() + 4];
+
+ std::stringbuf isbuf_00(str_00, std::ios_base::in);
+ std::istream is_00(&isbuf_00);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+ state1 = stateeof | statefail;
+ VERIFY( is_00.gcount() == 0 );
+ is_00.read(c_array, str_00.size() + 1);
+ VERIFY( is_00.gcount() == str_00.size() );
+ VERIFY( is_00.rdstate() == state1 );
+
+ is_00.read(c_array, str_00.size());
+ VERIFY( is_00.rdstate() == state1 );
+}
+
+int
+main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/read/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_istream/read/char/3.cc
new file mode 100644
index 00000000000..3c418e943b0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/read/char/3.cc
@@ -0,0 +1,51 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.3 unformatted input functions
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <cstring> // for strncmp,...
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// Theodore Papadopoulo
+void
+test09()
+{
+ using namespace std;
+ bool test = true;
+
+ istringstream iss("Juana Briones");
+ char tab[13];
+ iss.read(tab, 13);
+ if (!iss)
+ test = false;
+ VERIFY( test );
+}
+
+int
+main()
+{
+ test09();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/readsome/char/6746-1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/readsome/char/6746-1.cc
new file mode 100644
index 00000000000..f0109b0a661
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/readsome/char/6746-1.cc
@@ -0,0 +1,60 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.3 unformatted input functions
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <cstring> // for strncmp,...
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/6746
+void test12()
+{
+ using namespace std;
+ bool test = true;
+ streamsize sum = 0;
+ istringstream iss("shamma shamma");
+
+ // test01
+ size_t i = iss.rdbuf()->in_avail();
+ VERIFY( i != 0 );
+
+ // test02
+ streamsize extracted;
+ do
+ {
+ char buf[1024];
+ extracted = iss.readsome(buf, sizeof buf);
+ sum += extracted;
+ }
+ while (iss.good() && extracted);
+ VERIFY( sum != 0 );
+}
+
+int
+main()
+{
+ test12();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/readsome/char/6746-2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/readsome/char/6746-2.cc
new file mode 100644
index 00000000000..6d87a2959a3
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/readsome/char/6746-2.cc
@@ -0,0 +1,60 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.3 unformatted input functions
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <cstring> // for strncmp,...
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/6746
+void test13()
+{
+ using namespace std;
+ bool test = true;
+ streamsize sum = 0;
+ ifstream ifs("istream_unformatted-1.tst");
+
+ // test01
+ size_t i = ifs.rdbuf()->in_avail();
+ VERIFY( i != 0 );
+
+ // test02
+ streamsize extracted;
+ do
+ {
+ char buf[1024];
+ extracted = ifs.readsome(buf, sizeof buf);
+ sum += extracted;
+ }
+ while (ifs.good() && extracted);
+ VERIFY( sum != 0 );
+}
+
+int
+main()
+{
+ test13();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/readsome/char/8258.cc b/libstdc++-v3/testsuite/27_io/basic_istream/readsome/char/8258.cc
new file mode 100644
index 00000000000..fdb412ca125
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/readsome/char/8258.cc
@@ -0,0 +1,53 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.3 unformatted input functions
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <cstring> // for strncmp,...
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/8258
+class mybuf : public std::basic_streambuf<char>
+{ };
+
+void test11()
+{
+ bool test = true;
+ using namespace std;
+ char arr[10];
+ mybuf sbuf;
+ basic_istream<char, char_traits<char> > istr(&sbuf);
+
+ VERIFY(istr.rdstate() == ios_base::goodbit);
+ VERIFY(istr.readsome(arr, 10) == 0);
+ VERIFY(istr.rdstate() == ios_base::goodbit);
+}
+
+int
+main()
+{
+ test11();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2346-fstream.cc b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2346-fstream.cc
new file mode 100644
index 00000000000..4c4b25c57b4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2346-fstream.cc
@@ -0,0 +1,90 @@
+// 2000-06-29 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 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.3 unformatted input functions
+// NB: ostream has a particular "seeks" category. Adopt this for istreams too.
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+const char* s = " lootpack, peanut butter wolf, rob swift, madlib, quasimoto";
+const int times = 10;
+
+void write_rewind(std::iostream& stream)
+{
+ for (int j = 0; j < times; j++)
+ {
+ bool test = true;
+ std::streampos begin = stream.tellg();
+
+ for (int i = 0; i < times; ++i)
+ stream << j << '-' << i << s << '\n';
+
+ stream.seekg(begin);
+ std::streampos end = stream.tellg();
+ std::streampos badpos = std::streampos(std::streambuf::off_type(-1));
+ }
+}
+
+void check_contents(std::iostream& stream)
+{
+ bool test = true;
+
+ stream.clear();
+ stream.seekg(0, std::ios::beg);
+ int i = 0;
+ int loop = times * times + 2;
+ while (i < loop)
+ {
+ stream.ignore(80, '\n');
+ if (stream.good())
+ ++i;
+ else
+ break;
+ }
+ VERIFY( i == times );
+}
+
+// fstream
+// libstdc++/2346
+void test02()
+{
+ std::fstream ofstrm;
+ ofstrm.open("istream_seeks-3.txt", std::ios::out);
+ if (!ofstrm)
+ std::abort();
+ write_rewind(ofstrm);
+ ofstrm.close();
+
+ std::fstream ifstrm;
+ ifstrm.open("istream_seeks-3.txt", std::ios::in);
+ check_contents(ifstrm);
+ ifstrm.close();
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2346-sstream.cc b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2346-sstream.cc
new file mode 100644
index 00000000000..ab35ddba34f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2346-sstream.cc
@@ -0,0 +1,83 @@
+// 2000-06-29 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 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.3 unformatted input functions
+// NB: ostream has a particular "seeks" category. Adopt this for istreams too.
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+const char* s = " lootpack, peanut butter wolf, rob swift, madlib, quasimoto";
+const int times = 10;
+
+void write_rewind(std::iostream& stream)
+{
+ for (int j = 0; j < times; j++)
+ {
+ bool test = true;
+ std::streampos begin = stream.tellg();
+
+ for (int i = 0; i < times; ++i)
+ stream << j << '-' << i << s << '\n';
+
+ stream.seekg(begin);
+ std::streampos end = stream.tellg();
+ std::streampos badpos = std::streampos(std::streambuf::off_type(-1));
+ }
+}
+
+void check_contents(std::iostream& stream)
+{
+ bool test = true;
+
+ stream.clear();
+ stream.seekg(0, std::ios::beg);
+ int i = 0;
+ int loop = times * times + 2;
+ while (i < loop)
+ {
+ stream.ignore(80, '\n');
+ if (stream.good())
+ ++i;
+ else
+ break;
+ }
+ VERIFY( i == times );
+}
+
+// stringstream
+// libstdc++/2346
+void test03()
+{
+ std::stringstream sstrm;
+
+ write_rewind(sstrm);
+ check_contents(sstrm);
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/8348-1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/8348-1.cc
new file mode 100644
index 00000000000..823e237930a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/8348-1.cc
@@ -0,0 +1,55 @@
+// 2000-06-29 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 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.3 unformatted input functions
+// NB: ostream has a particular "seeks" category. Adopt this for istreams too.
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/8348
+void test06(void)
+{
+ using namespace std;
+ bool test = true;
+ string num1("555");
+
+ // seekg
+ {
+ istringstream iss(num1);
+ istream::pos_type pos1 = iss.tellg();
+ int asNum = 0;
+ iss >> asNum;
+ VERIFY( test = iss.eof() );
+ VERIFY( test = !iss.fail() );
+ iss.seekg(pos1);
+ VERIFY( test = !iss.fail() );
+ }
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/8348-2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/8348-2.cc
new file mode 100644
index 00000000000..aeed5325134
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/8348-2.cc
@@ -0,0 +1,55 @@
+// 2000-06-29 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 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.3 unformatted input functions
+// NB: ostream has a particular "seeks" category. Adopt this for istreams too.
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/8348
+void test06(void)
+{
+ using namespace std;
+ bool test = true;
+ string num1("555");
+
+ // seekg
+ {
+ istringstream iss(num1);
+ istream::pos_type pos1 = iss.tellg();
+ int asNum = 0;
+ iss >> asNum;
+ VERIFY( test = iss.eof() );
+ VERIFY( test = !iss.fail() );
+ iss.seekg(0, ios_base::beg);
+ VERIFY( test = !iss.fail() );
+ }
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/fstream.cc b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/fstream.cc
new file mode 100644
index 00000000000..27dca74fa5d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/fstream.cc
@@ -0,0 +1,127 @@
+// 2000-06-29 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 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.3 unformatted input functions
+// NB: ostream has a particular "seeks" category. Adopt this for istreams too.
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// fstreams
+void test04(void)
+{
+ typedef std::istream::off_type off_type;
+
+ bool test = true;
+ std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
+ std::ios_base::iostate state01, state02;
+ const char str_lit01[] = "istream_seeks-1.txt";
+ const char str_lit02[] = "istream_seeks-2.txt";
+ std::ifstream if01(str_lit01, std::ios_base::in | std::ios_base::out);
+ std::ifstream if02(str_lit01, std::ios_base::in);
+ std::ifstream if03(str_lit02, std::ios_base::out | std::ios_base::trunc);
+ VERIFY( if01.good() );
+ VERIFY( if02.good() );
+ VERIFY( if03.good() );
+
+ std::istream is01(if01.rdbuf());
+ std::istream is02(if02.rdbuf());
+ std::istream is03(if03.rdbuf());
+
+ pos01 = is01.tellg();
+ pos02 = is01.tellg();
+ pos03 = is02.tellg();
+ pos04 = is02.tellg();
+ pos05 = is03.tellg();
+ pos06 = is03.tellg();
+
+ // istream& seekg(pos_type)
+ // istream& seekg(off_type, ios_base::seekdir)
+
+ // cur
+ // NB: see library issues list 136. It's the v-3 interp that seekg
+ // only sets the input buffer, or else istreams with buffers that
+ // have _M_mode == ios_base::out will fail to have consistency
+ // between seekg and tellg.
+ state01 = is01.rdstate();
+ is01.seekg(10, std::ios_base::cur);
+ state02 = is01.rdstate();
+ pos01 = is01.tellg();
+ VERIFY( pos01 == pos02 + off_type(10) );
+ VERIFY( state01 == state02 );
+ pos02 = is01.tellg();
+ VERIFY( pos02 == pos01 );
+
+ state01 = is02.rdstate();
+ is02.seekg(10, std::ios_base::cur);
+ state02 = is02.rdstate();
+ pos03 = is02.tellg();
+ VERIFY( pos03 == pos04 + off_type(10) );
+ VERIFY( state01 == state02 );
+ pos04 = is02.tellg();
+ VERIFY( pos03 == pos04 );
+
+ state01 = is03.rdstate();
+ is03.seekg(10, std::ios_base::cur);
+ state02 = is03.rdstate();
+ pos05 = is03.tellg();
+ VERIFY( pos05 == pos06 + off_type(10) );
+ VERIFY( state01 == state02 );
+ pos06 = is03.tellg();
+ VERIFY( pos05 == pos06 );
+
+ // beg
+ state01 = is01.rdstate();
+ is01.seekg(20, std::ios_base::beg);
+ state02 = is01.rdstate();
+ pos01 = is01.tellg();
+ VERIFY( pos01 == pos02 + off_type(10) );
+ VERIFY( state01 == state02 );
+ pos02 = is01.tellg();
+ VERIFY( pos02 == pos01 );
+
+ state01 = is02.rdstate();
+ is02.seekg(20, std::ios_base::beg);
+ state02 = is02.rdstate();
+ pos03 = is02.tellg();
+ VERIFY( pos03 == pos04 + off_type(10) );
+ VERIFY( state01 == state02 );
+ pos04 = is02.tellg();
+ VERIFY( pos03 == pos04 );
+
+ state01 = is03.rdstate();
+ is03.seekg(20, std::ios_base::beg);
+ state02 = is03.rdstate();
+ pos05 = is03.tellg();
+ VERIFY( pos05 == pos06 + off_type(10) );
+ VERIFY( state01 == state02 );
+ pos06 = is03.tellg();
+ VERIFY( pos05 == pos06 );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/sstream.cc b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/sstream.cc
new file mode 100644
index 00000000000..cf1455fa0d4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/sstream.cc
@@ -0,0 +1,135 @@
+// 2000-06-29 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 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.3 unformatted input functions
+// NB: ostream has a particular "seeks" category. Adopt this for istreams too.
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// stringstreams
+void test05(void)
+{
+ typedef std::istream::off_type off_type;
+
+ bool test = true;
+ std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
+ std::ios_base::iostate state01, state02;
+ const char str_lit01[] = "istream_seeks-1.tst";
+ std::ifstream if01(str_lit01);
+ std::ifstream if02(str_lit01);
+ std::ifstream if03(str_lit01);
+ VERIFY( if01.good() );
+ VERIFY( if02.good() );
+ VERIFY( if03.good() );
+
+ std::stringbuf strbuf01(std::ios_base::in | std::ios_base::out);
+ if01 >> &strbuf01;
+ // initialize stringbufs that are ios_base::out
+ std::stringbuf strbuf03(strbuf01.str(), std::ios_base::out);
+ // initialize stringbufs that are ios_base::in
+ std::stringbuf strbuf02(strbuf01.str(), std::ios_base::in);
+
+ std::istream is01(&strbuf01);
+ std::istream is02(&strbuf02);
+ std::istream is03(&strbuf03);
+
+ // pos_type tellg()
+ // in | out
+ pos01 = is01.tellg();
+ pos02 = is01.tellg();
+ pos03 = is02.tellg();
+ pos04 = is02.tellg();
+ pos05 = is03.tellg();
+ pos06 = is03.tellg();
+
+ // istream& seekg(pos_type)
+ // istream& seekg(off_type, ios_base::seekdir)
+
+ // cur
+ // NB: see library issues list 136. It's the v-3 interp that seekg
+ // only sets the input buffer, or else istreams with buffers that
+ // have _M_mode == ios_base::out will fail to have consistency
+ // between seekg and tellg.
+ state01 = is01.rdstate();
+ is01.seekg(10, std::ios_base::cur);
+ state02 = is01.rdstate();
+ pos01 = is01.tellg();
+ VERIFY( pos01 == pos02 + off_type(10) );
+ VERIFY( state01 == state02 );
+ pos02 = is01.tellg();
+ VERIFY( pos02 == pos01 );
+
+ state01 = is02.rdstate();
+ is02.seekg(10, std::ios_base::cur);
+ state02 = is02.rdstate();
+ pos03 = is02.tellg();
+ VERIFY( pos03 == pos04 + off_type(10) );
+ VERIFY( state01 == state02 );
+ pos04 = is02.tellg();
+ VERIFY( pos03 == pos04 );
+
+ state01 = is03.rdstate();
+ is03.seekg(10, std::ios_base::cur);
+ state02 = is03.rdstate();
+ pos05 = is03.tellg();
+ VERIFY( pos05 == pos06 ); // as only out buffer
+ VERIFY( state01 != state02 );
+ pos06 = is03.tellg();
+ VERIFY( pos05 == pos06 );
+
+ // beg
+ state01 = is01.rdstate();
+ is01.seekg(20, std::ios_base::beg);
+ state02 = is01.rdstate();
+ pos01 = is01.tellg();
+ VERIFY( pos01 == pos02 + off_type(10) );
+ VERIFY( state01 == state02 );
+ pos02 = is01.tellg();
+ VERIFY( pos02 == pos01 );
+
+ state01 = is02.rdstate();
+ is02.seekg(20, std::ios_base::beg);
+ state02 = is02.rdstate();
+ pos03 = is02.tellg();
+ VERIFY( pos03 == pos04 + off_type(10) );
+ VERIFY( state01 == state02 );
+ pos04 = is02.tellg();
+ VERIFY( pos03 == pos04 );
+
+ state01 = is03.rdstate();
+ is03.seekg(20, std::ios_base::beg);
+ state02 = is03.rdstate();
+ pos05 = is03.tellg();
+ VERIFY( pos05 == pos06 ); // as only out buffer
+ VERIFY( state01 == state02 );
+ pos06 = is03.tellg();
+ VERIFY( pos05 == pos06 );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/istream_sentry.cc b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/1.cc
index faf8cfe53d0..1bc58ad20e7 100644
--- a/libstdc++-v3/testsuite/27_io/istream_sentry.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/1.cc
@@ -1,6 +1,6 @@
// 1999-10-14 bkoz
-// Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+// Copyright (C) 1999, 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
@@ -59,43 +59,8 @@ void test01()
VERIFY( bool(sentry04) == true );
}
-// libstdc++/944
-void
-test02()
-{
- using namespace std;
- istringstream in("80.21 56.89 12.3");
- bool test = true;
- int i = 0;
- double x;
-
- // ios_base::eof == 2
- while (in >> x)
- {
- ++i;
- if (i > 3)
- break;
- }
- VERIFY( i == 3 );
-}
-
-// libstdc++/9562
-void
-test03()
-{
- bool test = true;
-
- std::stringbuf strbuf01;
- std::istream strm1(&strbuf01);
- const std::istream::sentry sentry1(strm1);
-
- VERIFY( bool(sentry1) == false );
-}
-
int main()
{
test01();
- test02();
- test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/2.cc
new file mode 100644
index 00000000000..1e42d18ed83
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/2.cc
@@ -0,0 +1,60 @@
+// 1999-10-14 bkoz
+
+// Copyright (C) 1999, 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.
+
+// 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.2 class basic_istream::sentry
+
+#include <istream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/944
+void
+test02()
+{
+ using namespace std;
+ istringstream in("80.21 56.89 12.3");
+ bool test = true;
+ int i = 0;
+ double x;
+
+ // ios_base::eof == 2
+ while (in >> x)
+ {
+ ++i;
+ if (i > 3)
+ break;
+ }
+ VERIFY( i == 3 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/3.cc
new file mode 100644
index 00000000000..9f9e06a03d1
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/3.cc
@@ -0,0 +1,53 @@
+// 1999-10-14 bkoz
+
+// Copyright (C) 1999, 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.
+
+// 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.2 class basic_istream::sentry
+
+#include <istream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/9562
+void
+test03()
+{
+ bool test = true;
+
+ std::stringbuf strbuf01;
+ std::istream strm1(&strbuf01);
+ const std::istream::sentry sentry1(strm1);
+
+ VERIFY( bool(sentry1) == false );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/3983-fstream.cc b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/3983-fstream.cc
new file mode 100644
index 00000000000..99dd0b09bc1
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/3983-fstream.cc
@@ -0,0 +1,189 @@
+// 2001-06-05 Benjamin 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.
+
+// 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 <fstream>
+#include <testsuite_hooks.h>
+
+// char_traits specialization
+namespace std
+{
+ 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
+
+// libstdc++/3983
+// Sentry uses locale info, so have to try one formatted input/output.
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ // input streams
+ basic_ifstream<unsigned char> ifs_uc;
+ unsigned char arr[6] = { 'a', 'b', 'c', 'd', 'e' };
+
+ try
+ {
+ int i;
+ ifs_uc >> i;
+ }
+ catch (bad_cast& obj)
+ { }
+ catch (exception& obj)
+ { test = false; }
+
+ try
+ {
+ ifs_uc >> arr;
+ }
+ catch (bad_cast& obj)
+ { }
+ catch (exception& obj)
+ { test = false; }
+
+ try
+ {
+ ifs_uc >> ws;
+ }
+ catch (bad_cast& obj)
+ { }
+ catch (exception& obj)
+ { test = false; }
+
+ try
+ {
+ basic_string<unsigned char> s_uc(arr);
+ ifs_uc >> s_uc;
+ }
+ catch (bad_cast& obj)
+ { }
+ catch (exception& obj)
+ { test = false; }
+
+ VERIFY( test );
+}
+
+#if !__GXX_WEAK__
+// Explicitly instantiate for systems with no COMDAT or weak support.
+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()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/3983-sstream.cc b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/3983-sstream.cc
new file mode 100644
index 00000000000..6f51df5850d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/3983-sstream.cc
@@ -0,0 +1,189 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+// char_traits specialization
+namespace std
+{
+ 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
+
+// libstdc++/3983
+// Sentry uses locale info, so have to try one formatted input/output.
+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' };
+
+ 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; }
+
+ VERIFY( test );
+}
+
+#if !__GXX_WEAK__
+// Explicitly instantiate for systems with no COMDAT or weak support.
+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()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/1.cc
new file mode 100644
index 00000000000..6ec4d69f3fc
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/1.cc
@@ -0,0 +1,64 @@
+// 2000-06-29 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 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.3 unformatted input functions
+// NB: ostream has a particular "seeks" category. Adopt this for istreams too.
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef ios::pos_type pos_type;
+
+ bool test = true;
+ const char str_lit01[] = "istream_seeks-1.tst";
+
+ // in
+ // test default ctors leave things in the same positions...
+ istringstream ist1;
+ pos_type p3 = ist1.tellg();
+
+ ifstream ifs1;
+ pos_type p4 = ifs1.tellg();
+
+ VERIFY( p3 == p4 );
+
+ // in
+ // test ctors leave things in the same positions...
+ istringstream ist2("bob_marley:kaya");
+ p3 = ist2.tellg();
+
+ ifstream ifs2(str_lit01);
+ p4 = ifs2.tellg();
+
+ VERIFY( p3 == p4 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/8348.cc b/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/8348.cc
new file mode 100644
index 00000000000..771d25bfe9a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/8348.cc
@@ -0,0 +1,79 @@
+// 2000-06-29 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 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.3 unformatted input functions
+// NB: ostream has a particular "seeks" category. Adopt this for istreams too.
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/8348
+void test06(void)
+{
+ using namespace std;
+ bool test = true;
+ string num1("555");
+
+ // tellg
+ {
+ istringstream iss(num1);
+ istream::pos_type pos1 = iss.tellg();
+ int asNum = 0;
+ iss >> asNum;
+ VERIFY( test = iss.eof() );
+ VERIFY( test = !iss.fail() );
+ iss.tellg();
+ VERIFY( test = !iss.fail() );
+ }
+
+ // seekg
+ {
+ istringstream iss(num1);
+ istream::pos_type pos1 = iss.tellg();
+ int asNum = 0;
+ iss >> asNum;
+ VERIFY( test = iss.eof() );
+ VERIFY( test = !iss.fail() );
+ iss.seekg(0, ios_base::beg);
+ VERIFY( test = !iss.fail() );
+ }
+
+ // seekg
+ {
+ istringstream iss(num1);
+ istream::pos_type pos1 = iss.tellg();
+ int asNum = 0;
+ iss >> asNum;
+ VERIFY( test = iss.eof() );
+ VERIFY( test = !iss.fail() );
+ iss.seekg(pos1);
+ VERIFY( test = !iss.fail() );
+ }
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/fstream.cc b/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/fstream.cc
new file mode 100644
index 00000000000..d9d2f02dbb9
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/fstream.cc
@@ -0,0 +1,87 @@
+// 2000-06-29 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 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.3 unformatted input functions
+// NB: ostream has a particular "seeks" category. Adopt this for istreams too.
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// fstreams
+void test04(void)
+{
+ typedef std::istream::off_type off_type;
+
+ bool test = true;
+ std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
+ std::ios_base::iostate state01, state02;
+ const char str_lit01[] = "istream_seeks-1.txt";
+ const char str_lit02[] = "istream_seeks-2.txt";
+ std::ifstream if01(str_lit01, std::ios_base::in | std::ios_base::out);
+ std::ifstream if02(str_lit01, std::ios_base::in);
+ std::ifstream if03(str_lit02, std::ios_base::out | std::ios_base::trunc);
+ VERIFY( if01.good() );
+ VERIFY( if02.good() );
+ VERIFY( if03.good() );
+
+ std::istream is01(if01.rdbuf());
+ std::istream is02(if02.rdbuf());
+ std::istream is03(if03.rdbuf());
+
+ // pos_type tellg()
+ // in | out
+ pos01 = is01.tellg();
+ pos02 = is01.tellg();
+ VERIFY( pos01 == pos02 );
+
+ // in
+ pos03 = is02.tellg();
+ pos04 = is02.tellg();
+ VERIFY( pos03 == pos04 );
+
+ // out
+ pos05 = is03.tellg();
+ pos06 = is03.tellg();
+ VERIFY( pos05 == pos06 );
+
+ // cur
+ // NB: see library issues list 136. It's the v-3 interp that seekg
+ // only sets the input buffer, or else istreams with buffers that
+ // have _M_mode == ios_base::out will fail to have consistency
+ // between seekg and tellg.
+ state01 = is01.rdstate();
+ is01.seekg(10, std::ios_base::cur);
+ state02 = is01.rdstate();
+ pos01 = is01.tellg();
+ VERIFY( pos01 == pos02 + off_type(10) );
+ VERIFY( state01 == state02 );
+ pos02 = is01.tellg();
+ VERIFY( pos02 == pos01 );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/sstream.cc b/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/sstream.cc
new file mode 100644
index 00000000000..abc99f8bd6b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/sstream.cc
@@ -0,0 +1,93 @@
+// 2000-06-29 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 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.3 unformatted input functions
+// NB: ostream has a particular "seeks" category. Adopt this for istreams too.
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// stringstreams
+void test05(void)
+{
+ typedef std::istream::off_type off_type;
+
+ bool test = true;
+ std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
+ std::ios_base::iostate state01, state02;
+ const char str_lit01[] = "istream_seeks-1.tst";
+ std::ifstream if01(str_lit01);
+ std::ifstream if02(str_lit01);
+ std::ifstream if03(str_lit01);
+ VERIFY( if01.good() );
+ VERIFY( if02.good() );
+ VERIFY( if03.good() );
+
+ std::stringbuf strbuf01(std::ios_base::in | std::ios_base::out);
+ if01 >> &strbuf01;
+ // initialize stringbufs that are ios_base::out
+ std::stringbuf strbuf03(strbuf01.str(), std::ios_base::out);
+ // initialize stringbufs that are ios_base::in
+ std::stringbuf strbuf02(strbuf01.str(), std::ios_base::in);
+
+ std::istream is01(&strbuf01);
+ std::istream is02(&strbuf02);
+ std::istream is03(&strbuf03);
+
+ // pos_type tellg()
+ // in | out
+ pos01 = is01.tellg();
+ pos02 = is01.tellg();
+ VERIFY( pos01 == pos02 );
+
+ // in
+ pos03 = is02.tellg();
+ pos04 = is02.tellg();
+ VERIFY( pos03 == pos04 );
+
+ // out
+ pos05 = is03.tellg();
+ pos06 = is03.tellg();
+ VERIFY( pos05 == pos06 );
+
+ // cur
+ // NB: see library issues list 136. It's the v-3 interp that seekg
+ // only sets the input buffer, or else istreams with buffers that
+ // have _M_mode == ios_base::out will fail to have consistency
+ // between seekg and tellg.
+ state01 = is01.rdstate();
+ is01.seekg(10, std::ios_base::cur);
+ state02 = is01.rdstate();
+ pos01 = is01.tellg();
+ VERIFY( pos01 == pos02 + off_type(10) );
+ VERIFY( state01 == state02 );
+ pos02 = is01.tellg();
+ VERIFY( pos02 == pos01 );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/istream_manip.cc b/libstdc++-v3/testsuite/27_io/basic_istream/ws/char/1.cc
index 75eb79f135a..3761e948617 100644
--- a/libstdc++-v3/testsuite/27_io/istream_manip.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/ws/char/1.cc
@@ -1,6 +1,6 @@
// 1999-07-22 bkoz
-// Copyright (C) 1994, 1999, 2001 Free Software Foundation, Inc.
+// Copyright (C) 1994, 1999, 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
@@ -25,7 +25,7 @@
#include <stdexcept>
#include <testsuite_hooks.h>
-bool test01(void)
+void test01(void)
{
bool test = true;
@@ -72,12 +72,6 @@ bool test01(void)
iss01 >> std::ws;
VERIFY( !iss01.fail() );
VERIFY( iss01.eof() );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return test;
}
int main()
diff --git a/libstdc++-v3/testsuite/27_io/istringstream.cc b/libstdc++-v3/testsuite/27_io/basic_istringstream/1.cc
index d119f67e755..f8b76ee3e31 100644
--- a/libstdc++-v3/testsuite/27_io/istringstream.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istringstream/1.cc
@@ -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_istringstream<type_t, char_traits<type_t> >;
-} // test
-
-int main()
-{
- test01();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istringstream/2.cc b/libstdc++-v3/testsuite/27_io/basic_istringstream/2.cc
new file mode 100644
index 00000000000..becb4c8a81f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istringstream/2.cc
@@ -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.7.2 - Template class basic_istringstream
+// NB: This file is for testing basic_istringstream with NO OTHER INCLUDES.
+
+#include <sstream>
+
+// { dg-do compile }
+
+namespace test
+{
+ using namespace std;
+ typedef short type_t;
+ template class basic_istringstream<type_t, char_traits<type_t> >;
+} // test
diff --git a/libstdc++-v3/testsuite/27_io/basic_istringstream/3.cc b/libstdc++-v3/testsuite/27_io/basic_istringstream/3.cc
new file mode 100644
index 00000000000..9b5354531ca
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istringstream/3.cc
@@ -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 <sstream>
+#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_istringstream<gnu_char_type, gnu_char_traits> gnu_isstr;
+
+ try
+ {
+ gnu_isstr 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!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_istringstream/4.cc b/libstdc++-v3/testsuite/27_io/basic_istringstream/4.cc
new file mode 100644
index 00000000000..764dd1404f4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istringstream/4.cc
@@ -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 <sstream>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::istringstream 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!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istringstream_members.cc b/libstdc++-v3/testsuite/27_io/basic_istringstream/rdbuf/char/2832.cc
index cfc473621a2..59b601eef03 100644
--- a/libstdc++-v3/testsuite/27_io/istringstream_members.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istringstream/rdbuf/char/2832.cc
@@ -1,6 +1,6 @@
// 2000-01-10 bkoz
-// 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
@@ -23,57 +23,6 @@
#include <sstream>
#include <testsuite_hooks.h>
-void test01()
-{
- bool test = true;
- std::istringstream is01;
- const std::string str00;
- const std::string str01 = "123";
- std::string str02;
- const int i01 = 123;
- int a,b;
-
- std::ios_base::iostate state1, state2, statefail, stateeof;
- statefail = std::ios_base::failbit;
- stateeof = std::ios_base::eofbit;
-
- // string str() const
- str02 = is01.str();
- VERIFY( str00 == str02 );
-
- // void str(const basic_string&)
- is01.str(str01);
- str02 = is01.str();
- VERIFY( str01 == str02 );
- state1 = is01.rdstate();
- is01 >> a;
- state2 = is01.rdstate();
- VERIFY( a = i01 );
- // 22.2.2.1.2 num_get virtual functions
- // p 13
- // in any case, if stage 2 processing was terminated by the test for
- // in == end then err != ios_base::eofbit is performed.
- VERIFY( state1 != state2 );
- VERIFY( state2 == stateeof );
-
- is01.str(str01);
- is01 >> b;
- VERIFY( b != a );
- // as is01.good() is false, istream::sentry blocks extraction.
-
- is01.clear();
- state1 = is01.rdstate();
- is01 >> b;
- state2 = is01.rdstate();
- VERIFY( b == a );
- VERIFY( state1 != state2 );
- VERIFY( state2 == stateeof );
-
- #ifdef DEBUG_ASSERT
- assert(test);
-#endif
-}
-
void
redirect_buffer(std::ios& stream, std::streambuf* new_buf)
{ stream.rdbuf(new_buf); }
@@ -122,7 +71,6 @@ void test02()
int main()
{
- test01();
test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istringstream/str/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istringstream/str/char/1.cc
new file mode 100644
index 00000000000..32acd5b183c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istringstream/str/char/1.cc
@@ -0,0 +1,80 @@
+// 2000-01-10 bkoz
+
+// 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.7.2.2 member functions (istringstream_members)
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test = true;
+ std::istringstream is01;
+ const std::string str00;
+ const std::string str01 = "123";
+ std::string str02;
+ const int i01 = 123;
+ int a,b;
+
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+ // string str() const
+ str02 = is01.str();
+ VERIFY( str00 == str02 );
+
+ // void str(const basic_string&)
+ is01.str(str01);
+ str02 = is01.str();
+ VERIFY( str01 == str02 );
+ state1 = is01.rdstate();
+ is01 >> a;
+ state2 = is01.rdstate();
+ VERIFY( a = i01 );
+ // 22.2.2.1.2 num_get virtual functions
+ // p 13
+ // in any case, if stage 2 processing was terminated by the test for
+ // in == end then err != ios_base::eofbit is performed.
+ VERIFY( state1 != state2 );
+ VERIFY( state2 == stateeof );
+
+ is01.str(str01);
+ is01 >> b;
+ VERIFY( b != a );
+ // as is01.good() is false, istream::sentry blocks extraction.
+
+ is01.clear();
+ state1 = is01.rdstate();
+ is01 >> b;
+ state2 = is01.rdstate();
+ VERIFY( b == a );
+ VERIFY( state1 != state2 );
+ VERIFY( state2 == stateeof );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ofstream.cc b/libstdc++-v3/testsuite/27_io/basic_ofstream/1.cc
index 6b9d07d2523..497e4671b50 100644
--- a/libstdc++-v3/testsuite/27_io/ofstream.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ofstream/1.cc
@@ -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;
-}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ofstream/2.cc b/libstdc++-v3/testsuite/27_io/basic_ofstream/2.cc
new file mode 100644
index 00000000000..b13948945a6
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ofstream/2.cc
@@ -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.8 - Template class basic_ofstream
+// NB: This file is for testing basic_ofstream 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
diff --git a/libstdc++-v3/testsuite/27_io/basic_ofstream/3.cc b/libstdc++-v3/testsuite/27_io/basic_ofstream/3.cc
new file mode 100644
index 00000000000..0b2d7c979e3
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ofstream/3.cc
@@ -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_ofstream<gnu_char_type, gnu_char_traits> gnu_ofstr;
+
+ try
+ {
+ gnu_ofstr 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!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_ofstream/4.cc b/libstdc++-v3/testsuite/27_io/basic_ofstream/4.cc
new file mode 100644
index 00000000000..9d58396d193
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ofstream/4.cc
@@ -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 <ostream>
+#include <fstream>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::ofstream test_type;
+ typedef std::ostream base_type;
+ const test_type& obj = test_type();
+ const base_type* base = &obj;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
+// more surf!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_ofstream/cons/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ofstream/cons/char/2.cc
new file mode 100644
index 00000000000..14e217ec9c0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ofstream/cons/char/2.cc
@@ -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.10 ofstream member functions
+// @require@ %-*.tst
+// @diff@ %-*.tst %-*.txt
+
+#include <ostream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+const char name_02[] = "ofstream_members-1.txt";
+
+// 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::ofstream ifs(name_02);
+ VERIFY( static_cast<bool>(ifs) );
+ }
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/1.cc
new file mode 100644
index 00000000000..f97eec10454
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/1.cc
@@ -0,0 +1,58 @@
+// 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.10 ofstream member functions
+// @require@ %-*.tst
+// @diff@ %-*.tst %-*.txt
+
+#include <ostream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+const char name_01[] = "ofstream_members-1.tst";
+const char name_02[] = "ofstream_members-1.txt";
+
+// http://gcc.gnu.org/ml/libstdc++/2000-06/msg00136.html
+void test01()
+{
+ bool test = true;
+ std::ofstream ofs1;
+ ofs1.close();
+
+ // false as expected:
+ VERIFY( !ofs1.is_open() );
+ // this is now true:
+ VERIFY( !(ofs1) );
+
+ ofs1.open(name_02);
+ VERIFY( ofs1.is_open() );
+ // fail bit still true
+ VERIFY( !(ofs1) );
+ VERIFY( ofs1.rdstate() == std::ios_base::failbit );
+
+ ofs1.close();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ofstream_members.cc b/libstdc++-v3/testsuite/27_io/basic_ofstream/rdbuf/char/2832.cc
index 79c86e13066..7e897efdfaf 100644
--- a/libstdc++-v3/testsuite/27_io/ofstream_members.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ofstream/rdbuf/char/2832.cc
@@ -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
@@ -25,54 +25,6 @@
#include <testsuite_hooks.h>
const char name_01[] = "ofstream_members-1.tst";
-const char name_02[] = "ofstream_members-1.txt";
-
-// http://gcc.gnu.org/ml/libstdc++/2000-06/msg00136.html
-bool test00()
-{
- bool test = true;
- std::ofstream ofs1;
- ofs1.close();
-
- // false as expected:
- VERIFY( !ofs1.is_open() );
- // this is now true:
- VERIFY( !(ofs1) );
-
- ofs1.open(name_02);
- VERIFY( ofs1.is_open() );
- // fail bit still true
- VERIFY( !(ofs1) );
- VERIFY( ofs1.rdstate() == std::ios_base::failbit );
-
- ofs1.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::ofstream ifs(name_02);
- VERIFY( static_cast<bool>(ifs) );
- }
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return test;
-}
void
redirect_buffer(std::ios& stream, std::streambuf* new_buf)
@@ -83,7 +35,7 @@ active_buffer(std::ios& stream)
{ return stream.rdbuf(); }
// libstdc++/2832
-void test02()
+void test03()
{
bool test = true;
const char* strlit01 = "fuck war";
@@ -113,10 +65,7 @@ void test02()
int main()
{
- test00();
- test01();
-
- test02();
+ test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/ostream.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/1.cc
index 7efd65381a3..02401717813 100644
--- a/libstdc++-v3/testsuite/27_io/ostream.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/1.cc
@@ -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_ostream<type_t, char_traits<type_t> >;
- template class basic_ostream<pod_char, char_traits<pod_char> >;
-} // test
-
-int main()
-{
- test01();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/2.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/2.cc
new file mode 100644
index 00000000000..8c672b1f076
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/2.cc
@@ -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.2.1 basic_ostream
+// NB: This file is for testing ostream with NO OTHER INCLUDES.
+
+#include <ostream>
+#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_ostream<type_t, char_traits<type_t> >;
+ template class basic_ostream<pod_char, char_traits<pod_char> >;
+} // test
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/3.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/3.cc
new file mode 100644
index 00000000000..0c71061c3c7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/3.cc
@@ -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 <ostream>
+#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_ostream<gnu_char_type, gnu_char_traits> gnu_ostr;
+
+ try
+ {
+ gnu_ostr 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!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/4.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/4.cc
new file mode 100644
index 00000000000..b1b669c942f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/4.cc
@@ -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 <ostream>
+#include <sstream>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::ostream 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!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream_fail.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/cons/char/9827.cc
index 77b29eab635..7a4f26396d8 100644
--- a/libstdc++-v3/testsuite/27_io/ostream_fail.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/cons/char/9827.cc
@@ -27,25 +27,18 @@ class Buf : public std::streambuf
{
};
-bool test01()
+void test01()
{
using namespace std;
bool test = true;
Buf buf;
- ostream stream (&buf);
+ ostream stream(&buf);
stream << 1;
VERIFY(!stream.good());
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return test;
}
-
int main()
{
test01();
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/endl/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/endl/char/1.cc
new file mode 100644
index 00000000000..8e69c421dd1
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/endl/char/1.cc
@@ -0,0 +1,59 @@
+// 1999-07-22 bkoz
+
+// Copyright (C) 1994, 1999, 2000, 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.6.2.7 standard basic_ostream manipulators
+
+#include <ostream>
+#include <sstream>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void test01(void)
+{
+ bool test = true;
+
+ const char str_lit01[] = " venice ";
+ const std::string str01(" santa barbara ");
+ std::string str02(str_lit01);
+ std::string str04;
+ std::string str05;
+ std::ios_base::iostate flag1, flag2, flag3, flag4, flag5;
+
+ std::ostringstream oss01(str01);
+ std::ostringstream oss02;
+ std::ostringstream::int_type i01, i02;
+ typedef std::ostringstream::traits_type traits_type;
+
+ // template<_CharT, _Traits>
+ // basic_ostream<_CharT, _Traits>& ends(basic_ostream<_Char, _Traits>& os)
+ oss01 << std::endl;
+ str04 = oss01.str();
+ VERIFY( str04.size() == str01.size() );
+
+ oss02 << std::endl;
+ str05 = oss02.str();
+ VERIFY( str05.size() == 1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/ends/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/ends/char/1.cc
new file mode 100644
index 00000000000..a3c11791737
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/ends/char/1.cc
@@ -0,0 +1,61 @@
+// 1999-07-22 bkoz
+
+// Copyright (C) 1994, 1999, 2000, 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.6.2.7 standard basic_ostream manipulators
+
+#include <ostream>
+#include <sstream>
+#include <stdexcept>
+//#include <testsuite_hooks.h>
+#define VERIFY(x) test&=x
+
+void test01(void)
+{
+ bool test = true;
+
+ const char str_lit01[] = " venice ";
+ const std::string str01(" santa barbara ");
+ std::string str02(str_lit01);
+ std::string str04;
+ std::string str05;
+ std::ios_base::iostate flag1, flag2, flag3, flag4, flag5;
+
+ std::ostringstream oss01(str01);
+ std::ostringstream oss02;
+ std::ostringstream::int_type i01, i02;
+ typedef std::ostringstream::traits_type traits_type;
+
+ // template<_CharT, _Traits>
+ // basic_ostream<_CharT, _Traits>& ends(basic_ostream<_Char, _Traits>& os)
+ oss01 << std::ends;
+ str04 = oss01.str();
+ VERIFY( str04.size() == str01.size() );
+
+ oss02 << std::ends;
+ str05 = oss02.str();
+ VERIFY( str05.size() == 1 );
+ VERIFY( str05[0] == char() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ostream_manip.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/ends/char/2.cc
index d0837f5ac47..34de949e4bb 100644
--- a/libstdc++-v3/testsuite/27_io/ostream_manip.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/ends/char/2.cc
@@ -1,6 +1,6 @@
// 1999-07-22 bkoz
-// Copyright (C) 1994, 1999, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1994, 1999, 2000, 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
@@ -25,64 +25,9 @@
#include <stdexcept>
#include <testsuite_hooks.h>
-bool test01(void)
-{
- bool test = true;
-
- const char str_lit01[] = " venice ";
- const std::string str01(" santa barbara ");
- std::string str02(str_lit01);
- std::string str04;
- std::string str05;
- std::ios_base::iostate flag1, flag2, flag3, flag4, flag5;
-
- // template<_CharT, _Traits>
- // basic_ostream<_CharT, _Traits>& endl(basic_ostream<_Char, _Traits>& os)
- std::ostringstream oss01(str01);
- std::ostringstream oss02;
- std::ostringstream::int_type i01, i02;
- typedef std::ostringstream::traits_type traits_type;
-
- oss01 << std::endl;
- str04 = oss01.str();
- VERIFY( str04.size() == str01.size() );
-
- oss02 << std::endl;
- str05 = oss02.str();
- VERIFY( str05.size() == 1 );
-
- // template<_CharT, _Traits>
- // basic_ostream<_CharT, _Traits>& ends(basic_ostream<_Char, _Traits>& os)
- oss01 << std::ends;
- str04 = oss01.str();
- VERIFY( str04.size() == str01.size() );
- VERIFY( str04[1] == char() );
-
- oss02 << std::ends;
- str05 = oss02.str();
- VERIFY( str05.size() == 2 );
- VERIFY( str05[1] == char() );
-
- // template<_CharT, _Traits>
- // basic_ostream<_CharT, _Traits>& flush(basic_ostream<_Char, _Traits>& os)
- oss01.flush();
- str04 = oss01.str();
- VERIFY( str04.size() == str01.size() );
-
- oss02.flush();
- str05 = oss02.str();
- VERIFY( str05.size() == 2 );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
- return test;
-}
-
-
// based vaguely on this:
// http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00109.html
-bool test02()
+void test02()
{
using namespace std;
typedef ostringstream::int_type int_type;
@@ -111,16 +56,10 @@ bool test02()
int_type len5 = osst_01.str().size();
VERIFY( len3 < len5 );
VERIFY( len5 == len3 + len4 + 1 );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
- return test;
}
int main()
{
- test01();
test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/ostream_exception.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/exceptions/char/9561.cc
index 8c2b3407056..3e3726cd398 100644
--- a/libstdc++-v3/testsuite/27_io/ostream_exception.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/exceptions/char/9561.cc
@@ -58,7 +58,6 @@ void test01()
VERIFY(false);
}
-
int main()
{
test01();
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/flush/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/flush/char/1.cc
new file mode 100644
index 00000000000..3d9098f53d1
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/flush/char/1.cc
@@ -0,0 +1,59 @@
+// 1999-07-22 bkoz
+
+// Copyright (C) 1994, 1999, 2000, 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.6.2.7 standard basic_ostream manipulators
+
+#include <ostream>
+#include <sstream>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void test01(void)
+{
+ bool test = true;
+
+ const char str_lit01[] = " venice ";
+ const std::string str01(" santa barbara ");
+ std::string str02(str_lit01);
+ std::string str04;
+ std::string str05;
+ std::ios_base::iostate flag1, flag2, flag3, flag4, flag5;
+
+ std::ostringstream oss01(str01);
+ std::ostringstream oss02;
+ std::ostringstream::int_type i01, i02;
+ typedef std::ostringstream::traits_type traits_type;
+
+ // template<_CharT, _Traits>
+ // basic_ostream<_CharT, _Traits>& flush(basic_ostream<_Char, _Traits>& os)
+ oss01.flush();
+ str04 = oss01.str();
+ VERIFY( str04.size() == str01.size() );
+
+ oss02.flush();
+ str05 = oss02.str();
+ VERIFY( str05.size() == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/1.cc
new file mode 100644
index 00000000000..8a81b964fd1
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/1.cc
@@ -0,0 +1,194 @@
+// 1999-11-15 Kevin Ediger <kediger@licor.com>
+// test the floating point inserters (facet num_put)
+
+// Copyright (C) 1999, 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 <cstdio> // for sprintf
+#include <cmath> // for abs
+#include <cfloat> // for DBL_EPSILON
+#include <iostream>
+#include <iomanip>
+#include <sstream>
+#include <limits>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+#ifndef DEBUG_ASSERT
+# define TEST_NUMPUT_VERBOSE 1
+#endif
+
+struct _TestCase
+{
+ double val;
+
+ int precision;
+ int width;
+ char decimal;
+ char fill;
+
+ bool fixed;
+ bool scientific;
+ bool showpos;
+ bool showpoint;
+ bool uppercase;
+ bool internal;
+ bool left;
+ bool right;
+
+ const char* result;
+};
+
+static bool T=true;
+static bool F=false;
+
+static _TestCase testcases[] =
+{
+ // standard output (no formatting applied)
+ { 1.2, 6,0,'.',' ', F,F,F,F,F,F,F,F, "1.2" },
+ { 54, 6,0,'.',' ', F,F,F,F,F,F,F,F, "54" },
+ { -.012, 6,0,'.',' ', F,F,F,F,F,F,F,F, "-0.012" },
+ { -.00000012, 6,0,'.',' ', F,F,F,F,F,F,F,F, "-1.2e-07" },
+
+ // fixed formatting
+ { 10.2345, 0,0,'.',' ', T,F,F,F,F,F,F,F, "10" },
+ { 10.2345, 0,0,'.',' ', T,F,F,T,F,F,F,F, "10." },
+ { 10.2345, 1,0,'.',' ', T,F,F,F,F,F,F,F, "10.2" },
+ { 10.2345, 4,0,'.',' ', T,F,F,F,F,F,F,F, "10.2345" },
+ { 10.2345, 6,0,'.',' ', T,F,T,F,F,F,F,F, "+10.234500" },
+ { -10.2345, 6,0,'.',' ', T,F,F,F,F,F,F,F, "-10.234500" },
+ { -10.2345, 6,0,',',' ', T,F,F,F,F,F,F,F, "-10,234500" },
+
+ // fixed formatting with width
+ { 10.2345, 4,5,'.',' ', T,F,F,F,F,F,F,F, "10.2345" },
+ { 10.2345, 4,6,'.',' ', T,F,F,F,F,F,F,F, "10.2345" },
+ { 10.2345, 4,7,'.',' ', T,F,F,F,F,F,F,F, "10.2345" },
+ { 10.2345, 4,8,'.',' ', T,F,F,F,F,F,F,F, " 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,F,F, " 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,T,F, "10.2345 " },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,F,T, " 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,T,F,F, " 10.2345" },
+ { -10.2345, 4,10,'.',' ', T,F,F,F,F,T,F,F, "- 10.2345" },
+ { -10.2345, 4,10,'.','A', T,F,F,F,F,T,F,F, "-AA10.2345" },
+ { 10.2345, 4,10,'.','#', T,F,T,F,F,T,F,F, "+##10.2345" },
+
+ // scientific formatting
+ { 1.23e+12, 1,0,'.',' ', F,T,F,F,F,F,F,F, "1.2e+12" },
+ { 1.23e+12, 1,0,'.',' ', F,T,F,F,T,F,F,F, "1.2E+12" },
+ { 1.23e+12, 2,0,'.',' ', F,T,F,F,F,F,F,F, "1.23e+12" },
+ { 1.23e+12, 3,0,'.',' ', F,T,F,F,F,F,F,F, "1.230e+12" },
+ { 1.23e+12, 3,0,'.',' ', F,T,T,F,F,F,F,F, "+1.230e+12" },
+ { -1.23e-12, 3,0,'.',' ', F,T,F,F,F,F,F,F, "-1.230e-12" },
+ { 1.23e+12, 3,0,',',' ', F,T,F,F,F,F,F,F, "1,230e+12" },
+};
+
+template<typename _CharT>
+class testpunct : public numpunct<_CharT>
+{
+public:
+ typedef _CharT char_type;
+ const char_type dchar;
+
+ explicit
+ testpunct(char_type decimal_char) : numpunct<_CharT>(), dchar(decimal_char)
+ { }
+
+protected:
+ char_type
+ do_decimal_point() const
+ { return dchar; }
+
+ char_type
+ do_thousands_sep() const
+ { return ','; }
+
+ string
+ do_grouping() const
+ { return string(); }
+};
+
+template<typename _CharT>
+void apply_formatting(const _TestCase & tc, basic_ostream<_CharT> & os)
+{
+ os.precision(tc.precision);
+ os.width(tc.width);
+ os.fill(static_cast<_CharT>(tc.fill));
+ if (tc.fixed)
+ os.setf(ios::fixed);
+ if (tc.scientific)
+ os.setf(ios::scientific);
+ if (tc.showpos)
+ os.setf(ios::showpos);
+ if (tc.showpoint)
+ os.setf(ios::showpoint);
+ if (tc.uppercase)
+ os.setf(ios::uppercase);
+ if (tc.internal)
+ os.setf(ios::internal);
+ if (tc.left)
+ os.setf(ios::left);
+ if (tc.right)
+ os.setf(ios::right);
+}
+
+void
+test01()
+{
+ bool test = true;
+ for (int j=0; j<sizeof(testcases)/sizeof(testcases[0]); j++)
+ {
+ _TestCase & tc = testcases[j];
+#ifdef TEST_NUMPUT_VERBOSE
+ cout << "expect: " << tc.result << endl;
+#endif
+ // test double with char type
+ {
+ testpunct<char>* __tp = new testpunct<char>(tc.decimal);
+ ostringstream os;
+ locale __loc(os.getloc(), __tp);
+ os.imbue(__loc);
+ apply_formatting(tc, os);
+ os << tc.val;
+#ifdef TEST_NUMPUT_VERBOSE
+ cout << j << "result 1: " << os.str() << endl;
+#endif
+ VERIFY( os && os.str() == tc.result );
+ }
+ // test long double with char type
+ {
+ testpunct<char>* __tp = new testpunct<char>(tc.decimal);
+ ostringstream os;
+ locale __loc(os.getloc(), __tp);
+ os.imbue(__loc);
+ apply_formatting(tc, os);
+ os << (long double)tc.val;
+#ifdef TEST_NUMPUT_VERBOSE
+ cout << j << "result 2: " << os.str() << endl;
+#endif
+ VERIFY( os && os.str() == tc.result );
+ }
+ }
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/2.cc
new file mode 100644
index 00000000000..ed4979fa3a8
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/2.cc
@@ -0,0 +1,58 @@
+// 1999-11-15 Kevin Ediger <kediger@licor.com>
+// test the floating point inserters (facet num_put)
+
+// Copyright (C) 1999, 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 <cstdio> // for sprintf
+#include <iostream>
+#include <iomanip>
+#include <locale>
+#include <sstream>
+#include <limits>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+void
+test02()
+{
+ bool test = true;
+
+ // Make sure we can output a long float in fixed format
+ // without seg-faulting (libstdc++/4402)
+ double val2 = 3.5e230;
+
+ ostringstream os2;
+ os2.precision(3);
+ os2.setf(ios::fixed);
+
+ // Check it can be done in a locale with grouping on.
+ locale loc2("de_DE");
+ os2.imbue(loc2);
+ os2 << fixed << setprecision(3) << val2 << endl;
+ os2 << endl;
+ os2 << fixed << setprecision(1) << val2 << endl;
+}
+
+int
+main()
+{
+ __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/3.cc
new file mode 100644
index 00000000000..d26463b525d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/3.cc
@@ -0,0 +1,69 @@
+// 1999-11-15 Kevin Ediger <kediger@licor.com>
+// test the floating point inserters (facet num_put)
+
+// Copyright (C) 1999, 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 <sstream>
+#include <limits>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+template<typename T>
+bool
+test03_check(T n)
+{
+ stringbuf strbuf;
+ ostream o(&strbuf);
+ const char *expect;
+ bool test = true;
+
+ if (numeric_limits<T>::digits + 1 == 16)
+ expect = "177777 ffff";
+ else if (numeric_limits<T>::digits + 1 == 32)
+ expect = "37777777777 ffffffff";
+ else if (numeric_limits<T>::digits + 1 == 64)
+ expect = "1777777777777777777777 ffffffffffffffff";
+ else
+ expect = "wow, you've got some big numbers here";
+
+ o << oct << n << ' ' << hex << n;
+ VERIFY ( strbuf.str() == expect );
+
+ return test;
+}
+
+void
+test03()
+{
+ short s = -1;
+ int i = -1;
+ long l = -1;
+
+ test03_check (s);
+ test03_check (i);
+ test03_check (l);
+}
+
+int
+main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/4.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/4.cc
new file mode 100644
index 00000000000..445f884a6ae
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/4.cc
@@ -0,0 +1,51 @@
+// 1999-11-15 Kevin Ediger <kediger@licor.com>
+// test the floating point inserters (facet num_put)
+
+// Copyright (C) 1999, 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 <iomanip>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+// libstdc++/3655
+int
+test04()
+{
+ stringbuf strbuf1, strbuf2;
+ ostream o1(&strbuf1), o2(&strbuf2);
+ bool test = true;
+
+ o1 << hex << showbase << setw(6) << internal << 0xff;
+ VERIFY( strbuf1.str() == "0x ff" );
+
+ // ... vs internal-adjusted const char*-type objects
+ o2 << hex << showbase << setw(6) << internal << "0xff";
+ VERIFY( strbuf2.str() == " 0xff" );
+
+ return 0;
+}
+
+int
+main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/4402.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/4402.cc
new file mode 100644
index 00000000000..67eeecc2b6e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/4402.cc
@@ -0,0 +1,74 @@
+// 1999-11-15 Kevin Ediger <kediger@licor.com>
+// test the floating point inserters (facet num_put)
+
+// Copyright (C) 1999, 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 <cstdio> // for sprintf
+#include <iostream>
+#include <iomanip>
+#include <sstream>
+#include <limits>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+void
+test02()
+{
+ bool test = true;
+ // make sure we can output a very long float
+ long double val = 1.2345678901234567890123456789e+1000L;
+ int prec = numeric_limits<long double>::digits10;
+
+ ostringstream os;
+ os.precision(prec);
+ os.setf(ios::scientific);
+ os << val;
+
+ char largebuf[512];
+ sprintf(largebuf, "%.*Le", prec, val);
+#ifdef TEST_NUMPUT_VERBOSE
+ cout << "expect: " << largebuf << endl;
+ cout << "result: " << os.str() << endl;
+#endif
+ VERIFY(os && os.str() == largebuf);
+
+ // Make sure we can output a long float in fixed format
+ // without seg-faulting (libstdc++/4402)
+ double val2 = 3.5e230;
+
+ ostringstream os2;
+ os2.precision(3);
+ os2.setf(ios::fixed);
+ os2 << val2;
+
+ sprintf(largebuf, "%.*f", 3, val2);
+#ifdef TEST_NUMPUT_VERBOSE
+ cout << "expect: " << largebuf << endl;
+ cout << "result: " << os2.str() << endl;
+#endif
+ VERIFY(os2 && os2.str() == largebuf);
+}
+
+int
+main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/5.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/5.cc
new file mode 100644
index 00000000000..647f8714629
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/5.cc
@@ -0,0 +1,50 @@
+// 1999-11-15 Kevin Ediger <kediger@licor.com>
+// test the floating point inserters (facet num_put)
+
+// Copyright (C) 1999, 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 <cmath> // for abs
+#include <cfloat> // for DBL_EPSILON
+#include <sstream>
+#include <limits>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+void
+test05()
+{
+ bool test = true;
+ double pi = 3.14159265358979323846;
+ ostringstream ostr;
+ ostr.precision(20);
+ ostr << pi;
+ string sval = ostr.str();
+ istringstream istr (sval);
+ double d;
+ istr >> d;
+ VERIFY( abs(pi-d)/pi < DBL_EPSILON );
+}
+
+int
+main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/6.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/6.cc
new file mode 100644
index 00000000000..d3f0499c3bb
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/6.cc
@@ -0,0 +1,54 @@
+// 1999-11-15 Kevin Ediger <kediger@licor.com>
+// test the floating point inserters (facet num_put)
+
+// Copyright (C) 1999, 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 <cmath> // for abs
+#include <cfloat> // for DBL_EPSILON
+#include <sstream>
+#include <limits>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+// libstdc++/9151
+int
+test06()
+{
+ bool test = true;
+ int prec = numeric_limits<double>::digits10 + 2;
+ double oval = numeric_limits<double>::min();
+
+ stringstream ostr;
+ ostr.precision(prec);
+ ostr << oval;
+ string sval = ostr.str();
+ istringstream istr (sval);
+ double ival;
+ istr >> ival;
+ VERIFY( abs(oval-ival)/oval < DBL_EPSILON );
+ return 0;
+}
+
+int
+main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/1.cc
new file mode 100644
index 00000000000..a439c9e78ab
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/1.cc
@@ -0,0 +1,189 @@
+// 1999-11-15 Kevin Ediger <kediger@licor.com>
+// test the floating point inserters (facet num_put)
+
+// Copyright (C) 1999, 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 <cstdio> // for sprintf
+#include <cmath> // for abs
+#include <cfloat> // for DBL_EPSILON
+#include <iostream>
+#include <iomanip>
+#include <sstream>
+#include <limits>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+#ifndef DEBUG_ASSERT
+# define TEST_NUMPUT_VERBOSE 1
+#endif
+
+struct _TestCase
+{
+ double val;
+
+ int precision;
+ int width;
+ char decimal;
+ char fill;
+
+ bool fixed;
+ bool scientific;
+ bool showpos;
+ bool showpoint;
+ bool uppercase;
+ bool internal;
+ bool left;
+ bool right;
+
+ const char* result;
+ const wchar_t* wresult;
+};
+
+static bool T=true;
+static bool F=false;
+
+static _TestCase testcases[] =
+{
+ // standard output (no formatting applied) 1-4
+ { 1.2, 6,0,'.',' ', F,F,F,F,F,F,F,F, "1.2",L"1.2" },
+ { 54, 6,0,'.',' ', F,F,F,F,F,F,F,F, "54",L"54" },
+ { -.012, 6,0,'.',' ', F,F,F,F,F,F,F,F, "-0.012",L"-0.012" },
+ { -.00000012, 6,0,'.',' ', F,F,F,F,F,F,F,F, "-1.2e-07",L"-1.2e-07" },
+
+ // fixed formatting 5-11
+ { 10.2345, 0,0,'.',' ', T,F,F,F,F,F,F,F, "10",L"10" },
+ { 10.2345, 0,0,'.',' ', T,F,F,T,F,F,F,F, "10.",L"10." },
+ { 10.2345, 1,0,'.',' ', T,F,F,F,F,F,F,F, "10.2",L"10.2" },
+ { 10.2345, 4,0,'.',' ', T,F,F,F,F,F,F,F, "10.2345",L"10.2345" },
+ { 10.2345, 6,0,'.',' ', T,F,T,F,F,F,F,F, "+10.234500",L"+10.234500" },
+ { -10.2345, 6,0,'.',' ', T,F,F,F,F,F,F,F, "-10.234500",L"-10.234500" },
+ { -10.2345, 6,0,',',' ', T,F,F,F,F,F,F,F, "-10,234500",L"-10,234500" },
+
+ // fixed formatting with width 12-22
+ { 10.2345, 4,5,'.',' ', T,F,F,F,F,F,F,F, "10.2345",L"10.2345" },
+ { 10.2345, 4,6,'.',' ', T,F,F,F,F,F,F,F, "10.2345",L"10.2345" },
+ { 10.2345, 4,7,'.',' ', T,F,F,F,F,F,F,F, "10.2345",L"10.2345" },
+ { 10.2345, 4,8,'.',' ', T,F,F,F,F,F,F,F, " 10.2345",L" 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,F,F, " 10.2345",L" 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,T,F, "10.2345 ",L"10.2345 " },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,F,T, " 10.2345",L" 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,T,F,F, " 10.2345",L" 10.2345" },
+ { -10.2345, 4,10,'.',' ', T,F,F,F,F,T,F,F, "- 10.2345",L"- 10.2345" },
+ { -10.2345, 4,10,'.','A', T,F,F,F,F,T,F,F, "-AA10.2345",L"-AA10.2345" },
+ { 10.2345, 4,10,'.','#', T,F,T,F,F,T,F,F, "+##10.2345",L"+##10.2345" },
+
+ // scientific formatting 23-29
+ { 1.23e+12, 1,0,'.',' ', F,T,F,F,F,F,F,F, "1.2e+12",L"1.2e+12" },
+ { 1.23e+12, 1,0,'.',' ', F,T,F,F,T,F,F,F, "1.2E+12",L"1.2E+12" },
+ { 1.23e+12, 2,0,'.',' ', F,T,F,F,F,F,F,F, "1.23e+12",L"1.23e+12" },
+ { 1.23e+12, 3,0,'.',' ', F,T,F,F,F,F,F,F, "1.230e+12",L"1.230e+12" },
+ { 1.23e+12, 3,0,'.',' ', F,T,T,F,F,F,F,F, "+1.230e+12",L"+1.230e+12" },
+ { -1.23e-12, 3,0,'.',' ', F,T,F,F,F,F,F,F, "-1.230e-12",L"-1.230e-12" },
+ { 1.23e+12, 3,0,',',' ', F,T,F,F,F,F,F,F, "1,230e+12",L"1,230e+12" },
+};
+
+template<typename _CharT>
+class testpunct : public numpunct<_CharT>
+{
+public:
+ typedef _CharT char_type;
+ const char_type dchar;
+
+ explicit
+ testpunct(char_type decimal_char) : numpunct<_CharT>(), dchar(decimal_char)
+ { }
+
+protected:
+ char_type
+ do_decimal_point() const
+ { return dchar; }
+
+ char_type
+ do_thousands_sep() const
+ { return ','; }
+
+ string
+ do_grouping() const
+ { return string(); }
+};
+
+template<typename _CharT>
+void apply_formatting(const _TestCase & tc, basic_ostream<_CharT> & os)
+{
+ os.precision(tc.precision);
+ os.width(tc.width);
+ os.fill(static_cast<_CharT>(tc.fill));
+ if (tc.fixed)
+ os.setf(ios::fixed);
+ if (tc.scientific)
+ os.setf(ios::scientific);
+ if (tc.showpos)
+ os.setf(ios::showpos);
+ if (tc.showpoint)
+ os.setf(ios::showpoint);
+ if (tc.uppercase)
+ os.setf(ios::uppercase);
+ if (tc.internal)
+ os.setf(ios::internal);
+ if (tc.left)
+ os.setf(ios::left);
+ if (tc.right)
+ os.setf(ios::right);
+}
+
+void
+test01()
+{
+ bool test = true;
+ for (int j=0; j<sizeof(testcases)/sizeof(testcases[0]); j++)
+ {
+ _TestCase & tc = testcases[j];
+#ifdef TEST_NUMPUT_VERBOSE
+ cout << "expect: " << tc.result << endl;
+#endif
+ // test double with wchar_t type
+ {
+ testpunct<wchar_t>* __tp = new testpunct<wchar_t>(tc.decimal);
+ wostringstream os;
+ locale __loc(os.getloc(), __tp);
+ os.imbue(__loc);
+ apply_formatting(tc, os);
+ os << tc.val;
+ VERIFY( os && os.str() == tc.wresult );
+ }
+ // test long double with wchar_t type
+ {
+ testpunct<wchar_t>* __tp = new testpunct<wchar_t>(tc.decimal);
+ wostringstream os;
+ locale __loc(os.getloc(), __tp);
+ os.imbue(__loc);
+ apply_formatting(tc, os);
+ os << (long double)tc.val;
+ VERIFY( os && os.str() == tc.wresult );
+ }
+ }
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/1.cc
new file mode 100644
index 00000000000..976d45857ab
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/1.cc
@@ -0,0 +1,59 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 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.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// ofstream
+void test01()
+{
+ std::string str01;
+ const int size = 1000;
+ const char name_02[] = "ostream_inserter_char-1.txt";
+
+ // initialize string
+ for(int i=0 ; i < size; i++) {
+ str01 += '1';
+ str01 += '2';
+ str01 += '3';
+ str01 += '4';
+ str01 += '5';
+ str01 += '6';
+ str01 += '7';
+ str01 += '8';
+ str01 += '9';
+ str01 += '\n';
+ }
+ std::ofstream f(name_02);
+
+ f << str01;
+ f.close();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/2.cc
new file mode 100644
index 00000000000..9ffc492586e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/2.cc
@@ -0,0 +1,69 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 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.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// ostringstream width() != zero
+// left
+void
+test02(void)
+{
+ bool test = true;
+ std::string tmp;
+
+ std::string str01 = "";
+ std::ostringstream oss01;
+ oss01.width(5);
+ oss01.fill('0');
+ oss01.flags(std::ios_base::left);
+ oss01 << str01;
+ tmp = oss01.str();
+ VERIFY( tmp == "00000" );
+
+ std::string str02 = "1";
+ std::ostringstream oss02;
+ oss02.width(5);
+ oss02.fill('0');
+ oss02.flags(std::ios_base::left);
+ oss02 << str02;
+ tmp = oss02.str();
+ VERIFY( tmp == "10000" );
+
+ std::string str03 = "909909";
+ std::ostringstream oss03;
+ oss03.width(5);
+ oss03.fill('0');
+ oss03.flags(std::ios_base::left);
+ oss03 << str03;
+ tmp = oss03.str();
+ VERIFY( tmp == "909909" );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/3.cc
new file mode 100644
index 00000000000..5b95862b2b9
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/3.cc
@@ -0,0 +1,68 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 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.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// width() != zero
+// right
+void test03(void)
+{
+ bool test = true;
+ std::string tmp;
+
+ std::string str01 = "";
+ std::ostringstream oss01;
+ oss01.width(5);
+ oss01.fill('0');
+ oss01.flags(std::ios_base::right);
+ oss01 << str01;
+ tmp = oss01.str();
+ VERIFY( tmp == "00000" );
+
+ std::string str02 = "1";
+ std::ostringstream oss02;
+ oss02.width(5);
+ oss02.fill('0');
+ oss02.flags(std::ios_base::right);
+ oss02 << str02;
+ tmp = oss02.str();
+ VERIFY( tmp == "00001" );
+
+ std::string str03 = "909909";
+ std::ostringstream oss03;
+ oss03.width(5);
+ oss03.fill('0');
+ oss03.flags(std::ios_base::right);
+ oss03 << str03;
+ tmp = oss03.str();
+ VERIFY( tmp == "909909" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/4.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/4.cc
new file mode 100644
index 00000000000..52d92ecb2eb
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/4.cc
@@ -0,0 +1,61 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 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.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// stringstream and large strings
+void
+test04()
+{
+ 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::string str_tmp;
+ const int i_max=250;
+
+ std::ostringstream oss_01(std::ios_base::out);
+ std::ostringstream oss_02(str_01, std::ios_base::out);
+
+ std::ios_base::iostate state1, state2, statefail;
+ statefail = std::ios_base::failbit;
+
+ // template<_CharT, _Traits>
+ // basic_ostream& operator<<(ostream&, const char*)
+ for (int i = 0; i < i_max; ++i)
+ oss_02 << "Test: " << i << std::endl;
+ str_tmp = oss_02.str();
+ VERIFY( !oss_02.bad() );
+ VERIFY( oss_02.good() );
+ VERIFY( str_tmp != str_01 );
+ VERIFY( str_tmp.size() == 2390 );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/5.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/5.cc
new file mode 100644
index 00000000000..c68f227bfc2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/5.cc
@@ -0,0 +1,78 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 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.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// ostringstream and large strings number 2
+void
+test05()
+{
+ bool test = true;
+ std::string str05, str10;
+
+ typedef std::ostream::pos_type pos_type;
+ typedef std::ostream::off_type off_type;
+ std::string str01;
+ const int size = 1000;
+
+ // initialize string
+ for(int i=0 ; i < size; i++) {
+ str01 += '1';
+ str01 += '2';
+ str01 += '3';
+ str01 += '4';
+ str01 += '5';
+ str01 += '6';
+ str01 += '7';
+ str01 += '8';
+ str01 += '9';
+ str01 += '\n';
+ }
+
+ // test 1: out
+ std::ostringstream sstr01(str01, std::ios_base::out);
+ std::ostringstream sstr02;
+ sstr02 << str01;
+ str05 = sstr01.str();
+ str10 = sstr02.str();
+ VERIFY( str05 == str01 );
+ VERIFY( str10 == str01 );
+
+ // test 2: in | out
+ std::ostringstream sstr04(str01, std::ios_base::out | std::ios_base::in);
+ std::ostringstream sstr05(std::ios_base::in | std::ios_base::out);
+ sstr05 << str01;
+ str05 = sstr04.str();
+ str10 = sstr05.str();
+ VERIFY( str05 == str01 );
+ VERIFY( str10 == str01 );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/6.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/6.cc
new file mode 100644
index 00000000000..a73329c819c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/6.cc
@@ -0,0 +1,59 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 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.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// ostringstream and positioning, multiple writes
+// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00326.html
+void test06()
+{
+ bool test = true;
+ const char carray01[] = "mos def & talib kweli are black star";
+
+ // normal
+ std::ostringstream ostr1("mos def");
+ VERIFY( ostr1.str() == "mos def" );
+ ostr1 << " & talib kweli"; // should overwrite first part of buffer
+ VERIFY( ostr1.str() == " & talib kweli" );
+ ostr1 << " are black star"; // should append to string from above
+ VERIFY( ostr1.str() != carray01 );
+ VERIFY( ostr1.str() == " & talib kweli are black star" );
+
+ // appending
+ std::ostringstream ostr2("blackalicious",
+ std::ios_base::out | std::ios_base::ate);
+ VERIFY( ostr2.str() == "blackalicious" );
+ ostr2 << " NIA "; // should not overwrite first part of buffer
+ VERIFY( ostr2.str() == "blackalicious NIA " );
+ ostr2 << "4: deception (5:19)"; // should append to full string from above
+ VERIFY( ostr2.str() == "blackalicious NIA 4: deception (5:19)" );
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/8.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/8.cc
new file mode 100644
index 00000000000..244ee752919
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/8.cc
@@ -0,0 +1,49 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 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.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+void test08()
+{
+ bool test = true;
+ char* pt = NULL;
+
+ // 1
+ std::ostringstream oss;
+ oss << pt;
+ VERIFY( oss.bad() );
+ VERIFY( oss.str().size() == 0 );
+
+ oss.clear();
+ oss << "";
+ VERIFY( oss.good() );
+}
+
+int main()
+{
+ test08();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/7.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/7.cc
new file mode 100644
index 00000000000..6344dd4d5a0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/7.cc
@@ -0,0 +1,92 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 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.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// Global counter, needs to be reset after use.
+bool used;
+
+class gnu_ctype : public std::ctype<wchar_t>
+{
+protected:
+ char_type
+ do_widen(char c) const
+ {
+ used = true;
+ return std::ctype<wchar_t>::do_widen(c);
+ }
+
+ const char*
+ do_widen(const char* low, const char* high, char_type* dest) const
+ {
+ used = true;
+ return std::ctype<wchar_t>::do_widen(low, high, dest);
+ }
+};
+
+// 27.6.2.5.4 - Character inserter template functions
+// [lib.ostream.inserters.character]
+void test07()
+{
+ using namespace std;
+ bool test = true;
+
+ const char* buffer = "SFPL 5th floor, outside carrol, the Asian side";
+
+ wostringstream oss;
+ oss.imbue(locale(locale::classic(), new gnu_ctype));
+
+ // 1
+ // template<class charT, class traits>
+ // basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out,
+ // const char* s);
+ used = false;
+ oss << buffer;
+ VERIFY( used ); // Only required for char_type != char
+ wstring str = oss.str();
+ wchar_t c1 = oss.widen(buffer[0]);
+ VERIFY( str[0] == c1 );
+ wchar_t c2 = oss.widen(buffer[1]);
+ VERIFY( str[1] == c2 );
+
+ // 2
+ // template<class charT, class traits>
+ // basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out,
+ // char c);
+ used = false;
+ oss.str(wstring());
+ oss << 'b';
+ VERIFY( used ); // Only required for char_type != char
+ str = oss.str();
+ wchar_t c3 = oss.widen('b');
+ VERIFY( str[0] == c3 );
+}
+
+int main()
+{
+ test07();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/8.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/8.cc
new file mode 100644
index 00000000000..bf4480db26e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/8.cc
@@ -0,0 +1,60 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 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.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+void test08()
+{
+ bool test = true;
+ char* pt = NULL;
+
+ // 2
+ std::wostringstream woss;
+ woss << pt;
+ VERIFY( woss.bad() );
+ VERIFY( woss.str().size() == 0 );
+
+ woss.clear();
+ woss << "";
+ VERIFY( woss.good() );
+
+ // 3
+ wchar_t* wt = NULL;
+ woss.clear();
+ woss << wt;
+ VERIFY( woss.bad() );
+ VERIFY( woss.str().size() == 0 );
+
+ woss.clear();
+ woss << L"";
+ VERIFY( woss.good() );
+}
+
+int main()
+{
+ test08();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/1.cc
new file mode 100644
index 00000000000..3fa9e68fe56
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/1.cc
@@ -0,0 +1,82 @@
+// 1999-08-16 bkoz
+// 1999-11-01 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.2.5.4 basic_ostream character inserters
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <ostream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+const int size = 1000;
+const char name_01[] = "ostream_inserter_other-1.tst";
+const char name_02[] = "ostream_inserter_other-1.txt";
+const char name_03[] = "ostream_inserter_other-2.tst";
+const char name_04[] = "ostream_inserter_other-2.txt";
+
+// fstream
+void
+test02()
+{
+ typedef std::ios_base::iostate iostate;
+ bool test = true;
+
+ // basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type* __sb)
+ // filebuf-> NULL
+ std::ifstream f_in1(name_01);
+ std::ofstream f_out1(name_02);
+ std::stringbuf* strbuf01 = NULL;
+ iostate state01 = f_in1.rdstate();
+ f_in1 >> strbuf01;
+ iostate state02 = f_in1.rdstate();
+ VERIFY( state01 != state02 );
+ VERIFY( (state02 & std::ios_base::failbit) != 0 );
+ state01 = f_out1.rdstate();
+ f_out1 << strbuf01;
+ state02 = f_out1.rdstate();
+ VERIFY( state01 != state02 );
+ VERIFY( (state02 & std::ios_base::badbit) != 0 );
+
+ // filebuf->filebuf
+ std::ifstream f_in(name_01);
+ std::ofstream f_out(name_02);
+ f_out << f_in.rdbuf();
+ f_in.close();
+ f_out.close();
+
+ // filebuf->stringbuf->filebuf
+ std::ifstream f_in2(name_03);
+ std::ofstream f_out2(name_04); // should be different name
+ std::stringbuf strbuf02;
+ f_in2 >> &strbuf02;
+ f_out2 << &strbuf02;
+ f_in2.close();
+ f_out2.close();
+}
+
+int
+main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/2.cc
new file mode 100644
index 00000000000..c82e5cf508b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/2.cc
@@ -0,0 +1,70 @@
+// 1999-08-16 bkoz
+// 1999-11-01 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.2.5.4 basic_ostream character inserters
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <ostream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// via Brent Verner <brent@rcfile.org>
+// http://gcc.gnu.org/ml/libstdc++/2000-06/msg00005.html
+void
+test03(void)
+{
+ using namespace std;
+
+ typedef ios::pos_type pos_type;
+
+ const char* TEST_IN = "ostream_inserter_other_in";
+ const char* TEST_OUT = "ostream_inserter_other_out";
+ pos_type i_read, i_wrote, rs, ws;
+ double tf_size = BUFSIZ * 2.5;
+ ofstream testfile(TEST_IN);
+
+ for (int i = 0; i < tf_size; ++i)
+ testfile.put('.');
+ testfile.close();
+
+ ifstream in(TEST_IN);
+ ofstream out(TEST_OUT);
+ out << in.rdbuf();
+ in.seekg(0,ios_base::beg);
+ out.seekp(0,ios_base::beg);
+ rs = in.tellg();
+ ws = out.tellp();
+ in.seekg(0,ios_base::end);
+ out.seekp(0,ios_base::end);
+ i_read = in.tellg() - rs;
+ i_wrote = out.tellp() - ws;
+ in.close();
+ out.close();
+}
+
+int
+main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/3.cc
new file mode 100644
index 00000000000..89dca57cd54
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/3.cc
@@ -0,0 +1,50 @@
+// 1999-08-16 bkoz
+// 1999-11-01 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 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.2.5.4 basic_ostream character inserters
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/3272
+void test04()
+{
+ using namespace std;
+ bool test = true;
+ istringstream istr("inside betty carter");
+ ostringstream ostr;
+ ostr << istr.rdbuf() << endl;
+
+ if (ostr.rdstate() & ios_base::eofbit)
+ test = false;
+
+ VERIFY( test );
+}
+
+int
+main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/4.cc
index 4ae1f3b88a6..1ba200aaca7 100644
--- a/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/4.cc
@@ -1,7 +1,7 @@
// 1999-08-16 bkoz
// 1999-11-01 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
+// Copyright (C) 1999, 2000, 2001, 2002, 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
@@ -28,128 +28,6 @@
#include <fstream>
#include <testsuite_hooks.h>
-const int size = 1000;
-const char name_01[] = "ostream_inserter_other-1.tst";
-const char name_02[] = "ostream_inserter_other-1.txt";
-const char name_03[] = "ostream_inserter_other-2.tst";
-const char name_04[] = "ostream_inserter_other-2.txt";
-
-
-// stringstream
-int
-test01()
-{
- bool test = true;
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
- return 0;
-}
-
-// fstream
-int
-test02()
-{
- typedef std::ios_base::iostate iostate;
- bool test = true;
-
- // basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type* __sb)
- // filebuf-> NULL
- std::ifstream f_in1(name_01);
- std::ofstream f_out1(name_02);
- std::stringbuf* strbuf01 = NULL;
- iostate state01 = f_in1.rdstate();
- f_in1 >> strbuf01;
- iostate state02 = f_in1.rdstate();
- VERIFY( state01 != state02 );
- VERIFY( (state02 & std::ios_base::failbit) != 0 );
- state01 = f_out1.rdstate();
- f_out1 << strbuf01;
- state02 = f_out1.rdstate();
- VERIFY( state01 != state02 );
- VERIFY( (state02 & std::ios_base::badbit) != 0 );
-
- // filebuf->filebuf
- std::ifstream f_in(name_01);
- std::ofstream f_out(name_02);
- f_out << f_in.rdbuf();
- f_in.close();
- f_out.close();
-
- // filebuf->stringbuf->filebuf
- std::ifstream f_in2(name_03);
- std::ofstream f_out2(name_04); // should be different name
- std::stringbuf strbuf02;
- f_in2 >> &strbuf02;
- f_out2 << &strbuf02;
- f_in2.close();
- f_out2.close();
-
- // no characters inserted
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return 0;
-}
-
-// via Brent Verner <brent@rcfile.org>
-// http://gcc.gnu.org/ml/libstdc++/2000-06/msg00005.html
-int
-test03(void)
-{
- using namespace std;
-
- typedef ios::pos_type pos_type;
-
- const char* TEST_IN = "ostream_inserter_other_in";
- const char* TEST_OUT = "ostream_inserter_other_out";
- pos_type i_read, i_wrote, rs, ws;
- double tf_size = BUFSIZ * 2.5;
- ofstream testfile(TEST_IN);
-
- for (int i = 0; i < tf_size; ++i)
- testfile.put('.');
- testfile.close();
-
- ifstream in(TEST_IN);
- ofstream out(TEST_OUT);
- out << in.rdbuf();
- in.seekg(0,ios_base::beg);
- out.seekp(0,ios_base::beg);
- rs = in.tellg();
- ws = out.tellp();
- in.seekg(0,ios_base::end);
- out.seekp(0,ios_base::end);
- i_read = in.tellg() - rs;
- i_wrote = out.tellp() - ws;
- in.close();
- out.close();
-
-#ifdef DEBUG_ASSERT
- assert(i_read == i_wrote);
-#endif
-
- return 0;
-}
-
-// libstdc++/3272
-void test04()
-{
- using namespace std;
- bool test = true;
- istringstream istr("inside betty carter");
- ostringstream ostr;
- ostr << istr.rdbuf() << endl;
-
- if (ostr.rdstate() & ios_base::eofbit)
- test = false;
-
- VERIFY( test );
-}
-
-
class test_buffer_1 : public std::streambuf
{
public:
@@ -271,11 +149,6 @@ void test05()
int
main()
{
- test01();
- test02();
- test03();
- test04();
-
test05();
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/9318-out.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/9318-out.cc
new file mode 100644
index 00000000000..fcacbcb6483
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/9318-out.cc
@@ -0,0 +1,73 @@
+// 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 <streambuf>
+#include <sstream>
+#include <ostream>
+#include <testsuite_hooks.h>
+
+// libstdc++/9318
+class Outbuf : public std::streambuf
+{
+public:
+ typedef std::streambuf::traits_type traits_type;
+
+ std::string result() const { return str; }
+
+protected:
+ virtual int_type overflow(int_type c = traits_type::eof())
+ {
+ if (!traits_type::eq_int_type(c, traits_type::eof()))
+ str.push_back(traits_type::to_char_type(c));
+ return traits_type::not_eof(c);
+ }
+
+private:
+ std::string str;
+};
+
+void test10()
+{
+ bool test = true;
+
+ std::stringbuf sbuf("Bad Moon Rising", std::ios::in);
+ Outbuf buf;
+ std::ostream stream(&buf);
+ stream << &sbuf;
+
+ VERIFY( buf.result() == "Bad Moon Rising" );
+}
+
+int main()
+{
+ test10();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/9424-out.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/9424-out.cc
new file mode 100644
index 00000000000..61ec1a71eaf
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/9424-out.cc
@@ -0,0 +1,113 @@
+// 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 <cstring> // for memset, memcmp
+#include <streambuf>
+#include <sstream>
+#include <ostream>
+#include <testsuite_hooks.h>
+
+// libstdc++/9424
+class Outbuf_2 : public std::streambuf
+{
+ char buf[1];
+
+public:
+ Outbuf_2()
+ {
+ setp(buf, buf + 1);
+ }
+
+ int_type overflow(int_type c)
+ {
+ int_type eof = traits_type::eof();
+
+ if (pptr() < epptr())
+ {
+ if (traits_type::eq_int_type(c, eof))
+ return traits_type::not_eof(c);
+
+ *pptr() = traits_type::to_char_type(c);
+ pbump(1);
+ return c;
+ }
+
+ return eof;
+ }
+};
+
+class Inbuf_2 : public std::streambuf
+{
+ static const char buf[];
+ const char* current;
+ int size;
+
+public:
+ Inbuf_2()
+ {
+ current = buf;
+ size = std::strlen(buf);
+ }
+
+ int_type underflow()
+ {
+ if (current < buf + size)
+ return traits_type::to_int_type(*current);
+ return traits_type::eof();
+ }
+
+ int_type uflow()
+ {
+ if (current < buf + size)
+ return traits_type::to_int_type(*current++);
+ return traits_type::eof();
+ }
+};
+
+const char Inbuf_2::buf[] = "Atteivlis";
+
+void test12()
+{
+ bool test = true;
+
+ Outbuf_2 outbuf2;
+ std::ostream os (&outbuf2);
+ Inbuf_2 inbuf2;
+ os << &inbuf2;
+ VERIFY( inbuf2.sgetc() == 't' );
+ VERIFY( os.good() );
+}
+
+int main()
+{
+ test12();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/1.cc
new file mode 100644
index 00000000000..cba75f250fa
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/1.cc
@@ -0,0 +1,53 @@
+// 2003-02-06 Paolo Carlini <pcarlini@unitus.it>
+
+// 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.
+
+// 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.2.3 class basic_ostream::sentry
+
+#include <ostream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/9562
+void
+test01()
+{
+ bool test = true;
+
+ std::stringbuf strbuf01;
+ std::ostream strm1(&strbuf01);
+ const std::ostream::sentry sentry1(strm1);
+
+ VERIFY( bool(sentry1) == true );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ostream_sentry.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/2.cc
index 322dbc55057..4e7562cfd12 100644
--- a/libstdc++-v3/testsuite/27_io/ostream_sentry.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/2.cc
@@ -33,19 +33,6 @@
#include <sstream>
#include <testsuite_hooks.h>
-// libstdc++/9562
-void
-test01()
-{
- bool test = true;
-
- std::stringbuf strbuf01;
- std::ostream strm1(&strbuf01);
- const std::ostream::sentry sentry1(strm1);
-
- VERIFY( bool(sentry1) == true );
-}
-
// libstdc++/9563
struct buf: std::streambuf
{
@@ -79,7 +66,6 @@ test02()
int main()
{
- test01();
test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/3983-fstream.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/3983-fstream.cc
new file mode 100644
index 00000000000..3cdf3b83310
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/3983-fstream.cc
@@ -0,0 +1,160 @@
+// 2001-06-05 Benjamin 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.
+
+// 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 <fstream>
+#include <testsuite_hooks.h>
+
+// char_traits specialization
+namespace std
+{
+ 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
+
+// libstdc++/3983
+// Sentry uses locale info, so have to try one formatted input/output.
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ // output streams
+ basic_ofstream<unsigned char> ofs_uc;
+
+ try
+ {
+ bool b = true;
+ ofs_uc << b;
+ }
+ catch (bad_cast& obj)
+ { }
+ catch (exception& obj)
+ { test = false; }
+
+ VERIFY( test );
+}
+
+#if !__GXX_WEAK__
+// Explicitly instantiate for systems with no COMDAT or weak support.
+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()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/3983-sstream.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/3983-sstream.cc
new file mode 100644
index 00000000000..5f68c585ad5
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/3983-sstream.cc
@@ -0,0 +1,160 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+// char_traits specialization
+namespace std
+{
+ 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
+
+// libstdc++/3983
+// Sentry uses locale info, so have to try one formatted input/output.
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ // 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 );
+}
+
+#if !__GXX_WEAK__
+// Explicitly instantiate for systems with no COMDAT or weak support.
+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()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/1.cc
new file mode 100644
index 00000000000..05884fc123d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/1.cc
@@ -0,0 +1,62 @@
+// 2000-06-29 bkoz
+
+// Copyright (C) 2000, 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.2.4 basic_ostream seek members
+
+#include <ostream>
+#include <sstream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+
+void test01()
+{
+ using namespace std;
+ typedef ios::pos_type pos_type;
+
+ bool test = true;
+ const char str_lit01[] = "ostream_seeks-1.txt";
+
+ // out
+ // test default ctors leave things in the same positions...
+ ostringstream ost1;
+ pos_type p1 = ost1.tellp();
+
+ ofstream ofs1;
+ pos_type p2 = ofs1.tellp();
+
+ VERIFY( p1 == p2 );
+
+ // out
+ // test ctors leave things in the same positions...
+ ostringstream ost2("bob_marley:kaya");
+ p1 = ost2.tellp();
+
+ ofstream ofs2(str_lit01);
+ p2 = ofs2.tellp();
+
+ VERIFY( p1 == p2 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ostream_unformatted.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/2.cc
index a55ac3ca45b..e278daec21a 100644
--- a/libstdc++-v3/testsuite/27_io/ostream_unformatted.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/2.cc
@@ -1,6 +1,6 @@
// 2000-03-23 bkoz
-// Copyright (C) 2000 Free Software Foundation
+// Copyright (C) 2000, 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
@@ -22,7 +22,6 @@
#include <ostream>
#include <testsuite_hooks.h>
-
void test01()
{
using namespace std;
@@ -41,10 +40,6 @@ void test01()
ost << "ghost dog: way of the samurai";
pos1 = ost.tellp();
VERIFY( pos1 == pos_type(33) );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
}
int main()
diff --git a/libstdc++-v3/testsuite/27_io/ostringstream.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/1.cc
index c8a9dfccacc..4fd6be62f8b 100644
--- a/libstdc++-v3/testsuite/27_io/ostringstream.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/1.cc
@@ -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_ostringstream<type_t, char_traits<type_t> >;
-} // test
-
-int main()
-{
- test01();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/2.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/2.cc
new file mode 100644
index 00000000000..a1ca0bf27ed
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/2.cc
@@ -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.7.3 - Class basic_ostringstream
+// NB: This file is for testing basic_ostringstream with NO OTHER INCLUDES.
+
+#include <sstream>
+
+// { dg-do compile }
+
+namespace test
+{
+ using namespace std;
+ typedef short type_t;
+ template class basic_ostringstream<type_t, char_traits<type_t> >;
+} // test
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/3.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/3.cc
new file mode 100644
index 00000000000..777b70226a7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/3.cc
@@ -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 <sstream>
+#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_ostringstream<gnu_char_type, gnu_char_traits> gnu_osstr;
+
+ try
+ {
+ gnu_osstr 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!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/4.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/4.cc
new file mode 100644
index 00000000000..48c56383e4c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/4.cc
@@ -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 <ostream>
+#include <sstream>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::ostringstream test_type;
+ typedef std::ostream base_type;
+ const test_type& obj = test_type();
+ const base_type* base = &obj;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
+// more surf!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/char/3.cc
new file mode 100644
index 00000000000..3edad1a5080
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/char/3.cc
@@ -0,0 +1,64 @@
+// 2001-05-23 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.3.2 member functions (ostringstream_members)
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// 03: sanity checks for strings, stringbufs
+void
+test03()
+{
+ bool test = false;
+
+ // Empty string sanity check.
+ std::string str01;
+ std::string::iterator __i_start = str01.begin();
+ std::string::iterator __i_end = str01.end();
+ std::string::size_type len = str01.size();
+ test = __i_start == __i_end;
+ VERIFY( len == 0 );
+
+ // Full string sanity check.
+ std::string str02("these golden days, i spend waiting for you:\n"
+ "Betty Carter on Verve with I'm Yours and You're Mine.");
+ __i_start = str02.begin();
+ __i_end = str02.end();
+ len = str02.size();
+ VERIFY( __i_start != __i_end );
+ VERIFY( len != 0 );
+
+ // Test an empty ostringstream for sanity.
+ std::ostringstream ostrstream0;
+ std::string str03 = ostrstream0.str();
+ __i_start = str03.begin();
+ __i_end = str03.end();
+ len = str03.size();
+ VERIFY( __i_start == __i_end );
+ VERIFY( len == 0 );
+ VERIFY( str01 == str03 );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ostringstream_members.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/rdbuf/char/2832.cc
index bf823697c83..8019bba06f2 100644
--- a/libstdc++-v3/testsuite/27_io/ostringstream_members.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/rdbuf/char/2832.cc
@@ -1,6 +1,6 @@
// 2001-05-23 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
@@ -23,34 +23,6 @@
#include <sstream>
#include <testsuite_hooks.h>
-void test01()
-{
- bool test = true;
- std::ostringstream os01;
- const std::string str00;
- const std::string str01 = "123";
- std::string str02;
- const int i01 = 123;
- int a,b;
-
- std::ios_base::iostate state1, state2, statefail, stateeof;
- statefail = std::ios_base::failbit;
- stateeof = std::ios_base::eofbit;
-
- // string str() const
- str02 = os01.str();
- VERIFY( str00 == str02 );
-
- // void str(const basic_string&)
- os01.str(str01);
- str02 = os01.str();
- VERIFY( str01 == str02 );
-
- #ifdef DEBUG_ASSERT
- assert(test);
-#endif
-}
-
void
redirect_buffer(std::ios& stream, std::streambuf* new_buf)
{ stream.rdbuf(new_buf); }
@@ -97,61 +69,8 @@ void test02()
// These semantics are a joke, a serious defect, and incredibly lame.
}
-// 03: sanity checks for strings, stringbufs
-void
-test03()
-{
- bool test = false;
-
- // Empty string sanity check.
- std::string str01;
- std::string::iterator __i_start = str01.begin();
- std::string::iterator __i_end = str01.end();
- std::string::size_type len = str01.size();
- test = __i_start == __i_end;
- VERIFY( len == 0 );
-
- // Full string sanity check.
- std::string str02("these golden days, i spend waiting for you:\n"
- "Betty Carter on Verve with I'm Yours and You're Mine.");
- __i_start = str02.begin();
- __i_end = str02.end();
- len = str02.size();
- VERIFY( __i_start != __i_end );
- VERIFY( len != 0 );
-
- // Test an empty ostringstream for sanity.
- std::ostringstream ostrstream0;
- std::string str03 = ostrstream0.str();
- __i_start = str03.begin();
- __i_end = str03.end();
- len = str03.size();
- VERIFY( __i_start == __i_end );
- VERIFY( len == 0 );
- VERIFY( str01 == str03 );
-}
-
-// user-reported error
-class derived_oss: public std::ostringstream
-{
-public:
- derived_oss() : std::ostringstream() { }
-};
-
-void
-test04()
-{
- bool test = true;
- derived_oss yy;
- yy << "buena vista social club\n";
- VERIFY( yy.str() == std::string("buena vista social club\n") );
-}
-
int main()
{
- test01();
test02();
- test03();
- test04();
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/1.cc
new file mode 100644
index 00000000000..7a3b758ae72
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/1.cc
@@ -0,0 +1,54 @@
+// 2001-05-23 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.3.2 member functions (ostringstream_members)
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test = true;
+ std::ostringstream os01;
+ const std::string str00;
+ const std::string str01 = "123";
+ std::string str02;
+ const int i01 = 123;
+ int a,b;
+
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+ // string str() const
+ str02 = os01.str();
+ VERIFY( str00 == str02 );
+
+ // void str(const basic_string&)
+ os01.str(str01);
+ str02 = os01.str();
+ VERIFY( str01 == str02 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/2.cc
new file mode 100644
index 00000000000..310b298152b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/2.cc
@@ -0,0 +1,46 @@
+// 2001-05-23 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.3.2 member functions (ostringstream_members)
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// user-reported error
+class derived_oss: public std::ostringstream
+{
+public:
+ derived_oss() : std::ostringstream() { }
+};
+
+void
+test04()
+{
+ bool test = true;
+ derived_oss yy;
+ yy << "buena vista social club\n";
+ VERIFY( yy.str() == std::string("buena vista social club\n") );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/streambuf.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/1.cc
index 29c771b9074..d666528dc67 100644
--- a/libstdc++-v3/testsuite/27_io/streambuf.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/1.cc
@@ -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_streambuf<type_t, char_traits<type_t> >;
- template class basic_streambuf<pod_char, char_traits<pod_char> >;
-} // test
-
-int main()
-{
- test01();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/2.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/2.cc
new file mode 100644
index 00000000000..b3a48269bf4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/2.cc
@@ -0,0 +1,45 @@
+// 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.5.2 - Template class basic_streambuf
+// NB: This file is for testing basic_streambuf with NO OTHER INCLUDES.
+
+#include <streambuf>
+#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_streambuf<type_t, char_traits<type_t> >;
+ template class basic_streambuf<pod_char, char_traits<pod_char> >;
+} // test
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/3.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/3.cc
new file mode 100644
index 00000000000..ffc765f77f9
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/3.cc
@@ -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 <fstream>
+#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_sbuf: public std::basic_streambuf<gnu_char_type, gnu_char_traits>
+{ };
+
+void test07()
+{
+ bool test = true;
+
+ try
+ { gnu_sbuf 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!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/cons/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/cons/char/1.cc
new file mode 100644
index 00000000000..905852422a6
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/cons/char/1.cc
@@ -0,0 +1,111 @@
+// 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 <streambuf>
+#include <testsuite_hooks.h>
+
+class testbuf : public std::streambuf
+{
+public:
+
+ // Typedefs:
+ typedef std::streambuf::traits_type traits_type;
+ typedef std::streambuf::char_type char_type;
+
+ testbuf(): std::streambuf()
+ { _M_mode = (std::ios_base::in | std::ios_base::out); }
+
+ bool
+ check_pointers()
+ {
+ bool test = true;
+ VERIFY( this->eback() == NULL );
+ VERIFY( this->gptr() == NULL );
+ VERIFY( this->egptr() == NULL );
+ VERIFY( this->pbase() == NULL );
+ VERIFY( this->pptr() == NULL );
+ VERIFY( this->epptr() == NULL );
+ return test;
+ }
+
+ int_type
+ pub_uflow()
+ { return (this->uflow()); }
+
+ int_type
+ pub_overflow(int_type __c = traits_type::eof())
+ { return (this->overflow(__c)); }
+
+ int_type
+ pub_pbackfail(int_type __c)
+ { return (this->pbackfail(__c)); }
+
+ void
+ pub_setg(char* beg, char* cur, char *end)
+ { this->setg(beg, cur, end); }
+
+ void
+ pub_setp(char* beg, char* end)
+ { this->setp(beg, end); }
+
+protected:
+ int_type
+ underflow()
+ {
+ int_type __retval = traits_type::eof();
+ if (this->gptr() < this->egptr())
+ __retval = traits_type::not_eof(0);
+ return __retval;
+ }
+};
+
+void test01()
+{
+ typedef testbuf::traits_type traits_type;
+ typedef testbuf::int_type int_type;
+
+ bool test = true;
+ char* lit01 = "chicago underground trio/possible cube on delmark";
+ testbuf buf01;
+
+ // 27.5.2.1 basic_streambuf ctors
+ // default ctor initializes
+ // - all pointer members to null pointers
+ // - locale to current global locale
+ VERIFY( buf01.check_pointers() );
+ VERIFY( buf01.getloc() == std::locale() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/imbue/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/imbue/char/1.cc
new file mode 100644
index 00000000000..b574cdc6736
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/imbue/char/1.cc
@@ -0,0 +1,52 @@
+// 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 <streambuf>
+#include <testsuite_hooks.h>
+
+class testbuf : public std::streambuf
+{
+public:
+ typedef std::streambuf::traits_type traits_type;
+
+ testbuf() : std::streambuf() { }
+};
+
+// test the streambuf locale settings
+void test02()
+{
+ testbuf buf;
+ std::locale loc_c = std::locale::classic();
+ loc_c = buf.getloc();
+ buf.pubimbue(loc_c); //This should initialize _M_init to true
+ std::locale loc_tmp = buf.getloc();
+ VERIFY( loc_tmp == loc_c );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/imbue/char/9322.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/imbue/char/9322.cc
new file mode 100644
index 00000000000..3b8da10b5ad
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/imbue/char/9322.cc
@@ -0,0 +1,72 @@
+// 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 <cstring> // for memset, memcmp
+#include <streambuf>
+#include <sstream>
+#include <ostream>
+#include <testsuite_hooks.h>
+
+class testbuf : public std::streambuf
+{
+public:
+ typedef std::streambuf::traits_type traits_type;
+
+ testbuf() : std::streambuf() { }
+};
+
+// libstdc++/9322
+void test08()
+{
+ using std::locale;
+ bool test = true;
+
+ locale loc;
+ testbuf 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 );
+}
+
+int main()
+{
+ __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test08);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/1.cc
new file mode 100644
index 00000000000..386193b46c0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/1.cc
@@ -0,0 +1,116 @@
+// 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 <streambuf>
+#include <testsuite_hooks.h>
+
+class testbuf : public std::streambuf
+{
+public:
+
+ // Typedefs:
+ typedef std::streambuf::traits_type traits_type;
+ typedef std::streambuf::char_type char_type;
+
+ testbuf(): std::streambuf()
+ { _M_mode = (std::ios_base::in | std::ios_base::out); }
+
+ bool
+ check_pointers()
+ {
+ bool test = true;
+ VERIFY( this->eback() == NULL );
+ VERIFY( this->gptr() == NULL );
+ VERIFY( this->egptr() == NULL );
+ VERIFY( this->pbase() == NULL );
+ VERIFY( this->pptr() == NULL );
+ VERIFY( this->epptr() == NULL );
+ return test;
+ }
+
+ int_type
+ pub_uflow()
+ { return (this->uflow()); }
+
+ int_type
+ pub_overflow(int_type __c = traits_type::eof())
+ { return (this->overflow(__c)); }
+
+ int_type
+ pub_pbackfail(int_type __c)
+ { return (this->pbackfail(__c)); }
+
+ void
+ pub_setg(char* beg, char* cur, char *end)
+ { this->setg(beg, cur, end); }
+
+ void
+ pub_setp(char* beg, char* end)
+ { this->setp(beg, end); }
+
+protected:
+ int_type
+ underflow()
+ {
+ int_type __retval = traits_type::eof();
+ if (this->gptr() < this->egptr())
+ __retval = traits_type::not_eof(0);
+ return __retval;
+ }
+};
+
+void test01()
+{
+ typedef testbuf::traits_type traits_type;
+ typedef testbuf::int_type int_type;
+
+ bool test = true;
+ char* lit01 = "chicago underground trio/possible cube on delmark";
+ testbuf buf01;
+
+ // pbackfail
+ int i01 = 3;
+ buf01.pub_setg(lit01, lit01, (lit01 + i01));
+ VERIFY( i01 == buf01.in_avail() );
+ int_type intt01 = traits_type::to_int_type('b');
+ VERIFY( traits_type::eof() == buf01.pub_pbackfail(intt01) );
+
+ // overflow
+ VERIFY( traits_type::eof() == buf01.pub_overflow(intt01) );
+ VERIFY( traits_type::eof() == buf01.pub_overflow() );
+ VERIFY( buf01.sgetc() == traits_type::to_int_type(lit01[0]) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/2.cc
new file mode 100644
index 00000000000..dcee654b213
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/2.cc
@@ -0,0 +1,80 @@
+// 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 <streambuf>
+#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_streambuf<charT, traits>
+ {
+ protected:
+ typedef typename
+ std::basic_streambuf<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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/3599.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/3599.cc
new file mode 100644
index 00000000000..1b6cf0cf332
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/3599.cc
@@ -0,0 +1,68 @@
+// 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 <streambuf>
+#include <ostream>
+#include <testsuite_hooks.h>
+
+// libstdc++/3599
+class testbuf : public std::streambuf
+{
+public:
+ typedef std::streambuf::traits_type traits_type;
+
+ testbuf() : std::streambuf() { }
+
+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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/char/1.cc
new file mode 100644
index 00000000000..9efa3a72a48
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/char/1.cc
@@ -0,0 +1,118 @@
+// 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 <streambuf>
+#include <testsuite_hooks.h>
+
+class testbuf : public std::streambuf
+{
+public:
+
+ // Typedefs:
+ typedef std::streambuf::traits_type traits_type;
+ typedef std::streambuf::char_type char_type;
+
+ testbuf(): std::streambuf()
+ { _M_mode = (std::ios_base::in | std::ios_base::out); }
+
+ bool
+ check_pointers()
+ {
+ bool test = true;
+ VERIFY( this->eback() == NULL );
+ VERIFY( this->gptr() == NULL );
+ VERIFY( this->egptr() == NULL );
+ VERIFY( this->pbase() == NULL );
+ VERIFY( this->pptr() == NULL );
+ VERIFY( this->epptr() == NULL );
+ return test;
+ }
+
+ int_type
+ pub_uflow()
+ { return (this->uflow()); }
+
+ int_type
+ pub_overflow(int_type __c = traits_type::eof())
+ { return (this->overflow(__c)); }
+
+ int_type
+ pub_pbackfail(int_type __c)
+ { return (this->pbackfail(__c)); }
+
+ void
+ pub_setg(char* beg, char* cur, char *end)
+ { this->setg(beg, cur, end); }
+
+ void
+ pub_setp(char* beg, char* end)
+ { this->setp(beg, end); }
+
+protected:
+ int_type
+ underflow()
+ {
+ int_type __retval = traits_type::eof();
+ if (this->gptr() < this->egptr())
+ __retval = traits_type::not_eof(0);
+ return __retval;
+ }
+};
+
+void test01()
+{
+ typedef testbuf::traits_type traits_type;
+ typedef testbuf::int_type int_type;
+
+ bool test = true;
+ char* lit01 = "chicago underground trio/possible cube on delmark";
+ testbuf buf01;
+
+ // 27.5.2.3.1 get area
+ // 27.5.2.2.3 get area
+ // 27.5.2.4.3 get area
+ int i01 = 3;
+ buf01.pub_setg(lit01, lit01, (lit01 + i01));
+ VERIFY( i01 == buf01.in_avail() );
+
+ VERIFY( buf01.pub_uflow() == lit01[0] );
+ VERIFY( buf01.sgetc() == traits_type::to_int_type(lit01[1]) );
+ VERIFY( buf01.pub_uflow() == lit01[1] );
+ VERIFY( buf01.sgetc() == traits_type::to_int_type(lit01[2]) );
+ VERIFY( buf01.pub_uflow() == lit01[2] );
+ VERIFY( buf01.sgetc() == traits_type::eof() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetn/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetn/char/1.cc
new file mode 100644
index 00000000000..2466de5299f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetn/char/1.cc
@@ -0,0 +1,126 @@
+// 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 <streambuf>
+#include <testsuite_hooks.h>
+
+class testbuf : public std::streambuf
+{
+public:
+
+ // Typedefs:
+ typedef std::streambuf::traits_type traits_type;
+ typedef std::streambuf::char_type char_type;
+
+ testbuf(): std::streambuf()
+ { _M_mode = (std::ios_base::in | std::ios_base::out); }
+
+ bool
+ check_pointers()
+ {
+ bool test = true;
+ VERIFY( this->eback() == NULL );
+ VERIFY( this->gptr() == NULL );
+ VERIFY( this->egptr() == NULL );
+ VERIFY( this->pbase() == NULL );
+ VERIFY( this->pptr() == NULL );
+ VERIFY( this->epptr() == NULL );
+ return test;
+ }
+
+ int_type
+ pub_uflow()
+ { return (this->uflow()); }
+
+ int_type
+ pub_overflow(int_type __c = traits_type::eof())
+ { return (this->overflow(__c)); }
+
+ int_type
+ pub_pbackfail(int_type __c)
+ { return (this->pbackfail(__c)); }
+
+ void
+ pub_setg(char* beg, char* cur, char *end)
+ { this->setg(beg, cur, end); }
+
+ void
+ pub_setp(char* beg, char* end)
+ { this->setp(beg, end); }
+
+protected:
+ int_type
+ underflow()
+ {
+ int_type __retval = traits_type::eof();
+ if (this->gptr() < this->egptr())
+ __retval = traits_type::not_eof(0);
+ return __retval;
+ }
+};
+
+void test02()
+{
+ typedef testbuf::traits_type traits_type;
+ typedef testbuf::int_type int_type;
+
+ bool test = true;
+ char* lit01 = "chicago underground trio/possible cube on delmark";
+ testbuf buf01;
+
+ // 27.5.2.1 basic_streambuf ctors
+ // default ctor initializes
+ // - all pointer members to null pointers
+ // - locale to current global locale
+ VERIFY( buf01.check_pointers() );
+ VERIFY( buf01.getloc() == std::locale() );
+
+ // 27.5.2.2.5 Put area
+ size_t i01 = traits_type::length(lit01);
+ char carray01[i01];
+ std::memset(carray01, 0, i01);
+
+ buf01.pub_setg(lit01, lit01, lit01 + i01);
+ buf01.sgetn(carray01, 0);
+ VERIFY( carray01[0] == 0 );
+ buf01.sgetn(carray01, 1);
+ VERIFY( carray01[0] == 'c' );
+ buf01.sgetn(carray01 + 1, i01 - 1);
+ VERIFY( carray01[0] == 'c' );
+ VERIFY( carray01[1] == 'h' );
+ VERIFY( carray01[i01 - 1] == 'k' );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sputbackc/char/9538.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputbackc/char/9538.cc
new file mode 100644
index 00000000000..b90e3d50858
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputbackc/char/9538.cc
@@ -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.8.1.4 Overridden virtual functions
+
+#include <streambuf>
+#include <locale>
+#include <testsuite_hooks.h>
+
+class MyTraits : public std::char_traits<char>
+{
+public:
+ static bool eq(char c1, char c2)
+ {
+ bool test = true;
+ VERIFY( c1 != 'X' );
+ VERIFY( c2 != 'X' );
+ return std::char_traits<char>::eq(c1, c2);
+ }
+};
+
+class MyBuf : public std::basic_streambuf<char, MyTraits>
+{
+ char buffer[8];
+
+public:
+ MyBuf()
+ {
+ std::memset(buffer, 'X', sizeof(buffer));
+ std::memset(buffer + 2, 'f', 4);
+ setg(buffer + 2, buffer + 2, buffer + 6);
+ }
+};
+
+// libstdc++/9538
+void test08()
+{
+ bool test = true;
+
+ MyBuf mb;
+ mb.sputbackc('a');
+}
+
+main()
+{
+ test08();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sputc/char/1057.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputc/char/1057.cc
new file mode 100644
index 00000000000..de849513c01
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputc/char/1057.cc
@@ -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 <streambuf>
+#include <testsuite_hooks.h>
+
+class nullsetpbuf : public std::streambuf
+{
+ 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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1.cc
new file mode 100644
index 00000000000..f48f788f4f2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1.cc
@@ -0,0 +1,124 @@
+// 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 <streambuf>
+#include <testsuite_hooks.h>
+
+class testbuf : public std::streambuf
+{
+public:
+
+ // Typedefs:
+ typedef std::streambuf::traits_type traits_type;
+ typedef std::streambuf::char_type char_type;
+
+ testbuf(): std::streambuf()
+ { _M_mode = (std::ios_base::in | std::ios_base::out); }
+
+ bool
+ check_pointers()
+ {
+ bool test = true;
+ VERIFY( this->eback() == NULL );
+ VERIFY( this->gptr() == NULL );
+ VERIFY( this->egptr() == NULL );
+ VERIFY( this->pbase() == NULL );
+ VERIFY( this->pptr() == NULL );
+ VERIFY( this->epptr() == NULL );
+ return test;
+ }
+
+ int_type
+ pub_uflow()
+ { return (this->uflow()); }
+
+ int_type
+ pub_overflow(int_type __c = traits_type::eof())
+ { return (this->overflow(__c)); }
+
+ int_type
+ pub_pbackfail(int_type __c)
+ { return (this->pbackfail(__c)); }
+
+ void
+ pub_setg(char* beg, char* cur, char *end)
+ { this->setg(beg, cur, end); }
+
+ void
+ pub_setp(char* beg, char* end)
+ { this->setp(beg, end); }
+
+protected:
+ int_type
+ underflow()
+ {
+ int_type __retval = traits_type::eof();
+ if (this->gptr() < this->egptr())
+ __retval = traits_type::not_eof(0);
+ return __retval;
+ }
+};
+
+void test01()
+{
+ typedef testbuf::traits_type traits_type;
+ typedef testbuf::int_type int_type;
+
+ bool test = true;
+ char* lit01 = "chicago underground trio/possible cube on delmark";
+ testbuf buf01;
+ int i01 = 3;
+
+ // sputn/xsputn
+ char* lit02 = "isotope 217: the unstable molecule on thrill jockey";
+ int i02 = std::strlen(lit02);
+ char carray[i02 + 1];
+ std::memset(carray, 0, i02 + 1);
+
+ buf01.pub_setp(carray, (carray + i02));
+ buf01.sputn(lit02, 0);
+ VERIFY( carray[0] == 0 );
+ VERIFY( lit02[0] == 'i' );
+ buf01.sputn(lit02, 1);
+ VERIFY( lit02[0] == carray[0] );
+ VERIFY( lit02[1] == 's' );
+ VERIFY( carray[1] == 0 );
+ buf01.sputn(lit02 + 1, 10);
+ VERIFY( std::memcmp(lit02, carray, 10) == 0 );
+ buf01.sputn(lit02 + 11, 20);
+ VERIFY( std::memcmp(lit02, carray, 30) == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1057.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1057.cc
new file mode 100644
index 00000000000..628e2e77d73
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1057.cc
@@ -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 <streambuf>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+class nullsetpbuf : public std::streambuf
+{
+ 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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sync/char/1057.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sync/char/1057.cc
new file mode 100644
index 00000000000..8e2d3c0aef7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sync/char/1057.cc
@@ -0,0 +1,108 @@
+// 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 <streambuf>
+#include <testsuite_hooks.h>
+
+class setpbuf : public std::streambuf
+{
+ char buffer[4];
+ std::string result;
+
+public:
+
+ std::string&
+ get_result()
+ { return result; }
+
+ setpbuf()
+ {
+ char foo [32];
+ setp(foo, foo + 32);
+ setp(buffer, buffer + 4);
+ }
+
+ ~setpbuf()
+ { sync(); }
+
+ 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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/stringbuf.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/1.cc
index a91deab2f1d..a91deab2f1d 100644
--- a/libstdc++-v3/testsuite/27_io/stringbuf.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/1.cc
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/2.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/2.cc
new file mode 100644
index 00000000000..f40868a179f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/2.cc
@@ -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.7.1 - Template class basic_stringbuf
+// NB: This file is for testing basic_filebuf with NO OTHER INCLUDES.
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// { dg-do compile }
+
+// test05
+// libstdc++/1886
+// should be able to instantiate basic_stringbuf for non-standard types.
+namespace test
+{
+ using namespace std;
+ using __gnu_cxx_test::pod_char;
+ typedef short type_t;
+ template class basic_stringbuf<type_t, char_traits<type_t> >;
+ template class basic_stringbuf<pod_char, char_traits<pod_char> >;
+} // test
+
+// more surf!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/3.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/3.cc
new file mode 100644
index 00000000000..93358ccfe58
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/3.cc
@@ -0,0 +1,145 @@
+// 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.7.1 - Template class basic_stringbuf
+// NB: This file is for testing basic_filebuf with NO OTHER INCLUDES.
+
+#include <sstream>
+#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(); }
+};
+
+void test07()
+{
+ bool test = true;
+ typedef std::basic_stringbuf<gnu_char_type, gnu_char_traits> gnu_ssbuf;
+
+ try
+ { gnu_ssbuf 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!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/4.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/4.cc
new file mode 100644
index 00000000000..cd4c4311c6a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/4.cc
@@ -0,0 +1,47 @@
+// 2003-04-07 bkoz
+
+// 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.7.1 - Template class basic_stringbuf
+// NB: This file is for testing basic_filebuf with NO OTHER INCLUDES.
+
+#include <sstream>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// { dg-do compile }
+
+namespace test
+{
+ using namespace std;
+ using __gnu_cxx_test::pod_char;
+ typedef __gnu_cxx_test::tracker_alloc<char> alloc_type;
+ template class basic_stringbuf<char, char_traits<char>, alloc_type>;
+} // test
+
+// more surf!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/5.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/5.cc
new file mode 100644
index 00000000000..4f308b98cb7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/5.cc
@@ -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.7.1 - Template class basic_stringbuf
+
+#include <sstream>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::stringbuf 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!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/imbue/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/imbue/char/1.cc
new file mode 100644
index 00000000000..153d7df6a8a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/imbue/char/1.cc
@@ -0,0 +1,46 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+std::string str_01("mykonos. . . or what?");
+std::stringbuf strb_01(str_01);
+
+// test the streambuf/stringbuf locale settings
+void test02()
+{
+ std::locale loc_c = std::locale::classic();
+ loc_c = strb_01.getloc();
+ strb_01.pubimbue(loc_c); //This should initialize _M_init to true
+ std::locale loc_tmp = strb_01.getloc();
+ VERIFY( loc_tmp == loc_c );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/imbue/char/9322.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/imbue/char/9322.cc
new file mode 100644
index 00000000000..3da38fb8ff4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/imbue/char/9322.cc
@@ -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.7.1.3 Overridden virtual functions
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/9322
+void test03()
+{
+ using std::locale;
+ bool test = true;
+
+ locale loc = std::locale::classic();
+ std::stringbuf 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 );
+}
+
+int main()
+{
+ using namespace std;
+ __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/in_avail/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/in_avail/char/1.cc
new file mode 100644
index 00000000000..928f9457cb4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/in_avail/char/1.cc
@@ -0,0 +1,65 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+std::string str_01("mykonos. . . or what?");
+std::string str_02("paris, or sainte-maxime?");
+std::string str_03;
+std::stringbuf strb_01(str_01);
+std::stringbuf strb_02(str_02, std::ios_base::in);
+std::stringbuf strb_03(str_03, std::ios_base::out);
+
+// test overloaded virtual functions
+void test04()
+{
+ bool test = true;
+ std::string str_tmp;
+ std::stringbuf strb_tmp;
+ std::streamsize strmsz_1, strmsz_2;
+ std::streamoff strmof_1(-1), strmof_2;
+ typedef std::stringbuf::int_type int_type;
+ typedef std::stringbuf::traits_type traits_type;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+
+ // GET
+ // int in_avail()
+ strmof_1 = strb_01.in_avail();
+ strmof_2 = strb_02.in_avail();
+ VERIFY( strmof_1 != strmof_2 );
+ VERIFY( strmof_1 == str_01.length() );
+ VERIFY( strmof_2 == str_02.length() );
+ strmof_1 = strb_03.in_avail();
+ // zero cuz write-only, or eof()? zero, from showmany
+ VERIFY( strmof_1 == 0 );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/char/2.cc
new file mode 100644
index 00000000000..90845d0ad47
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/char/2.cc
@@ -0,0 +1,80 @@
+// 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 <sstream>
+#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_stringbuf<charT, traits>
+ {
+ protected:
+ typedef typename
+ std::basic_stringbuf<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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/char/3599.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/char/3599.cc
new file mode 100644
index 00000000000..a8e3a287464
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/char/3599.cc
@@ -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 <sstream>
+#include <ostream>
+#include <testsuite_hooks.h>
+
+// libstdc++/3599
+class testbuf : public std::stringbuf
+{
+public:
+ typedef std::stringbuf::traits_type traits_type;
+
+ testbuf() : std::stringbuf() { }
+
+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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/char/9988.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/char/9988.cc
new file mode 100644
index 00000000000..abdd4def261
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/char/9988.cc
@@ -0,0 +1,63 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+class OverBuf : public std::stringbuf
+{
+public:
+ int_type pub_overflow(int_type c = traits_type::eof())
+ { return std::stringbuf::overflow(c); }
+};
+
+// libstdc++/9988
+// filebuf::overflow writes EOF to file
+void test15()
+{
+ using namespace std;
+ bool test = true;
+
+ OverBuf sb;
+
+ sb.sputc('a');
+ sb.pub_overflow('b');
+ sb.pub_overflow();
+ sb.sputc('c');
+
+ stringbuf sbin(sb.str(), ios_base::in);
+ stringbuf::int_type c;
+ c = sbin.sbumpc();
+ VERIFY( c == 'a' );
+ c = sbin.sbumpc();
+ VERIFY( c == 'b' );
+ c = sbin.sbumpc();
+ VERIFY( c == 'c' );
+ c = sbin.sbumpc();
+ VERIFY( c == stringbuf::traits_type::eof() );
+}
+
+main()
+{
+ test15();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/1.cc
new file mode 100644
index 00000000000..f075f9db759
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/1.cc
@@ -0,0 +1,74 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+std::string str_01("mykonos. . . or what?");
+std::string str_02("paris, or sainte-maxime?");
+std::string str_03;
+std::stringbuf strb_01(str_01);
+std::stringbuf strb_02(str_02, std::ios_base::in);
+std::stringbuf strb_03(str_03, std::ios_base::out);
+
+// test overloaded virtual functions
+void test04()
+{
+ bool test = true;
+ std::string str_tmp;
+ std::stringbuf strb_tmp;
+ std::streamsize strmsz_1, strmsz_2;
+ std::streamoff strmof_1(-1), strmof_2;
+ typedef std::stringbuf::int_type int_type;
+ typedef std::stringbuf::traits_type traits_type;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+
+ // GET
+ strmof_1 = strb_01.in_avail();
+ strmof_2 = strb_02.in_avail();
+ strmof_1 = strb_03.in_avail();
+
+ // int_type sbumpc()
+ // if read_cur not avail, return uflow(), else return *read_cur & increment
+ int_type c1 = strb_01.sbumpc();
+ int_type c2 = strb_02.sbumpc();
+ VERIFY( c1 != c2 );
+ VERIFY( c1 == str_01[0] );
+ VERIFY( c2 == str_02[0] ); //should equal first letter at this point
+ int_type c3 = strb_01.sbumpc();
+ int_type c4 = strb_02.sbumpc();
+ VERIFY( c1 != c2 );
+ VERIFY( c1 != c3 );
+ VERIFY( c2 != c4 );
+ int_type c5 = strb_03.sbumpc();
+ VERIFY( c5 == traits_type::eof() );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/9825.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/9825.cc
new file mode 100644
index 00000000000..df6fa264d0e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/9825.cc
@@ -0,0 +1,50 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/9825
+// filebuf::sputbackc breaks sbumpc
+void test12()
+{
+ using namespace std;
+ bool test = true;
+
+ stringbuf sbuf;
+ sbuf.sputn("crazy bees!", 11);
+ sbuf.pubseekoff(0, ios_base::beg);
+ sbuf.sbumpc();
+ sbuf.sputbackc('x');
+ stringbuf::int_type c = sbuf.sbumpc();
+ VERIFY( c == 'x' );
+ c = sbuf.sbumpc();
+ VERIFY( c == 'r' );
+ c = sbuf.sbumpc();
+ VERIFY( c == 'a' );
+}
+
+main()
+{
+ test12();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc
new file mode 100644
index 00000000000..579206ff160
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc
@@ -0,0 +1,124 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+std::string str_01("mykonos. . . or what?");
+std::string str_02("paris, or sainte-maxime?");
+std::string str_03;
+std::stringbuf strb_01(str_01);
+std::stringbuf strb_02(str_02, std::ios_base::in);
+std::stringbuf strb_03(str_03, std::ios_base::out);
+
+// test overloaded virtual functions
+void test04()
+{
+ bool test = true;
+ std::string str_tmp;
+ std::stringbuf strb_tmp;
+ std::streamsize strmsz_1, strmsz_2;
+ std::streamoff strmof_1(-1), strmof_2;
+ typedef std::stringbuf::int_type int_type;
+ typedef std::stringbuf::traits_type traits_type;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+
+ int_type c1 = strb_01.sbumpc();
+ int_type c2 = strb_02.sbumpc();
+ int_type c3 = strb_01.sbumpc();
+ int_type c4 = strb_02.sbumpc();
+ int_type c5 = strb_03.sbumpc();
+
+ // PUT
+ strb_03.str(str_01); //reset
+
+ // BUFFER MANAGEMENT & POSITIONING
+
+ // 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;
+ strb_01.str(str_01); //in|out ("mykonos. . . or what?");
+ strb_02.str(str_02); //in ("paris, or sainte-maxime?");
+ strb_03.str(str_03); //out ("")
+ //IN|OUT
+ //beg
+ pt_1 = strb_01.pubseekoff(2, std::ios_base::beg);
+ off_1 = pt_1;
+ VERIFY( off_1 >= 0 );
+ c1 = strb_01.snextc(); //current in pointer +1
+ VERIFY( c1 == 'o' );
+ c2 = strb_01.sputc('x'); //test current out pointer
+ str_tmp = std::string("myxonos. . . or what?");
+ VERIFY( strb_01.str() == str_tmp );
+ //cur
+ pt_1 = strb_01.pubseekoff(2, std::ios_base::cur);
+ off_1 = pt_1;
+ VERIFY( off_1 == -1 ); // can't seekoff for in and out + cur in sstreams
+ pt_1 = strb_01.pubseekoff(2, std::ios_base::cur, std::ios_base::in);
+ off_1 = pt_1;
+ pt_2 = strb_01.pubseekoff(2, std::ios_base::cur, std::ios_base::in);
+ off_2 = pt_2;
+ VERIFY( off_2 == off_1 + 2 );
+ c1 = strb_01.snextc(); //current in pointer + 1
+ VERIFY( c1 == ' ' );
+ c2 = strb_01.sputc('x'); //test current out pointer
+ str_tmp = std::string("myxxnos. . . or what?");
+ VERIFY( strb_01.str() == str_tmp );
+ //end
+ pt_2 = strb_01.pubseekoff(2, std::ios_base::end);
+ off_1 = pt_2;
+ VERIFY( off_1 == -1 ); // not a valid position
+ VERIFY( strb_01.str() == str_tmp );
+ // end part two (from the filebuf tests)
+ strb_01.pubseekoff(0, std::ios_base::end);
+ strmsz_1 = strb_01.in_avail(); // 0 cuz at the end
+ c1 = strb_01.sgetc();
+ c2 = strb_01.sungetc();
+ strmsz_2 = strb_01.in_avail(); // 1
+ c3 = strb_01.sgetc();
+ VERIFY( c1 != c2 );
+ VERIFY( strmsz_2 != strmsz_1 );
+ VERIFY( strmsz_2 == 1 );
+ // end part three
+ strmsz_1 = strb_01.str().size();
+ strmsz_2 = strb_01.sputn(" ravi shankar meets carlos santana in LoHa", 90);
+ strb_01.pubseekoff(0, std::ios_base::end);
+ strb_01.sputc('<');
+ str_tmp = strb_01.str();
+ VERIFY( str_tmp.size() == strmsz_1 + strmsz_2 + 1 );
+ // IN
+ // OUT
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/2.cc
new file mode 100644
index 00000000000..869cd46f56a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/2.cc
@@ -0,0 +1,59 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+void test02(std::stringbuf& 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);
+ VERIFY( p == bad );
+}
+
+int main()
+{
+ using namespace std;
+
+ // movie star, submarine scientist!
+ stringbuf in1("Hedy Lamarr", ios_base::in);
+ stringbuf in2(ios_base::in);
+ stringbuf in3("", ios_base::in);
+ test02(in1, true);
+ test02(in2, false);
+ test02(in3, false);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/1.cc
new file mode 100644
index 00000000000..12143c5add7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/1.cc
@@ -0,0 +1,98 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+std::string str_01("mykonos. . . or what?");
+std::string str_02("paris, or sainte-maxime?");
+std::string str_03;
+std::stringbuf strb_01(str_01);
+std::stringbuf strb_02(str_02, std::ios_base::in);
+std::stringbuf strb_03(str_03, std::ios_base::out);
+
+// test overloaded virtual functions
+void test04()
+{
+ bool test = true;
+ std::string str_tmp;
+ std::stringbuf strb_tmp;
+ std::streamsize strmsz_1, strmsz_2;
+ std::streamoff strmof_1(-1), strmof_2;
+ typedef std::stringbuf::int_type int_type;
+ typedef std::stringbuf::traits_type traits_type;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+
+ int_type c1 = strb_01.sbumpc();
+ int_type c2 = strb_02.sbumpc();
+ int_type c3 = strb_01.sbumpc();
+ int_type c4 = strb_02.sbumpc();
+ int_type c5 = strb_03.sbumpc();
+
+ pos_type pt_1(off_type(-1));
+ pos_type pt_2(off_type(0));
+ off_type off_1 = 0;
+ off_type off_2 = 0;
+
+ // PUT
+ strb_03.str(str_01); //reset
+
+ // BUFFER MANAGEMENT & POSITIONING
+
+ // seekpos
+ // pubseekpos(pos_type sp, ios_base::openmode)
+ // alters the stream position to sp
+ strb_01.str(str_01); //in|out ("mykonos. . . or what?");
+ strb_02.str(str_02); //in ("paris, or sainte-maxime?");
+ strb_03.str(str_03); //out ("")
+ //IN|OUT
+ //beg
+ pt_1 = strb_01.pubseekoff(2, std::ios_base::beg);
+ off_1 = pt_1;
+ VERIFY( off_1 >= 0 );
+ pt_1 = strb_01.pubseekoff(0, std::ios_base::cur, std::ios_base::out);
+ off_1 = pt_1;
+ c1 = strb_01.snextc(); //current in pointer +1
+ VERIFY( c1 == 'o' );
+ c2 = strb_01.sputc('x'); //test current out pointer
+ str_tmp = std::string("myxonos. . . or what?");
+ VERIFY( strb_01.str() == str_tmp );
+ strb_01.pubsync(); //resets pointers
+ pt_2 = strb_01.pubseekpos(pt_1, std::ios_base::in|std::ios_base::out);
+ off_2 = pt_2;
+ VERIFY( off_1 == off_2 );
+ c3 = strb_01.snextc(); //current in pointer +1
+ VERIFY( c1 == c3 );
+ c2 = strb_01.sputc('x'); //test current out pointer
+ str_tmp = std::string("myxonos. . . or what?");
+ VERIFY( strb_01.str() == str_tmp );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/2.cc
new file mode 100644
index 00000000000..c3c6a8ad683
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/2.cc
@@ -0,0 +1,60 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+void test02(std::stringbuf& 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 );
+}
+
+int main()
+{
+ using namespace std;
+
+ // movie star, submarine scientist!
+ stringbuf in1("Hedy Lamarr", ios_base::in);
+ stringbuf in2(ios_base::in);
+ stringbuf in3("", ios_base::in);
+ test02(in1, true);
+ test02(in2, false);
+ test02(in3, false);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/char/1.cc
new file mode 100644
index 00000000000..e79da0eda3a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/char/1.cc
@@ -0,0 +1,72 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+std::string str_01("mykonos. . . or what?");
+std::string str_02("paris, or sainte-maxime?");
+std::string str_03;
+std::stringbuf strb_01(str_01);
+std::stringbuf strb_02(str_02, std::ios_base::in);
+std::stringbuf strb_03(str_03, std::ios_base::out);
+
+// test overloaded virtual functions
+void test04()
+{
+ bool test = true;
+ std::string str_tmp;
+ std::stringbuf strb_tmp;
+ std::streamsize strmsz_1, strmsz_2;
+ std::streamoff strmof_1(-1), strmof_2;
+ typedef std::stringbuf::int_type int_type;
+ typedef std::stringbuf::traits_type traits_type;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+
+ int_type c1 = strb_01.sbumpc();
+ int_type c2 = strb_02.sbumpc();
+ int_type c3 = strb_01.sbumpc();
+ int_type c4 = strb_02.sbumpc();
+ int_type c5 = strb_03.sbumpc();
+
+ // PUT
+ strb_03.str(str_01); //reset
+
+ // BUFFER MANAGEMENT & POSITIONING
+ // setbuf
+ // pubsetbuf(char_type* s, streamsize n)
+ str_tmp = std::string("naaaah, go to cebu");
+ strb_01.pubsetbuf(const_cast<char*> (str_tmp.c_str()), str_tmp.size());
+ VERIFY( strb_01.str() == str_tmp );
+ strb_01.pubsetbuf(0,0);
+ VERIFY( strb_01.str() == str_tmp );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/char/2.cc
new file mode 100644
index 00000000000..0eade15314a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/char/2.cc
@@ -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 <sstream>
+#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);
+ stringbuf sbuf;
+
+ sbuf.pubsetbuf(buf, 512);
+ sbuf.sputn(strlit, strlitsize);
+ VERIFY( std::strncmp(strlit, buf, strlitsize) == 0 );
+}
+
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/char/3.cc
new file mode 100644
index 00000000000..6a8d0b462e4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/char/3.cc
@@ -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 <sstream>
+#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);
+ string s("tmp");
+ stringbuf sbuf(s, ios_base::out);
+ sbuf.pubsetbuf(buf, strlitsize);
+ sbuf.sputn(strlit, strlitsize);
+ VERIFY( std::strncmp(strlit, buf, strlitsize) == 0 );
+}
+
+main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetc/char/1.cc
new file mode 100644
index 00000000000..c34109df6b1
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetc/char/1.cc
@@ -0,0 +1,78 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+std::string str_01("mykonos. . . or what?");
+std::string str_02("paris, or sainte-maxime?");
+std::string str_03;
+std::stringbuf strb_01(str_01);
+std::stringbuf strb_02(str_02, std::ios_base::in);
+std::stringbuf strb_03(str_03, std::ios_base::out);
+
+// test overloaded virtual functions
+void test04()
+{
+ bool test = true;
+ std::string str_tmp;
+ std::stringbuf strb_tmp;
+ std::streamsize strmsz_1, strmsz_2;
+ std::streamoff strmof_1(-1), strmof_2;
+ typedef std::stringbuf::int_type int_type;
+ typedef std::stringbuf::traits_type traits_type;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+
+ // GET
+ strmof_1 = strb_01.in_avail();
+ strmof_2 = strb_02.in_avail();
+ strmof_1 = strb_03.in_avail();
+
+ int_type c1 = strb_01.sbumpc();
+ int_type c2 = strb_02.sbumpc();
+ int_type c3 = strb_01.sbumpc();
+ int_type c4 = strb_02.sbumpc();
+ int_type c5 = strb_03.sbumpc();
+
+ // int_type sgetc()
+ // if read_cur not avail, return uflow(), else return *read_cur
+ int_type c6 = strb_01.sgetc();
+ int_type c7 = strb_02.sgetc();
+ VERIFY( c6 != c3 );
+ VERIFY( c7 != c4 );
+ int_type c8 = strb_01.sgetc();
+ int_type c9 = strb_02.sgetc();
+ VERIFY( c6 == c8 );
+ VERIFY( c7 == c9 );
+ c5 = strb_03.sgetc();
+ VERIFY( c5 == traits_type::eof() );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/char/1.cc
new file mode 100644
index 00000000000..420a318c86b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/char/1.cc
@@ -0,0 +1,108 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+std::string str_01("mykonos. . . or what?");
+std::string str_02("paris, or sainte-maxime?");
+std::string str_03;
+std::stringbuf strb_01(str_01);
+std::stringbuf strb_02(str_02, std::ios_base::in);
+std::stringbuf strb_03(str_03, std::ios_base::out);
+
+// test overloaded virtual functions
+void test04()
+{
+ bool test = true;
+ std::string str_tmp;
+ std::stringbuf strb_tmp;
+ std::streamsize strmsz_1, strmsz_2;
+ std::streamoff strmof_1(-1), strmof_2;
+ typedef std::stringbuf::int_type int_type;
+ typedef std::stringbuf::traits_type traits_type;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+
+ // GET
+ strmof_1 = strb_01.in_avail();
+ strmof_2 = strb_02.in_avail();
+ strmof_1 = strb_03.in_avail();
+
+ int_type c1 = strb_01.sbumpc();
+ int_type c2 = strb_02.sbumpc();
+ int_type c3 = strb_01.sbumpc();
+ int_type c4 = strb_02.sbumpc();
+ int_type c5 = strb_03.sbumpc();
+
+ // int_type sgetc()
+ // if read_cur not avail, return uflow(), else return *read_cur
+ int_type c6 = strb_01.sgetc();
+ int_type c7 = strb_02.sgetc();
+ int_type c8 = strb_01.sgetc();
+ int_type c9 = strb_02.sgetc();
+ c5 = strb_03.sgetc();
+
+ // int_type snextc()
+ // calls sbumpc and if sbumpc != eof, return sgetc
+ c6 = strb_01.snextc();
+ c7 = strb_02.snextc();
+ c5 = strb_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 = strb_01.in_avail();
+ strmsz_2 = strb_02.in_avail();
+ test = strmsz_1 != strmsz_2;
+ VERIFY( strmsz_1 != str_01.length() );
+ VERIFY( strmsz_2 != str_02.length() ); //because now we've moved into string
+ char carray1[11] = "";
+ strmsz_1 = strb_01.sgetn(carray1, 10);
+ char carray2[20] = "";
+ strmsz_2 = strb_02.sgetn(carray2, 10);
+ VERIFY( strmsz_1 == strmsz_2 );
+ VERIFY( strmsz_1 == 10 );
+ c1 = strb_01.sgetc();
+ c2 = strb_02.sgetc();
+ VERIFY( c6 == c1 ); //just by co-incidence both o's
+ VERIFY( c7 != c2 ); // n != i
+ VERIFY( c1 == str_01[13] );
+ VERIFY( c2 == str_02[13] ); //should equal fourteenth letter at this point
+ strmsz_1 = strb_03.sgetn(carray1, 10);
+ VERIFY( !strmsz_1 ); //zero
+ strmsz_1 = strb_02.in_avail();
+ strmsz_2 = strb_02.sgetn(carray2, strmsz_1 + 5);
+ VERIFY( strmsz_1 == strmsz_2 ); //write off the end
+ c4 = strb_02.sgetc(); // should be EOF
+ VERIFY( c4 == traits_type::eof() );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/char/1.cc
new file mode 100644
index 00000000000..63e3515c802
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/char/1.cc
@@ -0,0 +1,84 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+std::string str_01("mykonos. . . or what?");
+std::string str_02("paris, or sainte-maxime?");
+std::string str_03;
+std::stringbuf strb_01(str_01);
+std::stringbuf strb_02(str_02, std::ios_base::in);
+std::stringbuf strb_03(str_03, std::ios_base::out);
+
+// test overloaded virtual functions
+void test04()
+{
+ bool test = true;
+ std::string str_tmp;
+ std::stringbuf strb_tmp;
+ std::streamsize strmsz_1, strmsz_2;
+ std::streamoff strmof_1(-1), strmof_2;
+ typedef std::stringbuf::int_type int_type;
+ typedef std::stringbuf::traits_type traits_type;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+
+ // GET
+ strmof_1 = strb_01.in_avail();
+ strmof_2 = strb_02.in_avail();
+ strmof_1 = strb_03.in_avail();
+
+ int_type c1 = strb_01.sbumpc();
+ int_type c2 = strb_02.sbumpc();
+ int_type c3 = strb_01.sbumpc();
+ int_type c4 = strb_02.sbumpc();
+ int_type c5 = strb_03.sbumpc();
+
+ // int_type sgetc()
+ // if read_cur not avail, return uflow(), else return *read_cur
+ int_type c6 = strb_01.sgetc();
+ int_type c7 = strb_02.sgetc();
+ int_type c8 = strb_01.sgetc();
+ int_type c9 = strb_02.sgetc();
+ c5 = strb_03.sgetc();
+
+ // int_type snextc()
+ // calls sbumpc and if sbumpc != eof, return sgetc
+ c6 = strb_01.snextc();
+ c7 = strb_02.snextc();
+ VERIFY( c6 != c8 );
+ VERIFY( c7 != c9 );
+ VERIFY( c6 == str_01[3] );
+ VERIFY( c7 == str_02[3] ); //should equal fourth letter at this point
+ c5 = strb_03.snextc();
+ VERIFY( c5 == traits_type::eof() );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/char/1.cc
new file mode 100644
index 00000000000..ef7c68f72c0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/char/1.cc
@@ -0,0 +1,122 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+std::string str_01("mykonos. . . or what?");
+std::string str_02("paris, or sainte-maxime?");
+std::string str_03;
+std::stringbuf strb_01(str_01);
+std::stringbuf strb_02(str_02, std::ios_base::in);
+std::stringbuf strb_03(str_03, std::ios_base::out);
+
+// test overloaded virtual functions
+void test04()
+{
+ bool test = true;
+ std::string str_tmp, str_tmp2;
+ std::stringbuf strb_tmp;
+ std::streamsize strmsz_1, strmsz_2;
+ std::streamoff strmof_1(-1), strmof_2;
+ typedef std::stringbuf::int_type int_type;
+ typedef std::stringbuf::traits_type traits_type;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+
+ int_type c1 = strb_01.sbumpc();
+ int_type c2 = strb_02.sbumpc();
+ int_type c3 = strb_01.sbumpc();
+ int_type c4 = strb_02.sbumpc();
+ int_type c5 = strb_03.sbumpc();
+
+ // PUT
+ strb_03.str(str_01); //reset
+ std::string::size_type sz1 = strb_03.str().length();
+ std::string::size_type sz2 = strb_03.str().length();
+
+ // 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*
+ str_tmp = strb_03.str();
+ sz1 = str_tmp.length();
+ strmsz_1 = strb_03.sputn("racadabras", 10);//"abracadabras or what?"
+ sz2 = strb_03.str().length();
+ strmsz_2 = strb_03.sputn(", i wanna reach out and", 10);
+ sz2 = strb_03.str().length();
+ str_tmp = strb_02.str();
+ strmsz_1 = strb_02.sputn("racadabra", 10);
+
+ // PUTBACK
+
+ // 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()
+ strmsz_1 = strb_01.in_avail();
+ str_tmp = strb_01.str();
+ c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
+ c2 = strb_01.sputbackc('z');//"mykonos. . .zor what?"
+ c3 = strb_01.sgetc();
+ str_tmp2 = strb_01.str();
+ VERIFY( c1 != c2 );
+ VERIFY( c3 == c2 );
+ VERIFY( str_tmp2 == std::string("mzkonos. . . or what?") );
+ VERIFY( str_tmp.size() == str_tmp2.size() );
+ //test for _in_cur == _in_beg
+ strb_01.str(str_tmp);
+ strmsz_1 = strb_01.in_avail();
+ c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
+ c2 = strb_01.sputbackc('z');//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ VERIFY( c1 != c2 );
+ VERIFY( c3 != c2 );
+ VERIFY( c1 == c3 );
+ VERIFY( c2 == traits_type::eof() );
+ VERIFY( strb_01.str() == str_tmp );
+ VERIFY( str_tmp.size() == strb_01.str().size() );
+ // test for replacing char with identical one
+ strb_01.str(str_01); //reset
+ strmsz_1 = strb_01.in_avail();
+ strb_01.sbumpc();
+ strb_01.sbumpc();
+ c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
+ c2 = strb_01.sputbackc('y');//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ VERIFY( c1 != c2 );
+ VERIFY( c3 == c2 );
+ VERIFY( c1 != c3 );
+ VERIFY( strb_01.str() == str_01 );
+ VERIFY( str_01.size() == strb_01.str().size() );
+ //test for ios_base::out
+ strmsz_2 = strb_03.in_avail();
+ c4 = strb_03.sputbackc('x');
+ VERIFY( c4 == traits_type::eof() );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/char/9425.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/char/9425.cc
new file mode 100644
index 00000000000..e7dcaa1dbb9
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/char/9425.cc
@@ -0,0 +1,43 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+// 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;
+
+ stringbuf sbuf;
+ stringbuf::int_type r = sbuf.sputbackc('a');
+ VERIFY( r == stringbuf::traits_type::eof() );
+}
+
+main()
+{
+ test09();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/1.cc
new file mode 100644
index 00000000000..8e486424840
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/1.cc
@@ -0,0 +1,75 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+std::string str_01("mykonos. . . or what?");
+std::string str_02("paris, or sainte-maxime?");
+std::string str_03;
+std::stringbuf strb_01(str_01);
+std::stringbuf strb_02(str_02, std::ios_base::in);
+std::stringbuf strb_03(str_03, std::ios_base::out);
+
+// test overloaded virtual functions
+void test04()
+{
+ bool test = true;
+ std::string str_tmp;
+ std::stringbuf strb_tmp;
+ std::streamsize strmsz_1, strmsz_2;
+ std::streamoff strmof_1(-1), strmof_2;
+ typedef std::stringbuf::int_type int_type;
+ typedef std::stringbuf::traits_type traits_type;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+
+ int_type c1 = strb_01.sbumpc();
+ int_type c2 = strb_02.sbumpc();
+ int_type c3 = strb_01.sbumpc();
+ int_type c4 = strb_02.sbumpc();
+ int_type c5 = strb_03.sbumpc();
+
+ // PUT
+ // int_type sputc(char_type c)
+ // if out_cur not avail, return overflow. Else, stores c at out_cur,
+ // increments out_cur, and returns c as int_type
+ strb_03.str(str_01); //reset
+ std::string::size_type sz1 = strb_03.str().length();
+ c1 = strb_03.sputc('a');
+ std::string::size_type sz2 = strb_03.str().length();
+ VERIFY( sz1 == sz2 ); //cuz inserting at out_cur, which is at beg to start
+ c2 = strb_03.sputc('b');
+ VERIFY( c1 != c2 );
+ VERIFY( strb_03.str() != str_01 );
+ c3 = strb_02.sputc('a'); // should be EOF because this is read-only
+ VERIFY( c3 == traits_type::eof() );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/1057.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/1057.cc
new file mode 100644
index 00000000000..d4f005e496c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/1057.cc
@@ -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 <sstream>
+#include <testsuite_hooks.h>
+
+class nullsetpbuf : public std::stringbuf
+{
+ 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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/9404-1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/9404-1.cc
new file mode 100644
index 00000000000..6d4019295d2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/9404-1.cc
@@ -0,0 +1,73 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+bool over_called;
+
+class Derived_stringbuf : public std::stringbuf
+{
+public:
+ int_type overflow(int_type c)
+ {
+ over_called = true;
+ return std::stringbuf::overflow(c);
+ }
+
+ const char_type* pub_epptr() const
+ {
+ return epptr();
+ }
+
+ const char_type* pub_pptr() const
+ {
+ return pptr();
+ }
+};
+
+// libstdc++/9404
+void test04()
+{
+ bool test = true;
+
+ bool over_expected;
+
+ // sputc
+ Derived_stringbuf dsbuf_01;
+ over_called = false;
+ dsbuf_01.sputc('i');
+ VERIFY( over_called );
+ over_expected = dsbuf_01.pub_epptr() == dsbuf_01.pub_pptr();
+ over_called = false;
+ dsbuf_01.sputc('v');
+ VERIFY( (!over_expected && !over_called)
+ || (over_expected && over_called) );
+ dsbuf_01.sputc('i');
+ VERIFY( dsbuf_01.str() == "ivi" ); // Sanity check.
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/1.cc
new file mode 100644
index 00000000000..525014c2a02
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/1.cc
@@ -0,0 +1,87 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+std::string str_01("mykonos. . . or what?");
+std::string str_02("paris, or sainte-maxime?");
+std::string str_03;
+std::stringbuf strb_01(str_01);
+std::stringbuf strb_02(str_02, std::ios_base::in);
+std::stringbuf strb_03(str_03, std::ios_base::out);
+
+// test overloaded virtual functions
+void test04()
+{
+ bool test = true;
+ std::string str_tmp;
+ std::stringbuf strb_tmp;
+ std::streamsize strmsz_1, strmsz_2;
+ std::streamoff strmof_1(-1), strmof_2;
+ typedef std::stringbuf::int_type int_type;
+ typedef std::stringbuf::traits_type traits_type;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+
+ int_type c1 = strb_01.sbumpc();
+ int_type c2 = strb_02.sbumpc();
+ int_type c3 = strb_01.sbumpc();
+ int_type c4 = strb_02.sbumpc();
+ int_type c5 = strb_03.sbumpc();
+
+ // PUT
+ strb_03.str(str_01); //reset
+ std::string::size_type sz1 = strb_03.str().length();
+ std::string::size_type sz2 = strb_03.str().length();
+
+ // 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*
+ str_tmp = strb_03.str();
+ sz1 = str_tmp.length();
+ strmsz_1 = strb_03.sputn("racadabras", 10);//"abracadabras or what?"
+ sz2 = strb_03.str().length();
+ VERIFY( sz1 == sz2 ); //shouldn't have changed length
+ VERIFY( strmsz_1 == 10 );
+ VERIFY( str_tmp != strb_03.str() );
+ strmsz_2 = strb_03.sputn(", i wanna reach out and", 23);
+ VERIFY( strmsz_1 != strmsz_2 ); // should re-allocate, copy 10 chars.
+ VERIFY( strmsz_1 == 10 );
+ VERIFY( strmsz_2 == 23 );
+ sz2 = strb_03.str().length();
+ VERIFY( sz1 != sz2 ); // need to change length
+ VERIFY( str_tmp != strb_03.str() );
+ str_tmp = strb_02.str();
+ strmsz_1 = strb_02.sputn("racadabra", 10);
+ VERIFY( strmsz_1 == 0 );
+ VERIFY( str_tmp == strb_02.str() );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/1057.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/1057.cc
new file mode 100644
index 00000000000..2af2dff8c13
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/1057.cc
@@ -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 <sstream>
+#include <testsuite_hooks.h>
+
+class nullsetpbuf : public std::stringbuf
+{
+ 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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/9404-2.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/9404-2.cc
new file mode 100644
index 00000000000..3cb743cc699
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/9404-2.cc
@@ -0,0 +1,73 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+bool over_called;
+
+class Derived_stringbuf : public std::stringbuf
+{
+public:
+ int_type overflow(int_type c)
+ {
+ over_called = true;
+ return std::stringbuf::overflow(c);
+ }
+
+ const char_type* pub_epptr() const
+ {
+ return epptr();
+ }
+
+ const char_type* pub_pptr() const
+ {
+ return pptr();
+ }
+};
+
+// libstdc++/9404
+void test04()
+{
+ bool test = true;
+
+ bool over_expected;
+ Derived_stringbuf dsbuf_01;
+
+ // sputn
+ Derived_stringbuf dsbuf_02;
+ over_called = false;
+ dsbuf_02.sputn("sonne's", 7);
+ VERIFY( over_called );
+ over_expected = dsbuf_02.pub_epptr() == dsbuf_02.pub_pptr();
+ over_called = false;
+ dsbuf_02.sputn(" peak", 5);
+ VERIFY( (!over_expected && !over_called)
+ || (over_expected && over_called) );
+ VERIFY( dsbuf_02.str() == "sonne's peak" ); // Sanity check.
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/1.cc
new file mode 100644
index 00000000000..8de264b08e8
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/1.cc
@@ -0,0 +1,74 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+std::string str_01("mykonos. . . or what?");
+std::string str_02("paris, or sainte-maxime?");
+std::string str_03;
+std::stringbuf strb_01(str_01);
+std::stringbuf strb_02(str_02, std::ios_base::in);
+std::stringbuf strb_03(str_03, std::ios_base::out);
+
+// test member functions
+void test03()
+{
+ bool test = true;
+
+ //stringbuf::str()
+ VERIFY( strb_01.str() == str_01 );
+ VERIFY( strb_02.str() == str_02 );
+ VERIFY( strb_03.str() == str_03 );
+
+ //stringbuf::str(string&)
+ strb_03.str("none of the above, go to the oberoi in cairo, egypt.");
+ strb_03.str(str_01);
+ std::streamsize d1 = strb_01.in_avail();
+ std::streamsize d2 = strb_03.in_avail();
+ VERIFY( d1 ); // non-zero
+ VERIFY( !d2 ); // zero, cuz ios_base::out
+ VERIFY( d1 != d2 ); //these should be the same
+ VERIFY( str_01.length() == d1 );
+ VERIFY( strb_01.str() == strb_03.str() ); //ditto
+
+ // stringbuf::str(string&) and stringbuf::stringbuf(string&), where the
+ // string in question contains embedded NUL characters. Note that in this
+ // embedded-NUL situation, the size must be passed to the string ctor.
+ std::string str_nulls ("eschew \0 obfuscation", 20); // tested in 21_strings
+ std::stringbuf strb_normal (str_01);
+ std::stringbuf strb_nulls (str_nulls);
+ strb_normal.str(str_nulls); // tried using 'strb_01' rather than declaring
+ // another variable, but then test04 broke!
+ VERIFY( strb_nulls.in_avail() == str_nulls.size() );
+ VERIFY( strb_nulls.str().size() == 20 );
+ VERIFY( strb_normal.in_avail() == str_nulls.size() );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/2.cc
new file mode 100644
index 00000000000..feabe74e1ae
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/2.cc
@@ -0,0 +1,55 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+// http://gcc.gnu.org/ml/libstdc++/2003-02/msg00269.html
+// Growing and then seeking to ios_base::beg triggered a bug in str(),
+// which didn't notice the grow.
+void test07()
+{
+ bool test = true;
+
+ std::stringbuf strb_01;
+ strb_01.sputc('s');
+ strb_01.pubseekoff(0, std::ios_base::beg);
+ std::string tmp = strb_01.str();
+ VERIFY( tmp == "s" );
+
+ std::string str("strivi,");
+ std::stringbuf strb_02(str);
+ strb_02.pubseekoff(0, std::ios_base::end);
+ strb_02.sputn(" no better!", 11);
+ strb_02.pubseekoff(0, std::ios_base::beg);
+ tmp = strb_02.str();
+ VERIFY( tmp == "strivi, no better!" );
+}
+
+int main()
+{
+ test07();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/3.cc
new file mode 100644
index 00000000000..7fa42a6d1fd
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/3.cc
@@ -0,0 +1,43 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+void test06()
+{
+ bool test = true;
+
+ std::ostringstream os ("foo", std::ios_base::app);
+ os << "bar";
+
+ VERIFY( os.str() == "foobar" );
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/3955.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/3955.cc
new file mode 100644
index 00000000000..d43fd89345a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/3955.cc
@@ -0,0 +1,44 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/3955 -- ios_base::app overwrites from the beginning
+void test05()
+{
+ bool test = true;
+
+ std::ostringstream os ("foo");
+ os << "bar";
+
+ VERIFY( os.str() == "bar" );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sungetc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sungetc/char/1.cc
new file mode 100644
index 00000000000..c7bb35240bd
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sungetc/char/1.cc
@@ -0,0 +1,151 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+std::string str_01("mykonos. . . or what?");
+std::string str_02("paris, or sainte-maxime?");
+std::string str_03;
+std::stringbuf strb_01(str_01);
+std::stringbuf strb_02(str_02, std::ios_base::in);
+std::stringbuf strb_03(str_03, std::ios_base::out);
+
+// test overloaded virtual functions
+void test04()
+{
+ bool test = true;
+ std::string str_tmp;
+ std::stringbuf strb_tmp;
+ std::streamsize strmsz_1, strmsz_2;
+ std::streamoff strmof_1(-1), strmof_2;
+ typedef std::stringbuf::int_type int_type;
+ typedef std::stringbuf::traits_type traits_type;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+
+ int_type c1 = strb_01.sbumpc();
+ int_type c2 = strb_02.sbumpc();
+ int_type c3 = strb_01.sbumpc();
+ int_type c4 = strb_02.sbumpc();
+ int_type c5 = strb_03.sbumpc();
+
+ // PUT
+ strb_03.str(str_01); //reset
+ std::string::size_type sz1 = strb_03.str().length();
+ std::string::size_type sz2 = strb_03.str().length();
+
+ // 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*
+ str_tmp = strb_03.str();
+ sz1 = str_tmp.length();
+ strmsz_1 = strb_03.sputn("racadabras", 10);//"abracadabras or what?"
+ sz2 = strb_03.str().length();
+ strmsz_2 = strb_03.sputn(", i wanna reach out and", 10);
+ sz2 = strb_03.str().length();
+ str_tmp = strb_02.str();
+ strmsz_1 = strb_02.sputn("racadabra", 10);
+
+ // PUTBACK
+
+ // 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()
+ strmsz_1 = strb_01.in_avail();
+ str_tmp = strb_01.str();
+ c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
+ c2 = strb_01.sputbackc('z');//"mykonos. . .zor what?"
+ c3 = strb_01.sgetc();
+ //test for _in_cur == _in_beg
+ strb_01.str(str_tmp);
+ strmsz_1 = strb_01.in_avail();
+ c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
+ c2 = strb_01.sputbackc('z');//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ // test for replacing char with identical one
+ strb_01.str(str_01); //reset
+ strmsz_1 = strb_01.in_avail();
+ strb_01.sbumpc();
+ strb_01.sbumpc();
+ c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
+ c2 = strb_01.sputbackc('y');//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ //test for ios_base::out
+ strmsz_2 = strb_03.in_avail();
+ c4 = strb_03.sputbackc('x');
+
+ // int_type sungetc()
+ // if in_cur not avail, return pbackfail(), else decrement and
+ // return to_int_type(*gptr())
+ for (int i = 0; i<12; ++i)
+ strb_01.sbumpc();
+ strmsz_1 = strb_01.in_avail();
+ str_tmp = strb_01.str();
+ c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
+ c2 = strb_01.sungetc();//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ VERIFY( c1 != c2 );
+ VERIFY( c3 == c2 );
+ VERIFY( c1 != c3 );
+ VERIFY( c2 == ' ' );
+ VERIFY( strb_01.str() == str_01 );
+ VERIFY( str_01.size() == strb_01.str().size() );
+ //test for _in_cur == _in_beg
+ strb_01.str(str_tmp);
+ strmsz_1 = strb_01.in_avail();
+ c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
+ c2 = strb_01.sungetc();//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ VERIFY( c1 != c2 );
+ VERIFY( c3 != c2 );
+ VERIFY( c1 == c3 );
+ VERIFY( c2 == traits_type::eof() );
+ VERIFY( strb_01.str() == str_01 );
+ VERIFY( str_01.size() == strb_01.str().size() );
+ // test for replacing char with identical one
+ strb_01.str(str_01); //reset
+ strmsz_1 = strb_01.in_avail();
+ strb_01.sbumpc();
+ strb_01.sbumpc();
+ c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
+ c2 = strb_01.sungetc();//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ VERIFY( c1 != c2 );
+ VERIFY( c3 == c2 );
+ VERIFY( c1 != c3 );
+ VERIFY( strb_01.str() == str_01 );
+ VERIFY( str_01.size() == strb_01.str().size() );
+ //test for ios_base::out
+ strmsz_2 = strb_03.in_avail();
+ c4 = strb_03.sungetc();
+ VERIFY( c4 == traits_type::eof() );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
+
+
+
+// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sync/char/1057.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sync/char/1057.cc
new file mode 100644
index 00000000000..85717200d88
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sync/char/1057.cc
@@ -0,0 +1,108 @@
+// 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 <sstream>
+#include <testsuite_hooks.h>
+
+class setpbuf : public std::stringbuf
+{
+ char buffer[4];
+ std::string result;
+
+public:
+
+ std::string&
+ get_result()
+ { return result; }
+
+ setpbuf()
+ {
+ char foo [32];
+ setp(foo, foo + 32);
+ setp(buffer, buffer + 4);
+ }
+
+ ~setpbuf()
+ { sync(); }
+
+ 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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringstream/1.cc
new file mode 100644
index 00000000000..e53b91da148
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/1.cc
@@ -0,0 +1,48 @@
+// 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.7.4 - Template class basic_stringstream
+// NB: This file is for testing basic_stringstream with NO OTHER INCLUDES.
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// { dg-do compile }
+
+// libstdc++/7216
+void test01()
+{
+ // Check for required typedefs
+ typedef std::stringstream 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;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/2.cc b/libstdc++-v3/testsuite/27_io/basic_stringstream/2.cc
new file mode 100644
index 00000000000..abadf8271e6
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/2.cc
@@ -0,0 +1,45 @@
+// 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.7.4 - Template class basic_stringstream
+// NB: This file is for testing basic_stringstream with NO OTHER INCLUDES.
+
+#include <sstream>
+#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_stringstream<type_t, char_traits<type_t> >;
+ template class basic_stringstream<pod_char, char_traits<pod_char> >;
+} // test
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/3.cc b/libstdc++-v3/testsuite/27_io/basic_stringstream/3.cc
new file mode 100644
index 00000000000..d877dbb7baf
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/3.cc
@@ -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 <sstream>
+#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_stringstream<gnu_char_type, gnu_char_traits> gnu_sstr;
+
+ try
+ {
+ gnu_sstr 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!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/4.cc b/libstdc++-v3/testsuite/27_io/basic_stringstream/4.cc
new file mode 100644
index 00000000000..dcd5dc3dc64
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/4.cc
@@ -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 <sstream>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::stringstream 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!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/rdbuf/char/2832.cc b/libstdc++-v3/testsuite/27_io/basic_stringstream/rdbuf/char/2832.cc
new file mode 100644
index 00000000000..5e4fe022e75
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/rdbuf/char/2832.cc
@@ -0,0 +1,70 @@
+// 2003-04-01 Benjamin 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.7.6 - Member functions [lib.stringstream.members]
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void
+redirect_buffer(std::ios& stream, std::streambuf* new_buf)
+{ stream.rdbuf(new_buf); }
+
+std::streambuf*
+active_buffer(std::ios& stream)
+{ return stream.rdbuf(); }
+
+// libstdc++/2832
+void test02()
+{
+ bool test = true;
+ const char* strlit01 = "fuck war";
+ const char* strlit02 = "two less cars abstract riot crew, critical mass/SF";
+ const std::string str00;
+ const std::string str01(strlit01);
+ std::string str02;
+ std::stringbuf sbuf;
+ std::streambuf* pbasebuf0 = &sbuf;
+
+ std::stringstream sstrm1;
+ // derived rdbuf() always returns original streambuf, even though
+ // it's no longer associated with the stream.
+ std::stringbuf* const buf1 = sstrm1.rdbuf();
+ // base rdbuf() returns the currently associated streambuf
+ std::streambuf* pbasebuf1 = active_buffer(sstrm1);
+ redirect_buffer(sstrm1, &sbuf);
+ std::stringbuf* const buf2 = sstrm1.rdbuf();
+ std::streambuf* pbasebuf2 = active_buffer(sstrm1);
+ VERIFY( buf1 == buf2 );
+ VERIFY( pbasebuf1 != pbasebuf2 );
+ VERIFY( pbasebuf2 == pbasebuf0 );
+
+ // How confusing and non-intuitive is this?
+ // These semantics are a joke, a serious defect, and incredibly lame.
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/str/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringstream/str/char/1.cc
new file mode 100644
index 00000000000..79b1e9cb35e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/str/char/1.cc
@@ -0,0 +1,77 @@
+// 2001-05-24 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.6 member functions (stringstream_members)
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test = true;
+ std::stringstream is01;
+ const std::string str00;
+ const std::string str01 = "123";
+ std::string str02;
+ const int i01 = 123;
+ int a,b;
+
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+ // string str() const
+ str02 = is01.str();
+ VERIFY( str00 == str02 );
+
+ // void str(const basic_string&)
+ is01.str(str01);
+ str02 = is01.str();
+ VERIFY( str01 == str02 );
+ state1 = is01.rdstate();
+ is01 >> a;
+ state2 = is01.rdstate();
+ VERIFY( a = i01 );
+ // 22.2.2.1.2 num_get virtual functions
+ // p 13
+ // in any case, if stage 2 processing was terminated by the test for
+ // in == end then err != ios_base::eofbit is performed.
+ VERIFY( state1 != state2 );
+ VERIFY( state2 == stateeof );
+
+ is01.str(str01);
+ is01 >> b;
+ VERIFY( b != a );
+ // as is01.good() is false, istream::sentry blocks extraction.
+
+ is01.clear();
+ state1 = is01.rdstate();
+ is01 >> b;
+ state2 = is01.rdstate();
+ VERIFY( b == a );
+ VERIFY( state1 != state2 );
+ VERIFY( state2 == stateeof );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/str/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_stringstream/str/char/2.cc
new file mode 100644
index 00000000000..04f2746bcde
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/str/char/2.cc
@@ -0,0 +1,76 @@
+// 2001-05-24 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.6 member functions (stringstream_members)
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void
+redirect_buffer(std::ios& stream, std::streambuf* new_buf)
+{ stream.rdbuf(new_buf); }
+
+std::streambuf*
+active_buffer(std::ios& stream)
+{ return stream.rdbuf(); }
+
+// libstdc++/2832
+void test02()
+{
+ bool test = true;
+ const char* strlit01 = "fuck war";
+ const char* strlit02 = "two less cars abstract riot crew, critical mass/SF";
+ const std::string str00;
+ const std::string str01(strlit01);
+ std::string str02;
+ std::stringbuf sbuf(str01);
+ std::streambuf* pbasebuf0 = &sbuf;
+
+ std::stringstream sstrm1;
+ VERIFY( sstrm1.str() == str00 );
+ // derived rdbuf() always returns original streambuf, even though
+ // it's no longer associated with the stream.
+ std::stringbuf* const buf1 = sstrm1.rdbuf();
+ // base rdbuf() returns the currently associated streambuf
+ std::streambuf* pbasebuf1 = active_buffer(sstrm1);
+ redirect_buffer(sstrm1, &sbuf);
+ std::stringbuf* const buf2 = sstrm1.rdbuf();
+ std::streambuf* pbasebuf2 = active_buffer(sstrm1);
+ VERIFY( buf1 == buf2 );
+ VERIFY( pbasebuf1 != pbasebuf2 );
+ VERIFY( pbasebuf2 == pbasebuf0 );
+
+ // derived rdbuf() returns the original buf, so str() doesn't change.
+ VERIFY( sstrm1.str() != str01 );
+ VERIFY( sstrm1.str() == str00 );
+ // however, casting the active streambuf to a stringbuf shows what's up:
+ std::stringbuf* psbuf = dynamic_cast<std::stringbuf*>(pbasebuf2);
+ str02 = psbuf->str();
+ VERIFY( str02 == str01 );
+
+ // How confusing and non-intuitive is this?
+ // These semantics are a joke, a serious defect, and incredibly lame.
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/str/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_stringstream/str/char/3.cc
new file mode 100644
index 00000000000..47901a6e498
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/str/char/3.cc
@@ -0,0 +1,65 @@
+// 2001-05-24 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.6 member functions (stringstream_members)
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void
+test03()
+{
+ bool test = true;
+
+ //
+ // 1: Automatic formatting of a compound string
+ //
+ int i = 1024;
+ int *pi = &i;
+ double d = 3.14159;
+ double *pd = &d;
+ std::string blank;
+ std::ostringstream ostrst01;
+ std::ostringstream ostrst02(blank);
+
+ // No buffer, so should be created.
+ ostrst01 << "i: " << i << " i's address: " << pi << "\n"
+ << "d: " << d << " d's address: " << pd << std::endl;
+ // Buffer, so existing buffer should be overwritten.
+ ostrst02 << "i: " << i << " i's address: " << pi << "\n"
+ << "d: " << d << " d's address: " << pd << std::endl;
+
+ std::string msg01 = ostrst01.str();
+ std::string msg02 = ostrst02.str();
+ VERIFY( msg01 == msg02 );
+ VERIFY( msg02 != blank );
+
+ // stringstream
+ std::string str1("");
+ std::string str3("this is a somewhat string");
+ std::stringstream ss1(str1, std::ios_base::in|std::ios_base::out);
+ std::stringstream ss2(str3, std::ios_base::in|std::ios_base::out);
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/str/char/4.cc b/libstdc++-v3/testsuite/27_io/basic_stringstream/str/char/4.cc
new file mode 100644
index 00000000000..7d77fc2c63c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/str/char/4.cc
@@ -0,0 +1,45 @@
+// 2001-05-24 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.6 member functions (stringstream_members)
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/8466
+void test04()
+{
+ bool test = true;
+
+ const char* strlit00 = "orvieto";
+ const std::string str00 = strlit00;
+
+ std::ostringstream oss;
+
+ oss.str(str00);
+ oss << "cortona";
+ VERIFY( str00 == strlit00 );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/filebuf_members-1.tst b/libstdc++-v3/testsuite/27_io/filebuf_members-1.tst
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/libstdc++-v3/testsuite/27_io/filebuf_members-1.tst
+++ /dev/null
diff --git a/libstdc++-v3/testsuite/27_io/filebuf_members-1.txt b/libstdc++-v3/testsuite/27_io/filebuf_members-1.txt
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/libstdc++-v3/testsuite/27_io/filebuf_members-1.txt
+++ /dev/null
diff --git a/libstdc++-v3/testsuite/27_io/filebuf_members.cc b/libstdc++-v3/testsuite/27_io/filebuf_members.cc
deleted file mode 100644
index 79dfa251570..00000000000
--- a/libstdc++-v3/testsuite/27_io/filebuf_members.cc
+++ /dev/null
@@ -1,276 +0,0 @@
-// 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 <iostream>
-#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_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);
- // Try to open two different files without closing the first:
- // Should keep the old file attached, and disregard attempt to overthrow.
- fb_02.open(name_03, std::ios_base::in | std::ios_base::out);
- fb_03.open(name_03, std::ios_base::out | std::ios_base::trunc);
- 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() );
-}
-
-// 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.
-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 );
-}
-
-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 );
-}
-
-// 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);
-}
-
-// 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();
-}
-
-// 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 );
-}
-
-// 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_01();
- test_02();
- test_03();
- test_04();
- test_05();
- test_06();
- test_07();
- return 0;
-}
-
-
diff --git a/libstdc++-v3/testsuite/27_io/filebuf_virtuals-1.tst b/libstdc++-v3/testsuite/27_io/filebuf_virtuals-1.tst
deleted file mode 100644
index cb3c57f7dfd..00000000000
--- a/libstdc++-v3/testsuite/27_io/filebuf_virtuals-1.tst
+++ /dev/null
@@ -1,158 +0,0 @@
-// 990117 bkoz
-// test functionality of basic_filebuf for char_type == char
-// this is a data file for 27filebuf.cc
-
-// Copyright (C) 1997-1999 Cygnus Solutions
-//
-// 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.
-
-/mnt/cdrom/sarah_vaughan/sarah_vaughan.allofme
-/mnt/cdrom/sarah_vaughan/sarah_vaughan.speaklow
-
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_01_the_way_i_feel
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_02_seduction_kidnap
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_03_just_a_ny_poem
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_04_butterflies_i_remem
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_05_luxury_poem
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_06_my_house
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_07_the_women_gather
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_08_the_life_i_led
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_09_when_i_die
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_10_revolutionary_dreams
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_11_winter_poem
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_12_a_certain_peace_i_nap
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_13_poem_for_a_lady_whose
-
-/mnt/cdrom/marley-songs_of_freedom/disk_1/
-/mnt/cdrom/marley-songs_of_freedom/disk_2/
-/mnt/cdrom/marley-songs_of_freedom/disk_4/
-
-/mnt/cdrom/marley-songs_of_freedom/disk_1/back out
-/mnt/cdrom/marley-songs_of_freedom/disk_1/bend down low
-/mnt/cdrom/marley-songs_of_freedom/disk_1/bus dem shut (pyaka)
-/mnt/cdrom/marley-songs_of_freedom/disk_1/caution
-/mnt/cdrom/marley-songs_of_freedom/disk_1/do it twice
-/mnt/cdrom/marley-songs_of_freedom/disk_1/don't rock the boat
-/mnt/cdrom/marley-songs_of_freedom/disk_1/duppy conqueror
-/mnt/cdrom/marley-songs_of_freedom/disk_1/hammer
-/mnt/cdrom/marley-songs_of_freedom/disk_1/hypocrites
-/mnt/cdrom/marley-songs_of_freedom/disk_1/i'm still waiting
-/mnt/cdrom/marley-songs_of_freedom/disk_1/judge not
-/mnt/cdrom/marley-songs_of_freedom/disk_1/mellow mood
-/mnt/cdrom/marley-songs_of_freedom/disk_1/mr brown
-/mnt/cdrom/marley-songs_of_freedom/disk_1/nice time
-/mnt/cdrom/marley-songs_of_freedom/disk_1/one cup of coffee
-/mnt/cdrom/marley-songs_of_freedom/disk_1/one love_people get ready
-/mnt/cdrom/marley-songs_of_freedom/disk_1/put it on
-/mnt/cdrom/marley-songs_of_freedom/disk_1/simmer down
-/mnt/cdrom/marley-songs_of_freedom/disk_1/small axe
-/mnt/cdrom/marley-songs_of_freedom/disk_1/soul rebel
-/mnt/cdrom/marley-songs_of_freedom/disk_1/soul shake down party
-/mnt/cdrom/marley-songs_of_freedom/disk_1/stir it up (original)
-/mnt/cdrom/marley-songs_of_freedom/disk_1/sun is shining
-/mnt/cdrom/marley-songs_of_freedom/disk_1/thank you lord (original)
-/mnt/cdrom/marley-songs_of_freedom/disk_2/acoustic medley
-/mnt/cdrom/marley-songs_of_freedom/disk_2/burnin' and lootin'
-/mnt/cdrom/marley-songs_of_freedom/disk_2/concrete jungle
-/mnt/cdrom/marley-songs_of_freedom/disk_2/craven choke puppy
-/mnt/cdrom/marley-songs_of_freedom/disk_2/get up stand up
-/mnt/cdrom/marley-songs_of_freedom/disk_2/guava jelly
-/mnt/cdrom/marley-songs_of_freedom/disk_2/high tide or low tide
-/mnt/cdrom/marley-songs_of_freedom/disk_2/i shot the sheriff
-/mnt/cdrom/marley-songs_of_freedom/disk_2/i'm hurting inside
-/mnt/cdrom/marley-songs_of_freedom/disk_2/iron lion zion
-/mnt/cdrom/marley-songs_of_freedom/disk_2/lick samba
-/mnt/cdrom/marley-songs_of_freedom/disk_2/lively up yourself
-/mnt/cdrom/marley-songs_of_freedom/disk_2/natty dread
-/mnt/cdrom/marley-songs_of_freedom/disk_2/no more trouble
-/mnt/cdrom/marley-songs_of_freedom/disk_2/rastaman chant
-/mnt/cdrom/marley-songs_of_freedom/disk_2/screw face
-/mnt/cdrom/marley-songs_of_freedom/disk_2/slave driver
-/mnt/cdrom/marley-songs_of_freedom/disk_2/trenchtown rock
-/mnt/cdrom/marley-songs_of_freedom/disk_4/africa unite
-/mnt/cdrom/marley-songs_of_freedom/disk_4/babylon system
-/mnt/cdrom/marley-songs_of_freedom/disk_4/bad card
-/mnt/cdrom/marley-songs_of_freedom/disk_4/coming in from the cold (12
-/mnt/cdrom/marley-songs_of_freedom/disk_4/could you be loved (12 mix
-/mnt/cdrom/marley-songs_of_freedom/disk_4/forever loving jah
-/mnt/cdrom/marley-songs_of_freedom/disk_4/give thanks and praise
-/mnt/cdrom/marley-songs_of_freedom/disk_4/one drop
-/mnt/cdrom/marley-songs_of_freedom/disk_4/one dub
-/mnt/cdrom/marley-songs_of_freedom/disk_4/rastaman live up
-/mnt/cdrom/marley-songs_of_freedom/disk_4/real situation
-/mnt/cdrom/marley-songs_of_freedom/disk_4/redemption song (live in pi
-/mnt/cdrom/marley-songs_of_freedom/disk_4/ride natty ride (12 mix)
-/mnt/cdrom/marley-songs_of_freedom/disk_4/so much trouble in the worl
-/mnt/cdrom/marley-songs_of_freedom/disk_4/survival
-/mnt/cdrom/marley-songs_of_freedom/disk_4/why should i (previously un
-/mnt/cdrom/marley-songs_of_freedom/disk_4/zimbabwe
-
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_01_pandemonium
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_02_sync_disjecta
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_03_object_unknown
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_04_it's_nice_not
-/mnt/cdrom/dj_spooky_rid-2dim_warefare/djspooky_05_dialectical_tra
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_06_post-human_soph
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_07_quilombo_ex
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_08_rekonstruction
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_09_scientifik
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_10_a_conversation
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_11_peace_in_zaire
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_13_degree_zero
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_14_roman_planeta
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_15_bass_digitalis
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_16_polyphony_of
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_17_riddim_warfare
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_18_the_nerd
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_20_theme_of_the
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_21_twilight_fugue
-
-/mnt/cdrom/stuff_smith_mosaic/disk3/01_desert_sands
-/mnt/cdrom/stuff_smith_mosaic/disk3/02_soft_winds
-/mnt/cdrom/stuff_smith_mosaic/disk3/03_time_and_again
-/mnt/cdrom/stuff_smith_mosaic/disk3/04_it_don't_mean_a_thing
-/mnt/cdrom/stuff_smith_mosaic/disk3/05_in_a_mellotone
-/mnt/cdrom/stuff_smith_mosaic/disk3/06_i_know_that_you_know
-/mnt/cdrom/stuff_smith_mosaic/disk3/07_heat_wave
-/mnt/cdrom/stuff_smith_mosaic/disk3/08_things_ain't_what_they_used_to_be
-/mnt/cdrom/stuff_smith_mosaic/disk3/09_body_and_soul
-
-So I take a break, wander down to the park to stand, then lean into
-the concrete railing demarking the beginnings of space, oceanic
-space. I watch the waves break, and form, and ease back out to sea and
-wrap my arms around myself and hug tightly because it's early in the
-morning and windy, and the sun is late getting out of bed today, which
-is good because if there was brilliant light illuminating all the
-beauty around me I would be shocked, stunned, forced to retreat back
-into my cabana in a daze, blinded by hummingbirds and callilillies and
-un-named red, yellow, and blue flowers. Green envelopes me, waves
-sooth me. I can see the wind flip the top of the waves seaward, right
-before they break. The sea seems so calm from my perch above the fray
-that I wonder if maybe there is just some part of the deepest, most
-abstract ocean where there is a large creature who happily chews
-plankton and wags its tail in gentle, adulating waves that spread and
-move and gracefully glide thousands of miles, to crash upon a beach,
-one after the other, politely waiting for a turn to dance with the
-seashore.
-
-I know: it is what the Mexican schoolchildren call "la vibora de la
-mer," the serpent of the sea.
-
-
-
-
-
diff --git a/libstdc++-v3/testsuite/27_io/filebuf_virtuals-1.txt b/libstdc++-v3/testsuite/27_io/filebuf_virtuals-1.txt
deleted file mode 100644
index cb3c57f7dfd..00000000000
--- a/libstdc++-v3/testsuite/27_io/filebuf_virtuals-1.txt
+++ /dev/null
@@ -1,158 +0,0 @@
-// 990117 bkoz
-// test functionality of basic_filebuf for char_type == char
-// this is a data file for 27filebuf.cc
-
-// Copyright (C) 1997-1999 Cygnus Solutions
-//
-// 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.
-
-/mnt/cdrom/sarah_vaughan/sarah_vaughan.allofme
-/mnt/cdrom/sarah_vaughan/sarah_vaughan.speaklow
-
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_01_the_way_i_feel
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_02_seduction_kidnap
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_03_just_a_ny_poem
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_04_butterflies_i_remem
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_05_luxury_poem
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_06_my_house
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_07_the_women_gather
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_08_the_life_i_led
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_09_when_i_die
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_10_revolutionary_dreams
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_11_winter_poem
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_12_a_certain_peace_i_nap
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_13_poem_for_a_lady_whose
-
-/mnt/cdrom/marley-songs_of_freedom/disk_1/
-/mnt/cdrom/marley-songs_of_freedom/disk_2/
-/mnt/cdrom/marley-songs_of_freedom/disk_4/
-
-/mnt/cdrom/marley-songs_of_freedom/disk_1/back out
-/mnt/cdrom/marley-songs_of_freedom/disk_1/bend down low
-/mnt/cdrom/marley-songs_of_freedom/disk_1/bus dem shut (pyaka)
-/mnt/cdrom/marley-songs_of_freedom/disk_1/caution
-/mnt/cdrom/marley-songs_of_freedom/disk_1/do it twice
-/mnt/cdrom/marley-songs_of_freedom/disk_1/don't rock the boat
-/mnt/cdrom/marley-songs_of_freedom/disk_1/duppy conqueror
-/mnt/cdrom/marley-songs_of_freedom/disk_1/hammer
-/mnt/cdrom/marley-songs_of_freedom/disk_1/hypocrites
-/mnt/cdrom/marley-songs_of_freedom/disk_1/i'm still waiting
-/mnt/cdrom/marley-songs_of_freedom/disk_1/judge not
-/mnt/cdrom/marley-songs_of_freedom/disk_1/mellow mood
-/mnt/cdrom/marley-songs_of_freedom/disk_1/mr brown
-/mnt/cdrom/marley-songs_of_freedom/disk_1/nice time
-/mnt/cdrom/marley-songs_of_freedom/disk_1/one cup of coffee
-/mnt/cdrom/marley-songs_of_freedom/disk_1/one love_people get ready
-/mnt/cdrom/marley-songs_of_freedom/disk_1/put it on
-/mnt/cdrom/marley-songs_of_freedom/disk_1/simmer down
-/mnt/cdrom/marley-songs_of_freedom/disk_1/small axe
-/mnt/cdrom/marley-songs_of_freedom/disk_1/soul rebel
-/mnt/cdrom/marley-songs_of_freedom/disk_1/soul shake down party
-/mnt/cdrom/marley-songs_of_freedom/disk_1/stir it up (original)
-/mnt/cdrom/marley-songs_of_freedom/disk_1/sun is shining
-/mnt/cdrom/marley-songs_of_freedom/disk_1/thank you lord (original)
-/mnt/cdrom/marley-songs_of_freedom/disk_2/acoustic medley
-/mnt/cdrom/marley-songs_of_freedom/disk_2/burnin' and lootin'
-/mnt/cdrom/marley-songs_of_freedom/disk_2/concrete jungle
-/mnt/cdrom/marley-songs_of_freedom/disk_2/craven choke puppy
-/mnt/cdrom/marley-songs_of_freedom/disk_2/get up stand up
-/mnt/cdrom/marley-songs_of_freedom/disk_2/guava jelly
-/mnt/cdrom/marley-songs_of_freedom/disk_2/high tide or low tide
-/mnt/cdrom/marley-songs_of_freedom/disk_2/i shot the sheriff
-/mnt/cdrom/marley-songs_of_freedom/disk_2/i'm hurting inside
-/mnt/cdrom/marley-songs_of_freedom/disk_2/iron lion zion
-/mnt/cdrom/marley-songs_of_freedom/disk_2/lick samba
-/mnt/cdrom/marley-songs_of_freedom/disk_2/lively up yourself
-/mnt/cdrom/marley-songs_of_freedom/disk_2/natty dread
-/mnt/cdrom/marley-songs_of_freedom/disk_2/no more trouble
-/mnt/cdrom/marley-songs_of_freedom/disk_2/rastaman chant
-/mnt/cdrom/marley-songs_of_freedom/disk_2/screw face
-/mnt/cdrom/marley-songs_of_freedom/disk_2/slave driver
-/mnt/cdrom/marley-songs_of_freedom/disk_2/trenchtown rock
-/mnt/cdrom/marley-songs_of_freedom/disk_4/africa unite
-/mnt/cdrom/marley-songs_of_freedom/disk_4/babylon system
-/mnt/cdrom/marley-songs_of_freedom/disk_4/bad card
-/mnt/cdrom/marley-songs_of_freedom/disk_4/coming in from the cold (12
-/mnt/cdrom/marley-songs_of_freedom/disk_4/could you be loved (12 mix
-/mnt/cdrom/marley-songs_of_freedom/disk_4/forever loving jah
-/mnt/cdrom/marley-songs_of_freedom/disk_4/give thanks and praise
-/mnt/cdrom/marley-songs_of_freedom/disk_4/one drop
-/mnt/cdrom/marley-songs_of_freedom/disk_4/one dub
-/mnt/cdrom/marley-songs_of_freedom/disk_4/rastaman live up
-/mnt/cdrom/marley-songs_of_freedom/disk_4/real situation
-/mnt/cdrom/marley-songs_of_freedom/disk_4/redemption song (live in pi
-/mnt/cdrom/marley-songs_of_freedom/disk_4/ride natty ride (12 mix)
-/mnt/cdrom/marley-songs_of_freedom/disk_4/so much trouble in the worl
-/mnt/cdrom/marley-songs_of_freedom/disk_4/survival
-/mnt/cdrom/marley-songs_of_freedom/disk_4/why should i (previously un
-/mnt/cdrom/marley-songs_of_freedom/disk_4/zimbabwe
-
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_01_pandemonium
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_02_sync_disjecta
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_03_object_unknown
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_04_it's_nice_not
-/mnt/cdrom/dj_spooky_rid-2dim_warefare/djspooky_05_dialectical_tra
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_06_post-human_soph
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_07_quilombo_ex
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_08_rekonstruction
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_09_scientifik
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_10_a_conversation
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_11_peace_in_zaire
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_13_degree_zero
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_14_roman_planeta
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_15_bass_digitalis
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_16_polyphony_of
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_17_riddim_warfare
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_18_the_nerd
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_20_theme_of_the
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_21_twilight_fugue
-
-/mnt/cdrom/stuff_smith_mosaic/disk3/01_desert_sands
-/mnt/cdrom/stuff_smith_mosaic/disk3/02_soft_winds
-/mnt/cdrom/stuff_smith_mosaic/disk3/03_time_and_again
-/mnt/cdrom/stuff_smith_mosaic/disk3/04_it_don't_mean_a_thing
-/mnt/cdrom/stuff_smith_mosaic/disk3/05_in_a_mellotone
-/mnt/cdrom/stuff_smith_mosaic/disk3/06_i_know_that_you_know
-/mnt/cdrom/stuff_smith_mosaic/disk3/07_heat_wave
-/mnt/cdrom/stuff_smith_mosaic/disk3/08_things_ain't_what_they_used_to_be
-/mnt/cdrom/stuff_smith_mosaic/disk3/09_body_and_soul
-
-So I take a break, wander down to the park to stand, then lean into
-the concrete railing demarking the beginnings of space, oceanic
-space. I watch the waves break, and form, and ease back out to sea and
-wrap my arms around myself and hug tightly because it's early in the
-morning and windy, and the sun is late getting out of bed today, which
-is good because if there was brilliant light illuminating all the
-beauty around me I would be shocked, stunned, forced to retreat back
-into my cabana in a daze, blinded by hummingbirds and callilillies and
-un-named red, yellow, and blue flowers. Green envelopes me, waves
-sooth me. I can see the wind flip the top of the waves seaward, right
-before they break. The sea seems so calm from my perch above the fray
-that I wonder if maybe there is just some part of the deepest, most
-abstract ocean where there is a large creature who happily chews
-plankton and wags its tail in gentle, adulating waves that spread and
-move and gracefully glide thousands of miles, to crash upon a beach,
-one after the other, politely waiting for a turn to dance with the
-seashore.
-
-I know: it is what the Mexican schoolchildren call "la vibora de la
-mer," the serpent of the sea.
-
-
-
-
-
diff --git a/libstdc++-v3/testsuite/27_io/filebuf_virtuals-2.tst b/libstdc++-v3/testsuite/27_io/filebuf_virtuals-2.tst
deleted file mode 100644
index f25bba46d92..00000000000
--- a/libstdc++-v3/testsuite/27_io/filebuf_virtuals-2.tst
+++ /dev/null
@@ -1 +0,0 @@
-ac23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras23456789:;< \ No newline at end of file
diff --git a/libstdc++-v3/testsuite/27_io/filebuf_virtuals-3.tst b/libstdc++-v3/testsuite/27_io/filebuf_virtuals-3.tst
deleted file mode 100644
index 0a81f511290..00000000000
--- a/libstdc++-v3/testsuite/27_io/filebuf_virtuals-3.tst
+++ /dev/null
@@ -1,7 +0,0 @@
-bd2
-456x
-9m;uva?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wanna
-because because
-because. . .
-of the wonderful things he does!!
-ok \ No newline at end of file
diff --git a/libstdc++-v3/testsuite/27_io/filebuf_virtuals.cc b/libstdc++-v3/testsuite/27_io/filebuf_virtuals.cc
deleted file mode 100644
index 6699d80af30..00000000000
--- a/libstdc++-v3/testsuite/27_io/filebuf_virtuals.cc
+++ /dev/null
@@ -1,892 +0,0 @@
-// 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
-
-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 fbuf01;
-
- fbuf01.pubsetbuf(buf, 512);
- fbuf01.sputn(strlit, strlitsize);
- VERIFY( std::strncmp(strlit, buf, strlitsize) != 0 );
-}
-
-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 );
-}
-
-
-// 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 the filebuf/stringbuf locale settings.
-void test04()
-{
- std::locale loc_tmp;
- loc_tmp = fb_01.getloc();
- fb_01.pubimbue(loc_tmp); //This should initialize _M_init to true
- fb_01.getloc(); //This should just return _M_locale
-}
-
-// 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 showmanyc()
- // returns an estimate of the numbers of chars in the seq, or -1.
- // if __retval > 0, then calls to underflow won't return
- // traits_type::eof() till at least __retval chars.
- // if __retval == -1, then calls to underflow or uflow will fail.
- // NB overriding def if it can determine more chars can be read from
- // the input sequence.
-
- // 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
-
- // 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 ot the same thing, to check consistancy.
-
- // 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() );
-
- // 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 == '9' );
- 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() );
-
- // 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() );
-
- // 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() );
-
- // 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 );
-
- // 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 );
-
- // 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
-
- // BUFFER MANAGEMENT & POSITIONING
- // int sync()
- // if a put area exists, overflow.
- // if a get area exists, do something undefined. (like, nothing)
- strmsz_1 = fb_01.in_avail();
- fb_01.pubsync();
- strmsz_2 = fb_01.in_avail();
- VERIFY( strmsz_2 == strmsz_1 );
- strmsz_1 = fb_02.in_avail();
- fb_02.pubsync();
- // 27filebuf-2.txt == 53 bytes after this.
- strmsz_2 = fb_02.in_avail();
- VERIFY( strmsz_2 == -1 );
- VERIFY( strmsz_2 == strmsz_1 );
- strmsz_1 = fb_03.in_avail();
- fb_03.pubsync();
- // 27filebuf-3.txt
- // bd23456789mzuva?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
- // 63 bytes.
- strmsz_2 = fb_03.in_avail();
- VERIFY( strmsz_1 == 1 );
- // VERIFY( strmsz_2 == 1 );
-
- // setbuf
- // pubsetbuf(char_type* s, streamsize n)
- fb_01.pubsetbuf(0,0);
- fb_02.pubsetbuf(0,0);
- fb_03.pubsetbuf(0,0);
- // Need to test unbuffered output, which means calling this on some
- // things that have just been opened.
-
-
- // 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, std::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 == '3' );
- c2 = fb_03.sputc('\n'); //current in pointer +1
- c3 = fb_03.sgetc();
- VERIFY( c2 != c3 );
- VERIFY( c3 == '4' );
- fb_03.pubsync();
- c1 = fb_03.sgetc();
- VERIFY( c1 == c3 );
- //cur
- // 27filebuf-3.txt = bd2\n456789:;<=>?...
- pt_2 = fb_03.pubseekoff(2, std::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 == '7' );
- 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, std::ios_base::end,
- std::ios_base::in|std::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
-
-
- // seekpos
- // pubseekpos(pos_type sp, ios_base::openmode)
- // alters the stream position to sp
- //IN|OUT
- //beg
- pt_1 = fb_03.pubseekoff(78, std::ios_base::beg);
- off_1 = pt_1;
- VERIFY( off_1 > 0 );
- c1 = fb_03.snextc(); //current in pointer +1
- VERIFY( c1 == ' ' );
- 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, std::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_01.close();
- fb_02.close();
- fb_03.close();
- VERIFY( !fb_01.is_open() );
- VERIFY( !fb_02.is_open() );
- VERIFY( !fb_03.is_open() );
-}
-
-void test06()
-{
- using namespace std;
- typedef istream::int_type int_type;
-
- bool test = true;
- ifstream ifs(name_02);
- char buffer[] = "xxxxxxxxxx";
- int_type len1 = ifs.rdbuf()->sgetn(buffer, sizeof(buffer));
- VERIFY( len1 == sizeof(buffer) );
- VERIFY( buffer[0] == 'a' );
-}
-
-// 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 );
-}
-
-class MyTraits : public std::char_traits<char>
-{
-public:
- static bool eq(char c1, char c2)
- {
- bool test = true;
- VERIFY( c1 != 'X' );
- VERIFY( c2 != 'X' );
- return std::char_traits<char>::eq(c1, c2);
- }
-};
-
-class MyBuf : public std::basic_streambuf<char, MyTraits>
-{
- char buffer[8];
-
-public:
- MyBuf()
- {
- std::memset(buffer, 'X', sizeof(buffer));
- std::memset(buffer + 2, 'f', 4);
- setg(buffer + 2, buffer + 2, buffer + 6);
- }
-};
-
-// libstdc++/9538
-void test08()
-{
- bool test = true;
-
- MyBuf mb;
- mb.sputbackc('a');
-}
-
-// libstdc++/9439, libstdc++/9425
-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() );
-}
-
-class Cvt_to_upper : public std::codecvt<char, char, mbstate_t>
-{
- bool do_always_noconv() const throw()
- {
- return false;
- }
-};
-
-// libstdc++/9169
-void test10()
-{
- using namespace std;
- bool test = true;
-
- locale c_loc;
- 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 );
-}
-
-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();
-
- // 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();
-}
-
-// libstdc++/9825
-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();
-}
-
-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
-void test13()
-{
- using namespace std;
- bool test = true;
-
- locale loc;
- 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();
-}
-
-void test14()
-{
- using namespace std;
- bool test = true;
-
- locale loc;
- 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();
-}
-
-
-class OverBuf : public std::filebuf
-{
-public:
- int_type pub_overflow(int_type c = traits_type::eof())
- { return std::filebuf::overflow(c); }
-};
-
-// libstdc++/9988
-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();
-}
-
-class UnderBuf : public std::filebuf
-{
-public:
- int_type
- pub_underflow()
- { return underflow(); }
-
- std::streamsize
- pub_showmanyc()
- { return showmanyc(); }
-};
-
-// libstdc++/10097
-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()
-{
- test01();
- test02();
-
- test03();
- test04();
- test05();
- test06();
-
- __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test07);
- test08();
- test09();
- test10();
- test11();
- test12();
- test13();
- test14();
- test15();
- test16();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/27_io/fpos/1.cc b/libstdc++-v3/testsuite/27_io/fpos/1.cc
new file mode 100644
index 00000000000..4f33fd02461
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/fpos/1.cc
@@ -0,0 +1,71 @@
+// 1999-09-20 bkoz
+
+// Copyright (C) 1999, 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.
+
+// 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.3 template class fpos
+
+#include <cwchar> // for mbstate_t
+#include <ios>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test = true;
+
+ typedef std::mbstate_t state_type;
+ state_type state01;
+ state_type state02;
+
+ std::streampos pos01;
+ std::streampos pos02;
+
+ std::streamoff off01;
+ std::streamoff off02;
+
+ std::streamsize size01;
+ std::streamsize size02;
+
+ // 27.4.3.1 fpos members
+ // void state(state_type s);
+ // state_type state();
+#if 0
+// XXX Need to have some sanity checking for the mbstate_t type, or
+// whatever the insantiating type for class fpos happens to be for
+// streampos, as things like equality operators and assignment
+// operators, increment and deincrement operators need to be in place.
+ pos01.state(state02);
+ state01 = pos01.state();
+ VERIFY( state01 == state02 );
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/fpos.cc b/libstdc++-v3/testsuite/27_io/fpos/2.cc
index 2f52fd3c65e..46c64b8bef5 100644
--- a/libstdc++-v3/testsuite/27_io/fpos.cc
+++ b/libstdc++-v3/testsuite/27_io/fpos/2.cc
@@ -1,6 +1,6 @@
// 1999-09-20 bkoz
-// Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+// Copyright (C) 1999, 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
@@ -33,41 +33,6 @@
#include <ios>
#include <testsuite_hooks.h>
-void test01()
-{
- bool test = true;
-
- typedef std::mbstate_t state_type;
- state_type state01;
- state_type state02;
-
- std::streampos pos01;
- std::streampos pos02;
-
- std::streamoff off01;
- std::streamoff off02;
-
- std::streamsize size01;
- std::streamsize size02;
-
- // 27.4.3.1 fpos members
- // void state(state_type s);
- // state_type state();
-#if 0
-// XXX Need to have some sanity checking for the mbstate_t type, or
-// whatever the insantiating type for class fpos happens to be for
-// streampos, as things like equality operators and assignment
-// operators, increment and deincrement operators need to be in place.
- pos01.state(state02);
- state01 = pos01.state();
- VERIFY( state01 == state02 );
-#endif
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-}
-
// 27.4.3.2 fpos requirements/invariants
void test02()
{
@@ -129,51 +94,10 @@ void test02()
std::streamsize size01(off02);
std::streamoff off04(size01);
VERIFY( off01 == off04 );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
}
-void test03()
+int main()
{
- bool test = true;
-
- typedef std::mbstate_t state_type;
- state_type state01;
- state_type state02;
-
- std::streamoff off01;
- std::streamoff off02 = 997;
-
- int i01 = 0;
- int i02 = 999;
-
- // casts to const streamoff
- // (yes, I know this is weak code)
- const std::streampos pos01 = 0;
- off01 = pos01;
-
- // equality/inequality with const args
- const std::streampos pos02(54);
- std::streampos pos03(44);
- VERIFY( !(pos03 == pos02) );
- VERIFY( pos03 != pos02 );
- VERIFY( !(pos02 == pos03) );
- VERIFY( pos02 != pos03 );
-
- // default values
- std::streampos pos04;
- VERIFY( (std::streamoff)pos04 == 0 );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-}
-
-int main() {
- test01();
test02();
- test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/fpos/3.cc b/libstdc++-v3/testsuite/27_io/fpos/3.cc
new file mode 100644
index 00000000000..777de9e7ad0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/fpos/3.cc
@@ -0,0 +1,72 @@
+// 1999-09-20 bkoz
+
+// Copyright (C) 1999, 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.
+
+// 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.3 template class fpos
+
+#include <cwchar> // for mbstate_t
+#include <ios>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ bool test = true;
+
+ typedef std::mbstate_t state_type;
+ state_type state01;
+ state_type state02;
+
+ std::streamoff off01;
+ std::streamoff off02 = 997;
+
+ int i01 = 0;
+ int i02 = 999;
+
+ // casts to const streamoff
+ // (yes, I know this is weak code)
+ const std::streampos pos01 = 0;
+ off01 = pos01;
+
+ // equality/inequality with const args
+ const std::streampos pos02(54);
+ std::streampos pos03(44);
+ VERIFY( !(pos03 == pos02) );
+ VERIFY( pos03 != pos02 );
+ VERIFY( !(pos02 == pos03) );
+ VERIFY( pos02 != pos03 );
+
+ // default values
+ std::streampos pos04;
+ VERIFY( std::streamoff(pos04) == 0 );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ifstream_members-1.tst b/libstdc++-v3/testsuite/27_io/ifstream_members-1.tst
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/libstdc++-v3/testsuite/27_io/ifstream_members-1.tst
+++ /dev/null
diff --git a/libstdc++-v3/testsuite/27_io/ifstream_members-1.txt b/libstdc++-v3/testsuite/27_io/ifstream_members-1.txt
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/libstdc++-v3/testsuite/27_io/ifstream_members-1.txt
+++ /dev/null
diff --git a/libstdc++-v3/testsuite/27_io/ios_base_callbacks.cc b/libstdc++-v3/testsuite/27_io/ios_base/callbacks/1.cc
index aabb778a527..09cfee4affd 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base_callbacks.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/callbacks/1.cc
@@ -1,6 +1,6 @@
// 1999-11-10 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
@@ -39,7 +39,7 @@ void
callb03(std::ios_base::event e, std::ios_base& b, int i)
{ str02 += "plutonia"; }
-bool test01()
+void test01()
{
bool test = true;
std::locale loc("C");
@@ -51,19 +51,12 @@ bool test01()
ios01.register_callback(callb01, 1);
ios01.imbue(loc);
VERIFY( str01 == str02 );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return test;
}
int main(void)
{
test01();
-
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/state/1.cc b/libstdc++-v3/testsuite/27_io/ios_base/state/1.cc
new file mode 100644
index 00000000000..6097fdb1849
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/state/1.cc
@@ -0,0 +1,62 @@
+// 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.
+
+// 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 <sstream>
+#include <locale>
+#include <testsuite_hooks.h>
+
+void
+test02()
+{
+ bool test = true;
+ const std::string strue("true");
+ const std::string sfalse("false");
+ std::string str01;
+ std::string str02;
+
+ std::locale loc("");
+ std::ostringstream ostr01;
+ ostr01.imbue(loc);
+ std::ios_base::fmtflags ff = ostr01.flags(std::ios_base::boolalpha);
+
+ ostr01 << true;
+ str02 = ostr01.str();
+ VERIFY( str02 == strue );
+
+ ostr01.str(str01);
+ ostr01 << false;
+ str02 = ostr01.str();
+ VERIFY( str02 == sfalse );
+}
+
+int
+main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/storage/1.cc b/libstdc++-v3/testsuite/27_io/ios_base/storage/1.cc
new file mode 100644
index 00000000000..dac74cd35da
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/storage/1.cc
@@ -0,0 +1,54 @@
+// 2000-12-19 bkoz
+
+// Copyright (C) 2000, 2002, 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.4.2.5 ios_base storage functions
+
+// XXX This test will not work for some versions of irix6 because of
+// XXX bug(s) in libc malloc for very large allocations. However
+// XXX -lmalloc seems to work.
+// See http://gcc.gnu.org/ml/gcc/2002-05/msg01012.html
+// { dg-options "-lmalloc" { target mips*-*-irix6* } }
+
+#include <sstream>
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// http://gcc.gnu.org/ml/gcc-bugs/2000-12/msg00413.html
+void test01()
+{
+ bool test = true;
+
+ using namespace std;
+
+ long x1 = ios::xalloc();
+ long x2 = ios::xalloc();
+ long x3 = ios::xalloc();
+ long x4 = ios::xalloc();
+
+ ostringstream out("the element of crime, lars von trier");
+ out.pword(++x4); // should not crash
+}
+
+int main(void)
+{
+ __gnu_cxx_test::set_memory_limits();
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base_storage.cc b/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc
index 7033466e691..751b6be2583 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base_storage.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc
@@ -28,25 +28,8 @@
#include <sstream>
#include <iostream>
-
#include <testsuite_hooks.h>
-// http://gcc.gnu.org/ml/gcc-bugs/2000-12/msg00413.html
-void test01()
-{
- bool test = true;
-
- using namespace std;
-
- long x1 = ios::xalloc();
- long x2 = ios::xalloc();
- long x3 = ios::xalloc();
- long x4 = ios::xalloc();
-
- ostringstream out("the element of crime, lars von trier");
- out.pword(++x4); // should not crash
-}
-
// libstdc++/3129
void test02()
{
@@ -138,25 +121,9 @@ void test02()
}
-class derived : public std::ios_base
-{
-public:
- derived() {}
-};
-
-void test03()
-{
- derived d;
-
- d.pword(0) = &d;
- d.iword(0) = 1;
-}
-
int main(void)
{
__gnu_cxx_test::set_memory_limits();
- test01();
test02();
- test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/storage/3.cc b/libstdc++-v3/testsuite/27_io/ios_base/storage/3.cc
new file mode 100644
index 00000000000..2c9816a397e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/storage/3.cc
@@ -0,0 +1,52 @@
+// 2000-12-19 bkoz
+
+// Copyright (C) 2000, 2002, 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.4.2.5 ios_base storage functions
+
+// XXX This test will not work for some versions of irix6 because of
+// XXX bug(s) in libc malloc for very large allocations. However
+// XXX -lmalloc seems to work.
+// See http://gcc.gnu.org/ml/gcc/2002-05/msg01012.html
+// { dg-options "-lmalloc" { target mips*-*-irix6* } }
+
+#include <sstream>
+#include <iostream>
+#include <testsuite_hooks.h>
+
+class derived : public std::ios_base
+{
+public:
+ derived() {}
+};
+
+void test03()
+{
+ derived d;
+
+ d.pword(0) = &d;
+ d.iword(0) = 1;
+}
+
+int main(void)
+{
+ __gnu_cxx_test::set_memory_limits();
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/1.cc b/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/1.cc
new file mode 100644
index 00000000000..dcc0d5fcab4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/1.cc
@@ -0,0 +1,58 @@
+// 1999-05-21 bkoz
+// 2000-05-21 Benjamin Kosnik <bkoz@redhat.com>
+// 2001-01-17 Loren J. Rittle <ljrittle@acm.org>
+
+// Copyright (C) 1999, 2000, 2001, 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.4.2.4 ios_base static members
+// @require@ %-*.tst
+// @diff@ %-*.tst %-*.txt
+
+#include <cstdio>
+#include <sstream>
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// N.B. Once we have called sync_with_stdio(false), we can never go back.
+
+void
+test01()
+{
+ std::ios_base::sync_with_stdio();
+ std::freopen("ios_base_members_static-1.txt", "w", stdout);
+
+ for (int i = 0; i < 2; i++)
+ {
+ std::printf("1");
+ std::cout << "2";
+ std::putc('3', stdout);
+ std::cout << '4';
+ std::fputs("5", stdout);
+ std::cout << 6;
+ std::putchar('7');
+ std::cout << 8 << '9';
+ std::printf("0\n");
+ }
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base_members_static.cc b/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/2.cc
index 1e7df6a295f..b645b4a98fd 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base_members_static.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/2.cc
@@ -2,7 +2,7 @@
// 2000-05-21 Benjamin Kosnik <bkoz@redhat.com>
// 2001-01-17 Loren J. Rittle <ljrittle@acm.org>
-// Copyright (C) 1999, 2000, 2001 Free Software Foundation
+// Copyright (C) 1999, 2000, 2001, 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
@@ -27,32 +27,11 @@
#include <cstdio>
#include <sstream>
#include <iostream>
-
#include <testsuite_hooks.h>
// N.B. Once we have called sync_with_stdio(false), we can never go back.
-void
-test01()
-{
- std::ios_base::sync_with_stdio();
- std::freopen("ios_base_members_static-1.txt", "w", stdout);
-
- for (int i = 0; i < 2; i++)
- {
- std::printf("1");
- std::cout << "2";
- std::putc('3', stdout);
- std::cout << '4';
- std::fputs("5", stdout);
- std::cout << 6;
- std::putchar('7');
- std::cout << 8 << '9';
- std::printf("0\n");
- }
-}
-
-bool test02()
+void test02()
{
bool test = true;
@@ -69,17 +48,10 @@ bool test02()
VERIFY( std::cout.good() );
VERIFY( !std::cout.sync_with_stdio(0) );
VERIFY( std::cout.good() );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return test;
}
int main(void)
{
- test01();
test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base_members_static-1.tst b/libstdc++-v3/testsuite/27_io/ios_base_members_static-1.tst
deleted file mode 100644
index 8d1e93a0002..00000000000
--- a/libstdc++-v3/testsuite/27_io/ios_base_members_static-1.tst
+++ /dev/null
@@ -1,2 +0,0 @@
-1234567890
-1234567890
diff --git a/libstdc++-v3/testsuite/27_io/ios_members.cc b/libstdc++-v3/testsuite/27_io/ios_members.cc
deleted file mode 100644
index 3b7dc24c454..00000000000
--- a/libstdc++-v3/testsuite/27_io/ios_members.cc
+++ /dev/null
@@ -1,173 +0,0 @@
-// 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
-
-#include <ios>
-// NB: Don't include any other headers in this file.
-#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' );
-}
-
-// 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;
-
- 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 );
- }
-
- // iostate exceptions() const
- VERIFY( ios_01.exceptions() == std::ios_base::goodbit );
-
- // void exceptions(iostate except)
- 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 );
- }
-
- // basic_ios& copyfmt(const basic_ios& rhs)
- std::ios ios_02(NULL);
- ios_02.exceptions(std::ios_base::eofbit);
- VERIFY( static_cast<bool>(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 );
- }
-}
-
-// 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()
-{
- test01();
- test02();
- __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03);
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.tst b/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.tst
deleted file mode 100644
index 717a04c5f4d..00000000000
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.tst
+++ /dev/null
@@ -1,65 +0,0 @@
-// 990811 bkoz
-
-// Copyright (C) 1999 Cygnus Solutions
-//
-// 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.
-
-/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Repatriation
-/mnt/cdrom/yabbyyou_jesusdread/disk_2/Vivian Jackson and the Prop
-/mnt/cdrom/yabbyyou_jesusdread/disk_2/Michael Rose - Born Free (d
-/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Love Thy Nei
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Defe
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Ralp
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Tommy McCook and Don D. Jnr
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Big Youth and Vivian Jackso
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Big Youth Fi
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Upsetter Mix - Rally Dub
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Dicky Burton - God Is Watch
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Pablo and Vivian Jackson -
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Rock King Tu
-/mnt/cdrom/TORTOISE_millions_now_living/tortoise_5
-/mnt/cdrom/TORTOISE_millions_now_living/tortoise_6
-/mnt/cdrom/bettycarter_i'myours,you'remine/This time
-/mnt/cdrom/bettycarter_i'myours,you'remine/I'm Yours, You're Mine
-/mnt/cdrom/bettycarter_i'myours,you'remine/Lonely House
-/mnt/cdrom/bettycarter_i'myours,you'remine/Close Your Eyes
-/mnt/cdrom/bettycarter_i'myours,you'remine/Useless Landscape
-/mnt/cdrom/bettycarter_i'myours,you'remine/East of the Sun
-/mnt/cdrom/bettycarter_i'myours,you'remine/September Song
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/Naima's Love Song
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/Stay As Sweet As You Are
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/Make Him Believe
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/I Should Care
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/Once Upon a Summertime
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/You Go To My Head
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/In the Still Of the Night
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/When It's Sleepy Time Down
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/The Love We Had Yesterday
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/Dip Bag
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/You're Mine, Too
-/mnt/cdrom/c_adderly_somethin'_else/Autumn Leaves
-/mnt/cdrom/c_adderly_somethin'_else/Love For Sale
-/mnt/cdrom/c_adderly_somethin'_else/Somethin' Else
-/mnt/cdrom/c_adderly_somethin'_else/One For Daddy-O
-
-
-
-
-
-
-
-
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.txt b/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.txt
deleted file mode 100644
index 717a04c5f4d..00000000000
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-// 990811 bkoz
-
-// Copyright (C) 1999 Cygnus Solutions
-//
-// 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.
-
-/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Repatriation
-/mnt/cdrom/yabbyyou_jesusdread/disk_2/Vivian Jackson and the Prop
-/mnt/cdrom/yabbyyou_jesusdread/disk_2/Michael Rose - Born Free (d
-/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Love Thy Nei
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Defe
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Ralp
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Tommy McCook and Don D. Jnr
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Big Youth and Vivian Jackso
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Big Youth Fi
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Upsetter Mix - Rally Dub
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Dicky Burton - God Is Watch
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Pablo and Vivian Jackson -
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Rock King Tu
-/mnt/cdrom/TORTOISE_millions_now_living/tortoise_5
-/mnt/cdrom/TORTOISE_millions_now_living/tortoise_6
-/mnt/cdrom/bettycarter_i'myours,you'remine/This time
-/mnt/cdrom/bettycarter_i'myours,you'remine/I'm Yours, You're Mine
-/mnt/cdrom/bettycarter_i'myours,you'remine/Lonely House
-/mnt/cdrom/bettycarter_i'myours,you'remine/Close Your Eyes
-/mnt/cdrom/bettycarter_i'myours,you'remine/Useless Landscape
-/mnt/cdrom/bettycarter_i'myours,you'remine/East of the Sun
-/mnt/cdrom/bettycarter_i'myours,you'remine/September Song
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/Naima's Love Song
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/Stay As Sweet As You Are
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/Make Him Believe
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/I Should Care
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/Once Upon a Summertime
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/You Go To My Head
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/In the Still Of the Night
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/When It's Sleepy Time Down
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/The Love We Had Yesterday
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/Dip Bag
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/You're Mine, Too
-/mnt/cdrom/c_adderly_somethin'_else/Autumn Leaves
-/mnt/cdrom/c_adderly_somethin'_else/Love For Sale
-/mnt/cdrom/c_adderly_somethin'_else/Somethin' Else
-/mnt/cdrom/c_adderly_somethin'_else/One For Daddy-O
-
-
-
-
-
-
-
-
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_other-2.tst b/libstdc++-v3/testsuite/27_io/istream_extractor_other-2.tst
deleted file mode 100644
index 717a04c5f4d..00000000000
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_other-2.tst
+++ /dev/null
@@ -1,65 +0,0 @@
-// 990811 bkoz
-
-// Copyright (C) 1999 Cygnus Solutions
-//
-// 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.
-
-/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Repatriation
-/mnt/cdrom/yabbyyou_jesusdread/disk_2/Vivian Jackson and the Prop
-/mnt/cdrom/yabbyyou_jesusdread/disk_2/Michael Rose - Born Free (d
-/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Love Thy Nei
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Defe
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Ralp
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Tommy McCook and Don D. Jnr
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Big Youth and Vivian Jackso
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Big Youth Fi
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Upsetter Mix - Rally Dub
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Dicky Burton - God Is Watch
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/Pablo and Vivian Jackson -
-/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Rock King Tu
-/mnt/cdrom/TORTOISE_millions_now_living/tortoise_5
-/mnt/cdrom/TORTOISE_millions_now_living/tortoise_6
-/mnt/cdrom/bettycarter_i'myours,you'remine/This time
-/mnt/cdrom/bettycarter_i'myours,you'remine/I'm Yours, You're Mine
-/mnt/cdrom/bettycarter_i'myours,you'remine/Lonely House
-/mnt/cdrom/bettycarter_i'myours,you'remine/Close Your Eyes
-/mnt/cdrom/bettycarter_i'myours,you'remine/Useless Landscape
-/mnt/cdrom/bettycarter_i'myours,you'remine/East of the Sun
-/mnt/cdrom/bettycarter_i'myours,you'remine/September Song
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/Naima's Love Song
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/Stay As Sweet As You Are
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/Make Him Believe
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/I Should Care
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/Once Upon a Summertime
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/You Go To My Head
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/In the Still Of the Night
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/When It's Sleepy Time Down
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/The Love We Had Yesterday
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/Dip Bag
-/mnt/cdrom/bettycarter_it'snotaboutthemelo/You're Mine, Too
-/mnt/cdrom/c_adderly_somethin'_else/Autumn Leaves
-/mnt/cdrom/c_adderly_somethin'_else/Love For Sale
-/mnt/cdrom/c_adderly_somethin'_else/Somethin' Else
-/mnt/cdrom/c_adderly_somethin'_else/One For Daddy-O
-
-
-
-
-
-
-
-
diff --git a/libstdc++-v3/testsuite/27_io/istream_seeks-1.tst b/libstdc++-v3/testsuite/27_io/istream_seeks-1.tst
deleted file mode 100644
index 5d9eafa2a36..00000000000
--- a/libstdc++-v3/testsuite/27_io/istream_seeks-1.tst
+++ /dev/null
@@ -1,7 +0,0 @@
-bd2
-456x
-9mzuv>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
-because because
-because. .
-of the wonderful things he does!!
-ok \ No newline at end of file
diff --git a/libstdc++-v3/testsuite/27_io/istream_seeks-1.txt b/libstdc++-v3/testsuite/27_io/istream_seeks-1.txt
deleted file mode 100644
index 5d9eafa2a36..00000000000
--- a/libstdc++-v3/testsuite/27_io/istream_seeks-1.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-bd2
-456x
-9mzuv>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
-because because
-because. .
-of the wonderful things he does!!
-ok \ No newline at end of file
diff --git a/libstdc++-v3/testsuite/27_io/istream_seeks-2.tst b/libstdc++-v3/testsuite/27_io/istream_seeks-2.tst
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/libstdc++-v3/testsuite/27_io/istream_seeks-2.tst
+++ /dev/null
diff --git a/libstdc++-v3/testsuite/27_io/istream_seeks-3.tst b/libstdc++-v3/testsuite/27_io/istream_seeks-3.tst
deleted file mode 100644
index dc45fc9330a..00000000000
--- a/libstdc++-v3/testsuite/27_io/istream_seeks-3.tst
+++ /dev/null
@@ -1,10 +0,0 @@
-0-0 lootpack, peanut butter wolf, rob swift, madlib, quasimoto
-0-1 lootpack, peanut butter wolf, rob swift, madlib, quasimoto
-0-2 lootpack, peanut butter wolf, rob swift, madlib, quasimoto
-0-3 lootpack, peanut butter wolf, rob swift, madlib, quasimoto
-0-4 lootpack, peanut butter wolf, rob swift, madlib, quasimoto
-0-5 lootpack, peanut butter wolf, rob swift, madlib, quasimoto
-0-6 lootpack, peanut butter wolf, rob swift, madlib, quasimoto
-0-7 lootpack, peanut butter wolf, rob swift, madlib, quasimoto
-0-8 lootpack, peanut butter wolf, rob swift, madlib, quasimoto
-0-9 lootpack, peanut butter wolf, rob swift, madlib, quasimoto
diff --git a/libstdc++-v3/testsuite/27_io/istream_seeks.cc b/libstdc++-v3/testsuite/27_io/istream_seeks.cc
deleted file mode 100644
index 892e10bcb1e..00000000000
--- a/libstdc++-v3/testsuite/27_io/istream_seeks.cc
+++ /dev/null
@@ -1,405 +0,0 @@
-// 2000-06-29 bkoz
-
-// Copyright (C) 2000, 2001, 2002 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.3 unformatted input functions
-// NB: ostream has a particular "seeks" category. Adopt this for istreams too.
-// @require@ %-*.tst %-*.txt
-// @diff@ %-*.tst %-*.txt
-
-#include <istream>
-#include <sstream>
-#include <fstream>
-#include <testsuite_hooks.h>
-
-bool test01()
-{
- using namespace std;
- typedef ios::pos_type pos_type;
-
- bool test = true;
- const char str_lit01[] = "istream_seeks-1.tst";
-
- // in
- // test default ctors leave things in the same positions...
- istringstream ist1;
- pos_type p3 = ist1.tellg();
-
- ifstream ifs1;
- pos_type p4 = ifs1.tellg();
-
- VERIFY( p3 == p4 );
-
- // in
- // test ctors leave things in the same positions...
- istringstream ist2("bob_marley:kaya");
- p3 = ist2.tellg();
-
- ifstream ifs2(str_lit01);
- p4 = ifs2.tellg();
-
- VERIFY( p3 == p4 );
- return test;
-}
-
-const char* s = " lootpack, peanut butter wolf, rob swift, madlib, quasimoto";
-const int times = 10;
-
-void write_rewind(std::iostream& stream)
-{
- for (int j = 0; j < times; j++)
- {
- bool test = true;
- std::streampos begin = stream.tellg();
-
- for (int i = 0; i < times; ++i)
- stream << j << '-' << i << s << '\n';
-
- stream.seekg(begin);
- std::streampos end = stream.tellg();
- std::streampos badpos = std::streampos(std::streambuf::off_type(-1));
- }
-}
-
-void check_contents(std::iostream& stream)
-{
- bool test = true;
-
- stream.clear();
- stream.seekg(0, std::ios::beg);
- int i = 0;
- int loop = times * times + 2;
- while (i < loop)
- {
- stream.ignore(80, '\n');
- if (stream.good())
- ++i;
- else
- break;
- }
- VERIFY( i == times );
-}
-
-// fstream
-// libstdc++/2346
-void test02()
-{
- std::fstream ofstrm;
- ofstrm.open("istream_seeks-3.txt", std::ios::out);
- if (!ofstrm)
- std::abort();
- write_rewind(ofstrm);
- ofstrm.close();
-
- std::fstream ifstrm;
- ifstrm.open("istream_seeks-3.txt", std::ios::in);
- check_contents(ifstrm);
- ifstrm.close();
-}
-
-// stringstream
-// libstdc++/2346
-void test03()
-{
- std::stringstream sstrm;
-
- write_rewind(sstrm);
- check_contents(sstrm);
-}
-
-// fstreams
-void test04(void)
-{
- typedef std::istream::off_type off_type;
-
- bool test = true;
- std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
- std::ios_base::iostate state01, state02;
- const char str_lit01[] = "istream_seeks-1.txt";
- const char str_lit02[] = "istream_seeks-2.txt";
- std::ifstream if01(str_lit01, std::ios_base::in | std::ios_base::out);
- std::ifstream if02(str_lit01, std::ios_base::in);
- std::ifstream if03(str_lit02, std::ios_base::out | std::ios_base::trunc);
- VERIFY( if01.good() );
- VERIFY( if02.good() );
- VERIFY( if03.good() );
-
- std::istream is01(if01.rdbuf());
- std::istream is02(if02.rdbuf());
- std::istream is03(if03.rdbuf());
-
- // pos_type tellg()
- // in | out
- pos01 = is01.tellg();
- pos02 = is01.tellg();
- VERIFY( pos01 == pos02 );
- // VERIFY( istream::pos_type(0) != pos01 ); //deprecated
-
- // in
- pos03 = is02.tellg();
- pos04 = is02.tellg();
- VERIFY( pos03 == pos04 );
- // VERIFY( istream::pos_type(0) != pos03 ); //deprecated
-
- // out
- pos05 = is03.tellg();
- pos06 = is03.tellg();
- VERIFY( pos05 == pos06 );
- // VERIFY( istream::pos_type(0) != pos01 ); //deprecated
-
- // istream& seekg(pos_type)
- // istream& seekg(off_type, ios_base::seekdir)
-
- // cur
- // NB: see library issues list 136. It's the v-3 interp that seekg
- // only sets the input buffer, or else istreams with buffers that
- // have _M_mode == ios_base::out will fail to have consistency
- // between seekg and tellg.
- state01 = is01.rdstate();
- is01.seekg(10, std::ios_base::cur);
- state02 = is01.rdstate();
- pos01 = is01.tellg();
- VERIFY( pos01 == pos02 + off_type(10) );
- VERIFY( state01 == state02 );
- pos02 = is01.tellg();
- VERIFY( pos02 == pos01 );
-
- state01 = is02.rdstate();
- is02.seekg(10, std::ios_base::cur);
- state02 = is02.rdstate();
- pos03 = is02.tellg();
- VERIFY( pos03 == pos04 + off_type(10) );
- VERIFY( state01 == state02 );
- pos04 = is02.tellg();
- VERIFY( pos03 == pos04 );
-
- state01 = is03.rdstate();
- is03.seekg(10, std::ios_base::cur);
- state02 = is03.rdstate();
- pos05 = is03.tellg();
- VERIFY( pos05 == pos06 + off_type(10) );
- VERIFY( state01 == state02 );
- pos06 = is03.tellg();
- VERIFY( pos05 == pos06 );
-
- // beg
- state01 = is01.rdstate();
- is01.seekg(20, std::ios_base::beg);
- state02 = is01.rdstate();
- pos01 = is01.tellg();
- VERIFY( pos01 == pos02 + off_type(10) );
- VERIFY( state01 == state02 );
- pos02 = is01.tellg();
- VERIFY( pos02 == pos01 );
-
- state01 = is02.rdstate();
- is02.seekg(20, std::ios_base::beg);
- state02 = is02.rdstate();
- pos03 = is02.tellg();
- VERIFY( pos03 == pos04 + off_type(10) );
- VERIFY( state01 == state02 );
- pos04 = is02.tellg();
- VERIFY( pos03 == pos04 );
-
- state01 = is03.rdstate();
- is03.seekg(20, std::ios_base::beg);
- state02 = is03.rdstate();
- pos05 = is03.tellg();
- VERIFY( pos05 == pos06 + off_type(10) );
- VERIFY( state01 == state02 );
- pos06 = is03.tellg();
- VERIFY( pos05 == pos06 );
-
- // libstdc++/6414
- if01.seekg(0, std::ios_base::beg);
- pos01 = if01.tellg();
- if01.peek();
- pos02 = if01.tellg();
- VERIFY( pos02 == pos01 );
-}
-
-// stringstreams
-void test05(void)
-{
- typedef std::istream::off_type off_type;
-
- bool test = true;
- std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
- std::ios_base::iostate state01, state02;
- const char str_lit01[] = "istream_seeks-1.tst";
- std::ifstream if01(str_lit01);
- std::ifstream if02(str_lit01);
- std::ifstream if03(str_lit01);
- VERIFY( if01.good() );
- VERIFY( if02.good() );
- VERIFY( if03.good() );
-
- std::stringbuf strbuf01(std::ios_base::in | std::ios_base::out);
- if01 >> &strbuf01;
- // initialize stringbufs that are ios_base::out
- std::stringbuf strbuf03(strbuf01.str(), std::ios_base::out);
- // initialize stringbufs that are ios_base::in
- std::stringbuf strbuf02(strbuf01.str(), std::ios_base::in);
-
- std::istream is01(&strbuf01);
- std::istream is02(&strbuf02);
- std::istream is03(&strbuf03);
-
- // pos_type tellg()
- // in | out
- pos01 = is01.tellg();
- pos02 = is01.tellg();
- VERIFY( pos01 == pos02 );
- // VERIFY( istream::pos_type(0) != pos01 ); // deprecated
-
- // in
- pos03 = is02.tellg();
- pos04 = is02.tellg();
- VERIFY( pos03 == pos04 );
- // VERIFY( istream::pos_type(0) != pos03 ); // deprecated
-
- // out
- pos05 = is03.tellg();
- pos06 = is03.tellg();
- VERIFY( pos05 == pos06 );
- // VERIFY( istream::pos_type(0) != pos01 ); //deprecated
-
- // istream& seekg(pos_type)
- // istream& seekg(off_type, ios_base::seekdir)
-
- // cur
- // NB: see library issues list 136. It's the v-3 interp that seekg
- // only sets the input buffer, or else istreams with buffers that
- // have _M_mode == ios_base::out will fail to have consistency
- // between seekg and tellg.
- state01 = is01.rdstate();
- is01.seekg(10, std::ios_base::cur);
- state02 = is01.rdstate();
- pos01 = is01.tellg();
- VERIFY( pos01 == pos02 + off_type(10) );
- VERIFY( state01 == state02 );
- pos02 = is01.tellg();
- VERIFY( pos02 == pos01 );
-
- state01 = is02.rdstate();
- is02.seekg(10, std::ios_base::cur);
- state02 = is02.rdstate();
- pos03 = is02.tellg();
- VERIFY( pos03 == pos04 + off_type(10) );
- VERIFY( state01 == state02 );
- pos04 = is02.tellg();
- VERIFY( pos03 == pos04 );
-
- state01 = is03.rdstate();
- is03.seekg(10, std::ios_base::cur);
- state02 = is03.rdstate();
- pos05 = is03.tellg();
- VERIFY( pos05 == pos06 ); // as only out buffer
- VERIFY( state01 != state02 );
- pos06 = is03.tellg();
- VERIFY( pos05 == pos06 );
-
- // beg
- state01 = is01.rdstate();
- is01.seekg(20, std::ios_base::beg);
- state02 = is01.rdstate();
- pos01 = is01.tellg();
- VERIFY( pos01 == pos02 + off_type(10) );
- VERIFY( state01 == state02 );
- pos02 = is01.tellg();
- VERIFY( pos02 == pos01 );
-
- state01 = is02.rdstate();
- is02.seekg(20, std::ios_base::beg);
- state02 = is02.rdstate();
- pos03 = is02.tellg();
- VERIFY( pos03 == pos04 + off_type(10) );
- VERIFY( state01 == state02 );
- pos04 = is02.tellg();
- VERIFY( pos03 == pos04 );
-
- state01 = is03.rdstate();
- is03.seekg(20, std::ios_base::beg);
- state02 = is03.rdstate();
- pos05 = is03.tellg();
- VERIFY( pos05 == pos06 ); // as only out buffer
- VERIFY( state01 == state02 );
- pos06 = is03.tellg();
- VERIFY( pos05 == pos06 );
-}
-
-// libstdc++/8348
-void test06(void)
-{
- using namespace std;
- bool test = true;
- string num1("555");
-
- // tellg
- {
- istringstream iss(num1);
- istream::pos_type pos1 = iss.tellg();
- int asNum = 0;
- iss >> asNum;
- VERIFY( test = iss.eof() );
- VERIFY( test = !iss.fail() );
- iss.tellg();
- VERIFY( test = !iss.fail() );
- }
-
- // seekg
- {
- istringstream iss(num1);
- istream::pos_type pos1 = iss.tellg();
- int asNum = 0;
- iss >> asNum;
- VERIFY( test = iss.eof() );
- VERIFY( test = !iss.fail() );
- iss.seekg(0, ios_base::beg);
- VERIFY( test = !iss.fail() );
- }
-
- // seekg
- {
- istringstream iss(num1);
- istream::pos_type pos1 = iss.tellg();
- int asNum = 0;
- iss >> asNum;
- VERIFY( test = iss.eof() );
- VERIFY( test = !iss.fail() );
- iss.seekg(pos1);
- VERIFY( test = !iss.fail() );
- }
-}
-
-int main()
-{
- test01();
-
- test02();
- test03();
-
- test04();
- test05();
-
- test06();
- return 0;
-}
-
-
diff --git a/libstdc++-v3/testsuite/27_io/istream_unformatted-1.tst b/libstdc++-v3/testsuite/27_io/istream_unformatted-1.tst
deleted file mode 100644
index 9b770a55c3a..00000000000
--- a/libstdc++-v3/testsuite/27_io/istream_unformatted-1.tst
+++ /dev/null
@@ -1,1500 +0,0 @@
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
diff --git a/libstdc++-v3/testsuite/27_io/istream_unformatted-1.txt b/libstdc++-v3/testsuite/27_io/istream_unformatted-1.txt
deleted file mode 100644
index 9b770a55c3a..00000000000
--- a/libstdc++-v3/testsuite/27_io/istream_unformatted-1.txt
+++ /dev/null
@@ -1,1500 +0,0 @@
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
-1234567890
diff --git a/libstdc++-v3/testsuite/27_io/istream_unformatted.cc b/libstdc++-v3/testsuite/27_io/istream_unformatted.cc
deleted file mode 100644
index e7676ecb370..00000000000
--- a/libstdc++-v3/testsuite/27_io/istream_unformatted.cc
+++ /dev/null
@@ -1,639 +0,0 @@
-// 1999-08-11 bkoz
-
-// Copyright (C) 1999, 2000, 2001, 2002 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.3 unformatted input functions
-// @require@ %-*.tst %-*.txt
-// @diff@ %-*.tst %-*.txt
-
-#include <cstring> // for strncmp,...
-#include <istream>
-#include <sstream>
-#include <fstream>
-#include <testsuite_hooks.h>
-
-int
-test01()
-{
- typedef std::ios::traits_type traits_type;
-
- bool test = true;
- const std::string str_01;
- const std::string str_02("soul eyes: john coltrane quartet");
- std::string strtmp;
-
- std::stringbuf isbuf_03(str_02, std::ios_base::in);
- std::stringbuf isbuf_04(str_02, std::ios_base::in);
-
- std::istream is_00(NULL);
- std::istream is_03(&isbuf_03);
- std::istream is_04(&isbuf_04);
- std::ios_base::iostate state1, state2, statefail, stateeof;
- statefail = std::ios_base::failbit;
- stateeof = std::ios_base::eofbit;
-
- // istream& read(char_type* s, streamsize n)
- char carray[60] = "";
- state1 = is_04.rdstate();
- is_04.read(carray, 0);
- state2 = is_04.rdstate();
- VERIFY( state1 == state2 );
-
- state1 = is_04.rdstate();
- is_04.read(carray, 9);
- state2 = is_04.rdstate();
- VERIFY( state1 == state2 );
- VERIFY( !std::strncmp(carray, "soul eyes", 9) );
- VERIFY( is_04.peek() == ':' );
-
- state1 = is_03.rdstate();
- is_03.read(carray, 60);
- state2 = is_03.rdstate();
- VERIFY( state1 != state2 );
- VERIFY( static_cast<bool>(state2 & stateeof) );
- VERIFY( static_cast<bool>(state2 & statefail) );
- VERIFY( !std::strncmp(carray, "soul eyes: john coltrane quartet", 35) );
-
-
- // istream& ignore(streamsize n = 1, int_type delim = traits::eof())
- state1 = is_04.rdstate();
- is_04.ignore();
- VERIFY( is_04.gcount() == 1 );
- state2 = is_04.rdstate();
- VERIFY( state1 == state2 );
- VERIFY( is_04.peek() == ' ' );
-
- state1 = is_04.rdstate();
- is_04.ignore(0);
- VERIFY( is_04.gcount() == 0 );
- state2 = is_04.rdstate();
- VERIFY( state1 == state2 );
- VERIFY( is_04.peek() == ' ' );
-
- state1 = is_04.rdstate();
- is_04.ignore(5, traits_type::to_int_type(' '));
- VERIFY( is_04.gcount() == 1 );
- state2 = is_04.rdstate();
- VERIFY( state1 == state2 );
- VERIFY( is_04.peek() == 'j' );
-
- // int_type peek()
- state1 = is_04.rdstate();
- VERIFY( is_04.peek() == 'j' );
- VERIFY( is_04.gcount() == 0 );
- state2 = is_04.rdstate();
- VERIFY( state1 == state2 );
-
- is_04.ignore(30);
- state1 = is_04.rdstate();
- VERIFY( is_04.peek() == traits_type::eof() );
- VERIFY( is_04.gcount() == 0 );
- state2 = is_04.rdstate();
- VERIFY( state1 != state2 );
-
-
- // istream& putback(char c)
- is_04.clear();
- state1 = is_04.rdstate();
- is_04.putback('|');
- VERIFY( is_04.gcount() == 0 );
- state2 = is_04.rdstate();
- VERIFY( state1 == state2 );
- VERIFY( is_04.peek() == '|' );
-
- // istream& unget()
- is_04.clear();
- state1 = is_04.rdstate();
- is_04.unget();
- VERIFY( is_04.gcount() == 0 );
- state2 = is_04.rdstate();
- VERIFY( state1 == state2 );
- VERIFY( is_04.peek() == 'e' );
-
- // int sync()
- int i = is_00.sync();
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return 0;
-}
-
-int
-test02()
-{
- typedef std::char_traits<char> traits_type;
-
- bool test = true;
- const char str_lit01[] = "\t\t\t sun*ra \n"
- " "
- "and his myth science arkestra present\n"
- " "
- "angles and demons @ play\n"
- " "
- "the nubians of plutonia";
- std::string str01(str_lit01);
- std::string strtmp;
-
- std::stringbuf sbuf_04(str01, std::ios_base::in);
-
- std::istream is_00(NULL);
- std::istream is_04(&sbuf_04);
- std::ios_base::iostate state1, state2, statefail, stateeof;
- statefail = std::ios_base::failbit;
- stateeof = std::ios_base::eofbit;
- std::streamsize count1, count2;
- char carray1[400] = "";
-
- // istream& getline(char* s, streamsize n, char delim)
- // istream& getline(char* s, streamsize n)
- state1 = is_00.rdstate();
- is_00.getline(carray1, 20, '*');
- state2 = is_00.rdstate();
- // make sure failbit was set, since we couldn't extract
- // from the NULL streambuf...
- VERIFY( state1 != state2 );
- VERIFY( static_cast<bool>(state2 & statefail) );
-
- VERIFY( is_04.gcount() == 0 );
- state1 = is_04.rdstate();
- is_04.getline(carray1, 1, '\t'); // extracts, throws away
- state2 = is_04.rdstate();
- VERIFY( is_04.gcount() == 1 );
- VERIFY( state1 == state2 );
- VERIFY( state1 == 0 );
- VERIFY( !traits_type::compare("", carray1, 1) );
-
- state1 = is_04.rdstate();
- is_04.getline(carray1, 20, '*');
- state2 = is_04.rdstate();
- VERIFY( is_04.gcount() == 10 );
- VERIFY( state1 == state2 );
- VERIFY( state1 == 0 );
- VERIFY( !traits_type::compare("\t\t sun", carray1, 10) );
-
- state1 = is_04.rdstate();
- is_04.getline(carray1, 20);
- state2 = is_04.rdstate();
- VERIFY( is_04.gcount() == 4 );
- VERIFY( state1 == state2 );
- VERIFY( state1 == 0 );
- VERIFY( !traits_type::compare("ra ", carray1, 4) );
-
- state1 = is_04.rdstate();
- is_04.getline(carray1, 65);
- state2 = is_04.rdstate();
- VERIFY( is_04.gcount() == 64 );
- VERIFY( state1 != state2 );
- VERIFY( state2 == statefail );
- VERIFY( !traits_type::compare(
- " and his myth science arkestra presen",
- carray1, 65) );
-
- is_04.clear();
- state1 = is_04.rdstate();
- is_04.getline(carray1, 120, '|');
- state2 = is_04.rdstate();
- VERIFY( is_04.gcount() == 106 );
- VERIFY( state1 != state2 );
- VERIFY( state2 == stateeof );
-
- is_04.clear();
- state1 = is_04.rdstate();
- is_04.getline(carray1, 100, '|');
- state2 = is_04.rdstate();
- VERIFY( is_04.gcount() == 0 );
- VERIFY( state1 != state2 );
- VERIFY( static_cast<bool>(state2 & stateeof) );
- VERIFY( static_cast<bool>(state2 & statefail) );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return 0;
-}
-
-int
-test03()
-{
- typedef std::char_traits<char> traits_type;
-
- bool test = true;
- const char str_lit01[] =
- " sun*ra \n\t\t\t & his arkestra, featuring john gilmore: \n"
- " "
- "jazz in silhouette: images and forecasts of tomorrow";
-
- std::string str01(str_lit01);
- std::string strtmp;
-
- std::stringbuf sbuf_03;
- std::stringbuf sbuf_04(str01, std::ios_base::in);
- std::stringbuf sbuf_05(str01, std::ios_base::in);
-
- std::istream is_00(NULL);
- std::istream is_04(&sbuf_04);
- std::istream is_05(&sbuf_05);
- std::ios_base::iostate state1, state2, statefail, stateeof;
- statefail = std::ios_base::failbit;
- stateeof = std::ios_base::eofbit;
- std::streamsize count1, count2;
- char carray1[400] = "";
-
- // int_type get()
- // istream& get(char*, streamsize, char delim)
- // istream& get(char*, streamsize)
- // istream& get(streambuf&, char delim)
- // istream& get(streambuf&)
- is_00.get(carray1, 2);
- VERIFY( static_cast<bool>(is_00.rdstate() & statefail) );
- VERIFY( is_00.gcount() == 0 );
-
- is_04.get(carray1, 4);
- VERIFY( !(is_04.rdstate() & statefail) );
- VERIFY( !traits_type::compare(carray1, " ", 4) );
- VERIFY( is_04.gcount() == 3 );
-
- is_04.clear();
- is_04.get(carray1 + 3, 200);
- VERIFY( !(is_04.rdstate() & statefail) );
- VERIFY( !(is_04.rdstate() & stateeof) );
- VERIFY( !traits_type::compare(carray1, str_lit01, 10) );
- VERIFY( is_04.gcount() == 7 );
-
- is_04.clear();
- is_04.get(carray1, 200);
- VERIFY( !(is_04.rdstate() & stateeof) );
- VERIFY( static_cast<bool>(is_04.rdstate() & statefail) ); // delimiter
- VERIFY( is_04.gcount() == 0 );
- is_04.clear();
- is_04.get(carray1, 200, '[');
- VERIFY( static_cast<bool>(is_04.rdstate() & stateeof) );
- VERIFY( !(is_04.rdstate() & statefail) );
- VERIFY( is_04.gcount() == 125 );
- is_04.clear();
- is_04.get(carray1, 200);
- VERIFY( static_cast<bool>(is_04.rdstate() & stateeof) );
- VERIFY( static_cast<bool>(is_04.rdstate() & statefail) );
- VERIFY( is_04.gcount() == 0 );
-
- std::stringbuf sbuf_02(std::ios_base::in);
- is_05.clear();
- is_05.get(sbuf_02);
- VERIFY( is_05.gcount() == 0 );
- VERIFY( static_cast<bool>(is_05.rdstate() & statefail) );
- VERIFY( !(is_05.rdstate() & stateeof) );
-
- is_05.clear();
- is_05.get(sbuf_03);
- VERIFY( is_05.gcount() == 10 );
- VERIFY( sbuf_03.str() == " sun*ra " );
- VERIFY( !(is_05.rdstate() & statefail) );
- VERIFY( !(is_05.rdstate() & stateeof) );
-
- is_05.clear();
- is_05.get(sbuf_03, '|');
- VERIFY( is_05.gcount() == 125 );
- VERIFY( sbuf_03.str() == str_lit01 );
- VERIFY( !(is_05.rdstate() & statefail) );
- VERIFY( static_cast<bool>(is_05.rdstate() & stateeof) );
-
- is_05.clear();
- is_05.get(sbuf_03, '|');
- VERIFY( is_05.gcount() == 0 );
- VERIFY( static_cast<bool>(is_05.rdstate() & stateeof) );
- VERIFY( static_cast<bool>(is_05.rdstate() & statefail) );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return 0;
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00177.html
-int
-test04()
-{
- bool test = true;
-
- const std::string str_00("Red_Garland_Qunitet-Soul_Junction");
- std::string strtmp;
- char c_array[str_00.size() + 4];
-
- std::stringbuf isbuf_00(str_00, std::ios_base::in);
- std::istream is_00(&isbuf_00);
- std::ios_base::iostate state1, state2, statefail, stateeof;
- statefail = std::ios_base::failbit;
- stateeof = std::ios_base::eofbit;
-
- state1 = stateeof | statefail;
- VERIFY( is_00.gcount() == 0 );
- is_00.read(c_array, str_00.size() + 1);
- VERIFY( is_00.gcount() == str_00.size() );
- VERIFY( is_00.rdstate() == state1 );
-
- is_00.read(c_array, str_00.size());
- VERIFY( is_00.rdstate() == state1 );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
- return 0;
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2000-07/msg00003.html
-int
-test05()
-{
- const char* charray = "\n"
-"a\n"
-"aa\n"
-"aaa\n"
-"aaaa\n"
-"aaaaa\n"
-"aaaaaa\n"
-"aaaaaaa\n"
-"aaaaaaaa\n"
-"aaaaaaaaa\n"
-"aaaaaaaaaa\n"
-"aaaaaaaaaaa\n"
-"aaaaaaaaaaaa\n"
-"aaaaaaaaaaaaa\n"
-"aaaaaaaaaaaaaa\n";
-
- bool test = true;
- const std::streamsize it = 5;
- std::streamsize br = 0;
- char tmp[it];
- std::stringbuf sb(charray, std::ios_base::in);
- std::istream ifs(&sb);
- std::streamsize blen = std::strlen(charray);
- VERIFY(!(!ifs));
- while(ifs.getline(tmp, it) || ifs.gcount())
- {
- br += ifs.gcount();
- if(ifs.eof())
- {
- // Just sanity checks to make sure we've extracted the same
- // number of chars that were in the streambuf
- VERIFY(br == blen);
- // Also, we should only set the failbit if we could
- // _extract_ no chars from the stream, i.e. the first read
- // returned EOF.
- VERIFY(ifs.fail() && ifs.gcount() == 0);
- }
- else if(ifs.fail())
- {
- // delimiter not read
- //
- // either
- // -> extracted no characters
- // or
- // -> n - 1 characters are stored
- ifs.clear(ifs.rdstate() & ~std::ios::failbit);
- VERIFY((ifs.gcount() == 0) || (std::strlen(tmp) == it - 1));
- VERIFY(!(!ifs));
- continue;
- }
- else
- {
- // delimiter was read.
- //
- // -> strlen(__s) < n - 1
- // -> delimiter was seen -> gcount() > strlen(__s)
- VERIFY(ifs.gcount() == std::strlen(tmp) + 1);
- continue;
- }
- }
-
- return 0;
-}
-
-
-// http://gcc.gnu.org/ml/libstdc++/2000-07/msg00126.html
-int
-test06()
-{
- using namespace std;
-
- bool test = true;
- const streamsize it = 5;
- char tmp[it];
- const char* str_lit = "abcd\n";
-
- stringbuf strbuf(str_lit, std::ios_base::in);
- istream istr(&strbuf);
-
- istr.getline(tmp,it);
- VERIFY( istr.gcount() == it ); // extracted whole string
- VERIFY( strlen(tmp) == 4 ); // stored all but '\n'
- VERIFY( !istr.eof() ); // extracted up to but not eof
- VERIFY( !istr.fail() ); // failbit not set
-
- char c = 'z';
- istr.get(c);
- VERIFY( c == 'z' );
- VERIFY( istr.eof() );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return 0;
-}
-
-// bug reported by bgarcia@laurelnetworks.com
-// http://gcc.gnu.org/ml/libstdc++-prs/2000-q3/msg00041.html
-void
-test07()
-{
- bool test = true;
- const char* tfn = "istream_unformatted-1.txt";
- std::ifstream infile;
- infile.open(tfn);
- VERIFY( !(!infile) );
- while (infile)
- {
- std::string line;
- std::ostringstream line_ss;
- while (infile.peek() == '\n')
- infile.get();
- infile.get(*(line_ss.rdbuf()));
- line = line_ss.str();
- VERIFY( line == "1234567890" || line == "" );
- }
-}
-
-// 2002-04-19 PR libstdc++ 6360
-void
-test08()
-{
- using namespace std;
- bool test = true;
-
- stringstream ss("abcd" "\xFF" "1234ina donna coolbrith");
- char c;
- ss >> c;
- VERIFY( c == 'a' );
- ss.ignore(8);
- ss >> c;
- VERIFY( c == 'i' );
-}
-
-// Theodore Papadopoulo
-void
-test09()
-{
- using namespace std;
- bool test = true;
-
- istringstream iss("Juana Briones");
- char tab[13];
- iss.read(tab, 13);
- if (!iss)
- test = false;
- VERIFY( test );
-}
-
-// libstdc++/70220
-void
-test10()
-{
- using namespace std;
- bool test = true;
- typedef string string_type;
- typedef stringbuf stringbuf_type;
- typedef istream istream_type;
-
- int res = 0;
- streamsize n;
- string_type input("abcdefg\n");
- stringbuf_type sbuf(input);
- istream_type istr(&sbuf);
-
- istr.ignore(0);
- if (istr.gcount() != 0)
- test = false;
- VERIFY( test );
-
- istr.ignore(0, 'b');
- if (istr.gcount() != 0)
- test = false;
- VERIFY( test );
-
- istr.ignore(); // Advance to next position.
- istr.ignore(0, 'b');
- if ((n=istr.gcount()) != 0)
- test = false;
- VERIFY( test );
-
- if (istr.peek() != 'b')
- test = false;
- VERIFY( test );
-}
-
-
-// libstdc++/8258
-class mybuf : public std::basic_streambuf<char>
-{ };
-
-void test11()
-{
- bool test = true;
- using namespace std;
- char arr[10];
- mybuf sbuf;
- basic_istream<char, char_traits<char> > istr(&sbuf);
-
- VERIFY(istr.rdstate() == ios_base::goodbit);
- VERIFY(istr.readsome(arr, 10) == 0);
- VERIFY(istr.rdstate() == ios_base::goodbit);
-}
-
-// libstdc++/6746
-void test12()
-{
- using namespace std;
- bool test = true;
- streamsize sum = 0;
- istringstream iss("shamma shamma");
-
- // test01
- size_t i = iss.rdbuf()->in_avail();
- VERIFY( i != 0 );
-
- // test02
- streamsize extracted;
- do
- {
- char buf[1024];
- extracted = iss.readsome(buf, sizeof buf);
- sum += extracted;
- }
- while (iss.good() && extracted);
- VERIFY( sum != 0 );
-}
-
-// libstdc++/6746
-void test13()
-{
- using namespace std;
- bool test = true;
- streamsize sum = 0;
- ifstream ifs("istream_unformatted-1.tst");
-
- // test01
- size_t i = ifs.rdbuf()->in_avail();
- VERIFY( i != 0 );
-
- // test02
- streamsize extracted;
- do
- {
- char buf[1024];
- extracted = ifs.readsome(buf, sizeof buf);
- sum += extracted;
- }
- while (ifs.good() && extracted);
- VERIFY( sum != 0 );
-}
-
-int
-main()
-{
- test01();
- test02();
- test03();
- test04();
- test05();
- test06();
- test07();
- test08();
- test09();
- test10();
- test11();
-
- test12();
- test13();
-
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc b/libstdc++-v3/testsuite/27_io/manipulators/adjustfield/char/1.cc
index 3173dc3a54c..b3901d8f7b8 100644
--- a/libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc
+++ b/libstdc++-v3/testsuite/27_io/manipulators/adjustfield/char/1.cc
@@ -1,6 +1,6 @@
// 981027 ncm work with libstdc++v3
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// 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
@@ -84,37 +84,10 @@ test01()
VERIFY( oss.str() == lit );
}
-void
-test02()
-{
- bool test = true;
- const std::string strue("true");
- const std::string sfalse("false");
- std::string str01;
- std::string str02;
-
- std::locale loc("");
- std::ostringstream ostr01;
- ostr01.imbue(loc);
- std::ios_base::fmtflags ff = ostr01.flags(std::ios_base::boolalpha);
-
- ostr01 << true;
- str02 = ostr01.str();
- VERIFY( str02 == strue );
-
- ostr01.str(str01);
- ostr01 << false;
- str02 = ostr01.str();
- VERIFY( str02 == sfalse );
-
- VERIFY( test );
-}
-
int
main()
{
test01();
- test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/manipulators/adjustfield/char/2.cc b/libstdc++-v3/testsuite/27_io/manipulators/adjustfield/char/2.cc
new file mode 100644
index 00000000000..12b52aa0134
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/manipulators/adjustfield/char/2.cc
@@ -0,0 +1,59 @@
+// Copyright (C) 1997, 1998, 1999, 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.
+
+#include <sstream>
+#include <locale>
+#include <iomanip>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ bool test = true;
+ const std::string str_blank;
+ std::string str_tmp;
+ std::stringbuf strbuf;
+ std::ostream o(&strbuf);
+
+ o << std::setw(6) << std::right << "san";
+ VERIFY( strbuf.str() == " san" );
+ strbuf.str(str_blank);
+
+ o << std::setw(6) << std::internal << "fran";
+ VERIFY( strbuf.str() == " fran" );
+ strbuf.str(str_blank);
+
+ o << std::setw(6) << std::left << "cisco";
+ VERIFY( strbuf.str() == "cisco " );
+ strbuf.str(str_blank);
+}
+
+int
+main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc b/libstdc++-v3/testsuite/27_io/manipulators/basefield/char/1.cc
index 82aeeaa0c74..10336f50f1c 100644
--- a/libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc
+++ b/libstdc++-v3/testsuite/27_io/manipulators/basefield/char/1.cc
@@ -41,8 +41,8 @@ struct MyNP : std::numpunct<char>
std::string MyNP::do_grouping() const { std::string s("\3"); return s; }
char MyNP::do_thousands_sep() const { return ' '; }
-int
-test01()
+
+void test01()
{
bool test = true;
@@ -101,40 +101,11 @@ test01()
VERIFY( oss.good() );
VERIFY( oss.str() == lit );
-
- return 0;
-}
-
-int
-test02()
-{
- bool test = true;
- const std::string str_blank;
- std::string str_tmp;
- std::stringbuf strbuf;
- std::ostream o(&strbuf);
-
- o << std::setw(6) << std::right << "san";
- VERIFY( strbuf.str() == " san" );
- strbuf.str(str_blank);
-
- o << std::setw(6) << std::internal << "fran";
- VERIFY( strbuf.str() == " fran" );
- strbuf.str(str_blank);
-
- o << std::setw(6) << std::left << "cisco";
- VERIFY( strbuf.str() == "cisco " );
- strbuf.str(str_blank);
-
- VERIFY( test );
- return 0;
}
-
int
main()
{
test01();
- test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/standard_manipulators.cc b/libstdc++-v3/testsuite/27_io/manipulators/standard/char/1.cc
index 71822372fc8..71822372fc8 100644
--- a/libstdc++-v3/testsuite/27_io/standard_manipulators.cc
+++ b/libstdc++-v3/testsuite/27_io/manipulators/standard/char/1.cc
diff --git a/libstdc++-v3/testsuite/27_io/instantiations.cc b/libstdc++-v3/testsuite/27_io/manipulators/standard/char/2.cc
index b7ee2b4b6f5..b7ee2b4b6f5 100644
--- a/libstdc++-v3/testsuite/27_io/instantiations.cc
+++ b/libstdc++-v3/testsuite/27_io/manipulators/standard/char/2.cc
diff --git a/libstdc++-v3/testsuite/27_io/narrow_stream_objects.cc b/libstdc++-v3/testsuite/27_io/narrow_stream_objects.cc
deleted file mode 100644
index 45725309ba9..00000000000
--- a/libstdc++-v3/testsuite/27_io/narrow_stream_objects.cc
+++ /dev/null
@@ -1,239 +0,0 @@
-// 2000-08-02 bkoz
-
-// Copyright (C) 2000, 2001, 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.
-
-// Include all the headers except for iostream.
-#include <algorithm>
-#include <bitset>
-#include <complex>
-#include <deque>
-#include <exception>
-#include <fstream>
-#include <functional>
-#include <iomanip>
-#include <ios>
-#include <iosfwd>
-#include <istream>
-#include <iterator>
-#include <limits>
-#include <list>
-#include <locale>
-#include <map>
-#include <memory>
-#include <new>
-#include <numeric>
-#include <ostream>
-#include <queue>
-#include <set>
-#include <sstream>
-#include <stack>
-#include <stdexcept>
-#include <streambuf>
-#include <string>
-#include <typeinfo>
-#include <utility>
-#include <valarray>
-#include <vector>
-#include <cassert>
-#include <cctype>
-#include <cerrno>
-#include <cfloat>
-#include <ciso646>
-#include <climits>
-#include <clocale>
-#include <cmath>
-#include <csetjmp>
-#include <csignal>
-#include <cstdarg>
-#include <cstddef>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctime>
-#include <testsuite_hooks.h>
-
-// Include iostream last, just to make is as difficult as possible to
-// properly initialize the standard iostream objects.
-#include <iostream>
-
-// Make sure all the standard streams are defined.
-int
-test01()
-{
- bool test = true;
-
- char array1[20];
- typedef std::ios::traits_type ctraits_type;
- ctraits_type::int_type i = 15;
- ctraits_type::copy(array1, "testing istream", i);
- array1[i] = '\0';
- std::cout << "testing cout" << std::endl;
- std::cerr << "testing cerr" << std::endl;
- VERIFY( std::cerr.flags() & std::ios_base::unitbuf );
- std::clog << "testing clog" << std::endl;
- // std::cin >> array1; // requires somebody to type something in.
- VERIFY( std::cin.tie() == &std::cout );
-
- return 0;
-}
-
-// libstdc++/2523
-void test02()
-{
- using namespace std;
- int i;
- cin >> i;
- cout << "i == " << i << endl;
-}
-
-// libstdc++/2523
-void test03()
-{
- using namespace std;
- ios_base::sync_with_stdio(false);
-
- int i;
- cin >> i;
- cout << "i == " << i << endl;
-}
-
-// Interactive test, to be exercised as follows:
-// assign stderr to stdout in shell command line,
-// pipe stdout to cat process and/or redirect stdout to file.
-// a.out >& output
-// "hello fine world\n" should be written to stdout, and output, in
-// proper order. This is a version of the scott snyder test taken
-// from: http://gcc.gnu.org/ml/libstdc++/1999-q4/msg00108.html
-void test04()
-{
- using namespace std;
-
- cout << "hello ";
- cout.flush();
- cerr << "fine ";
- cerr.flush();
- cout << "world" << endl;
- cout.flush();
-}
-
-// Interactive test, to be exercised as follows:
-// run test under truss(1) or strace(1). Look at
-// size and pattern of write system calls.
-// Should be 2 or 3 write(1,[...]) calls when run interactively
-// depending upon buffering mode enforced.
-void test05()
-{
- std::cout << "hello" << ' ' << "world" << std::endl;
- std::cout << "Enter your name: ";
- std::string s;
- std::cin >> s;
- std::cout << "hello " << s << std::endl;
-}
-
-// libstdc++/5280
-// Interactive test: input "1234^D^D" for i should terminate for EOF.
-void test06()
-{
- using namespace std;
- int i;
- cin >> i;
- if (!cin.good())
- {
- cerr << endl;
- cerr << "i == " << i << endl;
- cerr << "cin.rdstate() == " << cin.rdstate() << endl;
- cerr << "cin.bad() == " << cin.bad() << endl;
- cerr << "cin.fail() == " << cin.fail() << endl;
- cerr << "cin.eof() == " << cin.eof() << endl;
- }
- else
- cerr << "i == " << i << endl;
-}
-
-// libstdc++/6548
-void test07()
-{
- bool test = true;
- std::cout << "Enter 'test':";
- std::string s;
- std::getline(std::cin, s, '\n');
- VERIFY( s == "test" );
-}
-
-// libstdc++/6648
-// Interactive tests: each one (run alone) must terminate upon a single '\n'.
-void test08()
-{
- bool test = true;
- char buff[2048];
- std::cout << "Enter name: ";
- std::cin.getline(buff, 2048);
-}
-
-void test09()
-{
- bool test = true;
- std::cout << "Enter favorite beach: ";
- std::cin.ignore(2048, '\n');
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-08/msg00060.html
-// Should only have to hit enter once.
-void
-test10()
-{
- using namespace std;
- cout << "Press ENTER once\n";
- cin.ignore(1);
- cout << "_M_gcount: "<< cin.gcount() << endl;
-}
-
-// libstdc++/7744
-void test11()
-{
- std::ios::sync_with_stdio(false);
-
- std::cout
- << "\n:: f2() ::\n"
- << "Type in the characters 'abc' and press <ENTER>: ";
- std::cin.peek();
-
- std::cout
- << "The number of unread characters should be 4 (a, b, c, \\n): "
- << std::cin.rdbuf()->in_avail()
- << '\n';
-}
-
-int
-main()
-{
- test01();
-
- // test02();
- // test03();
- // test04();
- // test05();
- // test06();
- // test07();
- // test08();
- // test09();
- // test10();
- // test11();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/1.cc b/libstdc++-v3/testsuite/27_io/objects/char/1.cc
new file mode 100644
index 00000000000..6ab05e861f1
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/1.cc
@@ -0,0 +1,98 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 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.
+
+// Include all the headers except for iostream.
+#include <algorithm>
+#include <bitset>
+#include <complex>
+#include <deque>
+#include <exception>
+#include <fstream>
+#include <functional>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <istream>
+#include <iterator>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#include <memory>
+#include <new>
+#include <numeric>
+#include <ostream>
+#include <queue>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <streambuf>
+#include <string>
+#include <typeinfo>
+#include <utility>
+#include <valarray>
+#include <vector>
+#include <cassert>
+#include <cctype>
+#include <cerrno>
+#include <cfloat>
+#include <ciso646>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <csetjmp>
+#include <csignal>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#include <testsuite_hooks.h>
+
+// Include iostream last, just to make is as difficult as possible to
+// properly initialize the standard iostream objects.
+#include <iostream>
+
+// Make sure all the standard streams are defined.
+void test01()
+{
+ bool test = true;
+
+ char array1[20];
+ typedef std::ios::traits_type ctraits_type;
+ ctraits_type::int_type i = 15;
+ ctraits_type::copy(array1, "testing istream", i);
+ array1[i] = '\0';
+ std::cout << "testing cout" << std::endl;
+ std::cerr << "testing cerr" << std::endl;
+ VERIFY( std::cerr.flags() & std::ios_base::unitbuf );
+ std::clog << "testing clog" << std::endl;
+ // std::cin >> array1; // requires somebody to type something in.
+ VERIFY( std::cin.tie() == &std::cout );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/2.cc b/libstdc++-v3/testsuite/27_io/objects/char/2.cc
new file mode 100644
index 00000000000..912d3ccf723
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/2.cc
@@ -0,0 +1,47 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 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.
+
+#include <iostream>
+
+// Interactive test, to be exercised as follows:
+// assign stderr to stdout in shell command line,
+// pipe stdout to cat process and/or redirect stdout to file.
+// a.out >& output
+// "hello fine world\n" should be written to stdout, and output, in
+// proper order. This is a version of the scott snyder test taken
+// from: http://gcc.gnu.org/ml/libstdc++/1999-q4/msg00108.html
+void test04()
+{
+ using namespace std;
+
+ cout << "hello ";
+ cout.flush();
+ cerr << "fine ";
+ cerr.flush();
+ cout << "world" << endl;
+ cout.flush();
+}
+
+int
+main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/2523-1_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/2523-1_xin.cc
new file mode 100644
index 00000000000..32acbb28b04
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/2523-1_xin.cc
@@ -0,0 +1,89 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 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.
+
+// Include all the headers except for iostream.
+#include <algorithm>
+#include <bitset>
+#include <complex>
+#include <deque>
+#include <exception>
+#include <fstream>
+#include <functional>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <istream>
+#include <iterator>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#include <memory>
+#include <new>
+#include <numeric>
+#include <ostream>
+#include <queue>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <streambuf>
+#include <string>
+#include <typeinfo>
+#include <utility>
+#include <valarray>
+#include <vector>
+#include <cassert>
+#include <cctype>
+#include <cerrno>
+#include <cfloat>
+#include <ciso646>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <csetjmp>
+#include <csignal>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#include <testsuite_hooks.h>
+
+// Include iostream last, just to make is as difficult as possible to
+// properly initialize the standard iostream objects.
+#include <iostream>
+
+// libstdc++/2523
+void test02()
+{
+ using namespace std;
+ int i;
+ cin >> i;
+ cout << "i == " << i << endl;
+}
+
+int
+main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/2523-1_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/2523-1_xin.in
new file mode 100644
index 00000000000..ec308096e18
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/2523-1_xin.in
@@ -0,0 +1 @@
+5588885
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/2523-2_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/2523-2_xin.cc
new file mode 100644
index 00000000000..6a2429a65d2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/2523-2_xin.cc
@@ -0,0 +1,39 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 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.
+
+#include <iostream>
+
+// libstdc++/2523
+void test03()
+{
+ using namespace std;
+ ios_base::sync_with_stdio(false);
+
+ int i;
+ cin >> i;
+ cout << "i == " << i << endl;
+}
+
+int
+main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/2523-2_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/2523-2_xin.in
new file mode 100644
index 00000000000..aaee5e5621a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/2523-2_xin.in
@@ -0,0 +1 @@
+33332
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/3045.cc b/libstdc++-v3/testsuite/27_io/objects/char/3045.cc
new file mode 100644
index 00000000000..ad190d0f2b5
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/3045.cc
@@ -0,0 +1,86 @@
+// 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.
+
+#include <fstream>
+#include <iostream>
+#include <testsuite_hooks.h>
+
+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 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/iostream_members.cc b/libstdc++-v3/testsuite/27_io/objects/char/3647.cc
index 4cdcc82af4c..4cdcc82af4c 100644
--- a/libstdc++-v3/testsuite/27_io/iostream_members.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/char/3647.cc
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/3_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/3_xin.cc
new file mode 100644
index 00000000000..b40b4c41046
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/3_xin.cc
@@ -0,0 +1,42 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 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.
+
+#include <iostream>
+
+// Interactive test, to be exercised as follows:
+// run test under truss(1) or strace(1). Look at
+// size and pattern of write system calls.
+// Should be 2 or 3 write(1,[...]) calls when run interactively
+// depending upon buffering mode enforced.
+void test05()
+{
+ std::cout << "hello" << ' ' << "world" << std::endl;
+ std::cout << "Enter your name: ";
+ std::string s;
+ std::cin >> s;
+ std::cout << "hello " << s << std::endl;
+}
+
+int
+main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/3_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/3_xin.in
new file mode 100644
index 00000000000..a26c12687d7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/3_xin.in
@@ -0,0 +1 @@
+JOHN HUME and DAVID TRIMBLE
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/4_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/4_xin.cc
new file mode 100644
index 00000000000..ae0d8638b27
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/4_xin.cc
@@ -0,0 +1,39 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 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.
+
+#include <iostream>
+
+// http://gcc.gnu.org/ml/libstdc++/2002-08/msg00060.html
+// Should only have to hit enter once.
+void
+test10()
+{
+ using namespace std;
+ cout << "Press ENTER once\n";
+ cin.ignore(1);
+ cout << "_M_gcount: "<< cin.gcount() << endl;
+}
+
+int
+main()
+{
+ test10();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/4_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/4_xin.in
new file mode 100644
index 00000000000..8b137891791
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/4_xin.in
@@ -0,0 +1 @@
+
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/5268.cc b/libstdc++-v3/testsuite/27_io/objects/char/5268.cc
new file mode 100644
index 00000000000..36f9019dae7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/5268.cc
@@ -0,0 +1,45 @@
+// 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.
+
+#include <sstream>
+#include <iostream>
+
+// libstdc++/5268
+void test04()
+{
+ std::stringbuf b1;
+ std::cout.rdbuf( &b1 );
+ std::cout << "hello\n";
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/5280_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/5280_xin.cc
new file mode 100644
index 00000000000..82830a9b04d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/5280_xin.cc
@@ -0,0 +1,48 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 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.
+
+#include <iostream>
+
+// libstdc++/5280
+// Interactive test: input "1234^D^D" for i should terminate for EOF.
+void test06()
+{
+ using namespace std;
+ int i;
+ cin >> i;
+ if (!cin.good())
+ {
+ cerr << endl;
+ cerr << "i == " << i << endl;
+ cerr << "cin.rdstate() == " << cin.rdstate() << endl;
+ cerr << "cin.bad() == " << cin.bad() << endl;
+ cerr << "cin.fail() == " << cin.fail() << endl;
+ cerr << "cin.eof() == " << cin.eof() << endl;
+ }
+ else
+ cerr << "i == " << i << endl;
+}
+
+int
+main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/5280_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/5280_xin.in
new file mode 100644
index 00000000000..274c0052dd5
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/5280_xin.in
@@ -0,0 +1 @@
+1234 \ No newline at end of file
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/6548_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/6548_xin.cc
new file mode 100644
index 00000000000..ce6133bc39b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/6548_xin.cc
@@ -0,0 +1,39 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 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.
+
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// libstdc++/6548
+void test07()
+{
+ bool test = true;
+ std::cout << "Enter 'test':";
+ std::string s;
+ std::getline(std::cin, s, '\n');
+ VERIFY( s == "test" );
+}
+
+int
+main()
+{
+ test07();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/6548_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/6548_xin.in
new file mode 100644
index 00000000000..9daeafb9864
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/6548_xin.in
@@ -0,0 +1 @@
+test
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/6648-1_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/6648-1_xin.cc
new file mode 100644
index 00000000000..9802f092a1f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/6648-1_xin.cc
@@ -0,0 +1,38 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 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.
+
+#include <iostream>
+
+// libstdc++/6648
+// Interactive tests: each one (run alone) must terminate upon a single '\n'.
+void test08()
+{
+ bool test = true;
+ char buff[2048];
+ std::cout << "Enter name: ";
+ std::cin.getline(buff, 2048);
+}
+
+int
+main()
+{
+ test08();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/6648-1_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/6648-1_xin.in
new file mode 100644
index 00000000000..9dd5f1f2e27
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/6648-1_xin.in
@@ -0,0 +1 @@
+Kofi A. Annan
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/6648-2_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/6648-2_xin.cc
new file mode 100644
index 00000000000..e25a8c3e765
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/6648-2_xin.cc
@@ -0,0 +1,35 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 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.
+
+#include <iostream>
+
+void test09()
+{
+ bool test = true;
+ std::cout << "Enter favorite beach: ";
+ std::cin.ignore(2048, '\n');
+}
+
+int
+main()
+{
+ test09();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/6648-2_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/6648-2_xin.in
new file mode 100644
index 00000000000..0b2c7cf282e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/6648-2_xin.in
@@ -0,0 +1 @@
+Oak St. Beach, Chicago
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/7744_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/7744_xin.cc
new file mode 100644
index 00000000000..977af9a4429
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/7744_xin.cc
@@ -0,0 +1,42 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 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.
+
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// libstdc++/7744
+void test11()
+{
+ bool test = true;
+ std::ios::sync_with_stdio(false);
+
+ std::cout << "Type in the characters 'abc' and press <ENTER>: ";
+ std::cin.peek();
+
+ // The number of unread characters should be 4 (a, b, c, \\n)
+ VERIFY( 4 == std::cin.rdbuf()->in_avail() );
+}
+
+int
+main()
+{
+ test11();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/7744_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/7744_xin.in
new file mode 100644
index 00000000000..8baef1b4abc
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/7744_xin.in
@@ -0,0 +1 @@
+abc
diff --git a/libstdc++-v3/testsuite/27_io/wide_stream_objects.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/1.cc
index 022f6eff327..bd946edd721 100644
--- a/libstdc++-v3/testsuite/27_io/wide_stream_objects.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/1.cc
@@ -1,6 +1,6 @@
// 2000-08-02 bkoz
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// Copyright (C) 2000, 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
@@ -66,11 +66,8 @@
#include <cstdlib>
#include <cstring>
#include <ctime>
-#if _GLIBCPP_USE_WCHAR_T
- #include <bits/c++config.h>
- #include <cwchar>
- #include <cwctype>
-#endif
+#include <cwchar>
+#include <cwctype>
#include <testsuite_hooks.h>
// Include iostream last, just to make is as difficult as possible to
@@ -78,12 +75,11 @@
#include <iostream>
// Make sure all the standard streams are defined.
-int
+void
test01()
{
bool test = true;
-#ifdef _GLIBCPP_USE_WCHAR_T
wchar_t array2[20];
typedef std::wios::traits_type wtraits_type;
wtraits_type::int_type wi = 15;
@@ -94,16 +90,12 @@ test01()
std::wclog << L"testing wclog" << std::endl;
// std::wcin >> array2; // requires somebody to type something in.
VERIFY( std::wcin.tie() == &std::wcout );
-#endif
-
- return 0;
}
int
main()
{
- test01();
-
+ test01();
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/ofstream_members-1.tst b/libstdc++-v3/testsuite/27_io/ofstream_members-1.tst
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/libstdc++-v3/testsuite/27_io/ofstream_members-1.tst
+++ /dev/null
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc b/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc
deleted file mode 100644
index 2523ab6241a..00000000000
--- a/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc
+++ /dev/null
@@ -1,409 +0,0 @@
-// 1999-11-15 Kevin Ediger <kediger@licor.com>
-// test the floating point inserters (facet num_put)
-
-// Copyright (C) 1999, 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 <cstdio> // for sprintf
-#include <cmath> // for abs
-#include <cfloat> // for DBL_EPSILON
-#include <iostream>
-#include <iomanip>
-#include <locale>
-#include <sstream>
-#include <limits>
-#include <testsuite_hooks.h>
-
-using namespace std;
-
-#ifndef DEBUG_ASSERT
-# define TEST_NUMPUT_VERBOSE 1
-#endif
-
-struct _TestCase
-{
- double val;
-
- int precision;
- int width;
- char decimal;
- char fill;
-
- bool fixed;
- bool scientific;
- bool showpos;
- bool showpoint;
- bool uppercase;
- bool internal;
- bool left;
- bool right;
-
- const char* result;
-#if _GLIBCPP_USE_WCHAR_T
- const wchar_t* wresult;
-#endif
-};
-
-static bool T=true;
-static bool F=false;
-
-static _TestCase testcases[] =
-{
-#if _GLIBCPP_USE_WCHAR_T
- // standard output (no formatting applied) 1-4
- { 1.2, 6,0,'.',' ', F,F,F,F,F,F,F,F, "1.2",L"1.2" },
- { 54, 6,0,'.',' ', F,F,F,F,F,F,F,F, "54",L"54" },
- { -.012, 6,0,'.',' ', F,F,F,F,F,F,F,F, "-0.012",L"-0.012" },
- { -.00000012, 6,0,'.',' ', F,F,F,F,F,F,F,F, "-1.2e-07",L"-1.2e-07" },
-
- // fixed formatting 5-11
- { 10.2345, 0,0,'.',' ', T,F,F,F,F,F,F,F, "10",L"10" },
- { 10.2345, 0,0,'.',' ', T,F,F,T,F,F,F,F, "10.",L"10." },
- { 10.2345, 1,0,'.',' ', T,F,F,F,F,F,F,F, "10.2",L"10.2" },
- { 10.2345, 4,0,'.',' ', T,F,F,F,F,F,F,F, "10.2345",L"10.2345" },
- { 10.2345, 6,0,'.',' ', T,F,T,F,F,F,F,F, "+10.234500",L"+10.234500" },
- { -10.2345, 6,0,'.',' ', T,F,F,F,F,F,F,F, "-10.234500",L"-10.234500" },
- { -10.2345, 6,0,',',' ', T,F,F,F,F,F,F,F, "-10,234500",L"-10,234500" },
-
- // fixed formatting with width 12-22
- { 10.2345, 4,5,'.',' ', T,F,F,F,F,F,F,F, "10.2345",L"10.2345" },
- { 10.2345, 4,6,'.',' ', T,F,F,F,F,F,F,F, "10.2345",L"10.2345" },
- { 10.2345, 4,7,'.',' ', T,F,F,F,F,F,F,F, "10.2345",L"10.2345" },
- { 10.2345, 4,8,'.',' ', T,F,F,F,F,F,F,F, " 10.2345",L" 10.2345" },
- { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,F,F, " 10.2345",L" 10.2345" },
- { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,T,F, "10.2345 ",L"10.2345 " },
- { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,F,T, " 10.2345",L" 10.2345" },
- { 10.2345, 4,10,'.',' ', T,F,F,F,F,T,F,F, " 10.2345",L" 10.2345" },
- { -10.2345, 4,10,'.',' ', T,F,F,F,F,T,F,F, "- 10.2345",L"- 10.2345" },
- { -10.2345, 4,10,'.','A', T,F,F,F,F,T,F,F, "-AA10.2345",L"-AA10.2345" },
- { 10.2345, 4,10,'.','#', T,F,T,F,F,T,F,F, "+##10.2345",L"+##10.2345" },
-
- // scientific formatting 23-29
- { 1.23e+12, 1,0,'.',' ', F,T,F,F,F,F,F,F, "1.2e+12",L"1.2e+12" },
- { 1.23e+12, 1,0,'.',' ', F,T,F,F,T,F,F,F, "1.2E+12",L"1.2E+12" },
- { 1.23e+12, 2,0,'.',' ', F,T,F,F,F,F,F,F, "1.23e+12",L"1.23e+12" },
- { 1.23e+12, 3,0,'.',' ', F,T,F,F,F,F,F,F, "1.230e+12",L"1.230e+12" },
- { 1.23e+12, 3,0,'.',' ', F,T,T,F,F,F,F,F, "+1.230e+12",L"+1.230e+12" },
- { -1.23e-12, 3,0,'.',' ', F,T,F,F,F,F,F,F, "-1.230e-12",L"-1.230e-12" },
- { 1.23e+12, 3,0,',',' ', F,T,F,F,F,F,F,F, "1,230e+12",L"1,230e+12" },
-#else
- // standard output (no formatting applied)
- { 1.2, 6,0,'.',' ', F,F,F,F,F,F,F,F, "1.2" },
- { 54, 6,0,'.',' ', F,F,F,F,F,F,F,F, "54" },
- { -.012, 6,0,'.',' ', F,F,F,F,F,F,F,F, "-0.012" },
- { -.00000012, 6,0,'.',' ', F,F,F,F,F,F,F,F, "-1.2e-07" },
-
- // fixed formatting
- { 10.2345, 0,0,'.',' ', T,F,F,F,F,F,F,F, "10" },
- { 10.2345, 0,0,'.',' ', T,F,F,T,F,F,F,F, "10." },
- { 10.2345, 1,0,'.',' ', T,F,F,F,F,F,F,F, "10.2" },
- { 10.2345, 4,0,'.',' ', T,F,F,F,F,F,F,F, "10.2345" },
- { 10.2345, 6,0,'.',' ', T,F,T,F,F,F,F,F, "+10.234500" },
- { -10.2345, 6,0,'.',' ', T,F,F,F,F,F,F,F, "-10.234500" },
- { -10.2345, 6,0,',',' ', T,F,F,F,F,F,F,F, "-10,234500" },
-
- // fixed formatting with width
- { 10.2345, 4,5,'.',' ', T,F,F,F,F,F,F,F, "10.2345" },
- { 10.2345, 4,6,'.',' ', T,F,F,F,F,F,F,F, "10.2345" },
- { 10.2345, 4,7,'.',' ', T,F,F,F,F,F,F,F, "10.2345" },
- { 10.2345, 4,8,'.',' ', T,F,F,F,F,F,F,F, " 10.2345" },
- { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,F,F, " 10.2345" },
- { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,T,F, "10.2345 " },
- { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,F,T, " 10.2345" },
- { 10.2345, 4,10,'.',' ', T,F,F,F,F,T,F,F, " 10.2345" },
- { -10.2345, 4,10,'.',' ', T,F,F,F,F,T,F,F, "- 10.2345" },
- { -10.2345, 4,10,'.','A', T,F,F,F,F,T,F,F, "-AA10.2345" },
- { 10.2345, 4,10,'.','#', T,F,T,F,F,T,F,F, "+##10.2345" },
-
- // scientific formatting
- { 1.23e+12, 1,0,'.',' ', F,T,F,F,F,F,F,F, "1.2e+12" },
- { 1.23e+12, 1,0,'.',' ', F,T,F,F,T,F,F,F, "1.2E+12" },
- { 1.23e+12, 2,0,'.',' ', F,T,F,F,F,F,F,F, "1.23e+12" },
- { 1.23e+12, 3,0,'.',' ', F,T,F,F,F,F,F,F, "1.230e+12" },
- { 1.23e+12, 3,0,'.',' ', F,T,T,F,F,F,F,F, "+1.230e+12" },
- { -1.23e-12, 3,0,'.',' ', F,T,F,F,F,F,F,F, "-1.230e-12" },
- { 1.23e+12, 3,0,',',' ', F,T,F,F,F,F,F,F, "1,230e+12" },
-#endif
-};
-
-template<typename _CharT>
-class testpunct : public numpunct<_CharT>
-{
-public:
- typedef _CharT char_type;
- const char_type dchar;
-
- explicit
- testpunct(char_type decimal_char) : numpunct<_CharT>(), dchar(decimal_char)
- { }
-
-protected:
- char_type
- do_decimal_point() const
- { return dchar; }
-
- char_type
- do_thousands_sep() const
- { return ','; }
-
- string
- do_grouping() const
- { return string(); }
-};
-
-template<typename _CharT>
-void apply_formatting(const _TestCase & tc, basic_ostream<_CharT> & os)
-{
- os.precision(tc.precision);
- os.width(tc.width);
- os.fill(static_cast<_CharT>(tc.fill));
- if (tc.fixed)
- os.setf(ios::fixed);
- if (tc.scientific)
- os.setf(ios::scientific);
- if (tc.showpos)
- os.setf(ios::showpos);
- if (tc.showpoint)
- os.setf(ios::showpoint);
- if (tc.uppercase)
- os.setf(ios::uppercase);
- if (tc.internal)
- os.setf(ios::internal);
- if (tc.left)
- os.setf(ios::left);
- if (tc.right)
- os.setf(ios::right);
-}
-
-int
-test01()
-{
- bool test = true;
- for (int j=0; j<sizeof(testcases)/sizeof(testcases[0]); j++)
- {
- _TestCase & tc = testcases[j];
-#ifdef TEST_NUMPUT_VERBOSE
- cout << "expect: " << tc.result << endl;
-#endif
- // test double with char type
- {
- testpunct<char>* __tp = new testpunct<char>(tc.decimal);
- ostringstream os;
- locale __loc(os.getloc(), __tp);
- os.imbue(__loc);
- apply_formatting(tc, os);
- os << tc.val;
-#ifdef TEST_NUMPUT_VERBOSE
- cout << j << "result 1: " << os.str() << endl;
-#endif
- VERIFY( os && os.str() == tc.result );
- }
- // test long double with char type
- {
- testpunct<char>* __tp = new testpunct<char>(tc.decimal);
- ostringstream os;
- locale __loc(os.getloc(), __tp);
- os.imbue(__loc);
- apply_formatting(tc, os);
- os << (long double)tc.val;
-#ifdef TEST_NUMPUT_VERBOSE
- cout << j << "result 2: " << os.str() << endl;
-#endif
- VERIFY( os && os.str() == tc.result );
- }
-#if _GLIBCPP_USE_WCHAR_T
- // test double with wchar_t type
- {
- testpunct<wchar_t>* __tp = new testpunct<wchar_t>(tc.decimal);
- wostringstream os;
- locale __loc(os.getloc(), __tp);
- os.imbue(__loc);
- apply_formatting(tc, os);
- os << tc.val;
- VERIFY( os && os.str() == tc.wresult );
- }
- // test long double with wchar_t type
- {
- testpunct<wchar_t>* __tp = new testpunct<wchar_t>(tc.decimal);
- wostringstream os;
- locale __loc(os.getloc(), __tp);
- os.imbue(__loc);
- apply_formatting(tc, os);
- os << (long double)tc.val;
- VERIFY( os && os.str() == tc.wresult );
- }
-#endif
- }
-
- return 0;
-}
-
-void
-test02()
-{
- bool test = true;
- // make sure we can output a very long float
- long double val = 1.2345678901234567890123456789e+1000L;
- int prec = numeric_limits<long double>::digits10;
-
- ostringstream os;
- os.precision(prec);
- os.setf(ios::scientific);
- os << val;
-
- char largebuf[512];
- sprintf(largebuf, "%.*Le", prec, val);
-#ifdef TEST_NUMPUT_VERBOSE
- cout << "expect: " << largebuf << endl;
- cout << "result: " << os.str() << endl;
-#endif
- VERIFY(os && os.str() == largebuf);
-
- // Make sure we can output a long float in fixed format
- // without seg-faulting (libstdc++/4402)
- double val2 = 3.5e230;
-
- ostringstream os2;
- os2.precision(3);
- os2.setf(ios::fixed);
- os2 << val2;
-
- sprintf(largebuf, "%.*f", 3, val2);
-#ifdef TEST_NUMPUT_VERBOSE
- cout << "expect: " << largebuf << endl;
- cout << "result: " << os2.str() << endl;
-#endif
- VERIFY(os2 && os2.str() == largebuf);
-
- // Check it can be done in a locale with grouping on.
- locale loc2("de_DE");
- os2.imbue(loc2);
- os2 << fixed << setprecision(3) << val2 << endl;
- os2 << endl;
- os2 << fixed << setprecision(1) << val2 << endl;
-
- return;
-}
-
-template<typename T>
-bool
-test03_check(T n)
-{
- stringbuf strbuf;
- ostream o(&strbuf);
- const char *expect;
- bool test = true;
-
- if (numeric_limits<T>::digits + 1 == 16)
- expect = "177777 ffff";
- else if (numeric_limits<T>::digits + 1 == 32)
- expect = "37777777777 ffffffff";
- else if (numeric_limits<T>::digits + 1 == 64)
- expect = "1777777777777777777777 ffffffffffffffff";
- else
- expect = "wow, you've got some big numbers here";
-
- o << oct << n << ' ' << hex << n;
- VERIFY ( strbuf.str() == expect );
-
- return test;
-}
-
-int
-test03()
-{
- short s = -1;
- int i = -1;
- long l = -1;
- bool test = true;
-
- test &= test03_check (s);
- test &= test03_check (i);
- test &= test03_check (l);
-
- return 0;
-}
-
-// libstdc++/3655
-int
-test04()
-{
- stringbuf strbuf1, strbuf2;
- ostream o1(&strbuf1), o2(&strbuf2);
- bool test = true;
-
- o1 << hex << showbase << setw(6) << internal << 0xff;
- VERIFY( strbuf1.str() == "0x ff" );
-
- // ... vs internal-adjusted const char*-type objects
- o2 << hex << showbase << setw(6) << internal << "0xff";
- VERIFY( strbuf2.str() == " 0xff" );
-
- return 0;
-}
-
-int
-test05()
-{
- bool test = true;
- double pi = 3.14159265358979323846;
- ostringstream ostr;
- ostr.precision(20);
- ostr << pi;
- string sval = ostr.str();
- istringstream istr (sval);
- double d;
- istr >> d;
- VERIFY( abs(pi-d)/pi < DBL_EPSILON );
- return 0;
-}
-
-
-// libstdc++/9151
-int
-test06()
-{
- bool test = true;
- int prec = numeric_limits<double>::digits10 + 2;
- double oval = numeric_limits<double>::min();
-
- stringstream ostr;
- ostr.precision(prec);
- ostr << oval;
- string sval = ostr.str();
- istringstream istr (sval);
- double ival;
- istr >> ival;
- VERIFY( abs(oval-ival)/oval < DBL_EPSILON );
- return 0;
-}
-
-int
-main()
-{
- test01();
- __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
- test03();
- test04();
- test05();
- test06();
-#ifdef TEST_NUMPUT_VERBOSE
- cout << "Test passed!" << endl;
-#endif
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_char-1.tst b/libstdc++-v3/testsuite/27_io/ostream_inserter_char-1.tst
deleted file mode 100644
index 0b0acc85640..00000000000
--- a/libstdc++-v3/testsuite/27_io/ostream_inserter_char-1.tst
+++ /dev/null
@@ -1,1000 +0,0 @@
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_char-1.txt b/libstdc++-v3/testsuite/27_io/ostream_inserter_char-1.txt
deleted file mode 100644
index 0b0acc85640..00000000000
--- a/libstdc++-v3/testsuite/27_io/ostream_inserter_char-1.txt
+++ /dev/null
@@ -1,1000 +0,0 @@
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
-123456789
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc b/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc
deleted file mode 100644
index 2fe88f5815b..00000000000
--- a/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc
+++ /dev/null
@@ -1,342 +0,0 @@
-// 1999-08-16 bkoz
-
-// Copyright (C) 1999, 2000, 2002 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.2.5.4 basic_ostream character inserters
-
-#include <string>
-#include <ostream>
-#include <sstream>
-#include <fstream>
-#include <testsuite_hooks.h>
-
-// ofstream
-bool test01()
-{
- bool test = true;
- std::string str01;
- const int size = 1000;
- const char name_02[] = "ostream_inserter_char-1.txt";
-
- // initialize string
- for(int i=0 ; i < size; i++) {
- str01 += '1';
- str01 += '2';
- str01 += '3';
- str01 += '4';
- str01 += '5';
- str01 += '6';
- str01 += '7';
- str01 += '8';
- str01 += '9';
- str01 += '\n';
- }
- std::ofstream f(name_02);
-
- f << str01;
- f.close();
-
- VERIFY( test );
- return test;
-}
-
-// ostringstream width() != zero
-// left
-bool test02(void)
-{
- bool test = true;
- std::string tmp;
-
- std::string str01 = "";
- std::ostringstream oss01;
- oss01.width(5);
- oss01.fill('0');
- oss01.flags(std::ios_base::left);
- oss01 << str01;
- tmp = oss01.str();
- VERIFY( tmp == "00000" );
-
- std::string str02 = "1";
- std::ostringstream oss02;
- oss02.width(5);
- oss02.fill('0');
- oss02.flags(std::ios_base::left);
- oss02 << str02;
- tmp = oss02.str();
- VERIFY( tmp == "10000" );
-
- std::string str03 = "909909";
- std::ostringstream oss03;
- oss03.width(5);
- oss03.fill('0');
- oss03.flags(std::ios_base::left);
- oss03 << str03;
- tmp = oss03.str();
- VERIFY( tmp == "909909" );
- return test;
-}
-
-// width() != zero
-// right
-bool test03(void)
-{
- bool test = true;
- std::string tmp;
-
- std::string str01 = "";
- std::ostringstream oss01;
- oss01.width(5);
- oss01.fill('0');
- oss01.flags(std::ios_base::right);
- oss01 << str01;
- tmp = oss01.str();
- VERIFY( tmp == "00000" );
-
- std::string str02 = "1";
- std::ostringstream oss02;
- oss02.width(5);
- oss02.fill('0');
- oss02.flags(std::ios_base::right);
- oss02 << str02;
- tmp = oss02.str();
- VERIFY( tmp == "00001" );
-
- std::string str03 = "909909";
- std::ostringstream oss03;
- oss03.width(5);
- oss03.fill('0');
- oss03.flags(std::ios_base::right);
- oss03 << str03;
- tmp = oss03.str();
- VERIFY( tmp == "909909" );
- return test;
-}
-
-// stringstream and large strings
-bool test04()
-{
- 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::string str_tmp;
- const int i_max=250;
-
- std::ostringstream oss_01(std::ios_base::out);
- std::ostringstream oss_02(str_01, std::ios_base::out);
-
- std::ios_base::iostate state1, state2, statefail;
- statefail = std::ios_base::failbit;
-
- // template<_CharT, _Traits>
- // basic_ostream& operator<<(ostream&, const char*)
- for (int i = 0; i < i_max; ++i)
- oss_02 << "Test: " << i << std::endl;
- str_tmp = oss_02.str();
- VERIFY( !oss_02.bad() );
- VERIFY( oss_02.good() );
- VERIFY( str_tmp != str_01 );
- VERIFY( str_tmp.size() == 2390 );
- return test;
-}
-
-// ostringstream and large strings number 2
-bool test05()
-{
- bool test = true;
- std::string str05, str10;
-
- typedef std::ostream::pos_type pos_type;
- typedef std::ostream::off_type off_type;
- std::string str01;
- const int size = 1000;
-
- // initialize string
- for(int i=0 ; i < size; i++) {
- str01 += '1';
- str01 += '2';
- str01 += '3';
- str01 += '4';
- str01 += '5';
- str01 += '6';
- str01 += '7';
- str01 += '8';
- str01 += '9';
- str01 += '\n';
- }
-
- // test 1: out
- std::ostringstream sstr01(str01, std::ios_base::out);
- std::ostringstream sstr02;
- sstr02 << str01;
- str05 = sstr01.str();
- str10 = sstr02.str();
- VERIFY( str05 == str01 );
- VERIFY( str10 == str01 );
-
- // test 2: in | out
- std::ostringstream sstr04(str01, std::ios_base::out | std::ios_base::in);
- std::ostringstream sstr05(std::ios_base::in | std::ios_base::out);
- sstr05 << str01;
- str05 = sstr04.str();
- str10 = sstr05.str();
- VERIFY( str05 == str01 );
- VERIFY( str10 == str01 );
- return test;
-}
-
-
-// ostringstream and positioning, multiple writes
-// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00326.html
-void test06()
-{
- bool test = true;
- const char carray01[] = "mos def & talib kweli are black star";
-
- // normal
- std::ostringstream ostr1("mos def");
- VERIFY( ostr1.str() == "mos def" );
- ostr1 << " & talib kweli"; // should overwrite first part of buffer
- VERIFY( ostr1.str() == " & talib kweli" );
- ostr1 << " are black star"; // should append to string from above
- VERIFY( ostr1.str() != carray01 );
- VERIFY( ostr1.str() == " & talib kweli are black star" );
-
- // appending
- std::ostringstream ostr2("blackalicious",
- std::ios_base::out | std::ios_base::ate);
- VERIFY( ostr2.str() == "blackalicious" );
- ostr2 << " NIA "; // should not overwrite first part of buffer
- VERIFY( ostr2.str() == "blackalicious NIA " );
- ostr2 << "4: deception (5:19)"; // should append to full string from above
- VERIFY( ostr2.str() == "blackalicious NIA 4: deception (5:19)" );
-}
-
-// Global counter, needs to be reset after use.
-bool used;
-
-class gnu_ctype : public std::ctype<wchar_t>
-{
-protected:
- char_type
- do_widen(char c) const
- {
- used = true;
- return std::ctype<wchar_t>::do_widen(c);
- }
-
- const char*
- do_widen(const char* low, const char* high, char_type* dest) const
- {
- used = true;
- return std::ctype<wchar_t>::do_widen(low, high, dest);
- }
-};
-
-// 27.6.2.5.4 - Character inserter template functions
-// [lib.ostream.inserters.character]
-void test07()
-{
-#if _GLIBCPP_USE_WCHAR_T
- using namespace std;
- bool test = true;
-
- const char* buffer = "SFPL 5th floor, outside carrol, the Asian side";
-
- wostringstream oss;
- oss.imbue(locale(locale::classic(), new gnu_ctype));
-
- // 1
- // template<class charT, class traits>
- // basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out,
- // const char* s);
- used = false;
- oss << buffer;
- VERIFY( used ); // Only required for char_type != char
- wstring str = oss.str();
- wchar_t c1 = oss.widen(buffer[0]);
- VERIFY( str[0] == c1 );
- wchar_t c2 = oss.widen(buffer[1]);
- VERIFY( str[1] == c2 );
-
- // 2
- // template<class charT, class traits>
- // basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out,
- // char c);
- used = false;
- oss.str(wstring());
- oss << 'b';
- VERIFY( used ); // Only required for char_type != char
- str = oss.str();
- wchar_t c3 = oss.widen('b');
- VERIFY( str[0] == c3 );
-#endif
-}
-
-void test08()
-{
- bool test = true;
- char* pt = NULL;
-
- // 1
- std::ostringstream oss;
- oss << pt;
- VERIFY( oss.bad() );
- VERIFY( oss.str().size() == 0 );
-
- oss.clear();
- oss << "";
- VERIFY( oss.good() );
-
-#if _GLIBCPP_USE_WCHAR_T
- // 2
- std::wostringstream woss;
- woss << pt;
- VERIFY( woss.bad() );
- VERIFY( woss.str().size() == 0 );
-
- woss.clear();
- woss << "";
- VERIFY( woss.good() );
-
- // 3
- wchar_t* wt = NULL;
- woss.clear();
- woss << wt;
- VERIFY( woss.bad() );
- VERIFY( woss.str().size() == 0 );
-
- woss.clear();
- woss << L"";
- VERIFY( woss.good() );
-#endif
-}
-
-int main()
-{
- test01();
- test02();
- test03();
- test04();
- test05();
- test06();
- test07();
- test08();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_other-1.tst b/libstdc++-v3/testsuite/27_io/ostream_inserter_other-1.tst
deleted file mode 100644
index cb3c57f7dfd..00000000000
--- a/libstdc++-v3/testsuite/27_io/ostream_inserter_other-1.tst
+++ /dev/null
@@ -1,158 +0,0 @@
-// 990117 bkoz
-// test functionality of basic_filebuf for char_type == char
-// this is a data file for 27filebuf.cc
-
-// Copyright (C) 1997-1999 Cygnus Solutions
-//
-// 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.
-
-/mnt/cdrom/sarah_vaughan/sarah_vaughan.allofme
-/mnt/cdrom/sarah_vaughan/sarah_vaughan.speaklow
-
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_01_the_way_i_feel
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_02_seduction_kidnap
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_03_just_a_ny_poem
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_04_butterflies_i_remem
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_05_luxury_poem
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_06_my_house
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_07_the_women_gather
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_08_the_life_i_led
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_09_when_i_die
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_10_revolutionary_dreams
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_11_winter_poem
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_12_a_certain_peace_i_nap
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_13_poem_for_a_lady_whose
-
-/mnt/cdrom/marley-songs_of_freedom/disk_1/
-/mnt/cdrom/marley-songs_of_freedom/disk_2/
-/mnt/cdrom/marley-songs_of_freedom/disk_4/
-
-/mnt/cdrom/marley-songs_of_freedom/disk_1/back out
-/mnt/cdrom/marley-songs_of_freedom/disk_1/bend down low
-/mnt/cdrom/marley-songs_of_freedom/disk_1/bus dem shut (pyaka)
-/mnt/cdrom/marley-songs_of_freedom/disk_1/caution
-/mnt/cdrom/marley-songs_of_freedom/disk_1/do it twice
-/mnt/cdrom/marley-songs_of_freedom/disk_1/don't rock the boat
-/mnt/cdrom/marley-songs_of_freedom/disk_1/duppy conqueror
-/mnt/cdrom/marley-songs_of_freedom/disk_1/hammer
-/mnt/cdrom/marley-songs_of_freedom/disk_1/hypocrites
-/mnt/cdrom/marley-songs_of_freedom/disk_1/i'm still waiting
-/mnt/cdrom/marley-songs_of_freedom/disk_1/judge not
-/mnt/cdrom/marley-songs_of_freedom/disk_1/mellow mood
-/mnt/cdrom/marley-songs_of_freedom/disk_1/mr brown
-/mnt/cdrom/marley-songs_of_freedom/disk_1/nice time
-/mnt/cdrom/marley-songs_of_freedom/disk_1/one cup of coffee
-/mnt/cdrom/marley-songs_of_freedom/disk_1/one love_people get ready
-/mnt/cdrom/marley-songs_of_freedom/disk_1/put it on
-/mnt/cdrom/marley-songs_of_freedom/disk_1/simmer down
-/mnt/cdrom/marley-songs_of_freedom/disk_1/small axe
-/mnt/cdrom/marley-songs_of_freedom/disk_1/soul rebel
-/mnt/cdrom/marley-songs_of_freedom/disk_1/soul shake down party
-/mnt/cdrom/marley-songs_of_freedom/disk_1/stir it up (original)
-/mnt/cdrom/marley-songs_of_freedom/disk_1/sun is shining
-/mnt/cdrom/marley-songs_of_freedom/disk_1/thank you lord (original)
-/mnt/cdrom/marley-songs_of_freedom/disk_2/acoustic medley
-/mnt/cdrom/marley-songs_of_freedom/disk_2/burnin' and lootin'
-/mnt/cdrom/marley-songs_of_freedom/disk_2/concrete jungle
-/mnt/cdrom/marley-songs_of_freedom/disk_2/craven choke puppy
-/mnt/cdrom/marley-songs_of_freedom/disk_2/get up stand up
-/mnt/cdrom/marley-songs_of_freedom/disk_2/guava jelly
-/mnt/cdrom/marley-songs_of_freedom/disk_2/high tide or low tide
-/mnt/cdrom/marley-songs_of_freedom/disk_2/i shot the sheriff
-/mnt/cdrom/marley-songs_of_freedom/disk_2/i'm hurting inside
-/mnt/cdrom/marley-songs_of_freedom/disk_2/iron lion zion
-/mnt/cdrom/marley-songs_of_freedom/disk_2/lick samba
-/mnt/cdrom/marley-songs_of_freedom/disk_2/lively up yourself
-/mnt/cdrom/marley-songs_of_freedom/disk_2/natty dread
-/mnt/cdrom/marley-songs_of_freedom/disk_2/no more trouble
-/mnt/cdrom/marley-songs_of_freedom/disk_2/rastaman chant
-/mnt/cdrom/marley-songs_of_freedom/disk_2/screw face
-/mnt/cdrom/marley-songs_of_freedom/disk_2/slave driver
-/mnt/cdrom/marley-songs_of_freedom/disk_2/trenchtown rock
-/mnt/cdrom/marley-songs_of_freedom/disk_4/africa unite
-/mnt/cdrom/marley-songs_of_freedom/disk_4/babylon system
-/mnt/cdrom/marley-songs_of_freedom/disk_4/bad card
-/mnt/cdrom/marley-songs_of_freedom/disk_4/coming in from the cold (12
-/mnt/cdrom/marley-songs_of_freedom/disk_4/could you be loved (12 mix
-/mnt/cdrom/marley-songs_of_freedom/disk_4/forever loving jah
-/mnt/cdrom/marley-songs_of_freedom/disk_4/give thanks and praise
-/mnt/cdrom/marley-songs_of_freedom/disk_4/one drop
-/mnt/cdrom/marley-songs_of_freedom/disk_4/one dub
-/mnt/cdrom/marley-songs_of_freedom/disk_4/rastaman live up
-/mnt/cdrom/marley-songs_of_freedom/disk_4/real situation
-/mnt/cdrom/marley-songs_of_freedom/disk_4/redemption song (live in pi
-/mnt/cdrom/marley-songs_of_freedom/disk_4/ride natty ride (12 mix)
-/mnt/cdrom/marley-songs_of_freedom/disk_4/so much trouble in the worl
-/mnt/cdrom/marley-songs_of_freedom/disk_4/survival
-/mnt/cdrom/marley-songs_of_freedom/disk_4/why should i (previously un
-/mnt/cdrom/marley-songs_of_freedom/disk_4/zimbabwe
-
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_01_pandemonium
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_02_sync_disjecta
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_03_object_unknown
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_04_it's_nice_not
-/mnt/cdrom/dj_spooky_rid-2dim_warefare/djspooky_05_dialectical_tra
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_06_post-human_soph
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_07_quilombo_ex
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_08_rekonstruction
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_09_scientifik
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_10_a_conversation
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_11_peace_in_zaire
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_13_degree_zero
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_14_roman_planeta
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_15_bass_digitalis
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_16_polyphony_of
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_17_riddim_warfare
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_18_the_nerd
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_20_theme_of_the
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_21_twilight_fugue
-
-/mnt/cdrom/stuff_smith_mosaic/disk3/01_desert_sands
-/mnt/cdrom/stuff_smith_mosaic/disk3/02_soft_winds
-/mnt/cdrom/stuff_smith_mosaic/disk3/03_time_and_again
-/mnt/cdrom/stuff_smith_mosaic/disk3/04_it_don't_mean_a_thing
-/mnt/cdrom/stuff_smith_mosaic/disk3/05_in_a_mellotone
-/mnt/cdrom/stuff_smith_mosaic/disk3/06_i_know_that_you_know
-/mnt/cdrom/stuff_smith_mosaic/disk3/07_heat_wave
-/mnt/cdrom/stuff_smith_mosaic/disk3/08_things_ain't_what_they_used_to_be
-/mnt/cdrom/stuff_smith_mosaic/disk3/09_body_and_soul
-
-So I take a break, wander down to the park to stand, then lean into
-the concrete railing demarking the beginnings of space, oceanic
-space. I watch the waves break, and form, and ease back out to sea and
-wrap my arms around myself and hug tightly because it's early in the
-morning and windy, and the sun is late getting out of bed today, which
-is good because if there was brilliant light illuminating all the
-beauty around me I would be shocked, stunned, forced to retreat back
-into my cabana in a daze, blinded by hummingbirds and callilillies and
-un-named red, yellow, and blue flowers. Green envelopes me, waves
-sooth me. I can see the wind flip the top of the waves seaward, right
-before they break. The sea seems so calm from my perch above the fray
-that I wonder if maybe there is just some part of the deepest, most
-abstract ocean where there is a large creature who happily chews
-plankton and wags its tail in gentle, adulating waves that spread and
-move and gracefully glide thousands of miles, to crash upon a beach,
-one after the other, politely waiting for a turn to dance with the
-seashore.
-
-I know: it is what the Mexican schoolchildren call "la vibora de la
-mer," the serpent of the sea.
-
-
-
-
-
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_other-2.tst b/libstdc++-v3/testsuite/27_io/ostream_inserter_other-2.tst
deleted file mode 100644
index cb3c57f7dfd..00000000000
--- a/libstdc++-v3/testsuite/27_io/ostream_inserter_other-2.tst
+++ /dev/null
@@ -1,158 +0,0 @@
-// 990117 bkoz
-// test functionality of basic_filebuf for char_type == char
-// this is a data file for 27filebuf.cc
-
-// Copyright (C) 1997-1999 Cygnus Solutions
-//
-// 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.
-
-/mnt/cdrom/sarah_vaughan/sarah_vaughan.allofme
-/mnt/cdrom/sarah_vaughan/sarah_vaughan.speaklow
-
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_01_the_way_i_feel
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_02_seduction_kidnap
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_03_just_a_ny_poem
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_04_butterflies_i_remem
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_05_luxury_poem
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_06_my_house
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_07_the_women_gather
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_08_the_life_i_led
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_09_when_i_die
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_10_revolutionary_dreams
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_11_winter_poem
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_12_a_certain_peace_i_nap
-/mnt/cdrom/nikkigiovanni_thewayifeel/ng_13_poem_for_a_lady_whose
-
-/mnt/cdrom/marley-songs_of_freedom/disk_1/
-/mnt/cdrom/marley-songs_of_freedom/disk_2/
-/mnt/cdrom/marley-songs_of_freedom/disk_4/
-
-/mnt/cdrom/marley-songs_of_freedom/disk_1/back out
-/mnt/cdrom/marley-songs_of_freedom/disk_1/bend down low
-/mnt/cdrom/marley-songs_of_freedom/disk_1/bus dem shut (pyaka)
-/mnt/cdrom/marley-songs_of_freedom/disk_1/caution
-/mnt/cdrom/marley-songs_of_freedom/disk_1/do it twice
-/mnt/cdrom/marley-songs_of_freedom/disk_1/don't rock the boat
-/mnt/cdrom/marley-songs_of_freedom/disk_1/duppy conqueror
-/mnt/cdrom/marley-songs_of_freedom/disk_1/hammer
-/mnt/cdrom/marley-songs_of_freedom/disk_1/hypocrites
-/mnt/cdrom/marley-songs_of_freedom/disk_1/i'm still waiting
-/mnt/cdrom/marley-songs_of_freedom/disk_1/judge not
-/mnt/cdrom/marley-songs_of_freedom/disk_1/mellow mood
-/mnt/cdrom/marley-songs_of_freedom/disk_1/mr brown
-/mnt/cdrom/marley-songs_of_freedom/disk_1/nice time
-/mnt/cdrom/marley-songs_of_freedom/disk_1/one cup of coffee
-/mnt/cdrom/marley-songs_of_freedom/disk_1/one love_people get ready
-/mnt/cdrom/marley-songs_of_freedom/disk_1/put it on
-/mnt/cdrom/marley-songs_of_freedom/disk_1/simmer down
-/mnt/cdrom/marley-songs_of_freedom/disk_1/small axe
-/mnt/cdrom/marley-songs_of_freedom/disk_1/soul rebel
-/mnt/cdrom/marley-songs_of_freedom/disk_1/soul shake down party
-/mnt/cdrom/marley-songs_of_freedom/disk_1/stir it up (original)
-/mnt/cdrom/marley-songs_of_freedom/disk_1/sun is shining
-/mnt/cdrom/marley-songs_of_freedom/disk_1/thank you lord (original)
-/mnt/cdrom/marley-songs_of_freedom/disk_2/acoustic medley
-/mnt/cdrom/marley-songs_of_freedom/disk_2/burnin' and lootin'
-/mnt/cdrom/marley-songs_of_freedom/disk_2/concrete jungle
-/mnt/cdrom/marley-songs_of_freedom/disk_2/craven choke puppy
-/mnt/cdrom/marley-songs_of_freedom/disk_2/get up stand up
-/mnt/cdrom/marley-songs_of_freedom/disk_2/guava jelly
-/mnt/cdrom/marley-songs_of_freedom/disk_2/high tide or low tide
-/mnt/cdrom/marley-songs_of_freedom/disk_2/i shot the sheriff
-/mnt/cdrom/marley-songs_of_freedom/disk_2/i'm hurting inside
-/mnt/cdrom/marley-songs_of_freedom/disk_2/iron lion zion
-/mnt/cdrom/marley-songs_of_freedom/disk_2/lick samba
-/mnt/cdrom/marley-songs_of_freedom/disk_2/lively up yourself
-/mnt/cdrom/marley-songs_of_freedom/disk_2/natty dread
-/mnt/cdrom/marley-songs_of_freedom/disk_2/no more trouble
-/mnt/cdrom/marley-songs_of_freedom/disk_2/rastaman chant
-/mnt/cdrom/marley-songs_of_freedom/disk_2/screw face
-/mnt/cdrom/marley-songs_of_freedom/disk_2/slave driver
-/mnt/cdrom/marley-songs_of_freedom/disk_2/trenchtown rock
-/mnt/cdrom/marley-songs_of_freedom/disk_4/africa unite
-/mnt/cdrom/marley-songs_of_freedom/disk_4/babylon system
-/mnt/cdrom/marley-songs_of_freedom/disk_4/bad card
-/mnt/cdrom/marley-songs_of_freedom/disk_4/coming in from the cold (12
-/mnt/cdrom/marley-songs_of_freedom/disk_4/could you be loved (12 mix
-/mnt/cdrom/marley-songs_of_freedom/disk_4/forever loving jah
-/mnt/cdrom/marley-songs_of_freedom/disk_4/give thanks and praise
-/mnt/cdrom/marley-songs_of_freedom/disk_4/one drop
-/mnt/cdrom/marley-songs_of_freedom/disk_4/one dub
-/mnt/cdrom/marley-songs_of_freedom/disk_4/rastaman live up
-/mnt/cdrom/marley-songs_of_freedom/disk_4/real situation
-/mnt/cdrom/marley-songs_of_freedom/disk_4/redemption song (live in pi
-/mnt/cdrom/marley-songs_of_freedom/disk_4/ride natty ride (12 mix)
-/mnt/cdrom/marley-songs_of_freedom/disk_4/so much trouble in the worl
-/mnt/cdrom/marley-songs_of_freedom/disk_4/survival
-/mnt/cdrom/marley-songs_of_freedom/disk_4/why should i (previously un
-/mnt/cdrom/marley-songs_of_freedom/disk_4/zimbabwe
-
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_01_pandemonium
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_02_sync_disjecta
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_03_object_unknown
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_04_it's_nice_not
-/mnt/cdrom/dj_spooky_rid-2dim_warefare/djspooky_05_dialectical_tra
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_06_post-human_soph
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_07_quilombo_ex
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_08_rekonstruction
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_09_scientifik
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_10_a_conversation
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_11_peace_in_zaire
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_13_degree_zero
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_14_roman_planeta
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_15_bass_digitalis
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_16_polyphony_of
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_17_riddim_warfare
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_18_the_nerd
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_20_theme_of_the
-/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_21_twilight_fugue
-
-/mnt/cdrom/stuff_smith_mosaic/disk3/01_desert_sands
-/mnt/cdrom/stuff_smith_mosaic/disk3/02_soft_winds
-/mnt/cdrom/stuff_smith_mosaic/disk3/03_time_and_again
-/mnt/cdrom/stuff_smith_mosaic/disk3/04_it_don't_mean_a_thing
-/mnt/cdrom/stuff_smith_mosaic/disk3/05_in_a_mellotone
-/mnt/cdrom/stuff_smith_mosaic/disk3/06_i_know_that_you_know
-/mnt/cdrom/stuff_smith_mosaic/disk3/07_heat_wave
-/mnt/cdrom/stuff_smith_mosaic/disk3/08_things_ain't_what_they_used_to_be
-/mnt/cdrom/stuff_smith_mosaic/disk3/09_body_and_soul
-
-So I take a break, wander down to the park to stand, then lean into
-the concrete railing demarking the beginnings of space, oceanic
-space. I watch the waves break, and form, and ease back out to sea and
-wrap my arms around myself and hug tightly because it's early in the
-morning and windy, and the sun is late getting out of bed today, which
-is good because if there was brilliant light illuminating all the
-beauty around me I would be shocked, stunned, forced to retreat back
-into my cabana in a daze, blinded by hummingbirds and callilillies and
-un-named red, yellow, and blue flowers. Green envelopes me, waves
-sooth me. I can see the wind flip the top of the waves seaward, right
-before they break. The sea seems so calm from my perch above the fray
-that I wonder if maybe there is just some part of the deepest, most
-abstract ocean where there is a large creature who happily chews
-plankton and wags its tail in gentle, adulating waves that spread and
-move and gracefully glide thousands of miles, to crash upon a beach,
-one after the other, politely waiting for a turn to dance with the
-seashore.
-
-I know: it is what the Mexican schoolchildren call "la vibora de la
-mer," the serpent of the sea.
-
-
-
-
-
diff --git a/libstdc++-v3/testsuite/27_io/ostream_seeks-1.tst b/libstdc++-v3/testsuite/27_io/ostream_seeks-1.tst
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/libstdc++-v3/testsuite/27_io/ostream_seeks-1.tst
+++ /dev/null
diff --git a/libstdc++-v3/testsuite/27_io/ostream_seeks.cc b/libstdc++-v3/testsuite/27_io/ostream_seeks.cc
deleted file mode 100644
index 5afc675d299..00000000000
--- a/libstdc++-v3/testsuite/27_io/ostream_seeks.cc
+++ /dev/null
@@ -1,301 +0,0 @@
-// 2000-06-29 bkoz
-
-// Copyright (C) 2000 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.2.4 basic_ostream seek members
-
-#include <ostream>
-#include <sstream>
-#include <fstream>
-#include <testsuite_hooks.h>
-
-
-bool test01()
-{
- using namespace std;
- typedef ios::pos_type pos_type;
-
- bool test = true;
- const char str_lit01[] = "ostream_seeks-1.txt";
-
- // out
- // test default ctors leave things in the same positions...
- ostringstream ost1;
- pos_type p1 = ost1.tellp();
-
- ofstream ofs1;
- pos_type p2 = ofs1.tellp();
-
- VERIFY( p1 == p2 );
-
- // out
- // test ctors leave things in the same positions...
- ostringstream ost2("bob_marley:kaya");
- p1 = ost2.tellp();
-
- ofstream ofs2(str_lit01);
- p2 = ofs2.tellp();
-
- VERIFY( p1 == p2 );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return test;
-}
-
-#if 0
-// XXX FIX ME
-// basically this is the istreams_seeks.cc code. We need to fix it up
-// for ostreams......
-
-// fstreams
-void test04(void)
-{
- bool test = true;
- std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
- std::ios_base::iostate state01, state02;
- const char str_lit01[] = "istream_unformatted-1.txt";
- const char str_lit02[] = "istream_unformatted-2.txt";
- std::ifstream if01(str_lit01, std::ios_base::in | std::ios_base::out);
- std::ifstream if02(str_lit01, std::ios_base::in);
- std::ifstream if03(str_lit02, std::ios_base::out | std::ios_base::trunc);
- VERIFY( if01.good() );
- VERIFY( if02.good() );
- VERIFY( if03.good() );
-
- std::istream is01(if01.rdbuf());
- std::istream is02(if02.rdbuf());
- std::istream is03(if03.rdbuf());
-
- // pos_type tellp()
- // in | out
- pos01 = is01.tellp();
- pos02 = is01.tellp();
- VERIFY( pos01 == pos02 );
- // VERIFY( istream::pos_type(0) != pos01 ); //deprecated
-
- // in
- pos03 = is02.tellp();
- pos04 = is02.tellp();
- VERIFY( pos03 == pos04 );
- // VERIFY( istream::pos_type(0) != pos03 ); //deprecated
-
- // out
- pos05 = is03.tellp();
- pos06 = is03.tellp();
- VERIFY( pos05 == pos06 );
- // VERIFY( istream::pos_type(0) != pos01 ); //deprecated
-
- // istream& seekg(pos_type)
- // istream& seekg(off_type, ios_base::seekdir)
-
- // cur
- // NB: see library issues list 136. It's the v-3 interp that seekg
- // only sets the input buffer, or else istreams with buffers that
- // have _M_mode == ios_base::out will fail to have consistency
- // between seekg and tellp.
- state01 = is01.rdstate();
- is01.seekg(10, std::ios_base::cur);
- state02 = is01.rdstate();
- pos01 = is01.tellp();
- VERIFY( pos01 == pos02 + 10 );
- VERIFY( state01 == state02 );
- pos02 = is01.tellp();
- VERIFY( pos02 == pos01 );
-
- state01 = is02.rdstate();
- is02.seekg(10, std::ios_base::cur);
- state02 = is02.rdstate();
- pos03 = is02.tellp();
- VERIFY( pos03 == pos04 + 10 );
- VERIFY( state01 == state02 );
- pos04 = is02.tellp();
- VERIFY( pos03 == pos04 );
-
- state01 = is03.rdstate();
- is03.seekg(10, std::ios_base::cur);
- state02 = is03.rdstate();
- pos05 = is03.tellp();
- VERIFY( pos05 == pos06 + 10 );
- VERIFY( state01 == state02 );
- pos06 = is03.tellp();
- VERIFY( pos05 == pos06 );
-
- // beg
- state01 = is01.rdstate();
- is01.seekg(20, std::ios_base::beg);
- state02 = is01.rdstate();
- pos01 = is01.tellp();
- VERIFY( pos01 == pos02 + 10 );
- VERIFY( state01 == state02 );
- pos02 = is01.tellp();
- VERIFY( pos02 == pos01 );
-
- state01 = is02.rdstate();
- is02.seekg(20, std::ios_base::beg);
- state02 = is02.rdstate();
- pos03 = is02.tellp();
- VERIFY( pos03 == pos04 + 10 );
- VERIFY( state01 == state02 );
- pos04 = is02.tellp();
- VERIFY( pos03 == pos04 );
-
- state01 = is03.rdstate();
- is03.seekg(20, std::ios_base::beg);
- state02 = is03.rdstate();
- pos05 = is03.tellp();
- VERIFY( pos05 == pos06 + 10 );
- VERIFY( state01 == state02 );
- pos06 = is03.tellp();
- VERIFY( pos05 == pos06 );
-
- // libstdc++/6414
- if01.seekg(0, std::ios_base::beg);
- pos01 = if01.tellg();
- if01.peek();
- pos02 = if01.tellg();
- VERIFY( pos02 == pos01 );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-}
-
-// stringstreams
-void test05(void)
-{
- bool test = true;
- std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
- std::ios_base::iostate state01, state02;
- const char str_lit01[] = "istream_unformatted-1.tst";
- std::ifstream if01(str_lit01);
- std::ifstream if02(str_lit01);
- std::ifstream if03(str_lit01);
- VERIFY( if01.good() );
- VERIFY( if02.good() );
- VERIFY( if03.good() );
-
- std::stringbuf strbuf01(std::ios_base::in | std::ios_base::out);
- if01 >> &strbuf01;
- // initialize stringbufs that are ios_base::out
- std::stringbuf strbuf03(strbuf01.str(), std::ios_base::out);
- // initialize stringbufs that are ios_base::in
- std::stringbuf strbuf02(strbuf01.str(), std::ios_base::in);
-
- std::istream is01(&strbuf01);
- std::istream is02(&strbuf02);
- std::istream is03(&strbuf03);
-
- // pos_type tellp()
- // in | out
- pos01 = is01.tellp();
- pos02 = is01.tellp();
- VERIFY( pos01 == pos02 );
- // VERIFY( istream::pos_type(0) != pos01 ); // deprecated
-
- // in
- pos03 = is02.tellp();
- pos04 = is02.tellp();
- VERIFY( pos03 == pos04 );
- // VERIFY( istream::pos_type(0) != pos03 ); // deprecated
-
- // out
- pos05 = is03.tellp();
- pos06 = is03.tellp();
- VERIFY( pos05 == pos06 );
- // VERIFY( istream::pos_type(0) != pos01 ); //deprecated
-
- // istream& seekg(pos_type)
- // istream& seekg(off_type, ios_base::seekdir)
-
- // cur
- // NB: see library issues list 136. It's the v-3 interp that seekg
- // only sets the input buffer, or else istreams with buffers that
- // have _M_mode == ios_base::out will fail to have consistency
- // between seekg and tellp.
- state01 = is01.rdstate();
- is01.seekg(10, std::ios_base::cur);
- state02 = is01.rdstate();
- pos01 = is01.tellp();
- VERIFY( pos01 == pos02 + 10 );
- VERIFY( state01 == state02 );
- pos02 = is01.tellp();
- VERIFY( pos02 == pos01 );
-
- state01 = is02.rdstate();
- is02.seekg(10, std::ios_base::cur);
- state02 = is02.rdstate();
- pos03 = is02.tellp();
- VERIFY( pos03 == pos04 + 10 );
- VERIFY( state01 == state02 );
- pos04 = is02.tellp();
- VERIFY( pos03 == pos04 );
-
- state01 = is03.rdstate();
- is03.seekg(10, std::ios_base::cur);
- state02 = is03.rdstate();
- pos05 = is03.tellp();
- VERIFY( pos05 == pos06 ); // as only out buffer
- VERIFY( state01 == state02 );
- pos06 = is03.tellp();
- VERIFY( pos05 == pos06 );
-
- // beg
- state01 = is01.rdstate();
- is01.seekg(20, std::ios_base::beg);
- state02 = is01.rdstate();
- pos01 = is01.tellp();
- VERIFY( pos01 == pos02 + 10 );
- VERIFY( state01 == state02 );
- pos02 = is01.tellp();
- VERIFY( pos02 == pos01 );
-
- state01 = is02.rdstate();
- is02.seekg(20, std::ios_base::beg);
- state02 = is02.rdstate();
- pos03 = is02.tellp();
- VERIFY( pos03 == pos04 + 10 );
- VERIFY( state01 == state02 );
- pos04 = is02.tellp();
- VERIFY( pos03 == pos04 );
-
- state01 = is03.rdstate();
- is03.seekg(20, std::ios_base::beg);
- state02 = is03.rdstate();
- pos05 = is03.tellp();
- VERIFY( pos05 == pos06 ); // as only out buffer
- VERIFY( state01 == state02 );
- pos06 = is03.tellp();
- VERIFY( pos05 == pos06 );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-}
-#endif // XXX
-
-int main()
-{
- test01();
- // test04();
- // test05();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/27_io/streambuf_members.cc b/libstdc++-v3/testsuite/27_io/streambuf_members.cc
deleted file mode 100644
index 263a95f06fb..00000000000
--- a/libstdc++-v3/testsuite/27_io/streambuf_members.cc
+++ /dev/null
@@ -1,536 +0,0 @@
-// 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 <cstring> // for memset, memcmp
-#include <streambuf>
-#include <sstream>
-#include <ostream>
-#include <testsuite_hooks.h>
-
-class testbuf : public std::streambuf
-{
-public:
-
- // Typedefs:
- typedef std::streambuf::traits_type traits_type;
- typedef std::streambuf::char_type char_type;
-
- testbuf(): std::streambuf()
- { _M_mode = (std::ios_base::in | std::ios_base::out); }
-
- bool
- check_pointers()
- {
- bool test = true;
- VERIFY( this->eback() == NULL );
- VERIFY( this->gptr() == NULL );
- VERIFY( this->egptr() == NULL );
- VERIFY( this->pbase() == NULL );
- VERIFY( this->pptr() == NULL );
- VERIFY( this->epptr() == NULL );
- return test;
- }
-
- int_type
- pub_uflow()
- { return (this->uflow()); }
-
- int_type
- pub_overflow(int_type __c = traits_type::eof())
- { return (this->overflow(__c)); }
-
- int_type
- pub_pbackfail(int_type __c)
- { return (this->pbackfail(__c)); }
-
- void
- pub_setg(char* beg, char* cur, char *end)
- { this->setg(beg, cur, end); }
-
- void
- pub_setp(char* beg, char* end)
- { this->setp(beg, end); }
-
-protected:
- int_type
- underflow()
- {
- int_type __retval = traits_type::eof();
- if (this->gptr() < this->egptr())
- __retval = traits_type::not_eof(0);
- return __retval;
- }
-};
-
-void test01()
-{
- typedef testbuf::traits_type traits_type;
- typedef testbuf::int_type int_type;
-
- bool test = true;
- char* lit01 = "chicago underground trio/possible cube on delmark";
- testbuf buf01;
-
- // 27.5.2.1 basic_streambuf ctors
- // default ctor initializes
- // - all pointer members to null pointers
- // - locale to current global locale
- VERIFY( buf01.check_pointers() );
- VERIFY( buf01.getloc() == std::locale() );
-
- // 27.5.2.3.1 get area
- // 27.5.2.2.3 get area
- // 27.5.2.4.3 get area
- int i01 = 3;
- buf01.pub_setg(lit01, lit01, (lit01 + i01));
- VERIFY( i01 == buf01.in_avail() );
-
- VERIFY( buf01.pub_uflow() == lit01[0] );
- VERIFY( buf01.sgetc() == traits_type::to_int_type(lit01[1]) );
- VERIFY( buf01.pub_uflow() == lit01[1] );
- VERIFY( buf01.sgetc() == traits_type::to_int_type(lit01[2]) );
- VERIFY( buf01.pub_uflow() == lit01[2] );
- VERIFY( buf01.sgetc() == traits_type::eof() );
-
- // pbackfail
- buf01.pub_setg(lit01, lit01, (lit01 + i01));
- VERIFY( i01 == buf01.in_avail() );
- int_type intt01 = traits_type::to_int_type('b');
- VERIFY( traits_type::eof() == buf01.pub_pbackfail(intt01) );
-
- // overflow
- VERIFY( traits_type::eof() == buf01.pub_overflow(intt01) );
- VERIFY( traits_type::eof() == buf01.pub_overflow() );
- VERIFY( buf01.sgetc() == traits_type::to_int_type(lit01[0]) );
-
- // sputn/xsputn
- char* lit02 = "isotope 217: the unstable molecule on thrill jockey";
- int i02 = std::strlen(lit02);
- char carray[i02 + 1];
- std::memset(carray, 0, i02 + 1);
-
- buf01.pub_setp(carray, (carray + i02));
- buf01.sputn(lit02, 0);
- VERIFY( carray[0] == 0 );
- VERIFY( lit02[0] == 'i' );
- buf01.sputn(lit02, 1);
- VERIFY( lit02[0] == carray[0] );
- VERIFY( lit02[1] == 's' );
- VERIFY( carray[1] == 0 );
- buf01.sputn(lit02 + 1, 10);
- VERIFY( std::memcmp(lit02, carray, 10) == 0 );
- buf01.sputn(lit02 + 11, 20);
- VERIFY( std::memcmp(lit02, carray, 30) == 0 );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-}
-
-void test02()
-{
- typedef testbuf::traits_type traits_type;
- typedef testbuf::int_type int_type;
-
- bool test = true;
- char* lit01 = "chicago underground trio/possible cube on delmark";
- testbuf buf01;
-
- // 27.5.2.1 basic_streambuf ctors
- // default ctor initializes
- // - all pointer members to null pointers
- // - locale to current global locale
- VERIFY( buf01.check_pointers() );
- VERIFY( buf01.getloc() == std::locale() );
-
- // 27.5.2.2.5 Put area
- size_t i01 = traits_type::length(lit01);
- char carray01[i01];
- std::memset(carray01, 0, i01);
-
- buf01.pub_setg(lit01, lit01, lit01 + i01);
- buf01.sgetn(carray01, 0);
- VERIFY( carray01[0] == 0 );
- buf01.sgetn(carray01, 1);
- VERIFY( carray01[0] == 'c' );
- buf01.sgetn(carray01 + 1, i01 - 1);
- VERIFY( carray01[0] == 'c' );
- VERIFY( carray01[1] == 'h' );
- VERIFY( carray01[i01 - 1] == 'k' );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-}
-
-// 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_streambuf<charT, traits>
- {
- protected:
- typedef typename
- std::basic_streambuf<charT, traits>::int_type int_type;
- virtual int_type
- overflow(int_type c)
- { return traits::not_eof(c); }
- };
-
-typedef basic_nullbuf<char> nullbuf;
-typedef basic_nullbuf<wchar_t> wnullbuf;
-
-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 );
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-}
-
-class setpbuf : public std::streambuf
-{
- char buffer[4];
- std::string result;
-
-public:
-
- std::string&
- get_result()
- { return result; }
-
- setpbuf()
- {
- char foo [32];
- setp(foo, foo + 32);
- setp(buffer, buffer + 4);
- }
-
- ~setpbuf()
- { sync(); }
-
- 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 );
-}
-
-class nullsetpbuf : public std::streambuf
-{
- 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());
- // ditto
- nsp.sputc('a');
-}
-
-// test06
-namespace gnu
-{
- class something_derived;
-}
-
-class gnu::something_derived : std::streambuf { };
-
-// libstdc++/3599
-class testbuf2 : public std::streambuf
-{
-public:
- typedef std::streambuf::traits_type traits_type;
-
- testbuf2() : std::streambuf() { }
-
-protected:
- int_type
- overflow(int_type c = traits_type::eof())
- { return traits_type::not_eof(0); }
-};
-
-void
-test07()
-{
- bool test = true;
- testbuf2 ob;
- std::ostream out(&ob);
-
- out << "gasp";
- VERIFY(out.good());
-
- out << std::endl;
- VERIFY(out.good());
-}
-
-// libstdc++/9322
-void test08()
-{
- using std::locale;
- bool test = true;
-
- locale loc;
- testbuf2 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 );
-}
-
-// libstdc++/9318
-class Outbuf : public std::streambuf
-{
-public:
- typedef std::streambuf::traits_type traits_type;
-
- std::string result() const { return str; }
-
-protected:
- virtual int_type overflow(int_type c = traits_type::eof())
- {
- if (!traits_type::eq_int_type(c, traits_type::eof()))
- str.push_back(traits_type::to_char_type(c));
- return traits_type::not_eof(c);
- }
-
-private:
- std::string str;
-};
-
-// <1>
-void test09()
-{
- bool test = true;
-
- std::istringstream stream("Bad Moon Rising");
- Outbuf buf;
- stream >> &buf;
-
- VERIFY( buf.result() == "Bad Moon Rising" );
-}
-
-// <2>
-void test10()
-{
- bool test = true;
-
- std::stringbuf sbuf("Bad Moon Rising", std::ios::in);
- Outbuf buf;
- std::ostream stream(&buf);
- stream << &sbuf;
-
- VERIFY( buf.result() == "Bad Moon Rising" );
-}
-
-// libstdc++/9424
-class Outbuf_2 : public std::streambuf
-{
- char buf[1];
-
-public:
- Outbuf_2()
- {
- setp(buf, buf + 1);
- }
-
- int_type overflow(int_type c)
- {
- int_type eof = traits_type::eof();
-
- if (pptr() < epptr())
- {
- if (traits_type::eq_int_type(c, eof))
- return traits_type::not_eof(c);
-
- *pptr() = traits_type::to_char_type(c);
- pbump(1);
- return c;
- }
-
- return eof;
- }
-};
-
-class Inbuf_2 : public std::streambuf
-{
- static const char buf[];
- const char* current;
- int size;
-
-public:
- Inbuf_2()
- {
- current = buf;
- size = std::strlen(buf);
- }
-
- int_type underflow()
- {
- if (current < buf + size)
- return traits_type::to_int_type(*current);
- return traits_type::eof();
- }
-
- int_type uflow()
- {
- if (current < buf + size)
- return traits_type::to_int_type(*current++);
- return traits_type::eof();
- }
-};
-
-const char Inbuf_2::buf[] = "Atteivlis";
-
-// <1>
-void test11()
-{
- bool test = true;
-
- Inbuf_2 inbuf1;
- std::istream is(&inbuf1);
- Outbuf_2 outbuf1;
- is >> &outbuf1;
- VERIFY( inbuf1.sgetc() == 't' );
- VERIFY( is.good() );
-}
-
-// <2>
-void test12()
-{
- bool test = true;
-
- Outbuf_2 outbuf2;
- std::ostream os (&outbuf2);
- Inbuf_2 inbuf2;
- os << &inbuf2;
- VERIFY( inbuf2.sgetc() == 't' );
- VERIFY( os.good() );
-}
-
-int main()
-{
- test01();
- test02();
- test03();
-
- test04();
- test05();
-
- test07();
- __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test08);
-
- test09();
- test10();
- test11();
- test12();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/27_io/stringbuf_members.cc b/libstdc++-v3/testsuite/27_io/stringbuf_members.cc
deleted file mode 100644
index 5e493301890..00000000000
--- a/libstdc++-v3/testsuite/27_io/stringbuf_members.cc
+++ /dev/null
@@ -1,517 +0,0 @@
-// 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 <sstream>
-#include <testsuite_hooks.h>
-
-std::string str_01("mykonos. . . or what?");
-std::string str_02("paris, or sainte-maxime?");
-std::string str_03;
-std::stringbuf strb_01(str_01);
-std::stringbuf strb_02(str_02, std::ios_base::in);
-std::stringbuf strb_03(str_03, std::ios_base::out);
-
-
-// test the underlying allocator
-bool test01() {
- bool test = false;
- std::allocator<char> alloc_01;
- std::allocator<char>::size_type size_01 = alloc_01.max_size();
- std::allocator<char>::pointer p_01 = alloc_01.allocate(32);
-
- return true;
-}
-
-
-// test the streambuf/stringbuf locale settings
-bool test02() {
- std::locale loc_tmp;
- loc_tmp = strb_01.getloc();
- strb_01.pubimbue(loc_tmp); //This should initialize _M_init to true
- strb_01.getloc(); //This should just return _M_locale
-
- return true;
-}
-
-
-// test member functions
-bool test03() {
- bool test = true;
-
- //stringbuf::str()
- VERIFY( strb_01.str() == str_01 );
- VERIFY( strb_02.str() == str_02 );
- VERIFY( strb_03.str() == str_03 );
-
- //stringbuf::str(string&)
- strb_03.str("none of the above, go to the oberoi in cairo, egypt.");
- strb_03.str(str_01);
- std::streamsize d1 = strb_01.in_avail();
- std::streamsize d2 = strb_03.in_avail();
- VERIFY( d1 ); // non-zero
- VERIFY( !d2 ); // zero, cuz ios_base::out
- VERIFY( d1 != d2 ); //these should be the same
- VERIFY( str_01.length() == d1 );
- VERIFY( strb_01.str() == strb_03.str() ); //ditto
-
- // stringbuf::str(string&) and stringbuf::stringbuf(string&), where the
- // string in question contains embedded NUL characters. Note that in this
- // embedded-NUL situation, the size must be passed to the string ctor.
- std::string str_nulls ("eschew \0 obfuscation", 20); // tested in 21_strings
- std::stringbuf strb_normal (str_01);
- std::stringbuf strb_nulls (str_nulls);
- strb_normal.str(str_nulls); // tried using 'strb_01' rather than declaring
- // another variable, but then test04 broke!
- VERIFY( strb_nulls.in_avail() == str_nulls.size() );
- VERIFY( strb_nulls.str().size() == 20 );
- VERIFY( strb_normal.in_avail() == str_nulls.size() );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return test;
-}
-
-
-// test overloaded virtual functions
-bool test04() {
- bool test = true;
- std::string str_tmp;
- std::stringbuf strb_tmp;
- std::streamsize strmsz_1, strmsz_2;
- std::streamoff strmof_1(-1), strmof_2;
- typedef std::stringbuf::int_type int_type;
- typedef std::stringbuf::traits_type traits_type;
- typedef std::stringbuf::pos_type pos_type;
- typedef std::stringbuf::off_type off_type;
-
- // GET
- // int in_avail()
- strmof_1 = strb_01.in_avail();
- strmof_2 = strb_02.in_avail();
- VERIFY( strmof_1 != strmof_2 );
- VERIFY( strmof_1 == str_01.length() );
- VERIFY( strmof_2 == str_02.length() );
- strmof_1 = strb_03.in_avail();
- VERIFY( strmof_1 == 0 ); // zero cuz write-only, or eof()? zero, from showmany
-
- // int_type sbumpc()
- // if read_cur not avail, return uflow(), else return *read_cur & increment
- int_type c1 = strb_01.sbumpc();
- int_type c2 = strb_02.sbumpc();
- VERIFY( c1 != c2 );
- VERIFY( c1 == str_01[0] );
- VERIFY( c2 == str_02[0] ); //should equal first letter at this point
- int_type c3 = strb_01.sbumpc();
- int_type c4 = strb_02.sbumpc();
- VERIFY( c1 != c2 );
- VERIFY( c1 != c3 );
- VERIFY( c2 != c4 );
- int_type c5 = strb_03.sbumpc();
- VERIFY( c5 == traits_type::eof() );
-
- // int_type sgetc()
- // if read_cur not avail, return uflow(), else return *read_cur
- int_type c6 = strb_01.sgetc();
- int_type c7 = strb_02.sgetc();
- VERIFY( c6 != c3 );
- VERIFY( c7 != c4 );
- int_type c8 = strb_01.sgetc();
- int_type c9 = strb_02.sgetc();
- VERIFY( c6 == c8 );
- VERIFY( c7 == c9 );
- c5 = strb_03.sgetc();
- VERIFY( c5 == traits_type::eof() );
-
- // int_type snextc()
- // calls sbumpc and if sbumpc != eof, return sgetc
- c6 = strb_01.snextc();
- c7 = strb_02.snextc();
- VERIFY( c6 != c8 );
- VERIFY( c7 != c9 );
- VERIFY( c6 == str_01[3] );
- VERIFY( c7 == str_02[3] ); //should equal fourth letter at this point
- c5 = strb_03.snextc();
- VERIFY( c5 == traits_type::eof() );
-
- // int showmanyc
- // 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 = strb_01.in_avail();
- strmsz_2 = strb_02.in_avail();
- test = strmsz_1 != strmsz_2;
- VERIFY( strmsz_1 != str_01.length() );
- VERIFY( strmsz_2 != str_02.length() ); //because now we've moved into string
- char carray1[11] = "";
- strmsz_1 = strb_01.sgetn(carray1, 10);
- char carray2[20] = "";
- strmsz_2 = strb_02.sgetn(carray2, 10);
- VERIFY( strmsz_1 == strmsz_2 );
- VERIFY( strmsz_1 == 10 );
- c1 = strb_01.sgetc();
- c2 = strb_02.sgetc();
- VERIFY( c6 == c1 ); //just by co-incidence both o's
- VERIFY( c7 != c2 ); // n != i
- VERIFY( c1 == str_01[13] );
- VERIFY( c2 == str_02[13] ); //should equal fourteenth letter at this point
- strmsz_1 = strb_03.sgetn(carray1, 10);
- VERIFY( !strmsz_1 ); //zero
- strmsz_1 = strb_02.in_avail();
- strmsz_2 = strb_02.sgetn(carray2, strmsz_1 + 5);
- VERIFY( strmsz_1 == strmsz_2 ); //write off the end
- c4 = strb_02.sgetc(); // should be EOF
- VERIFY( c4 == traits_type::eof() );
-
- // PUT
- // int_type sputc(char_type c)
- // if out_cur not avail, return overflow. Else, stores c at out_cur,
- // increments out_cur, and returns c as int_type
- strb_03.str(str_01); //reset
- std::string::size_type sz1 = strb_03.str().length();
- c1 = strb_03.sputc('a');
- std::string::size_type sz2 = strb_03.str().length();
- VERIFY( sz1 == sz2 ); //cuz inserting at out_cur, which is at beg to start
- c2 = strb_03.sputc('b');
- VERIFY( c1 != c2 );
- VERIFY( strb_03.str() != str_01 );
- c3 = strb_02.sputc('a'); // should be EOF because this is read-only
- VERIFY( c3 == traits_type::eof() );
-
- // 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*
- str_tmp = strb_03.str();
- sz1 = str_tmp.length();
- strmsz_1 = strb_03.sputn("racadabras", 10);//"abracadabras or what?"
- sz2 = strb_03.str().length();
- VERIFY( sz1 == sz2 ); //shouldn't have changed length
- VERIFY( strmsz_1 == 10 );
- VERIFY( str_tmp != strb_03.str() );
- strmsz_2 = strb_03.sputn(", i wanna reach out and", 10);
- VERIFY( strmsz_1 == strmsz_2 ); // should re-allocate, copy 10 chars.
- VERIFY( strmsz_1 == 10 );
- VERIFY( strmsz_2 == 10 );
- sz2 = strb_03.str().length();
- VERIFY( sz1 != sz2 ); // need to change length
- VERIFY( str_tmp != strb_03.str() );
- str_tmp = strb_02.str();
- strmsz_1 = strb_02.sputn("racadabra", 10);
- VERIFY( strmsz_1 == 0 );
- VERIFY( str_tmp == strb_02.str() );
-
- // 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()
- strmsz_1 = strb_01.in_avail();
- str_tmp = strb_01.str();
- c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
- c2 = strb_01.sputbackc('z');//"mykonos. . .zor what?"
- c3 = strb_01.sgetc();
- VERIFY( c1 != c2 );
- VERIFY( c3 == c2 );
- VERIFY( strb_01.str() == std::string("mykonos. . .zor what?") );
- VERIFY( str_tmp.size() == strb_01.str().size() );
- //test for _in_cur == _in_beg
- strb_01.str(str_tmp);
- strmsz_1 = strb_01.in_avail();
- c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
- c2 = strb_01.sputbackc('z');//"mykonos. . . or what?"
- c3 = strb_01.sgetc();
- VERIFY( c1 != c2 );
- VERIFY( c3 != c2 );
- VERIFY( c1 == c3 );
- VERIFY( c2 == traits_type::eof() );
- VERIFY( strb_01.str() == str_tmp );
- VERIFY( str_tmp.size() == strb_01.str().size() );
- // test for replacing char with identical one
- strb_01.str(str_01); //reset
- strmsz_1 = strb_01.in_avail();
- strb_01.sbumpc();
- strb_01.sbumpc();
- c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
- c2 = strb_01.sputbackc('y');//"mykonos. . . or what?"
- c3 = strb_01.sgetc();
- VERIFY( c1 != c2 );
- VERIFY( c3 == c2 );
- VERIFY( c1 != c3 );
- VERIFY( strb_01.str() == str_01 );
- VERIFY( str_01.size() == strb_01.str().size() );
- //test for ios_base::out
- strmsz_2 = strb_03.in_avail();
- c4 = strb_03.sputbackc('x');
- VERIFY( c4 == traits_type::eof() );
-
- // int_type sungetc()
- // if in_cur not avail, return pbackfail(), else decrement and
- // return to_int_type(*gptr())
- for (int i = 0; i<12; ++i)
- strb_01.sbumpc();
- strmsz_1 = strb_01.in_avail();
- str_tmp = strb_01.str();
- c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
- c2 = strb_01.sungetc();//"mykonos. . . or what?"
- c3 = strb_01.sgetc();
- VERIFY( c1 != c2 );
- VERIFY( c3 == c2 );
- VERIFY( c1 != c3 );
- VERIFY( c2 == ' ' );
- VERIFY( strb_01.str() == str_01 );
- VERIFY( str_01.size() == strb_01.str().size() );
- //test for _in_cur == _in_beg
- strb_01.str(str_tmp);
- strmsz_1 = strb_01.in_avail();
- c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
- c2 = strb_01.sungetc();//"mykonos. . . or what?"
- c3 = strb_01.sgetc();
- VERIFY( c1 != c2 );
- VERIFY( c3 != c2 );
- VERIFY( c1 == c3 );
- VERIFY( c2 == traits_type::eof() );
- VERIFY( strb_01.str() == str_01 );
- VERIFY( str_01.size() == strb_01.str().size() );
- // test for replacing char with identical one
- strb_01.str(str_01); //reset
- strmsz_1 = strb_01.in_avail();
- strb_01.sbumpc();
- strb_01.sbumpc();
- c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
- c2 = strb_01.sungetc();//"mykonos. . . or what?"
- c3 = strb_01.sgetc();
- VERIFY( c1 != c2 );
- VERIFY( c3 == c2 );
- VERIFY( c1 != c3 );
- VERIFY( strb_01.str() == str_01 );
- VERIFY( str_01.size() == strb_01.str().size() );
- //test for ios_base::out
- strmsz_2 = strb_03.in_avail();
- c4 = strb_03.sungetc();
- VERIFY( c4 == traits_type::eof() );
-
- // BUFFER MANAGEMENT & POSITIONING
- // sync
- // pubsync
- strb_01.pubsync();
- strb_02.pubsync();
- strb_03.pubsync();
-
- // setbuf
- // pubsetbuf(char_type* s, streamsize n)
- str_tmp = std::string("naaaah, go to cebu");
- strb_01.pubsetbuf(const_cast<char*> (str_tmp.c_str()), str_tmp.size());
- VERIFY( strb_01.str() == str_tmp );
- strb_01.pubsetbuf(0,0);
- VERIFY( strb_01.str() == str_tmp );
-
- // 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;
- strb_01.str(str_01); //in|out ("mykonos. . . or what?");
- strb_02.str(str_02); //in ("paris, or sainte-maxime?");
- strb_03.str(str_03); //out ("")
- //IN|OUT
- //beg
- pt_1 = strb_01.pubseekoff(2, std::ios_base::beg);
- off_1 = pt_1;
- VERIFY( off_1 >= 0 );
- c1 = strb_01.snextc(); //current in pointer +1
- VERIFY( c1 == 'o' );
- c2 = strb_01.sputc('x'); //test current out pointer
- str_tmp = std::string("myxonos. . . or what?");
- VERIFY( strb_01.str() == str_tmp );
- //cur
- pt_1 = strb_01.pubseekoff(2, std::ios_base::cur);
- off_1 = pt_1;
- VERIFY( off_1 == -1 ); // can't seekoff for in and out + cur in sstreams
- pt_1 = strb_01.pubseekoff(2, std::ios_base::cur, std::ios_base::in);
- off_1 = pt_1;
- pt_2 = strb_01.pubseekoff(2, std::ios_base::cur, std::ios_base::in);
- off_2 = pt_2;
- VERIFY( off_2 == off_1 + 2 );
- c1 = strb_01.snextc(); //current in pointer + 1
- VERIFY( c1 == ' ' );
- c2 = strb_01.sputc('x'); //test current out pointer
- str_tmp = std::string("myxxnos. . . or what?");
- VERIFY( strb_01.str() == str_tmp );
- //end
- pt_2 = strb_01.pubseekoff(2, std::ios_base::end);
- off_1 = pt_2;
- VERIFY( off_1 == -1 ); // not a valid position
- VERIFY( strb_01.str() == str_tmp );
- // end part two (from the filebuf tests)
- strb_01.pubseekoff(0, std::ios_base::end);
- strmsz_1 = strb_01.in_avail(); // 0 cuz at the end
- c1 = strb_01.sgetc();
- c2 = strb_01.sungetc();
- strmsz_2 = strb_01.in_avail(); // 1
- c3 = strb_01.sgetc();
- VERIFY( c1 != c2 );
- VERIFY( strmsz_2 != strmsz_1 );
- VERIFY( strmsz_2 == 1 );
- // end part three
- strmsz_1 = strb_01.str().size();
- strmsz_2 = strb_01.sputn(" ravi shankar meets carlos santana in LoHa", 90);
- strb_01.pubseekoff(0, std::ios_base::end);
- strb_01.sputc('<');
- str_tmp = strb_01.str();
- VERIFY( str_tmp.size() == strmsz_1 + strmsz_2 + 1 );
- // IN
- // OUT
-
- // seekpos
- // pubseekpos(pos_type sp, ios_base::openmode)
- // alters the stream position to sp
- strb_01.str(str_01); //in|out ("mykonos. . . or what?");
- strb_02.str(str_02); //in ("paris, or sainte-maxime?");
- strb_03.str(str_03); //out ("")
- //IN|OUT
- //beg
- pt_1 = strb_01.pubseekoff(2, std::ios_base::beg);
- off_1 = pt_1;
- VERIFY( off_1 >= 0 );
- pt_1 = strb_01.pubseekoff(0, std::ios_base::cur, std::ios_base::out);
- off_1 = pt_1;
- c1 = strb_01.snextc(); //current in pointer +1
- VERIFY( c1 == 'o' );
- c2 = strb_01.sputc('x'); //test current out pointer
- str_tmp = std::string("myxonos. . . or what?");
- VERIFY( strb_01.str() == str_tmp );
- strb_01.pubsync(); //resets pointers
- pt_2 = strb_01.pubseekpos(pt_1, std::ios_base::in|std::ios_base::out);
- off_2 = pt_2;
- VERIFY( off_1 == off_2 );
- c3 = strb_01.snextc(); //current in pointer +1
- VERIFY( c1 == c3 );
- c2 = strb_01.sputc('x'); //test current out pointer
- str_tmp = std::string("myxonos. . . or what?");
- VERIFY( strb_01.str() == str_tmp );
-
- // 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
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return test;
-}
-
-
-// libstdc++/3955 -- ios_base::app overwrites from the beginning
-bool test05()
-{
- bool test = true;
-
- std::ostringstream os ("foo");
- os << "bar";
-
- test = os.str() == "bar";
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return test;
-}
-
-bool test06()
-{
- bool test = true;
-
- std::ostringstream os ("foo", std::ios_base::app);
- os << "bar";
-
- test = os.str() == "foobar";
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return test;
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2003-02/msg00269.html
-// Growing and then seeking to ios_base::beg triggered a bug in str(),
-// which didn't notice the grow.
-bool test07()
-{
- bool test = true;
-
- std::stringbuf strb_01;
- strb_01.sputc('s');
- strb_01.pubseekoff(0, std::ios_base::beg);
- VERIFY( strb_01.str() == "s" );
-
- std::string str("strivi,");
- std::stringbuf strb_02(str);
- strb_02.pubseekoff(0, std::ios_base::end);
- strb_02.sputn(" no better!", 11);
- strb_02.pubseekoff(0, std::ios_base::beg);
- VERIFY( strb_02.str() == "strivi, no better!" );
-
-#ifdef DEBUG_ASSERT
- assert(test);
-#endif
-
- return test;
-}
-
-int main()
-{
- test01();
- test02();
- test03();
- test04();
- test05();
- test06();
- test07();
-
- return 0;
-}
-
-
-
-// more candy!!!
diff --git a/libstdc++-v3/testsuite/27_io/stringbuf_virtuals.cc b/libstdc++-v3/testsuite/27_io/stringbuf_virtuals.cc
deleted file mode 100644
index 40e95bae431..00000000000
--- a/libstdc++-v3/testsuite/27_io/stringbuf_virtuals.cc
+++ /dev/null
@@ -1,167 +0,0 @@
-// 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 <sstream>
-#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);
- stringbuf sbuf(ios_base::out);
-
- sbuf.pubsetbuf(buf, strlitsize);
- sbuf.sputn(strlit, strlitsize);
- VERIFY( std::strncmp(strlit, buf, strlitsize) != 0 );
-}
-
-void test02(std::stringbuf& 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);
- VERIFY( p == bad );
-
-
- // 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);
- VERIFY( p == bad );
-}
-
-// libstdc++/9322
-void test08()
-{
- using std::locale;
- bool test = true;
-
- locale loc;
- std::stringbuf 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 );
-}
-
-bool over_called;
-
-class Derived_stringbuf : public std::stringbuf
-{
-public:
- int_type overflow(int_type c)
- {
- over_called = true;
- return std::stringbuf::overflow(c);
- }
-
- const char_type* pub_epptr() const
- {
- return epptr();
- }
-
- const char_type* pub_pptr() const
- {
- return pptr();
- }
-};
-
-// libstdc++/9404
-void test09()
-{
- bool test = true;
-
- bool over_expected;
-
- // sputc
- Derived_stringbuf dsbuf_01;
- over_called = false;
- dsbuf_01.sputc('i');
- VERIFY( over_called );
- over_expected = dsbuf_01.pub_epptr() == dsbuf_01.pub_pptr();
- over_called = false;
- dsbuf_01.sputc('v');
- VERIFY( (!over_expected && !over_called)
- || (over_expected && over_called) );
- dsbuf_01.sputc('i');
- VERIFY( dsbuf_01.str() == "ivi" ); // Sanity check.
-
- // sputn
- Derived_stringbuf dsbuf_02;
- over_called = false;
- dsbuf_02.sputn("sonne's", 7);
- VERIFY( over_called );
- over_expected = dsbuf_02.pub_epptr() == dsbuf_02.pub_pptr();
- over_called = false;
- dsbuf_02.sputn(" peak", 5);
- VERIFY( (!over_expected && !over_called)
- || (over_expected && over_called) );
- VERIFY( dsbuf_02.str() == "sonne's peak" ); // Sanity check.
-}
-
-int main()
-{
- using namespace std;
- test01();
-
- // movie star, submarine scientist!
- stringbuf in1("Hedy Lamarr", ios_base::in);
- stringbuf in2(ios_base::in);
- stringbuf in3("", ios_base::in);
- test02(in1, true);
- test02(in2, false);
- test02(in3, false);
-
- __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test08);
- test09();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/27_io/stringstream_members.cc b/libstdc++-v3/testsuite/27_io/stringstream_members.cc
deleted file mode 100644
index 51635f72fd5..00000000000
--- a/libstdc++-v3/testsuite/27_io/stringstream_members.cc
+++ /dev/null
@@ -1,202 +0,0 @@
-// 2001-05-24 Benjamin Kosnik <bkoz@redhat.com>
-
-// Copyright (C) 2001, 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.
-
-// 27.7.6 member functions (stringstream_members)
-
-#include <sstream>
-#include <testsuite_hooks.h>
-
-void test01()
-{
- bool test = true;
- std::stringstream is01;
- const std::string str00;
- const std::string str01 = "123";
- std::string str02;
- const int i01 = 123;
- int a,b;
-
- std::ios_base::iostate state1, state2, statefail, stateeof;
- statefail = std::ios_base::failbit;
- stateeof = std::ios_base::eofbit;
-
- // string str() const
- str02 = is01.str();
- VERIFY( str00 == str02 );
-
- // void str(const basic_string&)
- is01.str(str01);
- str02 = is01.str();
- VERIFY( str01 == str02 );
- state1 = is01.rdstate();
- is01 >> a;
- state2 = is01.rdstate();
- VERIFY( a = i01 );
- // 22.2.2.1.2 num_get virtual functions
- // p 13
- // in any case, if stage 2 processing was terminated by the test for
- // in == end then err != ios_base::eofbit is performed.
- VERIFY( state1 != state2 );
- VERIFY( state2 == stateeof );
-
- is01.str(str01);
- is01 >> b;
- VERIFY( b != a );
- // as is01.good() is false, istream::sentry blocks extraction.
-
- is01.clear();
- state1 = is01.rdstate();
- is01 >> b;
- state2 = is01.rdstate();
- VERIFY( b == a );
- VERIFY( state1 != state2 );
- VERIFY( state2 == stateeof );
-
- #ifdef DEBUG_ASSERT
- assert(test);
-#endif
-}
-
-void
-redirect_buffer(std::ios& stream, std::streambuf* new_buf)
-{ stream.rdbuf(new_buf); }
-
-std::streambuf*
-active_buffer(std::ios& stream)
-{ return stream.rdbuf(); }
-
-// libstdc++/2832
-void test02()
-{
- bool test = true;
- const char* strlit01 = "fuck war";
- const char* strlit02 = "two less cars abstract riot crew, critical mass/SF";
- const std::string str00;
- const std::string str01(strlit01);
- std::string str02;
- std::stringbuf sbuf(str01);
- std::streambuf* pbasebuf0 = &sbuf;
-
- std::stringstream sstrm1;
- VERIFY( sstrm1.str() == str00 );
- // derived rdbuf() always returns original streambuf, even though
- // it's no longer associated with the stream.
- std::stringbuf* const buf1 = sstrm1.rdbuf();
- // base rdbuf() returns the currently associated streambuf
- std::streambuf* pbasebuf1 = active_buffer(sstrm1);
- redirect_buffer(sstrm1, &sbuf);
- std::stringbuf* const buf2 = sstrm1.rdbuf();
- std::streambuf* pbasebuf2 = active_buffer(sstrm1);
- VERIFY( buf1 == buf2 );
- VERIFY( pbasebuf1 != pbasebuf2 );
- VERIFY( pbasebuf2 == pbasebuf0 );
-
- // derived rdbuf() returns the original buf, so str() doesn't change.
- VERIFY( sstrm1.str() != str01 );
- VERIFY( sstrm1.str() == str00 );
- // however, casting the active streambuf to a stringbuf shows what's up:
- std::stringbuf* psbuf = dynamic_cast<std::stringbuf*>(pbasebuf2);
- str02 = psbuf->str();
- VERIFY( str02 == str01 );
-
- // How confusing and non-intuitive is this?
- // These semantics are a joke, a serious defect, and incredibly lame.
-}
-
-void
-test03()
-{
- bool test = true;
-
- //
- // 1: Automatic formatting of a compound string
- //
- int i = 1024;
- int *pi = &i;
- double d = 3.14159;
- double *pd = &d;
- std::string blank;
- std::ostringstream ostrst01;
- std::ostringstream ostrst02(blank);
-
- // No buffer, so should be created.
- ostrst01 << "i: " << i << " i's address: " << pi << "\n"
- << "d: " << d << " d's address: " << pd << std::endl;
- // Buffer, so existing buffer should be overwritten.
- ostrst02 << "i: " << i << " i's address: " << pi << "\n"
- << "d: " << d << " d's address: " << pd << std::endl;
-
- std::string msg01 = ostrst01.str();
- std::string msg02 = ostrst02.str();
- VERIFY( msg01 == msg02 );
- VERIFY( msg02 != blank );
-
- //
- // 2: istringstream
- //
- // extracts the stored ascii values, placing them in turn in the four vars
-#if 0
- int i2 = 0;
- //int* pi2 = &i2;
- void* pi2 = &i2;
- double d2 = 0.0;
- // double* pd2 = &d2;
- void* pd2 = &d2;
- std::istringstream istrst01(ostrst02.str());
-
- istrst01 >> i2 >> pi2 >> d2 >> pd2;
- //istrst01 >> i2;
- //istrst01 >> pi2;
- VERIFY( i2 == i );
- VERIFY( d2 == d );
- VERIFY( pd2 == pd );
- VERIFY( pi2 == pi );
-#endif
-
- // stringstream
- std::string str1("");
- std::string str3("this is a somewhat string");
- std::stringstream ss1(str1, std::ios_base::in|std::ios_base::out);
- std::stringstream ss2(str3, std::ios_base::in|std::ios_base::out);
-}
-
-// libstdc++/8466
-void test04()
-{
- bool test = true;
-
- const char* strlit00 = "orvieto";
- const std::string str00 = strlit00;
-
- std::ostringstream oss;
-
- oss.str(str00);
- oss << "cortona";
- VERIFY( str00 == strlit00 );
-}
-
-int main()
-{
- test01();
- test02();
- test03();
- test04();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base_types.cc b/libstdc++-v3/testsuite/27_io/types/1.cc
index 73d92c6e345..9ec9bb75755 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base_types.cc
+++ b/libstdc++-v3/testsuite/27_io/types/1.cc
@@ -19,7 +19,6 @@
// 27.4.2.1 - Types [lib.ios.types]
#include <ios>
-
#include <testsuite_hooks.h>
// libstdc++/7219
diff --git a/libstdc++-v3/testsuite/27_io/types/2.cc b/libstdc++-v3/testsuite/27_io/types/2.cc
new file mode 100644
index 00000000000..c64e20b78fb
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/types/2.cc
@@ -0,0 +1,40 @@
+// Copyright (C) 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.4.2.1 - Types [lib.ios.types]
+
+#include <ios>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ std::streamsize ssize;
+ std::streamoff soff;
+
+ // No signed/unsigned warnings.
+ long l = ssize;
+
+ // Wrapped in pos_type is EOF.
+ soff = -1;
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}