summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/27_io/basic_ostream
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/basic_ostream
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/basic_ostream')
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/1.cc48
-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.cc46
-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.cc65
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/exceptions/char/9561.cc65
-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.cc154
-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.cc71
-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.cc49
39 files changed, 3080 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/1.cc
new file mode 100644
index 00000000000..02401717813
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/1.cc
@@ -0,0 +1,48 @@
+// 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 }
+
+// libstdc++/7216
+void test01()
+{
+ // Check for required typedefs
+ typedef std::ostream 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_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/basic_ostream/cons/char/9827.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/cons/char/9827.cc
new file mode 100644
index 00000000000..7a4f26396d8
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/cons/char/9827.cc
@@ -0,0 +1,46 @@
+// 2003-02-24 Petur Runolfsson <peturr02 at ru dot is>
+
+// 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.
+
+#include <ostream>
+#include <streambuf>
+#include <testsuite_hooks.h>
+
+// libstdc++/9827
+class Buf : public std::streambuf
+{
+};
+
+void test01()
+{
+ using namespace std;
+ bool test = true;
+
+ Buf buf;
+ ostream stream(&buf);
+
+ stream << 1;
+ VERIFY(!stream.good());
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
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/basic_ostream/ends/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/ends/char/2.cc
new file mode 100644
index 00000000000..34de949e4bb
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/ends/char/2.cc
@@ -0,0 +1,65 @@
+// 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>
+
+// based vaguely on this:
+// http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00109.html
+void test02()
+{
+ using namespace std;
+ typedef ostringstream::int_type int_type;
+
+ bool test = true;
+ ostringstream osst_01;
+ const string str_00("herbie_hancock");
+ int_type len1 = str_00.size();
+ osst_01 << str_00;
+ VERIFY( osst_01.str().size() == len1 );
+
+ osst_01 << ends;
+
+ const string str_01("speak like a child");
+ int_type len2 = str_01.size();
+ osst_01 << str_01;
+ int_type len3 = osst_01.str().size();
+ VERIFY( len1 < len3 );
+ VERIFY( len3 == len1 + len2 + 1 );
+
+ osst_01 << ends;
+
+ const string str_02("+ inventions and dimensions");
+ int_type len4 = str_02.size();
+ osst_01 << str_02;
+ int_type len5 = osst_01.str().size();
+ VERIFY( len3 < len5 );
+ VERIFY( len5 == len3 + len4 + 1 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/exceptions/char/9561.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/exceptions/char/9561.cc
new file mode 100644
index 00000000000..3e3726cd398
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/exceptions/char/9561.cc
@@ -0,0 +1,65 @@
+// 2003-03-08 Jerry Quinn <jlquinn@optonline.net>
+
+// 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.
+
+#include <ostream>
+#include <streambuf>
+#include <testsuite_hooks.h>
+
+// libstdc++/9561
+struct foobar: std::exception { };
+
+struct buf: std::streambuf
+{
+ virtual int_type overflow (int_type) {
+ throw foobar ();
+ return -1;
+ }
+};
+
+void test01()
+{
+ using namespace std;
+ bool test = true;
+
+ buf b;
+ std::ostream strm (&b);
+ strm.exceptions (std::ios::badbit);
+
+ try {
+ strm << std::endl;
+ }
+ catch (foobar) {
+ // strm should throw foobar and not do anything else
+ VERIFY(strm.bad());
+ return;
+ }
+ catch (...) {
+ VERIFY(false);
+ return;
+ }
+
+ VERIFY(false);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
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/basic_ostream/inserters_other/char/4.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/4.cc
new file mode 100644
index 00000000000..1ba200aaca7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/4.cc
@@ -0,0 +1,154 @@
+// 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>
+
+class test_buffer_1 : public std::streambuf
+{
+public:
+ test_buffer_1(const std::string& s) : str(s), it(str.begin()) { }
+
+protected:
+ virtual int underflow() { return (it != str.end() ? *it : EOF); }
+ virtual int uflow() { return (it != str.end() ? *it++ : EOF); }
+
+private:
+ const std::string str;
+ std::string::const_iterator it;
+};
+
+
+class test_buffer_2 : public std::streambuf
+{
+public:
+ test_buffer_2(const std::string& s) : str(s), it(str.begin()) { }
+
+protected:
+ virtual int underflow() { return (it != str.end() ? *it : EOF); }
+ virtual int uflow() { return (it != str.end() ? *it++ : EOF); }
+ virtual std::streamsize showmanyc() { return std::distance(it, str.end()); }
+private:
+ const std::string str;
+ std::string::const_iterator it;
+};
+
+
+class test_buffer_3 : public std::streambuf
+{
+public:
+ test_buffer_3(const std::string& s) : str(s), it(str.begin()) { }
+
+protected:
+ virtual int underflow() { return (it != str.end() ? *it : EOF); }
+ virtual int uflow() { return (it != str.end() ? *it++ : EOF); }
+ virtual std::streamsize showmanyc()
+ {
+ std::streamsize ret = std::distance(it, str.end());
+ return ret > 0 ? ret : -1;
+ }
+private:
+ const std::string str;
+ std::string::const_iterator it;
+};
+
+class test_buffer_4 : public std::streambuf {
+public:
+ test_buffer_4(const std::string& s) : str(s), it(str.begin())
+ {
+ if (it != str.end()) {
+ buf[0] = *it++;
+ setg(buf, buf, buf+1);
+ }
+ }
+
+protected:
+ virtual int underflow() { return (it != str.end() ? *it : EOF); }
+ virtual int uflow() { return (it != str.end() ? *it++ : EOF); }
+ virtual std::streamsize showmanyc() {
+ std::streamsize ret = std::distance(it, str.end());
+ return ret > 0 ? ret : -1;
+ }
+private:
+ const std::string str;
+ std::string::const_iterator it;
+ char buf[1];
+};
+
+void test(const std::string& str, std::streambuf& buf)
+{
+ bool test = true;
+
+ std::ostringstream out;
+ std::istream in(&buf);
+
+ out << in.rdbuf();
+
+ if (out.str() != str)
+ VERIFY( false );
+}
+
+// libstdc++/6745
+// libstdc++/8071
+// libstdc++/8127
+// Jonathan Lennox <lennox@cs.columbia.edu>
+void test05()
+{
+ std::string string_a("Hello, world!");
+ std::string string_b("");
+
+ test_buffer_1 buf1a(string_a);
+ test_buffer_1 buf1b(string_b);
+
+ test_buffer_2 buf2a(string_a);
+ test_buffer_2 buf2b(string_b);
+
+ test_buffer_3 buf3a(string_a);
+ test_buffer_3 buf3b(string_b);
+
+ test_buffer_4 buf4a(string_a);
+ test_buffer_4 buf4b(string_b);
+
+ test(string_a, buf1a);
+ test(string_b, buf1b);
+
+ test(string_a, buf2a);
+ test(string_b, buf2b);
+
+ test(string_a, buf3a);
+ test(string_b, buf3b);
+
+ test(string_a, buf4a);
+ test(string_b, buf4b);
+}
+
+int
+main()
+{
+ 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/basic_ostream/sentry/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/2.cc
new file mode 100644
index 00000000000..4e7562cfd12
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/char/2.cc
@@ -0,0 +1,71 @@
+// 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++/9563
+struct buf: std::streambuf
+{
+ std::ios *io_;
+
+ buf (std::ios *io): io_ (io) { }
+
+ virtual int sync ()
+ {
+ io_->setstate (std::ios::failbit);
+ return 0;
+ }
+};
+
+void
+test02()
+{
+ bool test = true;
+
+ buf b(0);
+ std::ostream strm(&b);
+
+ buf tb(&strm);
+ std::ostream tied(&tb);
+
+ strm.tie(&tied);
+ std::ostream::sentry s(strm);
+
+ VERIFY( !s );
+}
+
+int main()
+{
+ 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/basic_ostream/tellp/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/2.cc
new file mode 100644
index 00000000000..e278daec21a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/tellp/char/2.cc
@@ -0,0 +1,49 @@
+// 2000-03-23 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,
+//
+
+#include <sstream>
+#include <ostream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+ bool test = true;
+
+ // tellp
+ ostringstream ost;
+ pos_type pos1;
+ pos1 = ost.tellp();
+ VERIFY( pos1 == pos_type(-1) );
+ ost << "RZA ";
+ pos1 = ost.tellp();
+ VERIFY( pos1 == pos_type(4) );
+ ost << "ghost dog: way of the samurai";
+ pos1 = ost.tellp();
+ VERIFY( pos1 == pos_type(33) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}