summaryrefslogtreecommitdiff
path: root/test/std/input.output
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-09-06 18:46:46 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-09-06 18:46:46 +0000
commit61b9a7258a7693d7f3674a5a1daf7b036ff1d382 (patch)
treeec41ed70ffca97240e76f9a78bb2dedba28f310c /test/std/input.output
parentf857581820d15e410e9945d2fcd5f7163be25a96 (diff)
Notes
Diffstat (limited to 'test/std/input.output')
-rw-r--r--test/std/input.output/file.streams/c.files/cinttypes.pass.cpp929
-rw-r--r--test/std/input.output/file.streams/c.files/cstdio.pass.cpp148
-rw-r--r--test/std/input.output/file.streams/c.files/gets.fail.cpp23
-rw-r--r--test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp15
-rw-r--r--test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/lit.local.cfg2
-rw-r--r--test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp15
-rw-r--r--test/std/input.output/file.streams/c.files/version_ccstdio.pass.cpp20
-rw-r--r--test/std/input.output/file.streams/c.files/version_cinttypes.pass.cpp20
-rw-r--r--test/std/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp54
-rw-r--r--test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp56
-rw-r--r--test/std/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp56
-rw-r--r--test/std/input.output/file.streams/fstreams/filebuf.cons/default.pass.cpp30
-rw-r--r--test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp54
-rw-r--r--test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp51
-rw-r--r--test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp142
-rw-r--r--test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp56
-rw-r--r--test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp66
-rw-r--r--test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.dat1
-rw-r--r--test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp121
-rw-r--r--test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow_utf8.dat1
-rw-r--r--test/std/input.output/file.streams/fstreams/filebuf/types.pass.cpp34
-rw-r--r--test/std/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp71
-rw-r--r--test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp50
-rw-r--r--test/std/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp72
-rw-r--r--test/std/input.output/file.streams/fstreams/fstream.cons/default.pass.cpp28
-rw-r--r--test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp48
-rw-r--r--test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp44
-rw-r--r--test/std/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp46
-rw-r--r--test/std/input.output/file.streams/fstreams/fstream.members/close.pass.cpp42
-rw-r--r--test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp50
-rw-r--r--test/std/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp50
-rw-r--r--test/std/input.output/file.streams/fstreams/fstream.members/rdbuf.pass.cpp30
-rw-r--r--test/std/input.output/file.streams/fstreams/fstream/types.pass.cpp34
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.assign/member_swap.pass.cpp42
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp40
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.assign/nonmember_swap.pass.cpp43
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.assign/test.dat1
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.assign/test2.dat1
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.cons/default.pass.cpp28
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp38
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp46
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp46
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.cons/test.dat1
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.members/close.pass.cpp38
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.members/open_pointer.pass.cpp46
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.members/open_string.pass.cpp46
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.members/rdbuf.pass.cpp32
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.members/test.dat1
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream/types.pass.cpp34
-rw-r--r--test/std/input.output/file.streams/fstreams/lit.local.cfg2
-rw-r--r--test/std/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp79
-rw-r--r--test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp52
-rw-r--r--test/std/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp80
-rw-r--r--test/std/input.output/file.streams/fstreams/ofstream.cons/default.pass.cpp28
-rw-r--r--test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp50
-rw-r--r--test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp46
-rw-r--r--test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp46
-rw-r--r--test/std/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp42
-rw-r--r--test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp58
-rw-r--r--test/std/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp58
-rw-r--r--test/std/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp36
-rw-r--r--test/std/input.output/file.streams/fstreams/ofstream/types.pass.cpp34
-rw-r--r--test/std/input.output/file.streams/fstreams/version.pass.cpp20
-rw-r--r--test/std/input.output/file.streams/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/input.output.general/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/iostream.format/ext.manip/get_money.pass.cpp75
-rw-r--r--test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp73
-rw-r--r--test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp91
-rw-r--r--test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp84
-rw-r--r--test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/member_swap.pass.cpp85
-rw-r--r--test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp92
-rw-r--r--test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp78
-rw-r--r--test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/streambuf.pass.cpp55
-rw-r--r--test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.dest/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/iostream.format/input.streams/iostreamclass/types.pass.cpp37
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp79
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp79
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp79
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp79
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp79
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp79
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp79
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp97
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp79
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp79
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp79
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp79
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp79
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.reqmts/tested_elsewhere.pass.cpp12
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/basic_ios.pass.cpp38
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/chart.pass.cpp87
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/ios_base.pass.cpp36
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/istream.pass.cpp38
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char.pass.cpp70
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp85
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp69
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char.pass.cpp70
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp85
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp85
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp79
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp63
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp100
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp103
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp99
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp99
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp88
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp89
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp83
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp83
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp76
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp34
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp69
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/putback.pass.cpp89
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp81
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp85
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp66
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp74
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp64
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/tellg.pass.cpp63
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/unget.pass.cpp81
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream/istream.assign/member_swap.pass.cpp85
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp92
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp78
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream/istream.cons/streambuf.pass.cpp55
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream/istream_sentry/ctor.pass.cpp128
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream/types.pass.cpp35
-rw-r--r--test/std/input.output/iostream.format/input.streams/version.pass.cpp20
-rw-r--r--test/std/input.output/iostream.format/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.assign/member_swap.pass.cpp85
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp92
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp74
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.cons/streambuf.pass.cpp53
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.reqmts/tested_elsewhere.pass.cpp12
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp91
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp83
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp83
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp83
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp83
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp83
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp83
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass84
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp91
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp83
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp83
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp83
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp83
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp83
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp88
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp88
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp88
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp88
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp88
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp88
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp88
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp88
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp88
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp88
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp70
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp61
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp69
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp69
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp80
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp71
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.manip/flush.pass.cpp58
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp72
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp.pass.cpp68
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp2.pass.cpp70
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.seeks/tellp.pass.cpp54
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.unformatted/flush.pass.cpp54
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp76
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp76
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream/types.pass.cpp35
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream_sentry/construct.pass.cpp61
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp75
-rw-r--r--test/std/input.output/iostream.format/output.streams/version.pass.cpp20
-rw-r--r--test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp219
-rw-r--r--test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp36
-rw-r--r--test/std/input.output/iostream.format/quoted.manip/quoted_traits.fail.cpp42
-rw-r--r--test/std/input.output/iostream.format/std.manip/resetiosflags.pass.cpp54
-rw-r--r--test/std/input.output/iostream.format/std.manip/setbase.pass.cpp74
-rw-r--r--test/std/input.output/iostream.format/std.manip/setfill.pass.cpp38
-rw-r--r--test/std/input.output/iostream.format/std.manip/setiosflags.pass.cpp54
-rw-r--r--test/std/input.output/iostream.format/std.manip/setprecision.pass.cpp50
-rw-r--r--test/std/input.output/iostream.format/std.manip/setw.pass.cpp50
-rw-r--r--test/std/input.output/iostream.format/std.manip/version.pass.cpp20
-rw-r--r--test/std/input.output/iostream.forward/iosfwd.pass.cpp142
-rw-r--r--test/std/input.output/iostream.forward/version.pass.cpp20
-rw-r--r--test/std/input.output/iostream.objects/narrow.stream.objects/cerr.pass.cpp29
-rw-r--r--test/std/input.output/iostream.objects/narrow.stream.objects/cin.pass.cpp34
-rw-r--r--test/std/input.output/iostream.objects/narrow.stream.objects/clog.pass.cpp23
-rw-r--r--test/std/input.output/iostream.objects/narrow.stream.objects/cout.pass.cpp29
-rw-r--r--test/std/input.output/iostream.objects/version.pass.cpp20
-rw-r--r--test/std/input.output/iostream.objects/wide.stream.objects/wcerr.pass.cpp29
-rw-r--r--test/std/input.output/iostream.objects/wide.stream.objects/wcin.pass.cpp34
-rw-r--r--test/std/input.output/iostream.objects/wide.stream.objects/wclog.pass.cpp23
-rw-r--r--test/std/input.output/iostream.objects/wide.stream.objects/wcout.pass.cpp25
-rw-r--r--test/std/input.output/iostreams.base/fpos/fpos.members/state.pass.cpp24
-rw-r--r--test/std/input.output/iostreams.base/fpos/fpos.operations/addition.pass.cpp28
-rw-r--r--test/std/input.output/iostreams.base/fpos/fpos.operations/ctor_int.pass.cpp24
-rw-r--r--test/std/input.output/iostreams.base/fpos/fpos.operations/difference.pass.cpp26
-rw-r--r--test/std/input.output/iostreams.base/fpos/fpos.operations/eq_int.pass.cpp26
-rw-r--r--test/std/input.output/iostreams.base/fpos/fpos.operations/offset.pass.cpp25
-rw-r--r--test/std/input.output/iostreams.base/fpos/fpos.operations/streamsize.pass.cpp24
-rw-r--r--test/std/input.output/iostreams.base/fpos/fpos.operations/subtraction.pass.cpp28
-rw-r--r--test/std/input.output/iostreams.base/fpos/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags.pass.cpp33
-rw-r--r--test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags_fmtflags.pass.cpp36
-rw-r--r--test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision.pass.cpp33
-rw-r--r--test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision_streamsize.pass.cpp36
-rw-r--r--test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags.pass.cpp36
-rw-r--r--test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags_mask.pass.cpp36
-rw-r--r--test/std/input.output/iostreams.base/ios.base/fmtflags.state/unsetf_mask.pass.cpp35
-rw-r--r--test/std/input.output/iostreams.base/ios.base/fmtflags.state/width.pass.cpp33
-rw-r--r--test/std/input.output/iostreams.base/ios.base/fmtflags.state/width_streamsize.pass.cpp36
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.base.callback/register_callback.pass.cpp54
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.base.cons/dtor.pass.cpp86
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.base.locales/getloc.pass.cpp34
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.base.locales/imbue.pass.cpp89
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.base.storage/iword.pass.cpp42
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.base.storage/pword.pass.cpp43
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.base.storage/xalloc.pass.cpp26
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.members.static/sync_with_stdio.pass.cpp27
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.types/ios_Init/tested_elsewhere.pass.cpp12
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp39
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp39
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.types/ios_fmtflags/fmtflags.pass.cpp81
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.types/ios_iostate/iostate.pass.cpp36
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.types/ios_openmode/openmode.pass.cpp42
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.types/ios_seekdir/seekdir.pass.cpp26
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.types/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/iostreams.base/ios.base/nothing_to_do.pass.cpp16
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.cons/ctor_streambuf.pass.cpp48
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp190
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/fill.pass.cpp23
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/fill_char_type.pass.cpp26
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/imbue.pass.cpp101
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/move.pass.cpp140
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/narow.pass.cpp24
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf.pass.cpp31
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf_streambuf.pass.cpp34
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp57
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp168
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/tie.pass.cpp23
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/tie_ostream.pass.cpp26
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/widen.pass.cpp23
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/bad.pass.cpp41
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/bool.pass.cpp25
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp65
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/eof.pass.cpp37
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/exceptions.pass.cpp33
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp48
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/fail.pass.cpp41
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/good.pass.cpp35
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/not.pass.cpp25
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/rdstate.pass.cpp25
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp64
-rw-r--r--test/std/input.output/iostreams.base/ios/types.pass.cpp33
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/internal.pass.cpp29
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/left.pass.cpp29
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/right.pass.cpp29
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/dec.pass.cpp29
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/hex.pass.cpp29
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/oct.pass.cpp29
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/error.reporting/iostream_category.pass.cpp23
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/error.reporting/make_error_code.pass.cpp24
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/error.reporting/make_error_condition.pass.cpp24
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/defaultfloat.pass.cpp30
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/fixed.pass.cpp29
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/hexfloat.pass.cpp30
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/scientific.pass.cpp29
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/boolalpha.pass.cpp29
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noboolalpha.pass.cpp30
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowbase.pass.cpp30
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowpoint.pass.cpp30
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowpos.pass.cpp30
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noskipws.pass.cpp30
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/nounitbuf.pass.cpp30
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/nouppercase.pass.cpp30
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showbase.pass.cpp29
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showpoint.pass.cpp29
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showpos.pass.cpp29
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/skipws.pass.cpp29
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/unitbuf.pass.cpp29
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/uppercase.pass.cpp29
-rw-r--r--test/std/input.output/iostreams.base/std.ios.manip/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/iostreams.base/stream.types/streamoff.pass.cpp21
-rw-r--r--test/std/input.output/iostreams.base/stream.types/streamsize.pass.cpp21
-rw-r--r--test/std/input.output/iostreams.base/version.pass.cpp20
-rw-r--r--test/std/input.output/iostreams.requirements/iostream.limits.imbue/tested_elsewhere.pass.cpp12
-rw-r--r--test/std/input.output/iostreams.requirements/iostreams.limits.pos/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/iostreams.requirements/iostreams.threadsafety/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/iostreams.requirements/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/stream.buffers/streambuf.reqts/tested_elsewhere.pass.cpp12
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp25
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp84
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.fail.cpp22
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.pass.cpp56
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekoff.pass.cpp35
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekpos.pass.cpp34
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsetbuf.pass.cpp33
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsync.pass.cpp33
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.locales/locales.pass.cpp52
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/in_avail.pass.cpp52
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sbumpc.pass.cpp56
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetc.pass.cpp56
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp41
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/snextc.pass.cpp56
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp56
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp56
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp63
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp41
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.protected/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp91
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp101
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/gbump.pass.cpp59
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/setg.pass.cpp49
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump.pass.cpp61
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/setp.pass.cpp49
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.buffer/tested_elsewhere.pass.cpp12
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/showmanyc.pass.cpp33
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/uflow.pass.cpp33
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/underflow.pass.cpp30
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp41
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.locales/nothing_to_do.pass.cpp12
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.pass.cpp32
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/overflow.pass.cpp30
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.pass.cpp44
-rw-r--r--test/std/input.output/stream.buffers/streambuf/types.pass.cpp39
-rw-r--r--test/std/input.output/stream.buffers/version.pass.cpp20
-rw-r--r--test/std/input.output/string.streams/istringstream/istringstream.assign/member_swap.pass.cpp56
-rw-r--r--test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp86
-rw-r--r--test/std/input.output/string.streams/istringstream/istringstream.assign/nonmember_swap.pass.cpp59
-rw-r--r--test/std/input.output/string.streams/istringstream/istringstream.cons/default.pass.cpp46
-rw-r--r--test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp48
-rw-r--r--test/std/input.output/string.streams/istringstream/istringstream.cons/string.pass.cpp67
-rw-r--r--test/std/input.output/string.streams/istringstream/istringstream.members/str.pass.cpp56
-rw-r--r--test/std/input.output/string.streams/istringstream/types.pass.cpp36
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.pass.cpp48
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp46
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.pass.cpp48
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.pass.cpp46
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp44
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp59
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.members/str.pass.cpp52
-rw-r--r--test/std/input.output/string.streams/ostringstream/types.pass.cpp36
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.assign/member_swap.pass.cpp64
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.assign/move.pass.cpp58
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.assign/nonmember_swap.pass.cpp66
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp30
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.cons/move.pass.cpp52
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.pass.cpp47
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.members/str.pass.cpp34
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp97
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp92
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp143
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekpos.pass.cpp77
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/setbuf.pass.cpp32
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/underflow.pass.cpp70
-rw-r--r--test/std/input.output/string.streams/stringbuf/types.pass.cpp36
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/default.pass.cpp46
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/move.pass.cpp52
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp37
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/string.pass.cpp49
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/stringstream.assign/member_swap.pass.cpp56
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp54
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/stringstream.assign/nonmember_swap.pass.cpp59
-rw-r--r--test/std/input.output/string.streams/stringstream.members/str.pass.cpp62
-rw-r--r--test/std/input.output/string.streams/stringstream/types.pass.cpp36
-rw-r--r--test/std/input.output/string.streams/version.pass.cpp20
374 files changed, 20123 insertions, 0 deletions
diff --git a/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp b/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp
new file mode 100644
index 0000000000000..4cb2c4c2f448e
--- /dev/null
+++ b/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp
@@ -0,0 +1,929 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// test <cinttypes>
+
+#include <cinttypes>
+#include <type_traits>
+
+#ifndef INT8_MIN
+#error INT8_MIN not defined
+#endif
+
+#ifndef INT16_MIN
+#error INT16_MIN not defined
+#endif
+
+#ifndef INT32_MIN
+#error INT32_MIN not defined
+#endif
+
+#ifndef INT64_MIN
+#error INT64_MIN not defined
+#endif
+
+#ifndef INT8_MAX
+#error INT8_MAX not defined
+#endif
+
+#ifndef INT16_MAX
+#error INT16_MAX not defined
+#endif
+
+#ifndef INT32_MAX
+#error INT32_MAX not defined
+#endif
+
+#ifndef INT64_MAX
+#error INT64_MAX not defined
+#endif
+
+#ifndef UINT8_MAX
+#error UINT8_MAX not defined
+#endif
+
+#ifndef UINT16_MAX
+#error UINT16_MAX not defined
+#endif
+
+#ifndef UINT32_MAX
+#error UINT32_MAX not defined
+#endif
+
+#ifndef UINT64_MAX
+#error UINT64_MAX not defined
+#endif
+
+#ifndef INT_LEAST8_MIN
+#error INT_LEAST8_MIN not defined
+#endif
+
+#ifndef INT_LEAST16_MIN
+#error INT_LEAST16_MIN not defined
+#endif
+
+#ifndef INT_LEAST32_MIN
+#error INT_LEAST32_MIN not defined
+#endif
+
+#ifndef INT_LEAST64_MIN
+#error INT_LEAST64_MIN not defined
+#endif
+
+#ifndef INT_LEAST8_MAX
+#error INT_LEAST8_MAX not defined
+#endif
+
+#ifndef INT_LEAST16_MAX
+#error INT_LEAST16_MAX not defined
+#endif
+
+#ifndef INT_LEAST32_MAX
+#error INT_LEAST32_MAX not defined
+#endif
+
+#ifndef INT_LEAST64_MAX
+#error INT_LEAST64_MAX not defined
+#endif
+
+#ifndef UINT_LEAST8_MAX
+#error UINT_LEAST8_MAX not defined
+#endif
+
+#ifndef UINT_LEAST16_MAX
+#error UINT_LEAST16_MAX not defined
+#endif
+
+#ifndef UINT_LEAST32_MAX
+#error UINT_LEAST32_MAX not defined
+#endif
+
+#ifndef UINT_LEAST64_MAX
+#error UINT_LEAST64_MAX not defined
+#endif
+
+#ifndef INT_FAST8_MIN
+#error INT_FAST8_MIN not defined
+#endif
+
+#ifndef INT_FAST16_MIN
+#error INT_FAST16_MIN not defined
+#endif
+
+#ifndef INT_FAST32_MIN
+#error INT_FAST32_MIN not defined
+#endif
+
+#ifndef INT_FAST64_MIN
+#error INT_FAST64_MIN not defined
+#endif
+
+#ifndef INT_FAST8_MAX
+#error INT_FAST8_MAX not defined
+#endif
+
+#ifndef INT_FAST16_MAX
+#error INT_FAST16_MAX not defined
+#endif
+
+#ifndef INT_FAST32_MAX
+#error INT_FAST32_MAX not defined
+#endif
+
+#ifndef INT_FAST64_MAX
+#error INT_FAST64_MAX not defined
+#endif
+
+#ifndef UINT_FAST8_MAX
+#error UINT_FAST8_MAX not defined
+#endif
+
+#ifndef UINT_FAST16_MAX
+#error UINT_FAST16_MAX not defined
+#endif
+
+#ifndef UINT_FAST32_MAX
+#error UINT_FAST32_MAX not defined
+#endif
+
+#ifndef UINT_FAST64_MAX
+#error UINT_FAST64_MAX not defined
+#endif
+
+#ifndef INTPTR_MIN
+#error INTPTR_MIN not defined
+#endif
+
+#ifndef INTPTR_MAX
+#error INTPTR_MAX not defined
+#endif
+
+#ifndef UINTPTR_MAX
+#error UINTPTR_MAX not defined
+#endif
+
+#ifndef INTMAX_MIN
+#error INTMAX_MIN not defined
+#endif
+
+#ifndef INTMAX_MAX
+#error INTMAX_MAX not defined
+#endif
+
+#ifndef UINTMAX_MAX
+#error UINTMAX_MAX not defined
+#endif
+
+#ifndef PTRDIFF_MIN
+#error PTRDIFF_MIN not defined
+#endif
+
+#ifndef PTRDIFF_MAX
+#error PTRDIFF_MAX not defined
+#endif
+
+#ifndef SIG_ATOMIC_MIN
+#error SIG_ATOMIC_MIN not defined
+#endif
+
+#ifndef SIG_ATOMIC_MAX
+#error SIG_ATOMIC_MAX not defined
+#endif
+
+#ifndef SIZE_MAX
+#error SIZE_MAX not defined
+#endif
+
+#ifndef WCHAR_MIN
+#error WCHAR_MIN not defined
+#endif
+
+#ifndef WCHAR_MAX
+#error WCHAR_MAX not defined
+#endif
+
+#ifndef WINT_MIN
+#error WINT_MIN not defined
+#endif
+
+#ifndef WINT_MAX
+#error WINT_MAX not defined
+#endif
+
+#ifndef INT8_C
+#error INT8_C not defined
+#endif
+
+#ifndef INT16_C
+#error INT16_C not defined
+#endif
+
+#ifndef INT32_C
+#error INT32_C not defined
+#endif
+
+#ifndef INT64_C
+#error INT64_C not defined
+#endif
+
+#ifndef UINT8_C
+#error UINT8_C not defined
+#endif
+
+#ifndef UINT16_C
+#error UINT16_C not defined
+#endif
+
+#ifndef UINT32_C
+#error UINT32_C not defined
+#endif
+
+#ifndef UINT64_C
+#error UINT64_C not defined
+#endif
+
+#ifndef INTMAX_C
+#error INTMAX_C not defined
+#endif
+
+#ifndef UINTMAX_C
+#error UINTMAX_C not defined
+#endif
+
+#ifndef PRId8
+#error PRId8 not defined
+#endif
+
+#ifndef PRId16
+#error PRId16 not defined
+#endif
+
+#ifndef PRId32
+#error PRId32 not defined
+#endif
+
+#ifndef PRId64
+#error PRId64 not defined
+#endif
+
+#ifndef PRIdLEAST8
+#error PRIdLEAST8 not defined
+#endif
+
+#ifndef PRIdLEAST16
+#error PRIdLEAST16 not defined
+#endif
+
+#ifndef PRIdLEAST32
+#error PRIdLEAST32 not defined
+#endif
+
+#ifndef PRIdLEAST64
+#error PRIdLEAST64 not defined
+#endif
+
+#ifndef PRIdFAST8
+#error PRIdFAST8 not defined
+#endif
+
+#ifndef PRIdFAST16
+#error PRIdFAST16 not defined
+#endif
+
+#ifndef PRIdFAST32
+#error PRIdFAST32 not defined
+#endif
+
+#ifndef PRIdFAST64
+#error PRIdFAST64 not defined
+#endif
+
+#ifndef PRIdMAX
+#error PRIdMAX not defined
+#endif
+
+#ifndef PRIdPTR
+#error PRIdPTR not defined
+#endif
+
+#ifndef PRIi8
+#error PRIi8 not defined
+#endif
+
+#ifndef PRIi16
+#error PRIi16 not defined
+#endif
+
+#ifndef PRIi32
+#error PRIi32 not defined
+#endif
+
+#ifndef PRIi64
+#error PRIi64 not defined
+#endif
+
+#ifndef PRIiLEAST8
+#error PRIiLEAST8 not defined
+#endif
+
+#ifndef PRIiLEAST16
+#error PRIiLEAST16 not defined
+#endif
+
+#ifndef PRIiLEAST32
+#error PRIiLEAST32 not defined
+#endif
+
+#ifndef PRIiLEAST64
+#error PRIiLEAST64 not defined
+#endif
+
+#ifndef PRIiFAST8
+#error PRIiFAST8 not defined
+#endif
+
+#ifndef PRIiFAST16
+#error PRIiFAST16 not defined
+#endif
+
+#ifndef PRIiFAST32
+#error PRIiFAST32 not defined
+#endif
+
+#ifndef PRIiFAST64
+#error PRIiFAST64 not defined
+#endif
+
+#ifndef PRIiMAX
+#error PRIiMAX not defined
+#endif
+
+#ifndef PRIiPTR
+#error PRIiPTR not defined
+#endif
+
+#ifndef PRIo8
+#error PRIo8 not defined
+#endif
+
+#ifndef PRIo16
+#error PRIo16 not defined
+#endif
+
+#ifndef PRIo32
+#error PRIo32 not defined
+#endif
+
+#ifndef PRIo64
+#error PRIo64 not defined
+#endif
+
+#ifndef PRIoLEAST8
+#error PRIoLEAST8 not defined
+#endif
+
+#ifndef PRIoLEAST16
+#error PRIoLEAST16 not defined
+#endif
+
+#ifndef PRIoLEAST32
+#error PRIoLEAST32 not defined
+#endif
+
+#ifndef PRIoLEAST64
+#error PRIoLEAST64 not defined
+#endif
+
+#ifndef PRIoFAST8
+#error PRIoFAST8 not defined
+#endif
+
+#ifndef PRIoFAST16
+#error PRIoFAST16 not defined
+#endif
+
+#ifndef PRIoFAST32
+#error PRIoFAST32 not defined
+#endif
+
+#ifndef PRIoFAST64
+#error PRIoFAST64 not defined
+#endif
+
+#ifndef PRIoMAX
+#error PRIoMAX not defined
+#endif
+
+#ifndef PRIoPTR
+#error PRIoPTR not defined
+#endif
+
+#ifndef PRIu8
+#error PRIu8 not defined
+#endif
+
+#ifndef PRIu16
+#error PRIu16 not defined
+#endif
+
+#ifndef PRIu32
+#error PRIu32 not defined
+#endif
+
+#ifndef PRIu64
+#error PRIu64 not defined
+#endif
+
+#ifndef PRIuLEAST8
+#error PRIuLEAST8 not defined
+#endif
+
+#ifndef PRIuLEAST16
+#error PRIuLEAST16 not defined
+#endif
+
+#ifndef PRIuLEAST32
+#error PRIuLEAST32 not defined
+#endif
+
+#ifndef PRIuLEAST64
+#error PRIuLEAST64 not defined
+#endif
+
+#ifndef PRIuFAST8
+#error PRIuFAST8 not defined
+#endif
+
+#ifndef PRIuFAST16
+#error PRIuFAST16 not defined
+#endif
+
+#ifndef PRIuFAST32
+#error PRIuFAST32 not defined
+#endif
+
+#ifndef PRIuFAST64
+#error PRIuFAST64 not defined
+#endif
+
+#ifndef PRIuMAX
+#error PRIuMAX not defined
+#endif
+
+#ifndef PRIuPTR
+#error PRIuPTR not defined
+#endif
+
+#ifndef PRIx8
+#error PRIx8 not defined
+#endif
+
+#ifndef PRIx16
+#error PRIx16 not defined
+#endif
+
+#ifndef PRIx32
+#error PRIx32 not defined
+#endif
+
+#ifndef PRIx64
+#error PRIx64 not defined
+#endif
+
+#ifndef PRIxLEAST8
+#error PRIxLEAST8 not defined
+#endif
+
+#ifndef PRIxLEAST16
+#error PRIxLEAST16 not defined
+#endif
+
+#ifndef PRIxLEAST32
+#error PRIxLEAST32 not defined
+#endif
+
+#ifndef PRIxLEAST64
+#error PRIxLEAST64 not defined
+#endif
+
+#ifndef PRIxFAST8
+#error PRIxFAST8 not defined
+#endif
+
+#ifndef PRIxFAST16
+#error PRIxFAST16 not defined
+#endif
+
+#ifndef PRIxFAST32
+#error PRIxFAST32 not defined
+#endif
+
+#ifndef PRIxFAST64
+#error PRIxFAST64 not defined
+#endif
+
+#ifndef PRIxMAX
+#error PRIxMAX not defined
+#endif
+
+#ifndef PRIxPTR
+#error PRIxPTR not defined
+#endif
+
+#ifndef PRIX8
+#error PRIX8 not defined
+#endif
+
+#ifndef PRIX16
+#error PRIX16 not defined
+#endif
+
+#ifndef PRIX32
+#error PRIX32 not defined
+#endif
+
+#ifndef PRIX64
+#error PRIX64 not defined
+#endif
+
+#ifndef PRIXLEAST8
+#error PRIXLEAST8 not defined
+#endif
+
+#ifndef PRIXLEAST16
+#error PRIXLEAST16 not defined
+#endif
+
+#ifndef PRIXLEAST32
+#error PRIXLEAST32 not defined
+#endif
+
+#ifndef PRIXLEAST64
+#error PRIXLEAST64 not defined
+#endif
+
+#ifndef PRIXFAST8
+#error PRIXFAST8 not defined
+#endif
+
+#ifndef PRIXFAST16
+#error PRIXFAST16 not defined
+#endif
+
+#ifndef PRIXFAST32
+#error PRIXFAST32 not defined
+#endif
+
+#ifndef PRIXFAST64
+#error PRIXFAST64 not defined
+#endif
+
+#ifndef PRIXMAX
+#error PRIXMAX not defined
+#endif
+
+#ifndef PRIXPTR
+#error PRIXPTR not defined
+#endif
+
+#ifndef SCNd8
+#error SCNd8 not defined
+#endif
+
+#ifndef SCNd16
+#error SCNd16 not defined
+#endif
+
+#ifndef SCNd32
+#error SCNd32 not defined
+#endif
+
+#ifndef SCNd64
+#error SCNd64 not defined
+#endif
+
+#ifndef SCNdLEAST8
+#error SCNdLEAST8 not defined
+#endif
+
+#ifndef SCNdLEAST16
+#error SCNdLEAST16 not defined
+#endif
+
+#ifndef SCNdLEAST32
+#error SCNdLEAST32 not defined
+#endif
+
+#ifndef SCNdLEAST64
+#error SCNdLEAST64 not defined
+#endif
+
+#ifndef SCNdFAST8
+#error SCNdFAST8 not defined
+#endif
+
+#ifndef SCNdFAST16
+#error SCNdFAST16 not defined
+#endif
+
+#ifndef SCNdFAST32
+#error SCNdFAST32 not defined
+#endif
+
+#ifndef SCNdFAST64
+#error SCNdFAST64 not defined
+#endif
+
+#ifndef SCNdMAX
+#error SCNdMAX not defined
+#endif
+
+#ifndef SCNdPTR
+#error SCNdPTR not defined
+#endif
+
+#ifndef SCNi8
+#error SCNi8 not defined
+#endif
+
+#ifndef SCNi16
+#error SCNi16 not defined
+#endif
+
+#ifndef SCNi32
+#error SCNi32 not defined
+#endif
+
+#ifndef SCNi64
+#error SCNi64 not defined
+#endif
+
+#ifndef SCNiLEAST8
+#error SCNiLEAST8 not defined
+#endif
+
+#ifndef SCNiLEAST16
+#error SCNiLEAST16 not defined
+#endif
+
+#ifndef SCNiLEAST32
+#error SCNiLEAST32 not defined
+#endif
+
+#ifndef SCNiLEAST64
+#error SCNiLEAST64 not defined
+#endif
+
+#ifndef SCNiFAST8
+#error SCNiFAST8 not defined
+#endif
+
+#ifndef SCNiFAST16
+#error SCNiFAST16 not defined
+#endif
+
+#ifndef SCNiFAST32
+#error SCNiFAST32 not defined
+#endif
+
+#ifndef SCNiFAST64
+#error SCNiFAST64 not defined
+#endif
+
+#ifndef SCNiMAX
+#error SCNiMAX not defined
+#endif
+
+#ifndef SCNiPTR
+#error SCNiPTR not defined
+#endif
+
+#ifndef SCNo8
+#error SCNo8 not defined
+#endif
+
+#ifndef SCNo16
+#error SCNo16 not defined
+#endif
+
+#ifndef SCNo32
+#error SCNo32 not defined
+#endif
+
+#ifndef SCNo64
+#error SCNo64 not defined
+#endif
+
+#ifndef SCNoLEAST8
+#error SCNoLEAST8 not defined
+#endif
+
+#ifndef SCNoLEAST16
+#error SCNoLEAST16 not defined
+#endif
+
+#ifndef SCNoLEAST32
+#error SCNoLEAST32 not defined
+#endif
+
+#ifndef SCNoLEAST64
+#error SCNoLEAST64 not defined
+#endif
+
+#ifndef SCNoFAST8
+#error SCNoFAST8 not defined
+#endif
+
+#ifndef SCNoFAST16
+#error SCNoFAST16 not defined
+#endif
+
+#ifndef SCNoFAST32
+#error SCNoFAST32 not defined
+#endif
+
+#ifndef SCNoFAST64
+#error SCNoFAST64 not defined
+#endif
+
+#ifndef SCNoMAX
+#error SCNoMAX not defined
+#endif
+
+#ifndef SCNoPTR
+#error SCNoPTR not defined
+#endif
+
+#ifndef SCNu8
+#error SCNu8 not defined
+#endif
+
+#ifndef SCNu16
+#error SCNu16 not defined
+#endif
+
+#ifndef SCNu32
+#error SCNu32 not defined
+#endif
+
+#ifndef SCNu64
+#error SCNu64 not defined
+#endif
+
+#ifndef SCNuLEAST8
+#error SCNuLEAST8 not defined
+#endif
+
+#ifndef SCNuLEAST16
+#error SCNuLEAST16 not defined
+#endif
+
+#ifndef SCNuLEAST32
+#error SCNuLEAST32 not defined
+#endif
+
+#ifndef SCNuLEAST64
+#error SCNuLEAST64 not defined
+#endif
+
+#ifndef SCNuFAST8
+#error SCNuFAST8 not defined
+#endif
+
+#ifndef SCNuFAST16
+#error SCNuFAST16 not defined
+#endif
+
+#ifndef SCNuFAST32
+#error SCNuFAST32 not defined
+#endif
+
+#ifndef SCNuFAST64
+#error SCNuFAST64 not defined
+#endif
+
+#ifndef SCNuMAX
+#error SCNuMAX not defined
+#endif
+
+#ifndef SCNuPTR
+#error SCNuPTR not defined
+#endif
+
+#ifndef SCNx8
+#error SCNx8 not defined
+#endif
+
+#ifndef SCNx16
+#error SCNx16 not defined
+#endif
+
+#ifndef SCNx32
+#error SCNx32 not defined
+#endif
+
+#ifndef SCNx64
+#error SCNx64 not defined
+#endif
+
+#ifndef SCNxLEAST8
+#error SCNxLEAST8 not defined
+#endif
+
+#ifndef SCNxLEAST16
+#error SCNxLEAST16 not defined
+#endif
+
+#ifndef SCNxLEAST32
+#error SCNxLEAST32 not defined
+#endif
+
+#ifndef SCNxLEAST64
+#error SCNxLEAST64 not defined
+#endif
+
+#ifndef SCNxFAST8
+#error SCNxFAST8 not defined
+#endif
+
+#ifndef SCNxFAST16
+#error SCNxFAST16 not defined
+#endif
+
+#ifndef SCNxFAST32
+#error SCNxFAST32 not defined
+#endif
+
+#ifndef SCNxFAST64
+#error SCNxFAST64 not defined
+#endif
+
+#ifndef SCNxMAX
+#error SCNxMAX not defined
+#endif
+
+#ifndef SCNxPTR
+#error SCNxPTR not defined
+#endif
+
+int main()
+{
+ {
+ std::int8_t i1 = 0;
+ std::int16_t i2 = 0;
+ std::int32_t i3 = 0;
+ std::int64_t i4 = 0;
+ }
+ {
+ std::uint8_t i1 = 0;
+ std::uint16_t i2 = 0;
+ std::uint32_t i3 = 0;
+ std::uint64_t i4 = 0;
+ }
+ {
+ std::int_least8_t i1 = 0;
+ std::int_least16_t i2 = 0;
+ std::int_least32_t i3 = 0;
+ std::int_least64_t i4 = 0;
+ }
+ {
+ std::uint_least8_t i1 = 0;
+ std::uint_least16_t i2 = 0;
+ std::uint_least32_t i3 = 0;
+ std::uint_least64_t i4 = 0;
+ }
+ {
+ std::int_fast8_t i1 = 0;
+ std::int_fast16_t i2 = 0;
+ std::int_fast32_t i3 = 0;
+ std::int_fast64_t i4 = 0;
+ }
+ {
+ std::uint_fast8_t i1 = 0;
+ std::uint_fast16_t i2 = 0;
+ std::uint_fast32_t i3 = 0;
+ std::uint_fast64_t i4 = 0;
+ }
+ {
+ std::intptr_t i1 = 0;
+ std::uintptr_t i2 = 0;
+ std::intmax_t i3 = 0;
+ std::uintmax_t i4 = 0;
+ }
+ {
+ std::imaxdiv_t i1 = {0};
+ }
+ std::intmax_t i = 0;
+ static_assert((std::is_same<decltype(std::imaxabs(i)), std::intmax_t>::value), "");
+ static_assert((std::is_same<decltype(std::imaxdiv(i, i)), std::imaxdiv_t>::value), "");
+ static_assert((std::is_same<decltype(std::strtoimax("", (char**)0, 0)), std::intmax_t>::value), "");
+ static_assert((std::is_same<decltype(std::strtoumax("", (char**)0, 0)), std::uintmax_t>::value), "");
+ static_assert((std::is_same<decltype(std::wcstoimax(L"", (wchar_t**)0, 0)), std::intmax_t>::value), "");
+ static_assert((std::is_same<decltype(std::wcstoumax(L"", (wchar_t**)0, 0)), std::uintmax_t>::value), "");
+}
diff --git a/test/std/input.output/file.streams/c.files/cstdio.pass.cpp b/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
new file mode 100644
index 0000000000000..ec4ad8a3bbcad
--- /dev/null
+++ b/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
@@ -0,0 +1,148 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// test <cstdio>
+
+#include <cstdio>
+#include <type_traits>
+
+#ifndef BUFSIZ
+#error BUFSIZ not defined
+#endif
+
+#ifndef EOF
+#error EOF not defined
+#endif
+
+#ifndef FILENAME_MAX
+#error FILENAME_MAX not defined
+#endif
+
+#ifndef FOPEN_MAX
+#error FOPEN_MAX not defined
+#endif
+
+#ifndef L_tmpnam
+#error L_tmpnam not defined
+#endif
+
+#ifndef NULL
+#error NULL not defined
+#endif
+
+#ifndef SEEK_CUR
+#error SEEK_CUR not defined
+#endif
+
+#ifndef SEEK_END
+#error SEEK_END not defined
+#endif
+
+#ifndef SEEK_SET
+#error SEEK_SET not defined
+#endif
+
+#ifndef TMP_MAX
+#error TMP_MAX not defined
+#endif
+
+#ifndef _IOFBF
+#error _IOFBF not defined
+#endif
+
+#ifndef _IOLBF
+#error _IOLBF not defined
+#endif
+
+#ifndef _IONBF
+#error _IONBF not defined
+#endif
+
+#ifndef stderr
+#error stderr not defined
+#endif
+
+#ifndef stdin
+#error stdin not defined
+#endif
+
+#ifndef stdout
+#error stdout not defined
+#endif
+
+#include <cstdarg>
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-zero-length"
+
+int main()
+{
+ std::FILE* fp = 0;
+ std::fpos_t fpos = {0};
+ std::size_t s = 0;
+ char* cp = 0;
+ std::va_list va;
+ static_assert((std::is_same<decltype(std::fclose(fp)), int>::value), "");
+ static_assert((std::is_same<decltype(std::fflush(fp)), int>::value), "");
+ static_assert((std::is_same<decltype(std::setbuf(fp,cp)), void>::value), "");
+ static_assert((std::is_same<decltype(std::vfprintf(fp,"",va)), int>::value), "");
+ static_assert((std::is_same<decltype(std::fprintf(fp," ")), int>::value), "");
+ static_assert((std::is_same<decltype(std::fscanf(fp,"")), int>::value), "");
+ static_assert((std::is_same<decltype(std::snprintf(cp,0," ")), int>::value), "");
+ static_assert((std::is_same<decltype(std::sprintf(cp," ")), int>::value), "");
+ static_assert((std::is_same<decltype(std::sscanf("","")), int>::value), "");
+ static_assert((std::is_same<decltype(std::vfprintf(fp,"",va)), int>::value), "");
+ static_assert((std::is_same<decltype(std::vfscanf(fp,"",va)), int>::value), "");
+ static_assert((std::is_same<decltype(std::vsnprintf(cp,0," ",va)), int>::value), "");
+ static_assert((std::is_same<decltype(std::vsprintf(cp," ",va)), int>::value), "");
+ static_assert((std::is_same<decltype(std::vsscanf("","",va)), int>::value), "");
+ static_assert((std::is_same<decltype(std::fgetc(fp)), int>::value), "");
+ static_assert((std::is_same<decltype(std::fgets(cp,0,fp)), char*>::value), "");
+ static_assert((std::is_same<decltype(std::fputc(0,fp)), int>::value), "");
+ static_assert((std::is_same<decltype(std::fputs("",fp)), int>::value), "");
+ static_assert((std::is_same<decltype(std::getc(fp)), int>::value), "");
+ static_assert((std::is_same<decltype(std::putc(0,fp)), int>::value), "");
+ static_assert((std::is_same<decltype(std::ungetc(0,fp)), int>::value), "");
+ static_assert((std::is_same<decltype(std::fread((void*)0,0,0,fp)), std::size_t>::value), "");
+ static_assert((std::is_same<decltype(std::fwrite((const void*)0,0,0,fp)), std::size_t>::value), "");
+ static_assert((std::is_same<decltype(std::fgetpos(fp, &fpos)), int>::value), "");
+ static_assert((std::is_same<decltype(std::fseek(fp, 0,0)), int>::value), "");
+ static_assert((std::is_same<decltype(std::fsetpos(fp, &fpos)), int>::value), "");
+ static_assert((std::is_same<decltype(std::ftell(fp)), long>::value), "");
+ static_assert((std::is_same<decltype(std::rewind(fp)), void>::value), "");
+ static_assert((std::is_same<decltype(std::clearerr(fp)), void>::value), "");
+ static_assert((std::is_same<decltype(std::feof(fp)), int>::value), "");
+ static_assert((std::is_same<decltype(std::ferror(fp)), int>::value), "");
+ static_assert((std::is_same<decltype(std::perror("")), void>::value), "");
+
+#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+ static_assert((std::is_same<decltype(std::fopen("", "")), std::FILE*>::value), "");
+ static_assert((std::is_same<decltype(std::freopen("", "", fp)), std::FILE*>::value), "");
+ static_assert((std::is_same<decltype(std::remove("")), int>::value), "");
+ static_assert((std::is_same<decltype(std::rename("","")), int>::value), "");
+ static_assert((std::is_same<decltype(std::tmpfile()), std::FILE*>::value), "");
+ static_assert((std::is_same<decltype(std::tmpnam(cp)), char*>::value), "");
+#endif
+
+#ifndef _LIBCPP_HAS_NO_STDIN
+ static_assert((std::is_same<decltype(std::getchar()), int>::value), "");
+#if _LIBCPP_STD_VER <= 11
+ static_assert((std::is_same<decltype(std::gets(cp)), char*>::value), "");
+#endif
+ static_assert((std::is_same<decltype(std::scanf(" ")), int>::value), "");
+ static_assert((std::is_same<decltype(std::vscanf("",va)), int>::value), "");
+#endif
+
+#ifndef _LIBCPP_HAS_NO_STDOUT
+ static_assert((std::is_same<decltype(std::printf(" ")), int>::value), "");
+ static_assert((std::is_same<decltype(std::putchar(0)), int>::value), "");
+ static_assert((std::is_same<decltype(std::puts("")), int>::value), "");
+ static_assert((std::is_same<decltype(std::vprintf(" ",va)), int>::value), "");
+#endif
+}
diff --git a/test/std/input.output/file.streams/c.files/gets.fail.cpp b/test/std/input.output/file.streams/c.files/gets.fail.cpp
new file mode 100644
index 0000000000000..4250e23c11c2b
--- /dev/null
+++ b/test/std/input.output/file.streams/c.files/gets.fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// test <cstdio>
+
+// gets
+
+#include <cstdio>
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11
+ (void) std::gets((char *) NULL);
+#else
+#error
+#endif
+}
diff --git a/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp b/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp
new file mode 100644
index 0000000000000..4d83296f086a2
--- /dev/null
+++ b/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp
@@ -0,0 +1,15 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstdio>
+
+int main() {
+ // fopen is not available on systems without a global filesystem namespace.
+ std::fopen("", "");
+}
diff --git a/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/lit.local.cfg b/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/lit.local.cfg
new file mode 100644
index 0000000000000..4ea670935591a
--- /dev/null
+++ b/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/lit.local.cfg
@@ -0,0 +1,2 @@
+if 'libcpp-has-no-global-filesystem-namespace' not in config.available_features:
+ config.unsupported = True
diff --git a/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp b/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp
new file mode 100644
index 0000000000000..deca9bf5b5519
--- /dev/null
+++ b/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp
@@ -0,0 +1,15 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstdio>
+
+int main() {
+ // rename is not available on systems without a global filesystem namespace.
+ std::rename("", "");
+}
diff --git a/test/std/input.output/file.streams/c.files/version_ccstdio.pass.cpp b/test/std/input.output/file.streams/c.files/version_ccstdio.pass.cpp
new file mode 100644
index 0000000000000..0d7fc5605324b
--- /dev/null
+++ b/test/std/input.output/file.streams/c.files/version_ccstdio.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <cstdio>
+
+#include <cstdio>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/std/input.output/file.streams/c.files/version_cinttypes.pass.cpp b/test/std/input.output/file.streams/c.files/version_cinttypes.pass.cpp
new file mode 100644
index 0000000000000..bfd379e43493b
--- /dev/null
+++ b/test/std/input.output/file.streams/c.files/version_cinttypes.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <cinttypes>
+
+#include <cinttypes>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/std/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp
new file mode 100644
index 0000000000000..86844343ecdc7
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_filebuf
+
+// void swap(basic_filebuf& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp = get_temp_file_name();
+ {
+ std::filebuf f;
+ assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
+ assert(f.is_open());
+ assert(f.sputn("123", 3) == 3);
+ f.pubseekoff(1, std::ios_base::beg);
+ assert(f.sgetc() == '2');
+ std::filebuf f2;
+ f2.swap(f);
+ assert(!f.is_open());
+ assert(f2.is_open());
+ assert(f2.sgetc() == '2');
+ }
+ std::remove(temp.c_str());
+ {
+ std::wfilebuf f;
+ assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
+ assert(f.is_open());
+ assert(f.sputn(L"123", 3) == 3);
+ f.pubseekoff(1, std::ios_base::beg);
+ assert(f.sgetc() == L'2');
+ std::wfilebuf f2;
+ f2.swap(f);
+ assert(!f.is_open());
+ assert(f2.is_open());
+ assert(f2.sgetc() == L'2');
+ }
+ std::remove(temp.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp
new file mode 100644
index 0000000000000..a92ec872a54b8
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_filebuf
+
+// basic_filebuf& operator=(basic_filebuf&& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ std::string temp = get_temp_file_name();
+ {
+ std::filebuf f;
+ assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
+ assert(f.is_open());
+ assert(f.sputn("123", 3) == 3);
+ f.pubseekoff(1, std::ios_base::beg);
+ assert(f.sgetc() == '2');
+ std::filebuf f2;
+ f2 = move(f);
+ assert(!f.is_open());
+ assert(f2.is_open());
+ assert(f2.sgetc() == '2');
+ }
+ std::remove(temp.c_str());
+ {
+ std::wfilebuf f;
+ assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
+ assert(f.is_open());
+ assert(f.sputn(L"123", 3) == 3);
+ f.pubseekoff(1, std::ios_base::beg);
+ assert(f.sgetc() == L'2');
+ std::wfilebuf f2;
+ f2 = move(f);
+ assert(!f.is_open());
+ assert(f2.is_open());
+ assert(f2.sgetc() == L'2');
+ }
+ std::remove(temp.c_str());
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp
new file mode 100644
index 0000000000000..084d001031d89
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_filebuf
+
+// template <class charT, class traits>
+// void
+// swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp = get_temp_file_name();
+ {
+ std::filebuf f;
+ assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
+ assert(f.is_open());
+ assert(f.sputn("123", 3) == 3);
+ f.pubseekoff(1, std::ios_base::beg);
+ assert(f.sgetc() == '2');
+ std::filebuf f2;
+ swap(f2, f);
+ assert(!f.is_open());
+ assert(f2.is_open());
+ assert(f2.sgetc() == '2');
+ }
+ std::remove(temp.c_str());
+ {
+ std::wfilebuf f;
+ assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
+ assert(f.is_open());
+ assert(f.sputn(L"123", 3) == 3);
+ f.pubseekoff(1, std::ios_base::beg);
+ assert(f.sgetc() == L'2');
+ std::wfilebuf f2;
+ swap(f2, f);
+ assert(!f.is_open());
+ assert(f2.is_open());
+ assert(f2.sgetc() == L'2');
+ }
+ std::remove(temp.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/filebuf.cons/default.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.cons/default.pass.cpp
new file mode 100644
index 0000000000000..f4fbbf69e69b7
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/filebuf.cons/default.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_filebuf
+
+// basic_filebuf();
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::filebuf f;
+ assert(!f.is_open());
+ }
+ {
+ std::wfilebuf f;
+ assert(!f.is_open());
+ }
+}
diff --git a/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp
new file mode 100644
index 0000000000000..f13ee44700f32
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_filebuf
+
+// basic_filebuf(basic_filebuf&& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ std::string temp = get_temp_file_name();
+ {
+ std::filebuf f;
+ assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
+ assert(f.is_open());
+ assert(f.sputn("123", 3) == 3);
+ f.pubseekoff(1, std::ios_base::beg);
+ assert(f.sgetc() == '2');
+ std::filebuf f2(move(f));
+ assert(!f.is_open());
+ assert(f2.is_open());
+ assert(f2.sgetc() == '2');
+ }
+ std::remove(temp.c_str());
+ {
+ std::wfilebuf f;
+ assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
+ assert(f.is_open());
+ assert(f.sputn(L"123", 3) == 3);
+ f.pubseekoff(1, std::ios_base::beg);
+ assert(f.sgetc() == L'2');
+ std::wfilebuf f2(move(f));
+ assert(!f.is_open());
+ assert(f2.is_open());
+ assert(f2.sgetc() == L'2');
+ }
+ std::remove(temp.c_str());
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp
new file mode 100644
index 0000000000000..9d2d56782a3e8
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// basic_filebuf<charT,traits>* open(const char* s, ios_base::openmode mode);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp = get_temp_file_name();
+ {
+ std::filebuf f;
+ assert(f.open(temp.c_str(), std::ios_base::out) != 0);
+ assert(f.is_open());
+ assert(f.sputn("123", 3) == 3);
+ }
+ {
+ std::filebuf f;
+ assert(f.open(temp.c_str(), std::ios_base::in) != 0);
+ assert(f.is_open());
+ assert(f.sbumpc() == '1');
+ assert(f.sbumpc() == '2');
+ assert(f.sbumpc() == '3');
+ }
+ std::remove(temp.c_str());
+ {
+ std::wfilebuf f;
+ assert(f.open(temp.c_str(), std::ios_base::out) != 0);
+ assert(f.is_open());
+ assert(f.sputn(L"123", 3) == 3);
+ }
+ {
+ std::wfilebuf f;
+ assert(f.open(temp.c_str(), std::ios_base::in) != 0);
+ assert(f.is_open());
+ assert(f.sbumpc() == L'1');
+ assert(f.sbumpc() == L'2');
+ assert(f.sbumpc() == L'3');
+ }
+ remove(temp.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp
new file mode 100644
index 0000000000000..1da3856982105
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp
@@ -0,0 +1,142 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// int_type overflow(int_type c = traits::eof());
+
+// This test is not entirely portable
+
+#include <fstream>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test_buf
+ : public std::basic_filebuf<CharT>
+{
+ typedef std::basic_filebuf<CharT> base;
+ typedef typename base::char_type char_type;
+ typedef typename base::int_type int_type;
+ typedef typename base::traits_type traits_type;
+
+ char_type* pbase() const {return base::pbase();}
+ char_type* pptr() const {return base::pptr();}
+ char_type* epptr() const {return base::epptr();}
+ void gbump(int n) {base::gbump(n);}
+
+ virtual int_type overflow(int_type c = traits_type::eof()) {return base::overflow(c);}
+};
+
+int main()
+{
+ {
+ test_buf<char> f;
+ assert(f.open("overflow.dat", std::ios_base::out) != 0);
+ assert(f.is_open());
+ assert(f.pbase() == 0);
+ assert(f.pptr() == 0);
+ assert(f.epptr() == 0);
+ assert(f.overflow('a') == 'a');
+ assert(f.pbase() != 0);
+ assert(f.pptr() == f.pbase());
+ assert(f.epptr() - f.pbase() == 4095);
+ }
+ {
+ test_buf<char> f;
+ assert(f.open("overflow.dat", std::ios_base::in) != 0);
+ assert(f.is_open());
+ assert(f.sgetc() == 'a');
+ }
+ std::remove("overflow.dat");
+ {
+ test_buf<char> f;
+ f.pubsetbuf(0, 0);
+ assert(f.open("overflow.dat", std::ios_base::out) != 0);
+ assert(f.is_open());
+ assert(f.pbase() == 0);
+ assert(f.pptr() == 0);
+ assert(f.epptr() == 0);
+ assert(f.overflow('a') == 'a');
+ assert(f.pbase() == 0);
+ assert(f.pptr() == 0);
+ assert(f.epptr() == 0);
+ }
+ {
+ test_buf<char> f;
+ assert(f.open("overflow.dat", std::ios_base::in) != 0);
+ assert(f.is_open());
+ assert(f.sgetc() == 'a');
+ }
+ std::remove("overflow.dat");
+ {
+ test_buf<wchar_t> f;
+ assert(f.open("overflow.dat", std::ios_base::out) != 0);
+ assert(f.is_open());
+ assert(f.pbase() == 0);
+ assert(f.pptr() == 0);
+ assert(f.epptr() == 0);
+ assert(f.overflow(L'a') == L'a');
+ assert(f.pbase() != 0);
+ assert(f.pptr() == f.pbase());
+ assert(f.epptr() - f.pbase() == 4095);
+ }
+ {
+ test_buf<wchar_t> f;
+ assert(f.open("overflow.dat", std::ios_base::in) != 0);
+ assert(f.is_open());
+ assert(f.sgetc() == L'a');
+ }
+ std::remove("overflow.dat");
+ {
+ test_buf<wchar_t> f;
+ f.pubsetbuf(0, 0);
+ assert(f.open("overflow.dat", std::ios_base::out) != 0);
+ assert(f.is_open());
+ assert(f.pbase() == 0);
+ assert(f.pptr() == 0);
+ assert(f.epptr() == 0);
+ assert(f.overflow(L'a') == L'a');
+ assert(f.pbase() == 0);
+ assert(f.pptr() == 0);
+ assert(f.epptr() == 0);
+ }
+ {
+ test_buf<wchar_t> f;
+ assert(f.open("overflow.dat", std::ios_base::in) != 0);
+ assert(f.is_open());
+ assert(f.sgetc() == L'a');
+ }
+ std::remove("overflow.dat");
+ {
+ test_buf<wchar_t> f;
+ f.pubimbue(std::locale(LOCALE_en_US_UTF_8));
+ assert(f.open("overflow.dat", std::ios_base::out) != 0);
+ assert(f.sputc(0x4E51) == 0x4E51);
+ assert(f.sputc(0x4E52) == 0x4E52);
+ assert(f.sputc(0x4E53) == 0x4E53);
+ }
+ {
+ test_buf<char> f;
+ assert(f.open("overflow.dat", std::ios_base::in) != 0);
+ assert(f.is_open());
+ assert(f.sbumpc() == 0xE4);
+ assert(f.sbumpc() == 0xB9);
+ assert(f.sbumpc() == 0x91);
+ assert(f.sbumpc() == 0xE4);
+ assert(f.sbumpc() == 0xB9);
+ assert(f.sbumpc() == 0x92);
+ assert(f.sbumpc() == 0xE4);
+ assert(f.sbumpc() == 0xB9);
+ assert(f.sbumpc() == 0x93);
+ assert(f.sbumpc() == -1);
+ }
+ std::remove("overflow.dat");
+}
diff --git a/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp
new file mode 100644
index 0000000000000..4419cb51a6dc2
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// int_type pbackfail(int_type c = traits::eof());
+
+// This test is not entirely portable
+
+#include <fstream>
+#include <cassert>
+
+template <class CharT>
+struct test_buf
+ : public std::basic_filebuf<CharT>
+{
+ typedef std::basic_filebuf<CharT> base;
+ typedef typename base::char_type char_type;
+ typedef typename base::int_type int_type;
+ typedef typename base::traits_type traits_type;
+
+ char_type* eback() const {return base::eback();}
+ char_type* gptr() const {return base::gptr();}
+ char_type* egptr() const {return base::egptr();}
+ void gbump(int n) {base::gbump(n);}
+
+ virtual int_type pbackfail(int_type c = traits_type::eof()) {return base::pbackfail(c);}
+};
+
+int main()
+{
+ {
+ test_buf<char> f;
+ assert(f.open("underflow.dat", std::ios_base::in) != 0);
+ assert(f.is_open());
+ assert(f.sbumpc() == '1');
+ assert(f.sgetc() == '2');
+ assert(f.pbackfail('a') == -1);
+ }
+ {
+ test_buf<char> f;
+ assert(f.open("underflow.dat", std::ios_base::in | std::ios_base::out) != 0);
+ assert(f.is_open());
+ assert(f.sbumpc() == '1');
+ assert(f.sgetc() == '2');
+ assert(f.pbackfail('a') == 'a');
+ assert(f.sbumpc() == 'a');
+ assert(f.sgetc() == '2');
+ }
+}
diff --git a/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp
new file mode 100644
index 0000000000000..eb15facad5baf
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// pos_type seekoff(off_type off, ios_base::seekdir way,
+// ios_base::openmode which = ios_base::in | ios_base::out);
+// pos_type seekpos(pos_type sp,
+// ios_base::openmode which = ios_base::in | ios_base::out);
+
+// This test is not entirely portable
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+ {
+ char buf[10];
+ typedef std::filebuf::pos_type pos_type;
+ std::filebuf f;
+ f.pubsetbuf(buf, sizeof(buf));
+ assert(f.open("seekoff.dat", std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc) != 0);
+ assert(f.is_open());
+ f.sputn("abcdefghijklmnopqrstuvwxyz", 26);
+ assert(buf[0] == 'v');
+ pos_type p = f.pubseekoff(-15, std::ios_base::cur);
+ assert(p == 11);
+ assert(f.sgetc() == 'l');
+ f.pubseekoff(0, std::ios_base::beg);
+ assert(f.sgetc() == 'a');
+ f.pubseekoff(-1, std::ios_base::end);
+ assert(f.sgetc() == 'z');
+ assert(f.pubseekpos(p) == p);
+ assert(f.sgetc() == 'l');
+ }
+ std::remove("seekoff.dat");
+ {
+ wchar_t buf[10];
+ typedef std::filebuf::pos_type pos_type;
+ std::wfilebuf f;
+ f.pubsetbuf(buf, sizeof(buf)/sizeof(buf[0]));
+ assert(f.open("seekoff.dat", std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc) != 0);
+ assert(f.is_open());
+ f.sputn(L"abcdefghijklmnopqrstuvwxyz", 26);
+ assert(buf[0] == L'v');
+ pos_type p = f.pubseekoff(-15, std::ios_base::cur);
+ assert(p == 11);
+ assert(f.sgetc() == L'l');
+ f.pubseekoff(0, std::ios_base::beg);
+ assert(f.sgetc() == L'a');
+ f.pubseekoff(-1, std::ios_base::end);
+ assert(f.sgetc() == L'z');
+ assert(f.pubseekpos(p) == p);
+ assert(f.sgetc() == L'l');
+ }
+ std::remove("seekoff.dat");
+}
diff --git a/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.dat b/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.dat
new file mode 100644
index 0000000000000..e2e107ac61ac2
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.dat
@@ -0,0 +1 @@
+123456789 \ No newline at end of file
diff --git a/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
new file mode 100644
index 0000000000000..e34bc844bd286
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
@@ -0,0 +1,121 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// int_type underflow();
+
+// This test is not entirely portable
+
+#include <fstream>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test_buf
+ : public std::basic_filebuf<CharT>
+{
+ typedef std::basic_filebuf<CharT> base;
+ typedef typename base::char_type char_type;
+ typedef typename base::int_type int_type;
+
+ char_type* eback() const {return base::eback();}
+ char_type* gptr() const {return base::gptr();}
+ char_type* egptr() const {return base::egptr();}
+ void gbump(int n) {base::gbump(n);}
+
+ virtual int_type underflow() {return base::underflow();}
+};
+
+int main()
+{
+ {
+ test_buf<char> f;
+ assert(f.open("underflow.dat", std::ios_base::in) != 0);
+ assert(f.is_open());
+ assert(f.eback() == 0);
+ assert(f.gptr() == 0);
+ assert(f.egptr() == 0);
+ assert(f.underflow() == '1');
+ assert(f.eback() != 0);
+ assert(f.eback() == f.gptr());
+ assert(*f.gptr() == '1');
+ assert(f.egptr() - f.eback() == 9);
+ }
+ {
+ test_buf<char> f;
+ assert(f.open("underflow.dat", std::ios_base::in) != 0);
+ assert(f.pubsetbuf(0, 0));
+ assert(f.is_open());
+ assert(f.eback() == 0);
+ assert(f.gptr() == 0);
+ assert(f.egptr() == 0);
+ assert(f.underflow() == '1');
+ assert(f.eback() != 0);
+ assert(f.eback() == f.gptr());
+ assert(*f.gptr() == '1');
+ assert(f.egptr() - f.eback() == 8);
+ f.gbump(8);
+ assert(f.sgetc() == '9');
+ assert(f.eback()[0] == '5');
+ assert(f.eback()[1] == '6');
+ assert(f.eback()[2] == '7');
+ assert(f.eback()[3] == '8');
+ assert(f.gptr() - f.eback() == 4);
+ assert(*f.gptr() == '9');
+ assert(f.egptr() - f.gptr() == 1);
+ }
+ {
+ test_buf<wchar_t> f;
+ assert(f.open("underflow.dat", std::ios_base::in) != 0);
+ assert(f.is_open());
+ assert(f.eback() == 0);
+ assert(f.gptr() == 0);
+ assert(f.egptr() == 0);
+ assert(f.underflow() == L'1');
+ assert(f.eback() != 0);
+ assert(f.eback() == f.gptr());
+ assert(*f.gptr() == L'1');
+ assert(f.egptr() - f.eback() == 9);
+ }
+ {
+ test_buf<wchar_t> f;
+ assert(f.pubsetbuf(0, 0));
+ assert(f.open("underflow.dat", std::ios_base::in) != 0);
+ assert(f.is_open());
+ assert(f.eback() == 0);
+ assert(f.gptr() == 0);
+ assert(f.egptr() == 0);
+ assert(f.underflow() == L'1');
+ assert(f.eback() != 0);
+ assert(f.eback() == f.gptr());
+ assert(*f.gptr() == L'1');
+ assert(f.egptr() - f.eback() == 8);
+ f.gbump(8);
+ assert(f.sgetc() == L'9');
+ assert(f.eback()[0] == L'5');
+ assert(f.eback()[1] == L'6');
+ assert(f.eback()[2] == L'7');
+ assert(f.eback()[3] == L'8');
+ assert(f.gptr() - f.eback() == 4);
+ assert(*f.gptr() == L'9');
+ assert(f.egptr() - f.gptr() == 1);
+ }
+ {
+ test_buf<wchar_t> f;
+ f.pubimbue(std::locale(LOCALE_en_US_UTF_8));
+ assert(f.open("underflow_utf8.dat", std::ios_base::in) != 0);
+ assert(f.is_open());
+ assert(f.sbumpc() == 0x4E51);
+ assert(f.sbumpc() == 0x4E52);
+ assert(f.sbumpc() == 0x4E53);
+ assert(f.sbumpc() == -1);
+ }
+}
diff --git a/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow_utf8.dat b/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow_utf8.dat
new file mode 100644
index 0000000000000..ee7063e1207c0
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow_utf8.dat
@@ -0,0 +1 @@
+乑乒乓 \ No newline at end of file
diff --git a/test/std/input.output/file.streams/fstreams/filebuf/types.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf/types.pass.cpp
new file mode 100644
index 0000000000000..5d77e0054b757
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/filebuf/types.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_filebuf
+// : public basic_streambuf<charT, traits>
+// {
+// public:
+// typedef charT char_type;
+// typedef traits traits_type;
+// typedef typename traits_type::int_type int_type;
+// typedef typename traits_type::pos_type pos_type;
+// typedef typename traits_type::off_type off_type;
+
+#include <fstream>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_base_of<std::basic_streambuf<char>, std::basic_filebuf<char> >::value), "");
+ static_assert((std::is_same<std::basic_filebuf<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::basic_filebuf<char>::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_filebuf<char>::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::basic_filebuf<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::basic_filebuf<char>::off_type, std::char_traits<char>::off_type>::value), "");
+}
diff --git a/test/std/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp
new file mode 100644
index 0000000000000..fcc86a13ffa11
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// void swap(basic_fstream& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp1 = get_temp_file_name();
+ std::string temp2 = get_temp_file_name();
+ {
+ std::fstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ std::fstream fs2(temp2.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ fs1 << 1 << ' ' << 2;
+ fs2 << 2 << ' ' << 1;
+ fs1.seekg(0);
+ fs1.swap(fs2);
+ fs1.seekg(0);
+ int i;
+ fs1 >> i;
+ assert(i == 2);
+ fs1 >> i;
+ assert(i == 1);
+ i = 0;
+ fs2 >> i;
+ assert(i == 1);
+ fs2 >> i;
+ assert(i == 2);
+ }
+ std::remove(temp1.c_str());
+ std::remove(temp2.c_str());
+ {
+ std::wfstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ std::wfstream fs2(temp2.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ fs1 << 1 << ' ' << 2;
+ fs2 << 2 << ' ' << 1;
+ fs1.seekg(0);
+ fs1.swap(fs2);
+ fs1.seekg(0);
+ int i;
+ fs1 >> i;
+ assert(i == 2);
+ fs1 >> i;
+ assert(i == 1);
+ i = 0;
+ fs2 >> i;
+ assert(i == 1);
+ fs2 >> i;
+ assert(i == 2);
+ }
+ std::remove(temp1.c_str());
+ std::remove(temp2.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp
new file mode 100644
index 0000000000000..b5157e90edcc3
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// basic_fstream& operator=(basic_fstream&& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ std::string temp = get_temp_file_name();
+ {
+ std::fstream fso(temp.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ std::fstream fs;
+ fs = move(fso);
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+ {
+ std::wfstream fso(temp.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ std::wfstream fs;
+ fs = move(fso);
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp
new file mode 100644
index 0000000000000..0a4f7240daa19
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// template <class charT, class traits>
+// void swap(basic_fstream<charT, traits>& x, basic_fstream<charT, traits>& y);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp1 = get_temp_file_name();
+ std::string temp2 = get_temp_file_name();
+ {
+ std::fstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ std::fstream fs2(temp2.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ fs1 << 1 << ' ' << 2;
+ fs2 << 2 << ' ' << 1;
+ fs1.seekg(0);
+ swap(fs1, fs2);
+ fs1.seekg(0);
+ int i;
+ fs1 >> i;
+ assert(i == 2);
+ fs1 >> i;
+ assert(i == 1);
+ i = 0;
+ fs2 >> i;
+ assert(i == 1);
+ fs2 >> i;
+ assert(i == 2);
+ }
+ std::remove(temp1.c_str());
+ std::remove(temp2.c_str());
+ {
+ std::wfstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ std::wfstream fs2(temp2.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ fs1 << 1 << ' ' << 2;
+ fs2 << 2 << ' ' << 1;
+ fs1.seekg(0);
+ swap(fs1, fs2);
+ fs1.seekg(0);
+ int i;
+ fs1 >> i;
+ assert(i == 2);
+ fs1 >> i;
+ assert(i == 1);
+ i = 0;
+ fs2 >> i;
+ assert(i == 1);
+ fs2 >> i;
+ assert(i == 2);
+ }
+ std::remove(temp1.c_str());
+ std::remove(temp2.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/fstream.cons/default.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.cons/default.pass.cpp
new file mode 100644
index 0000000000000..cfd5a031f0fc7
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/fstream.cons/default.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// basic_fstream();
+
+#include <fstream>
+#include <type_traits>
+
+int main()
+{
+ {
+ std::fstream fs;
+ }
+ {
+ std::wfstream fs;
+ }
+}
diff --git a/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp
new file mode 100644
index 0000000000000..d2ae3028606c2
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// basic_fstream(basic_fstream&& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ std::string temp = get_temp_file_name();
+ {
+ std::fstream fso(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ std::fstream fs = move(fso);
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+ {
+ std::wfstream fso(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ std::wfstream fs = move(fso);
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp
new file mode 100644
index 0000000000000..06a6b77943a62
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// explicit basic_fstream(const char* s, ios_base::openmode mode = ios_base::in | ios_base::out);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp = get_temp_file_name();
+ {
+ std::fstream fs(temp.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+ {
+ std::wfstream fs(temp.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
new file mode 100644
index 0000000000000..4b0819f8af498
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// explicit basic_fstream(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp = get_temp_file_name();
+ {
+ std::fstream fs(temp,
+ std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+ {
+ std::wfstream fs(temp,
+ std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/fstream.members/close.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.members/close.pass.cpp
new file mode 100644
index 0000000000000..0e4bc7177b8fa
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/fstream.members/close.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// void close();
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp = get_temp_file_name();
+ {
+ std::fstream fs;
+ assert(!fs.is_open());
+ fs.open(temp.c_str(), std::ios_base::out);
+ assert(fs.is_open());
+ fs.close();
+ assert(!fs.is_open());
+ }
+ std::remove(temp.c_str());
+ {
+ std::wfstream fs;
+ assert(!fs.is_open());
+ fs.open(temp.c_str(), std::ios_base::out);
+ assert(fs.is_open());
+ fs.close();
+ assert(!fs.is_open());
+ }
+ std::remove(temp.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp
new file mode 100644
index 0000000000000..231bb82c74345
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// void open(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp = get_temp_file_name();
+ {
+ std::fstream fs;
+ assert(!fs.is_open());
+ fs.open(temp.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ assert(fs.is_open());
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+ {
+ std::wfstream fs;
+ assert(!fs.is_open());
+ fs.open(temp.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ assert(fs.is_open());
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp
new file mode 100644
index 0000000000000..182f12c47d1a5
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// void open(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp = get_temp_file_name();
+ {
+ std::fstream fs;
+ assert(!fs.is_open());
+ fs.open(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ assert(fs.is_open());
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+ {
+ std::wfstream fs;
+ assert(!fs.is_open());
+ fs.open(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ assert(fs.is_open());
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/fstream.members/rdbuf.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.members/rdbuf.pass.cpp
new file mode 100644
index 0000000000000..d8398326910be
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/fstream.members/rdbuf.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// basic_filebuf<charT,traits>* rdbuf() const;
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::fstream fs;
+ assert(fs.rdbuf());
+ }
+ {
+ std::wfstream fs;
+ assert(fs.rdbuf());
+ }
+}
diff --git a/test/std/input.output/file.streams/fstreams/fstream/types.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream/types.pass.cpp
new file mode 100644
index 0000000000000..6ced241f75fdf
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/fstream/types.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+// : public basic_iostream<charT,traits>
+// {
+// public:
+// typedef charT char_type;
+// typedef traits traits_type;
+// typedef typename traits_type::int_type int_type;
+// typedef typename traits_type::pos_type pos_type;
+// typedef typename traits_type::off_type off_type;
+
+#include <fstream>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_base_of<std::basic_iostream<char>, std::basic_fstream<char> >::value), "");
+ static_assert((std::is_same<std::basic_fstream<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::basic_fstream<char>::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_fstream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::basic_fstream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::basic_fstream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+}
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.assign/member_swap.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.assign/member_swap.pass.cpp
new file mode 100644
index 0000000000000..18443cedb8d9a
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ifstream.assign/member_swap.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// void swap(basic_ifstream& rhs);
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ifstream fs1("test.dat");
+ std::ifstream fs2("test2.dat");
+ fs1.swap(fs2);
+ double x = 0;
+ fs1 >> x;
+ assert(x == 4.5);
+ fs2 >> x;
+ assert(x == 3.25);
+ }
+ {
+ std::wifstream fs1("test.dat");
+ std::wifstream fs2("test2.dat");
+ fs1.swap(fs2);
+ double x = 0;
+ fs1 >> x;
+ assert(x == 4.5);
+ fs2 >> x;
+ assert(x == 3.25);
+ }
+}
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp
new file mode 100644
index 0000000000000..9c2fcad33a3c5
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// basic_ifstream& operator=(basic_ifstream&& rhs);
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ std::ifstream fso("test.dat");
+ std::ifstream fs;
+ fs = move(fso);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ {
+ std::wifstream fso("test.dat");
+ std::wifstream fs;
+ fs = move(fso);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.assign/nonmember_swap.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.assign/nonmember_swap.pass.cpp
new file mode 100644
index 0000000000000..5700720a06432
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ifstream.assign/nonmember_swap.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// template <class charT, class traits>
+// void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ifstream fs1("test.dat");
+ std::ifstream fs2("test2.dat");
+ swap(fs1, fs2);
+ double x = 0;
+ fs1 >> x;
+ assert(x == 4.5);
+ fs2 >> x;
+ assert(x == 3.25);
+ }
+ {
+ std::wifstream fs1("test.dat");
+ std::wifstream fs2("test2.dat");
+ swap(fs1, fs2);
+ double x = 0;
+ fs1 >> x;
+ assert(x == 4.5);
+ fs2 >> x;
+ assert(x == 3.25);
+ }
+}
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.assign/test.dat b/test/std/input.output/file.streams/fstreams/ifstream.assign/test.dat
new file mode 100644
index 0000000000000..64064d34a8e3e
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ifstream.assign/test.dat
@@ -0,0 +1 @@
+3.25 \ No newline at end of file
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.assign/test2.dat b/test/std/input.output/file.streams/fstreams/ifstream.assign/test2.dat
new file mode 100644
index 0000000000000..958d30d86d0ef
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ifstream.assign/test2.dat
@@ -0,0 +1 @@
+4.5 \ No newline at end of file
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.cons/default.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.cons/default.pass.cpp
new file mode 100644
index 0000000000000..41e6780e80729
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ifstream.cons/default.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// basic_ifstream();
+
+#include <fstream>
+#include <type_traits>
+
+int main()
+{
+ {
+ std::ifstream fs;
+ }
+ {
+ std::wifstream fs;
+ }
+}
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp
new file mode 100644
index 0000000000000..aaac1212262d1
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// basic_ifstream(basic_ifstream&& rhs);
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ std::ifstream fso("test.dat");
+ std::ifstream fs = move(fso);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ {
+ std::wifstream fso("test.dat");
+ std::wifstream fs = move(fso);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp
new file mode 100644
index 0000000000000..f43df3c9f84ab
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// explicit basic_ifstream(const char* s, ios_base::openmode mode = ios_base::in);
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ifstream fs("test.dat");
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ {
+ std::ifstream fs("test.dat", std::ios_base::out);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ {
+ std::wifstream fs("test.dat");
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ {
+ std::wifstream fs("test.dat", std::ios_base::out);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+}
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp
new file mode 100644
index 0000000000000..ad5fe5149df23
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// explicit basic_ifstream(const string& s, ios_base::openmode mode = ios_base::in);
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ifstream fs(std::string("test.dat"));
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ {
+ std::ifstream fs(std::string("test.dat"), std::ios_base::out);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ {
+ std::wifstream fs(std::string("test.dat"));
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ {
+ std::wifstream fs(std::string("test.dat"), std::ios_base::out);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+}
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.cons/test.dat b/test/std/input.output/file.streams/fstreams/ifstream.cons/test.dat
new file mode 100644
index 0000000000000..64064d34a8e3e
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ifstream.cons/test.dat
@@ -0,0 +1 @@
+3.25 \ No newline at end of file
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.members/close.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.members/close.pass.cpp
new file mode 100644
index 0000000000000..3e3933240851b
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ifstream.members/close.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// void close();
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ifstream fs;
+ assert(!fs.is_open());
+ fs.open("test.dat");
+ assert(fs.is_open());
+ fs.close();
+ assert(!fs.is_open());
+ }
+ {
+ std::wifstream fs;
+ assert(!fs.is_open());
+ fs.open("test.dat");
+ assert(fs.is_open());
+ fs.close();
+ assert(!fs.is_open());
+ }
+}
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.members/open_pointer.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.members/open_pointer.pass.cpp
new file mode 100644
index 0000000000000..47dc85fac605b
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ifstream.members/open_pointer.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// void open(const char* s, ios_base::openmode mode = ios_base::in);
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ifstream fs;
+ assert(!fs.is_open());
+ char c = 'a';
+ fs >> c;
+ assert(fs.fail());
+ assert(c == 'a');
+ fs.open("test.dat");
+ assert(fs.is_open());
+ fs >> c;
+ assert(c == 'r');
+ }
+ {
+ std::wifstream fs;
+ assert(!fs.is_open());
+ wchar_t c = L'a';
+ fs >> c;
+ assert(fs.fail());
+ assert(c == L'a');
+ fs.open("test.dat");
+ assert(fs.is_open());
+ fs >> c;
+ assert(c == L'r');
+ }
+}
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.members/open_string.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.members/open_string.pass.cpp
new file mode 100644
index 0000000000000..619694e2736a6
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ifstream.members/open_string.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// void open(const string& s, ios_base::openmode mode = ios_base::in);
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ifstream fs;
+ assert(!fs.is_open());
+ char c = 'a';
+ fs >> c;
+ assert(fs.fail());
+ assert(c == 'a');
+ fs.open(std::string("test.dat"));
+ assert(fs.is_open());
+ fs >> c;
+ assert(c == 'r');
+ }
+ {
+ std::wifstream fs;
+ assert(!fs.is_open());
+ wchar_t c = L'a';
+ fs >> c;
+ assert(fs.fail());
+ assert(c == L'a');
+ fs.open(std::string("test.dat"));
+ assert(fs.is_open());
+ fs >> c;
+ assert(c == L'r');
+ }
+}
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.members/rdbuf.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.members/rdbuf.pass.cpp
new file mode 100644
index 0000000000000..53fd294e71f2e
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ifstream.members/rdbuf.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// basic_filebuf<charT,traits>* rdbuf() const;
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ifstream fs("test.dat");
+ std::filebuf* fb = fs.rdbuf();
+ assert(fb->sgetc() == 'r');
+ }
+ {
+ std::wifstream fs("test.dat");
+ std::wfilebuf* fb = fs.rdbuf();
+ assert(fb->sgetc() == L'r');
+ }
+}
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.members/test.dat b/test/std/input.output/file.streams/fstreams/ifstream.members/test.dat
new file mode 100644
index 0000000000000..1d2f01491f783
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ifstream.members/test.dat
@@ -0,0 +1 @@
+r \ No newline at end of file
diff --git a/test/std/input.output/file.streams/fstreams/ifstream/types.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream/types.pass.cpp
new file mode 100644
index 0000000000000..dd39eee1a174c
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ifstream/types.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+// : public basic_istream<charT,traits>
+// {
+// public:
+// typedef charT char_type;
+// typedef traits traits_type;
+// typedef typename traits_type::int_type int_type;
+// typedef typename traits_type::pos_type pos_type;
+// typedef typename traits_type::off_type off_type;
+
+#include <fstream>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_base_of<std::basic_istream<char>, std::basic_ifstream<char> >::value), "");
+ static_assert((std::is_same<std::basic_ifstream<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::basic_ifstream<char>::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_ifstream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::basic_ifstream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::basic_ifstream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+}
diff --git a/test/std/input.output/file.streams/fstreams/lit.local.cfg b/test/std/input.output/file.streams/fstreams/lit.local.cfg
new file mode 100644
index 0000000000000..25ac02ba7c667
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/lit.local.cfg
@@ -0,0 +1,2 @@
+if 'libcpp-has-no-global-filesystem-namespace' in config.available_features:
+ config.unsupported = True
diff --git a/test/std/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp
new file mode 100644
index 0000000000000..519b84fb1abe2
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// void swap(basic_ofstream& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp1 = get_temp_file_name();
+ std::string temp2 = get_temp_file_name();
+ {
+ std::ofstream fs1(temp1.c_str());
+ std::ofstream fs2(temp2.c_str());
+ fs1 << 3.25;
+ fs2 << 4.5;
+ fs1.swap(fs2);
+ fs1 << ' ' << 3.25;
+ fs2 << ' ' << 4.5;
+ }
+ {
+ std::ifstream fs(temp1.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ fs >> x;
+ assert(x == 4.5);
+ }
+ std::remove(temp1.c_str());
+ {
+ std::ifstream fs(temp2.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 4.5);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp2.c_str());
+ {
+ std::wofstream fs1(temp1.c_str());
+ std::wofstream fs2(temp2.c_str());
+ fs1 << 3.25;
+ fs2 << 4.5;
+ fs1.swap(fs2);
+ fs1 << ' ' << 3.25;
+ fs2 << ' ' << 4.5;
+ }
+ {
+ std::wifstream fs(temp1.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ fs >> x;
+ assert(x == 4.5);
+ }
+ std::remove(temp1.c_str());
+ {
+ std::wifstream fs(temp2.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 4.5);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp2.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp
new file mode 100644
index 0000000000000..0f21eb81d078f
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// basic_ofstream& operator=(basic_ofstream&& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ std::string temp = get_temp_file_name();
+ {
+ std::ofstream fso(temp.c_str());
+ std::ofstream fs;
+ fs = move(fso);
+ fs << 3.25;
+ }
+ {
+ std::ifstream fs(temp.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+ {
+ std::wofstream fso(temp.c_str());
+ std::wofstream fs;
+ fs = move(fso);
+ fs << 3.25;
+ }
+ {
+ std::wifstream fs(temp.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp
new file mode 100644
index 0000000000000..d58f5f2560042
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// template <class charT, class traits>
+// void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp1 = get_temp_file_name();
+ std::string temp2 = get_temp_file_name();
+ {
+ std::ofstream fs1(temp1.c_str());
+ std::ofstream fs2(temp2.c_str());
+ fs1 << 3.25;
+ fs2 << 4.5;
+ swap(fs1, fs2);
+ fs1 << ' ' << 3.25;
+ fs2 << ' ' << 4.5;
+ }
+ {
+ std::ifstream fs(temp1.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ fs >> x;
+ assert(x == 4.5);
+ }
+ std::remove(temp1.c_str());
+ {
+ std::ifstream fs(temp2.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 4.5);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp2.c_str());
+ {
+ std::wofstream fs1(temp1.c_str());
+ std::wofstream fs2(temp2.c_str());
+ fs1 << 3.25;
+ fs2 << 4.5;
+ swap(fs1, fs2);
+ fs1 << ' ' << 3.25;
+ fs2 << ' ' << 4.5;
+ }
+ {
+ std::wifstream fs(temp1.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ fs >> x;
+ assert(x == 4.5);
+ }
+ std::remove(temp1.c_str());
+ {
+ std::wifstream fs(temp2.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 4.5);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp2.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/ofstream.cons/default.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.cons/default.pass.cpp
new file mode 100644
index 0000000000000..f8308ab06bfb0
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ofstream.cons/default.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// basic_ofstream();
+
+#include <fstream>
+#include <type_traits>
+
+int main()
+{
+ {
+ std::ofstream fs;
+ }
+ {
+ std::wofstream fs;
+ }
+}
diff --git a/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp
new file mode 100644
index 0000000000000..8645358cbd4d4
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// basic_ofstream(basic_ofstream&& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ std::string temp = get_temp_file_name();
+ {
+ std::ofstream fso(temp.c_str());
+ std::ofstream fs = move(fso);
+ fs << 3.25;
+ }
+ {
+ std::ifstream fs(temp.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+ {
+ std::wofstream fso(temp.c_str());
+ std::wofstream fs = move(fso);
+ fs << 3.25;
+ }
+ {
+ std::wifstream fs(temp.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
new file mode 100644
index 0000000000000..bd5832abeb59f
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// explicit basic_ofstream(const char* s, ios_base::openmode mode = ios_base::out);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp = get_temp_file_name();
+ {
+ std::ofstream fs(temp.c_str());
+ fs << 3.25;
+ }
+ {
+ std::ifstream fs(temp.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+ {
+ std::wofstream fs(temp.c_str());
+ fs << 3.25;
+ }
+ {
+ std::wifstream fs(temp.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp
new file mode 100644
index 0000000000000..7112b17fb8bee
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// explicit basic_ofstream(const string& s, ios_base::openmode mode = ios_base::out);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp = get_temp_file_name();
+ {
+ std::ofstream fs(temp);
+ fs << 3.25;
+ }
+ {
+ std::ifstream fs(temp);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+ {
+ std::wofstream fs(temp);
+ fs << 3.25;
+ }
+ {
+ std::wifstream fs(temp);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ std::remove(temp.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp
new file mode 100644
index 0000000000000..b8c358d8ece45
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// void close();
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp = get_temp_file_name();
+ {
+ std::ofstream fs;
+ assert(!fs.is_open());
+ fs.open(temp.c_str());
+ assert(fs.is_open());
+ fs.close();
+ assert(!fs.is_open());
+ }
+ std::remove(temp.c_str());
+ {
+ std::wofstream fs;
+ assert(!fs.is_open());
+ fs.open(temp.c_str());
+ assert(fs.is_open());
+ fs.close();
+ assert(!fs.is_open());
+ }
+ std::remove(temp.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp
new file mode 100644
index 0000000000000..e5cddc9e1642e
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// void open(const char* s, ios_base::openmode mode = ios_base::out);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp = get_temp_file_name();
+ {
+ std::ofstream fs;
+ assert(!fs.is_open());
+ char c = 'a';
+ fs << c;
+ assert(fs.fail());
+ fs.open(temp.c_str());
+ assert(fs.is_open());
+ fs << c;
+ }
+ {
+ std::ifstream fs(temp.c_str());
+ char c = 0;
+ fs >> c;
+ assert(c == 'a');
+ }
+ std::remove(temp.c_str());
+ {
+ std::wofstream fs;
+ assert(!fs.is_open());
+ wchar_t c = L'a';
+ fs << c;
+ assert(fs.fail());
+ fs.open(temp.c_str());
+ assert(fs.is_open());
+ fs << c;
+ }
+ {
+ std::wifstream fs(temp.c_str());
+ wchar_t c = 0;
+ fs >> c;
+ assert(c == L'a');
+ }
+ std::remove(temp.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp
new file mode 100644
index 0000000000000..d54aa1824ab9f
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// void open(const string& s, ios_base::openmode mode = ios_base::out);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp = get_temp_file_name();
+ {
+ std::ofstream fs;
+ assert(!fs.is_open());
+ char c = 'a';
+ fs << c;
+ assert(fs.fail());
+ fs.open(temp);
+ assert(fs.is_open());
+ fs << c;
+ }
+ {
+ std::ifstream fs(temp.c_str());
+ char c = 0;
+ fs >> c;
+ assert(c == 'a');
+ }
+ std::remove(temp.c_str());
+ {
+ std::wofstream fs;
+ assert(!fs.is_open());
+ wchar_t c = L'a';
+ fs << c;
+ assert(fs.fail());
+ fs.open(temp);
+ assert(fs.is_open());
+ fs << c;
+ }
+ {
+ std::wifstream fs(temp.c_str());
+ wchar_t c = 0;
+ fs >> c;
+ assert(c == L'a');
+ }
+ std::remove(temp.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp
new file mode 100644
index 0000000000000..d707e0a32ac44
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// basic_filebuf<charT,traits>* rdbuf() const;
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp = get_temp_file_name();
+ {
+ std::ofstream fs(temp.c_str());
+ std::filebuf* fb = fs.rdbuf();
+ assert(fb->sputc('r') == 'r');
+ }
+ std::remove(temp.c_str());
+ {
+ std::wofstream fs(temp.c_str());
+ std::wfilebuf* fb = fs.rdbuf();
+ assert(fb->sputc(L'r') == L'r');
+ }
+ std::remove(temp.c_str());
+}
diff --git a/test/std/input.output/file.streams/fstreams/ofstream/types.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream/types.pass.cpp
new file mode 100644
index 0000000000000..243994addcc44
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/ofstream/types.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+// : public basic_ostream<charT,traits>
+// {
+// public:
+// typedef charT char_type;
+// typedef traits traits_type;
+// typedef typename traits_type::int_type int_type;
+// typedef typename traits_type::pos_type pos_type;
+// typedef typename traits_type::off_type off_type;
+
+#include <fstream>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_base_of<std::basic_ostream<char>, std::basic_ofstream<char> >::value), "");
+ static_assert((std::is_same<std::basic_ofstream<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::basic_ofstream<char>::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_ofstream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::basic_ofstream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::basic_ofstream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+}
diff --git a/test/std/input.output/file.streams/fstreams/version.pass.cpp b/test/std/input.output/file.streams/fstreams/version.pass.cpp
new file mode 100644
index 0000000000000..44b851416808c
--- /dev/null
+++ b/test/std/input.output/file.streams/fstreams/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+#include <fstream>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/std/input.output/file.streams/nothing_to_do.pass.cpp b/test/std/input.output/file.streams/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/file.streams/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/input.output.general/nothing_to_do.pass.cpp b/test/std/input.output/input.output.general/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/input.output.general/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostream.format/ext.manip/get_money.pass.cpp b/test/std/input.output/iostream.format/ext.manip/get_money.pass.cpp
new file mode 100644
index 0000000000000..1ea1d780c50ff
--- /dev/null
+++ b/test/std/input.output/iostream.format/ext.manip/get_money.pass.cpp
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// template <class moneyT> T7 get_money(moneyT& mon, bool intl = false);
+
+// REQUIRES: locale.en_US.UTF-8
+
+#include <iomanip>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" -$1,234,567.89");
+ std::istream is(&sb);
+ is.imbue(std::locale(LOCALE_en_US_UTF_8));
+ long double x = 0;
+ is >> std::get_money(x, false);
+ assert(x == -123456789);
+ }
+ {
+ testbuf<char> sb(" -USD 1,234,567.89");
+ std::istream is(&sb);
+ is.imbue(std::locale(LOCALE_en_US_UTF_8));
+ long double x = 0;
+ is >> std::get_money(x, true);
+ assert(x == -123456789);
+ }
+ {
+ testbuf<wchar_t> sb(L" -$1,234,567.89");
+ std::wistream is(&sb);
+ is.imbue(std::locale(LOCALE_en_US_UTF_8));
+ long double x = 0;
+ is >> std::get_money(x, false);
+ assert(x == -123456789);
+ }
+ {
+ testbuf<wchar_t> sb(L" -USD 1,234,567.89");
+ std::wistream is(&sb);
+ is.imbue(std::locale(LOCALE_en_US_UTF_8));
+ long double x = 0;
+ is >> std::get_money(x, true);
+ assert(x == -123456789);
+ }
+}
diff --git a/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp b/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
new file mode 100644
index 0000000000000..17ff642dc46d2
--- /dev/null
+++ b/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// template <class charT> T9 get_time(struct tm* tmb, const charT* fmt);
+
+#include <iomanip>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" Sat Dec 31 23:55:59 2061");
+ std::istream is(&sb);
+ is.imbue(std::locale(LOCALE_en_US_UTF_8));
+ std::tm t = {0};
+ is >> std::get_time(&t, "%a %b %d %H:%M:%S %Y");
+ assert(t.tm_sec == 59);
+ assert(t.tm_min == 55);
+ assert(t.tm_hour == 23);
+ assert(t.tm_mday == 31);
+ assert(t.tm_mon == 11);
+ assert(t.tm_year == 161);
+ assert(t.tm_wday == 6);
+ assert(is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L" Sat Dec 31 23:55:59 2061");
+ std::wistream is(&sb);
+ is.imbue(std::locale(LOCALE_en_US_UTF_8));
+ std::tm t = {0};
+ is >> std::get_time(&t, L"%a %b %d %H:%M:%S %Y");
+ assert(t.tm_sec == 59);
+ assert(t.tm_min == 55);
+ assert(t.tm_hour == 23);
+ assert(t.tm_mday == 31);
+ assert(t.tm_mon == 11);
+ assert(t.tm_year == 161);
+ assert(t.tm_wday == 6);
+ assert(is.eof());
+ assert(!is.fail());
+ }
+}
diff --git a/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp b/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
new file mode 100644
index 0000000000000..a00cf139be938
--- /dev/null
+++ b/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// template <class charT, class moneyT> T8 put_money(const moneyT& mon, bool intl = false);
+
+// REQUIRES: locale.en_US.UTF-8
+
+#include <iomanip>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.imbue(std::locale(LOCALE_en_US_UTF_8));
+ showbase(os);
+ long double x = -123456789;
+ os << std::put_money(x, false);
+ assert(sb.str() == "-$1,234,567.89");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.imbue(std::locale(LOCALE_en_US_UTF_8));
+ showbase(os);
+ long double x = -123456789;
+ os << std::put_money(x, true);
+ assert(sb.str() == "-USD 1,234,567.89");
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ os.imbue(std::locale(LOCALE_en_US_UTF_8));
+ showbase(os);
+ long double x = -123456789;
+ os << std::put_money(x, false);
+ assert(sb.str() == L"-$1,234,567.89");
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ os.imbue(std::locale(LOCALE_en_US_UTF_8));
+ showbase(os);
+ long double x = -123456789;
+ os << std::put_money(x, true);
+ assert(sb.str() == L"-USD 1,234,567.89");
+ }
+}
diff --git a/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp b/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
new file mode 100644
index 0000000000000..52a98a1b5688c
--- /dev/null
+++ b/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// template <class charT> T10 put_time(const struct tm* tmb, const charT* fmt);
+
+#include <iomanip>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.imbue(std::locale(LOCALE_en_US_UTF_8));
+ std::tm t = {0};
+ t.tm_sec = 59;
+ t.tm_min = 55;
+ t.tm_hour = 23;
+ t.tm_mday = 31;
+ t.tm_mon = 11;
+ t.tm_year = 161;
+ t.tm_wday = 6;
+ t.tm_isdst = 0;
+ os << std::put_time(&t, "%a %b %d %H:%M:%S %Y");
+ assert(sb.str() == "Sat Dec 31 23:55:59 2061");
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ os.imbue(std::locale(LOCALE_en_US_UTF_8));
+ std::tm t = {0};
+ t.tm_sec = 59;
+ t.tm_min = 55;
+ t.tm_hour = 23;
+ t.tm_mday = 31;
+ t.tm_mon = 11;
+ t.tm_year = 161;
+ t.tm_wday = 6;
+ os << std::put_time(&t, L"%a %b %d %H:%M:%S %Y");
+ assert(sb.str() == L"Sat Dec 31 23:55:59 2061");
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/member_swap.pass.cpp b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/member_swap.pass.cpp
new file mode 100644
index 0000000000000..f4d425728b773
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/member_swap.pass.cpp
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_iostream;
+
+// void swap(basic_iostream& rhs);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+template <class CharT>
+struct test_iostream
+ : public std::basic_iostream<CharT>
+{
+ typedef std::basic_iostream<CharT> base;
+ test_iostream(testbuf<CharT>* sb) : base(sb) {}
+
+ void swap(test_iostream& s) {base::swap(s);}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb1;
+ testbuf<char> sb2;
+ test_iostream<char> is1(&sb1);
+ test_iostream<char> is2(&sb2);
+ is1.swap(is2);
+ assert(is1.rdbuf() == &sb1);
+ assert(is1.tie() == 0);
+ assert(is1.fill() == ' ');
+ assert(is1.rdstate() == is1.goodbit);
+ assert(is1.exceptions() == is1.goodbit);
+ assert(is1.flags() == (is1.skipws | is1.dec));
+ assert(is1.precision() == 6);
+ assert(is1.getloc().name() == "C");
+ assert(is2.rdbuf() == &sb2);
+ assert(is2.tie() == 0);
+ assert(is2.fill() == ' ');
+ assert(is2.rdstate() == is2.goodbit);
+ assert(is2.exceptions() == is2.goodbit);
+ assert(is2.flags() == (is2.skipws | is2.dec));
+ assert(is2.precision() == 6);
+ assert(is2.getloc().name() == "C");
+ }
+ {
+ testbuf<wchar_t> sb1;
+ testbuf<wchar_t> sb2;
+ test_iostream<wchar_t> is1(&sb1);
+ test_iostream<wchar_t> is2(&sb2);
+ is1.swap(is2);
+ assert(is1.rdbuf() == &sb1);
+ assert(is1.tie() == 0);
+ assert(is1.fill() == ' ');
+ assert(is1.rdstate() == is1.goodbit);
+ assert(is1.exceptions() == is1.goodbit);
+ assert(is1.flags() == (is1.skipws | is1.dec));
+ assert(is1.precision() == 6);
+ assert(is1.getloc().name() == "C");
+ assert(is2.rdbuf() == &sb2);
+ assert(is2.tie() == 0);
+ assert(is2.fill() == ' ');
+ assert(is2.rdstate() == is2.goodbit);
+ assert(is2.exceptions() == is2.goodbit);
+ assert(is2.flags() == (is2.skipws | is2.dec));
+ assert(is2.precision() == 6);
+ assert(is2.getloc().name() == "C");
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp
new file mode 100644
index 0000000000000..2032e935bfacc
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp
@@ -0,0 +1,92 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_iostream;
+
+// basic_iostream& operator=(basic_iostream&& rhs);
+
+#include <istream>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+template <class CharT>
+struct test_iostream
+ : public std::basic_iostream<CharT>
+{
+ typedef std::basic_iostream<CharT> base;
+ test_iostream(testbuf<CharT>* sb) : base(sb) {}
+
+ test_iostream& operator=(test_iostream&& s)
+ {base::operator=(std::move(s)); return *this;}
+};
+
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ testbuf<char> sb1;
+ testbuf<char> sb2;
+ test_iostream<char> is1(&sb1);
+ test_iostream<char> is2(&sb2);
+ is2 = (std::move(is1));
+ assert(is1.rdbuf() == &sb1);
+ assert(is1.tie() == 0);
+ assert(is1.fill() == ' ');
+ assert(is1.rdstate() == is1.goodbit);
+ assert(is1.exceptions() == is1.goodbit);
+ assert(is1.flags() == (is1.skipws | is1.dec));
+ assert(is1.precision() == 6);
+ assert(is1.getloc().name() == "C");
+ assert(is2.rdbuf() == &sb2);
+ assert(is2.tie() == 0);
+ assert(is2.fill() == ' ');
+ assert(is2.rdstate() == is2.goodbit);
+ assert(is2.exceptions() == is2.goodbit);
+ assert(is2.flags() == (is2.skipws | is2.dec));
+ assert(is2.precision() == 6);
+ assert(is2.getloc().name() == "C");
+ }
+ {
+ testbuf<wchar_t> sb1;
+ testbuf<wchar_t> sb2;
+ test_iostream<wchar_t> is1(&sb1);
+ test_iostream<wchar_t> is2(&sb2);
+ is2 = (std::move(is1));
+ assert(is1.rdbuf() == &sb1);
+ assert(is1.tie() == 0);
+ assert(is1.fill() == ' ');
+ assert(is1.rdstate() == is1.goodbit);
+ assert(is1.exceptions() == is1.goodbit);
+ assert(is1.flags() == (is1.skipws | is1.dec));
+ assert(is1.precision() == 6);
+ assert(is1.getloc().name() == "C");
+ assert(is2.rdbuf() == &sb2);
+ assert(is2.tie() == 0);
+ assert(is2.fill() == ' ');
+ assert(is2.rdstate() == is2.goodbit);
+ assert(is2.exceptions() == is2.goodbit);
+ assert(is2.flags() == (is2.skipws | is2.dec));
+ assert(is2.precision() == 6);
+ assert(is2.getloc().name() == "C");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp
new file mode 100644
index 0000000000000..c0592e927c8f6
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_iostream;
+
+// basic_iostream(basic_iostream&& rhs);
+
+#include <istream>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+template <class CharT>
+struct test_iostream
+ : public std::basic_iostream<CharT>
+{
+ typedef std::basic_iostream<CharT> base;
+ test_iostream(testbuf<CharT>* sb) : base(sb) {}
+
+ test_iostream(test_iostream&& s)
+ : base(std::move(s)) {}
+};
+
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ testbuf<char> sb;
+ test_iostream<char> is1(&sb);
+ test_iostream<char> is(std::move(is1));
+ assert(is1.rdbuf() == &sb);
+ assert(is1.gcount() == 0);
+ assert(is.gcount() == 0);
+ assert(is.rdbuf() == 0);
+ assert(is.tie() == 0);
+ assert(is.fill() == ' ');
+ assert(is.rdstate() == is.goodbit);
+ assert(is.exceptions() == is.goodbit);
+ assert(is.flags() == (is.skipws | is.dec));
+ assert(is.precision() == 6);
+ assert(is.getloc().name() == "C");
+ }
+ {
+ testbuf<wchar_t> sb;
+ test_iostream<wchar_t> is1(&sb);
+ test_iostream<wchar_t> is(std::move(is1));
+ assert(is1.gcount() == 0);
+ assert(is.gcount() == 0);
+ assert(is1.rdbuf() == &sb);
+ assert(is.rdbuf() == 0);
+ assert(is.tie() == 0);
+ assert(is.fill() == L' ');
+ assert(is.rdstate() == is.goodbit);
+ assert(is.exceptions() == is.goodbit);
+ assert(is.flags() == (is.skipws | is.dec));
+ assert(is.precision() == 6);
+ assert(is.getloc().name() == "C");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/streambuf.pass.cpp b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/streambuf.pass.cpp
new file mode 100644
index 0000000000000..dacc8d26d76e1
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/streambuf.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_iostream;
+
+// explicit basic_iostream(basic_streambuf<charT,traits>* sb);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::basic_iostream<char> is(&sb);
+ assert(is.rdbuf() == &sb);
+ assert(is.tie() == 0);
+ assert(is.fill() == ' ');
+ assert(is.rdstate() == is.goodbit);
+ assert(is.exceptions() == is.goodbit);
+ assert(is.flags() == (is.skipws | is.dec));
+ assert(is.precision() == 6);
+ assert(is.getloc().name() == "C");
+ assert(is.gcount() == 0);
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::basic_iostream<wchar_t> is(&sb);
+ assert(is.rdbuf() == &sb);
+ assert(is.tie() == 0);
+ assert(is.fill() == L' ');
+ assert(is.rdstate() == is.goodbit);
+ assert(is.exceptions() == is.goodbit);
+ assert(is.flags() == (is.skipws | is.dec));
+ assert(is.precision() == 6);
+ assert(is.getloc().name() == "C");
+ assert(is.gcount() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.dest/nothing_to_do.pass.cpp b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.dest/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.dest/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostream.format/input.streams/iostreamclass/types.pass.cpp b/test/std/input.output/iostream.format/input.streams/iostreamclass/types.pass.cpp
new file mode 100644
index 0000000000000..6890f1cf7c170
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/iostreamclass/types.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_iostream :
+// public basic_istream<charT,traits>,
+// public basic_ostream<charT,traits>
+// {
+// public:
+// // types:
+// typedef charT char_type;
+// typedef traits traits_type;
+// typedef typename traits_type::int_type int_type;
+// typedef typename traits_type::pos_type pos_type;
+// typedef typename traits_type::off_type off_type;
+
+#include <istream>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_base_of<std::basic_istream<char>, std::basic_iostream<char> >::value), "");
+ static_assert((std::is_base_of<std::basic_ostream<char>, std::basic_iostream<char> >::value), "");
+ static_assert((std::is_same<std::basic_iostream<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::basic_iostream<char>::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_iostream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::basic_iostream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::basic_iostream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp
new file mode 100644
index 0000000000000..beaebfe8566d3
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// operator>>(bool& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ std::istream is((std::streambuf*)0);
+ bool n = 0;
+ is >> n;
+ assert(is.fail());
+ }
+ {
+ testbuf<char> sb("0");
+ std::istream is(&sb);
+ bool n = true;
+ is >> n;
+ assert(n == false);
+ assert( is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<char> sb(" 1 ");
+ std::istream is(&sb);
+ bool n = 0;
+ is >> n;
+ assert(n == true);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L" 1 ");
+ std::wistream is(&sb);
+ bool n = 0;
+ is >> n;
+ assert(n == true);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp
new file mode 100644
index 0000000000000..1c8716e86e47b
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// operator>>(double& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ std::istream is((std::streambuf*)0);
+ double n = 0;
+ is >> n;
+ assert(is.fail());
+ }
+ {
+ testbuf<char> sb("0");
+ std::istream is(&sb);
+ double n = 10;
+ is >> n;
+ assert(n == 0);
+ assert( is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<char> sb(" 123 ");
+ std::istream is(&sb);
+ double n = 10;
+ is >> n;
+ assert(n == 123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L" -123.5 ");
+ std::wistream is(&sb);
+ double n = 10;
+ is >> n;
+ assert(n == -123.5);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp
new file mode 100644
index 0000000000000..f5ef23e654a1b
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// operator>>(float& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ std::istream is((std::streambuf*)0);
+ float n = 0;
+ is >> n;
+ assert(is.fail());
+ }
+ {
+ testbuf<char> sb("0");
+ std::istream is(&sb);
+ float n = 10;
+ is >> n;
+ assert(n == 0);
+ assert( is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<char> sb(" 123 ");
+ std::istream is(&sb);
+ float n = 10;
+ is >> n;
+ assert(n == 123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L" -123.5 ");
+ std::wistream is(&sb);
+ float n = 10;
+ is >> n;
+ assert(n == -123.5);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp
new file mode 100644
index 0000000000000..25687db16f37e
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// operator>>(int& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ std::istream is((std::streambuf*)0);
+ int n = 0;
+ is >> n;
+ assert(is.fail());
+ }
+ {
+ testbuf<char> sb("0");
+ std::istream is(&sb);
+ int n = 10;
+ is >> n;
+ assert(n == 0);
+ assert( is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<char> sb(" 123 ");
+ std::istream is(&sb);
+ int n = 10;
+ is >> n;
+ assert(n == 123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L" -1234567890123456 ");
+ std::wistream is(&sb);
+ int n = 10;
+ is >> n;
+ assert(n == std::numeric_limits<int>::min());
+ assert(!is.eof());
+ assert( is.fail());
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp
new file mode 100644
index 0000000000000..4b4765452c687
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// operator>>(long& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ std::istream is((std::streambuf*)0);
+ long n = 0;
+ is >> n;
+ assert(is.fail());
+ }
+ {
+ testbuf<char> sb("0");
+ std::istream is(&sb);
+ long n = 10;
+ is >> n;
+ assert(n == 0);
+ assert( is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<char> sb(" 123 ");
+ std::istream is(&sb);
+ long n = 10;
+ is >> n;
+ assert(n == 123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L" -123 ");
+ std::wistream is(&sb);
+ long n = 10;
+ is >> n;
+ assert(n == -123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp
new file mode 100644
index 0000000000000..cc70faed6c23a
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// operator>>(long double& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ std::istream is((std::streambuf*)0);
+ long double n = 0;
+ is >> n;
+ assert(is.fail());
+ }
+ {
+ testbuf<char> sb("0");
+ std::istream is(&sb);
+ long double n = 10;
+ is >> n;
+ assert(n == 0);
+ assert( is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<char> sb(" 123 ");
+ std::istream is(&sb);
+ long double n = 10;
+ is >> n;
+ assert(n == 123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L" -123.5 ");
+ std::wistream is(&sb);
+ long double n = 10;
+ is >> n;
+ assert(n == -123.5);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp
new file mode 100644
index 0000000000000..c37e175162487
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// operator>>(long long& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ std::istream is((std::streambuf*)0);
+ long long n = 0;
+ is >> n;
+ assert(is.fail());
+ }
+ {
+ testbuf<char> sb("0");
+ std::istream is(&sb);
+ long long n = 10;
+ is >> n;
+ assert(n == 0);
+ assert( is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<char> sb(" 123 ");
+ std::istream is(&sb);
+ long long n = 10;
+ is >> n;
+ assert(n == 123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L" -123 ");
+ std::wistream is(&sb);
+ long long n = 10;
+ is >> n;
+ assert(n == -123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp
new file mode 100644
index 0000000000000..52b35666424af
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// operator>>(void*& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ std::istream is((std::streambuf*)0);
+ void* n = 0;
+ is >> n;
+ assert(is.fail());
+ }
+ {
+ testbuf<char> sb("0");
+ std::istream is(&sb);
+ void* n = (void*)1;
+ is >> n;
+ assert(n == 0);
+ assert( is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<char> sb(" 1 ");
+ std::istream is(&sb);
+ void* n = 0;
+ is >> n;
+ assert(n == (void*)1);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L" 1 ");
+ std::wistream is(&sb);
+ void* n = 0;
+ is >> n;
+ assert(n == (void*)1);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<char> sb("12345678");
+ std::istream is(&sb);
+ void* n = 0;
+ is >> n;
+ assert(n == (void*)0x12345678);
+ assert( is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L"12345678");
+ std::wistream is(&sb);
+ void* n = 0;
+ is >> n;
+ assert(n == (void*)0x12345678);
+ assert( is.eof());
+ assert(!is.fail());
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp
new file mode 100644
index 0000000000000..62e44f542a649
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// operator>>(short& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ std::istream is((std::streambuf*)0);
+ short n = 0;
+ is >> n;
+ assert(is.fail());
+ }
+ {
+ testbuf<char> sb("0");
+ std::istream is(&sb);
+ short n = 10;
+ is >> n;
+ assert(n == 0);
+ assert( is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<char> sb(" 123 ");
+ std::istream is(&sb);
+ short n = 10;
+ is >> n;
+ assert(n == 123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L" -1234567890 ");
+ std::wistream is(&sb);
+ short n = 10;
+ is >> n;
+ assert(n == std::numeric_limits<short>::min());
+ assert(!is.eof());
+ assert( is.fail());
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp
new file mode 100644
index 0000000000000..6f1091690da1e
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// operator>>(unsigned int& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ std::istream is((std::streambuf*)0);
+ unsigned int n = 0;
+ is >> n;
+ assert(is.fail());
+ }
+ {
+ testbuf<char> sb("0");
+ std::istream is(&sb);
+ unsigned int n = 10;
+ is >> n;
+ assert(n == 0);
+ assert( is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<char> sb(" 123 ");
+ std::istream is(&sb);
+ unsigned int n = 10;
+ is >> n;
+ assert(n == 123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L" 123 ");
+ std::wistream is(&sb);
+ unsigned int n = 10;
+ is >> n;
+ assert(n == 123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp
new file mode 100644
index 0000000000000..eb8a7231ffca1
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// operator>>(unsigned long& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ std::istream is((std::streambuf*)0);
+ unsigned long n = 0;
+ is >> n;
+ assert(is.fail());
+ }
+ {
+ testbuf<char> sb("0");
+ std::istream is(&sb);
+ unsigned long n = 10;
+ is >> n;
+ assert(n == 0);
+ assert( is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<char> sb(" 123 ");
+ std::istream is(&sb);
+ unsigned long n = 10;
+ is >> n;
+ assert(n == 123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L" 123 ");
+ std::wistream is(&sb);
+ unsigned long n = 10;
+ is >> n;
+ assert(n == 123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp
new file mode 100644
index 0000000000000..1db250ed463a9
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// operator>>(unsigned long long& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ std::istream is((std::streambuf*)0);
+ unsigned long long n = 0;
+ is >> n;
+ assert(is.fail());
+ }
+ {
+ testbuf<char> sb("0");
+ std::istream is(&sb);
+ unsigned long long n = 10;
+ is >> n;
+ assert(n == 0);
+ assert( is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<char> sb(" 123 ");
+ std::istream is(&sb);
+ unsigned long long n = 10;
+ is >> n;
+ assert(n == 123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L" 123 ");
+ std::wistream is(&sb);
+ unsigned long long n = 10;
+ is >> n;
+ assert(n == 123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp
new file mode 100644
index 0000000000000..78fdc66388235
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// operator>>(unsigned short& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ std::istream is((std::streambuf*)0);
+ unsigned short n = 0;
+ is >> n;
+ assert(is.fail());
+ }
+ {
+ testbuf<char> sb("0");
+ std::istream is(&sb);
+ unsigned short n = 10;
+ is >> n;
+ assert(n == 0);
+ assert( is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<char> sb(" 123 ");
+ std::istream is(&sb);
+ unsigned short n = 10;
+ is >> n;
+ assert(n == 123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L" 123 ");
+ std::wistream is(&sb);
+ unsigned short n = 10;
+ is >> n;
+ assert(n == 123);
+ assert(!is.eof());
+ assert(!is.fail());
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.reqmts/tested_elsewhere.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.reqmts/tested_elsewhere.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.reqmts/tested_elsewhere.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/basic_ios.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/basic_ios.pass.cpp
new file mode 100644
index 0000000000000..0d4516d555670
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/basic_ios.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// basic_istream<charT,traits>& operator>>(basic_ios<charT,traits>&
+// (*pf)(basic_ios<charT,traits>&));
+
+#include <istream>
+#include <cassert>
+
+int f_called = 0;
+
+template <class CharT>
+std::basic_ios<CharT>&
+f(std::basic_ios<CharT>& is)
+{
+ ++f_called;
+ return is;
+}
+
+int main()
+{
+ {
+ std::istream is((std::streambuf*)0);
+ is >> f;
+ assert(f_called == 1);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/chart.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/chart.pass.cpp
new file mode 100644
index 0000000000000..b5068220cffd5
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/chart.pass.cpp
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template<class charT, class traits>
+// basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&& in, charT& c);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" ");
+ std::istream is(&sb);
+ char c = 'z';
+ is >> c;
+ assert( is.eof());
+ assert( is.fail());
+ assert(c == 'z');
+ }
+ {
+ testbuf<char> sb(" abcdefghijk ");
+ std::istream is(&sb);
+ char c;
+ is >> c;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == 'a');
+ is >> c;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == 'b');
+ is >> c;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == 'c');
+ }
+ {
+ testbuf<wchar_t> sb(L" abc");
+ std::wistream is(&sb);
+ wchar_t c;
+ is >> c;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == L'a');
+ is >> c;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == L'b');
+ is >> c;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == L'c');
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/ios_base.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/ios_base.pass.cpp
new file mode 100644
index 0000000000000..d4cb2bb13b2f4
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/ios_base.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// basic_istream<charT,traits>& operator>>(ios_base& (*pf)(ios_base&));
+
+#include <istream>
+#include <cassert>
+
+int f_called = 0;
+
+std::ios_base&
+f(std::ios_base& is)
+{
+ ++f_called;
+ return is;
+}
+
+int main()
+{
+ {
+ std::istream is((std::streambuf*)0);
+ is >> f;
+ assert(f_called == 1);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/istream.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/istream.pass.cpp
new file mode 100644
index 0000000000000..4c3aef491ea65
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/istream.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&
+// (*pf)(basic_istream<charT,traits>&));
+
+#include <istream>
+#include <cassert>
+
+int f_called = 0;
+
+template <class CharT>
+std::basic_istream<CharT>&
+f(std::basic_istream<CharT>& is)
+{
+ ++f_called;
+ return is;
+}
+
+int main()
+{
+ {
+ std::istream is((std::streambuf*)0);
+ is >> f;
+ assert(f_called == 1);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char.pass.cpp
new file mode 100644
index 0000000000000..a02fe2c51a6d4
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template<class traits>
+// basic_istream<char,traits>& operator>>(basic_istream<char,traits>&& in, signed char& c);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" ");
+ std::istream is(&sb);
+ signed char c = 'z';
+ is >> c;
+ assert( is.eof());
+ assert( is.fail());
+ assert(c == 'z');
+ }
+ {
+ testbuf<char> sb(" abcdefghijk ");
+ std::istream is(&sb);
+ signed char c;
+ is >> c;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == 'a');
+ is >> c;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == 'b');
+ is >> c;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == 'c');
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp
new file mode 100644
index 0000000000000..70f1c20108fca
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template<class traits>
+// basic_istream<char,traits>& operator>>(basic_istream<char,traits>&& in, signed char* s);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" abcdefghijk ");
+ std::istream is(&sb);
+ signed char s[20];
+ is >> s;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string((char*)s) == "abcdefghijk");
+ }
+ {
+ testbuf<char> sb(" abcdefghijk ");
+ std::istream is(&sb);
+ is.width(4);
+ signed char s[20];
+ is >> s;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string((char*)s) == "abc");
+ assert(is.width() == 0);
+ }
+ {
+ testbuf<char> sb(" abcdefghijk");
+ std::istream is(&sb);
+ signed char s[20];
+ is >> s;
+ assert( is.eof());
+ assert(!is.fail());
+ assert(std::string((char*)s) == "abcdefghijk");
+ assert(is.width() == 0);
+ }
+ {
+ testbuf<char> sb(" abcdefghijk");
+ std::istream is(&sb);
+ signed char s[20];
+ is.width(1);
+ is >> s;
+ assert(!is.eof());
+ assert( is.fail());
+ assert(std::string((char*)s) == "");
+ assert(is.width() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp
new file mode 100644
index 0000000000000..29ed68e9770c2
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// basic_istream<charT,traits>& operator<<(basic_streambuf<charT,traits>* sb);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+ testbuf(const std::basic_string<CharT>& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb("testing...");
+ std::istream is(&sb);
+ testbuf<char> sb2;
+ is >> &sb2;
+ assert(sb2.str() == "testing...");
+ assert(is.gcount() == 10);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char.pass.cpp
new file mode 100644
index 0000000000000..8f19cea7b882e
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template<class traits>
+// basic_istream<char,traits>& operator>>(basic_istream<char,traits>&& in, unsigned char& c);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" ");
+ std::istream is(&sb);
+ unsigned char c = 'z';
+ is >> c;
+ assert( is.eof());
+ assert( is.fail());
+ assert(c == 'z');
+ }
+ {
+ testbuf<char> sb(" abcdefghijk ");
+ std::istream is(&sb);
+ unsigned char c;
+ is >> c;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == 'a');
+ is >> c;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == 'b');
+ is >> c;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == 'c');
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp
new file mode 100644
index 0000000000000..07fa5a79e8f28
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template<class traits>
+// basic_istream<char,traits>& operator>>(basic_istream<char,traits>&& in, unsigned char* s);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" abcdefghijk ");
+ std::istream is(&sb);
+ unsigned char s[20];
+ is >> s;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string((char*)s) == "abcdefghijk");
+ }
+ {
+ testbuf<char> sb(" abcdefghijk ");
+ std::istream is(&sb);
+ is.width(4);
+ unsigned char s[20];
+ is >> s;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string((char*)s) == "abc");
+ assert(is.width() == 0);
+ }
+ {
+ testbuf<char> sb(" abcdefghijk");
+ std::istream is(&sb);
+ unsigned char s[20];
+ is >> s;
+ assert( is.eof());
+ assert(!is.fail());
+ assert(std::string((char*)s) == "abcdefghijk");
+ assert(is.width() == 0);
+ }
+ {
+ testbuf<char> sb(" abcdefghijk");
+ std::istream is(&sb);
+ unsigned char s[20];
+ is.width(1);
+ is >> s;
+ assert(!is.eof());
+ assert( is.fail());
+ assert(std::string((char*)s) == "");
+ assert(is.width() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp
new file mode 100644
index 0000000000000..a00c7a1dda381
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template<class charT, class traits>
+// basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&& in, charT* s);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" abcdefghijk ");
+ std::istream is(&sb);
+ char s[20];
+ is >> s;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string(s) == "abcdefghijk");
+ }
+ {
+ testbuf<wchar_t> sb(L" abcdefghijk ");
+ std::wistream is(&sb);
+ is.width(4);
+ wchar_t s[20];
+ is >> s;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s) == L"abc");
+ assert(is.width() == 0);
+ }
+ {
+ testbuf<wchar_t> sb(L" abcdefghijk");
+ std::wistream is(&sb);
+ wchar_t s[20];
+ is >> s;
+ assert( is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s) == L"abcdefghijk");
+ assert(is.width() == 0);
+ }
+ {
+ testbuf<char> sb(" abcdefghijk");
+ std::istream is(&sb);
+ char s[20];
+ is.width(1);
+ is >> s;
+ assert(!is.eof());
+ assert( is.fail());
+ assert(std::string(s) == "");
+ assert(is.width() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/nothing_to_do.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp
new file mode 100644
index 0000000000000..3c8159a6d7cb2
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits>
+// basic_istream<charT,traits>&
+// ws(basic_istream<charT,traits>& is);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" 123");
+ std::istream is(&sb);
+ ws(is);
+ assert(is.good());
+ assert(is.peek() == '1');
+ }
+ {
+ testbuf<wchar_t> sb(L" 123");
+ std::wistream is(&sb);
+ ws(is);
+ assert(is.good());
+ assert(is.peek() == L'1');
+ }
+ {
+ testbuf<char> sb(" ");
+ std::istream is(&sb);
+ ws(is);
+ assert(!is.fail());
+ assert(is.eof());
+ ws(is);
+ assert(is.eof());
+ assert(is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L" ");
+ std::wistream is(&sb);
+ ws(is);
+ assert(!is.fail());
+ assert(is.eof());
+ ws(is);
+ assert(is.eof());
+ assert(is.fail());
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp
new file mode 100644
index 0000000000000..5b7664e3f55cd
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits, class T>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>&& is, T& x);
+
+#include <istream>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ testbuf<char> sb(" 123");
+ int i = 0;
+ std::istream(&sb) >> i;
+ assert(i == 123);
+ }
+ {
+ testbuf<wchar_t> sb(L" 123");
+ int i = 0;
+ std::wistream(&sb) >> i;
+ assert(i == 123);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp
new file mode 100644
index 0000000000000..41a721d50f13f
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp
@@ -0,0 +1,100 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// int_type get();
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" ");
+ std::istream is(&sb);
+ char c = is.get();
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == ' ');
+ assert(is.gcount() == 1);
+ }
+ {
+ testbuf<char> sb(" abc");
+ std::istream is(&sb);
+ char c = is.get();
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == ' ');
+ assert(is.gcount() == 1);
+ c = is.get();
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == 'a');
+ assert(is.gcount() == 1);
+ c = is.get();
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == 'b');
+ assert(is.gcount() == 1);
+ c = is.get();
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == 'c');
+ assert(is.gcount() == 1);
+ }
+ {
+ testbuf<wchar_t> sb(L" abc");
+ std::wistream is(&sb);
+ wchar_t c = is.get();
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == L' ');
+ assert(is.gcount() == 1);
+ c = is.get();
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == L'a');
+ assert(is.gcount() == 1);
+ c = is.get();
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == L'b');
+ assert(is.gcount() == 1);
+ c = is.get();
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == L'c');
+ assert(is.gcount() == 1);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp
new file mode 100644
index 0000000000000..cf06e343bcc2a
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp
@@ -0,0 +1,103 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& get(char_type& c);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" ");
+ std::istream is(&sb);
+ char c;
+ is.get(c);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == ' ');
+ assert(is.gcount() == 1);
+ }
+ {
+ testbuf<char> sb(" abc");
+ std::istream is(&sb);
+ char c;
+ is.get(c);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == ' ');
+ assert(is.gcount() == 1);
+ is.get(c);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == 'a');
+ assert(is.gcount() == 1);
+ is.get(c);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == 'b');
+ assert(is.gcount() == 1);
+ is.get(c);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == 'c');
+ assert(is.gcount() == 1);
+ }
+ {
+ testbuf<wchar_t> sb(L" abc");
+ std::wistream is(&sb);
+ wchar_t c;
+ is.get(c);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == L' ');
+ assert(is.gcount() == 1);
+ is.get(c);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == L'a');
+ assert(is.gcount() == 1);
+ is.get(c);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == L'b');
+ assert(is.gcount() == 1);
+ is.get(c);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(c == L'c');
+ assert(is.gcount() == 1);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp
new file mode 100644
index 0000000000000..1691a2d2de14f
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp
@@ -0,0 +1,99 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& get(char_type* s, streamsize n);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" \n \n ");
+ std::istream is(&sb);
+ char s[5];
+ is.get(s, 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string(s) == " ");
+ assert(is.gcount() == 2);
+ is.get(s, 5);
+ assert(!is.eof());
+ assert( is.fail());
+ assert(std::string(s) == "");
+ assert(is.gcount() == 0);
+ is.clear();
+ assert(is.get() == '\n');
+ is.get(s, 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string(s) == " ");
+ assert(is.gcount() == 4);
+ assert(is.get() == '\n');
+ is.get(s, 5);
+ assert( is.eof());
+ assert(!is.fail());
+ assert(std::string(s) == " ");
+ assert(is.gcount() == 1);
+ }
+ {
+ testbuf<wchar_t> sb(L" \n \n ");
+ std::wistream is(&sb);
+ wchar_t s[5];
+ is.get(s, 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s) == L" ");
+ assert(is.gcount() == 2);
+ is.get(s, 5);
+ assert(!is.eof());
+ assert( is.fail());
+ assert(std::wstring(s) == L"");
+ assert(is.gcount() == 0);
+ is.clear();
+ assert(is.get() == L'\n');
+ is.get(s, 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s) == L" ");
+ assert(is.gcount() == 4);
+ assert(is.get() == L'\n');
+ is.get(s, 5);
+ assert( is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s) == L" ");
+ assert(is.gcount() == 1);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp
new file mode 100644
index 0000000000000..c9389ec9dad55
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp
@@ -0,0 +1,99 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& get(char_type* s, streamsize n, char_type delim);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" * * ");
+ std::istream is(&sb);
+ char s[5];
+ is.get(s, 5, '*');
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string(s) == " ");
+ assert(is.gcount() == 2);
+ is.get(s, 5, '*');
+ assert(!is.eof());
+ assert( is.fail());
+ assert(std::string(s) == "");
+ assert(is.gcount() == 0);
+ is.clear();
+ assert(is.get() == '*');
+ is.get(s, 5, '*');
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string(s) == " ");
+ assert(is.gcount() == 4);
+ assert(is.get() == '*');
+ is.get(s, 5, '*');
+ assert( is.eof());
+ assert(!is.fail());
+ assert(std::string(s) == " ");
+ assert(is.gcount() == 1);
+ }
+ {
+ testbuf<wchar_t> sb(L" * * ");
+ std::wistream is(&sb);
+ wchar_t s[5];
+ is.get(s, 5, L'*');
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s) == L" ");
+ assert(is.gcount() == 2);
+ is.get(s, 5, L'*');
+ assert(!is.eof());
+ assert( is.fail());
+ assert(std::wstring(s) == L"");
+ assert(is.gcount() == 0);
+ is.clear();
+ assert(is.get() == L'*');
+ is.get(s, 5, L'*');
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s) == L" ");
+ assert(is.gcount() == 4);
+ assert(is.get() == L'*');
+ is.get(s, 5, L'*');
+ assert( is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s) == L" ");
+ assert(is.gcount() == 1);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp
new file mode 100644
index 0000000000000..7a55f847d7349
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& get(basic_streambuf<char_type,traits>& sb);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+ testbuf(const std::basic_string<CharT>& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb("testing\n...");
+ std::istream is(&sb);
+ testbuf<char> sb2;
+ is.get(sb2);
+ assert(sb2.str() == "testing");
+ assert(is.good());
+ assert(is.gcount() == 7);
+ assert(is.get() == '\n');
+ is.get(sb2);
+ assert(sb2.str() == "testing...");
+ assert(is.eof());
+ assert(!is.fail());
+ assert(is.gcount() == 3);
+ }
+ {
+ testbuf<wchar_t> sb(L"testing\n...");
+ std::wistream is(&sb);
+ testbuf<wchar_t> sb2;
+ is.get(sb2);
+ assert(sb2.str() == L"testing");
+ assert(is.good());
+ assert(is.gcount() == 7);
+ assert(is.get() == L'\n');
+ is.get(sb2);
+ assert(sb2.str() == L"testing...");
+ assert(is.eof());
+ assert(!is.fail());
+ assert(is.gcount() == 3);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp
new file mode 100644
index 0000000000000..cbc007587d5e4
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp
@@ -0,0 +1,89 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& get(basic_streambuf<char_type,traits>& sb,
+// char_type delim);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+ testbuf(const std::basic_string<CharT>& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb("testing*...");
+ std::istream is(&sb);
+ testbuf<char> sb2;
+ is.get(sb2, '*');
+ assert(sb2.str() == "testing");
+ assert(is.good());
+ assert(is.gcount() == 7);
+ assert(is.get() == '*');
+ is.get(sb2, '*');
+ assert(sb2.str() == "testing...");
+ assert(is.eof());
+ assert(!is.fail());
+ assert(is.gcount() == 3);
+ }
+ {
+ testbuf<wchar_t> sb(L"testing*...");
+ std::wistream is(&sb);
+ testbuf<wchar_t> sb2;
+ is.get(sb2, L'*');
+ assert(sb2.str() == L"testing");
+ assert(is.good());
+ assert(is.gcount() == 7);
+ assert(is.get() == L'*');
+ is.get(sb2, L'*');
+ assert(sb2.str() == L"testing...");
+ assert(is.eof());
+ assert(!is.fail());
+ assert(is.gcount() == 3);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp
new file mode 100644
index 0000000000000..465824a659f28
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& getline(char_type* s, streamsize n);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" \n \n ");
+ std::istream is(&sb);
+ char s[5];
+ is.getline(s, 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string(s) == " ");
+ assert(is.gcount() == 3);
+ is.getline(s, 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string(s) == " ");
+ assert(is.gcount() == 5);
+ is.getline(s, 5);
+ assert( is.eof());
+ assert(!is.fail());
+ assert(std::string(s) == " ");
+ assert(is.gcount() == 1);
+ }
+ {
+ testbuf<wchar_t> sb(L" \n \n ");
+ std::wistream is(&sb);
+ wchar_t s[5];
+ is.getline(s, 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s) == L" ");
+ assert(is.gcount() == 3);
+ is.getline(s, 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s) == L" ");
+ assert(is.gcount() == 5);
+ is.getline(s, 5);
+ assert( is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s) == L" ");
+ assert(is.gcount() == 1);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp
new file mode 100644
index 0000000000000..7362959966a6d
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& getline(char_type* s, streamsize n, char_type delim);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" * * ");
+ std::istream is(&sb);
+ char s[5];
+ is.getline(s, 5, '*');
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string(s) == " ");
+ assert(is.gcount() == 3);
+ is.getline(s, 5, '*');
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string(s) == " ");
+ assert(is.gcount() == 5);
+ is.getline(s, 5, '*');
+ assert( is.eof());
+ assert(!is.fail());
+ assert(std::string(s) == " ");
+ assert(is.gcount() == 1);
+ }
+ {
+ testbuf<wchar_t> sb(L" * * ");
+ std::wistream is(&sb);
+ wchar_t s[5];
+ is.getline(s, 5, L'*');
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s) == L" ");
+ assert(is.gcount() == 3);
+ is.getline(s, 5, L'*');
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s) == L" ");
+ assert(is.gcount() == 5);
+ is.getline(s, 5, L'*');
+ assert( is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s) == L" ");
+ assert(is.gcount() == 1);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp
new file mode 100644
index 0000000000000..9510961a4c516
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>&
+// ignore(streamsize n = 1, int_type delim = traits::eof());
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" 1\n2345\n6");
+ std::istream is(&sb);
+ is.ignore();
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(is.gcount() == 1);
+ is.ignore(5, '\n');
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(is.gcount() == 2);
+ is.ignore(15);
+ assert( is.eof());
+ assert(!is.fail());
+ assert(is.gcount() == 6);
+ }
+ {
+ testbuf<wchar_t> sb(L" 1\n2345\n6");
+ std::wistream is(&sb);
+ is.ignore();
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(is.gcount() == 1);
+ is.ignore(5, '\n');
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(is.gcount() == 2);
+ is.ignore(15);
+ assert( is.eof());
+ assert(!is.fail());
+ assert(is.gcount() == 6);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp
new file mode 100644
index 0000000000000..ccc3545483e71
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>&
+// ignore(streamsize n = 1, int_type delim = traits::eof());
+
+// http://llvm.org/bugs/show_bug.cgi?id=16427
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ int bad=-1;
+ std::ostringstream os;
+ os << "aaaabbbb" << static_cast<char>(bad)
+ << "ccccdddd" << std::endl;
+ std::string s=os.str();
+
+ std::istringstream is(s);
+ const unsigned int ignoreLen=10;
+ size_t a=is.tellg();
+ is.ignore(ignoreLen);
+ size_t b=is.tellg();
+ assert((b-a)==ignoreLen);
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp
new file mode 100644
index 0000000000000..4264849a09172
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// int_type peek();
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" 1\n2345\n6");
+ std::istream is(&sb);
+ assert(is.peek() == ' ');
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(is.gcount() == 0);
+ is.get();
+ assert(is.peek() == '1');
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(is.gcount() == 0);
+ }
+ {
+ testbuf<wchar_t> sb(L" 1\n2345\n6");
+ std::wistream is(&sb);
+ assert(is.peek() == L' ');
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(is.gcount() == 0);
+ is.get();
+ assert(is.peek() == L'1');
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(is.gcount() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/putback.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/putback.pass.cpp
new file mode 100644
index 0000000000000..3564d710bc238
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/putback.pass.cpp
@@ -0,0 +1,89 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& putback(char_type c);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" 123456789");
+ std::istream is(&sb);
+ is.get();
+ is.get();
+ is.get();
+ is.putback('a');
+ assert(is.bad());
+ assert(is.gcount() == 0);
+ is.clear();
+ is.putback('2');
+ assert(is.good());
+ assert(is.gcount() == 0);
+ is.putback('1');
+ assert(is.good());
+ assert(is.gcount() == 0);
+ is.putback(' ');
+ assert(is.good());
+ assert(is.gcount() == 0);
+ is.putback(' ');
+ assert(is.bad());
+ assert(is.gcount() == 0);
+ }
+ {
+ testbuf<wchar_t> sb(L" 123456789");
+ std::wistream is(&sb);
+ is.get();
+ is.get();
+ is.get();
+ is.putback(L'a');
+ assert(is.bad());
+ assert(is.gcount() == 0);
+ is.clear();
+ is.putback(L'2');
+ assert(is.good());
+ assert(is.gcount() == 0);
+ is.putback(L'1');
+ assert(is.good());
+ assert(is.gcount() == 0);
+ is.putback(L' ');
+ assert(is.good());
+ assert(is.gcount() == 0);
+ is.putback(L' ');
+ assert(is.bad());
+ assert(is.gcount() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp
new file mode 100644
index 0000000000000..20e70cfbd5cdf
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& read(char_type* s, streamsize n);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" 123456789");
+ std::istream is(&sb);
+ char s[5];
+ is.read(s, 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string(s, 5) == " 1234");
+ assert(is.gcount() == 5);
+ is.read(s, 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string(s, 5) == "56789");
+ assert(is.gcount() == 5);
+ is.read(s, 5);
+ assert( is.eof());
+ assert( is.fail());
+ assert(is.gcount() == 0);
+ }
+ {
+ testbuf<wchar_t> sb(L" 123456789");
+ std::wistream is(&sb);
+ wchar_t s[5];
+ is.read(s, 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s, 5) == L" 1234");
+ assert(is.gcount() == 5);
+ is.read(s, 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s, 5) == L"56789");
+ assert(is.gcount() == 5);
+ is.read(s, 5);
+ assert( is.eof());
+ assert( is.fail());
+ assert(is.gcount() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp
new file mode 100644
index 0000000000000..01eecb5d824ba
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// streamsize readsome(char_type* s, streamsize n);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" 1234567890");
+ std::istream is(&sb);
+ char s[5];
+ assert(is.readsome(s, 5) == 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string(s, 5) == " 1234");
+ assert(is.gcount() == 5);
+ is.readsome(s, 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string(s, 5) == "56789");
+ assert(is.gcount() == 5);
+ is.readsome(s, 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(is.gcount() == 1);
+ assert(std::string(s, 1) == "0");
+ assert(is.readsome(s, 5) == 0);
+ }
+ {
+ testbuf<wchar_t> sb(L" 1234567890");
+ std::wistream is(&sb);
+ wchar_t s[5];
+ assert(is.readsome(s, 5) == 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s, 5) == L" 1234");
+ assert(is.gcount() == 5);
+ is.readsome(s, 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s, 5) == L"56789");
+ assert(is.gcount() == 5);
+ is.readsome(s, 5);
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(is.gcount() == 1);
+ assert(std::wstring(s, 1) == L"0");
+ assert(is.readsome(s, 5) == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp
new file mode 100644
index 0000000000000..e6f4e1e4c19ec
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& seekg(pos_type pos);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+protected:
+ typename base::pos_type seekpos(typename base::pos_type sp,
+ std::ios_base::openmode which)
+ {
+ assert(which == std::ios_base::in);
+ return sp;
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" 123456789");
+ std::istream is(&sb);
+ is.seekg(5);
+ assert(is.good());
+ is.seekg(-1);
+ assert(is.fail());
+ }
+ {
+ testbuf<wchar_t> sb(L" 123456789");
+ std::wistream is(&sb);
+ is.seekg(5);
+ assert(is.good());
+ is.seekg(-1);
+ assert(is.fail());
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp
new file mode 100644
index 0000000000000..73f3da1c6bd1f
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& seekg(off_type off, ios_base::seekdir dir);
+
+#include <istream>
+#include <cassert>
+
+int seekoff_called = 0;
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+protected:
+ typename base::pos_type seekoff(typename base::off_type off,
+ std::ios_base::seekdir way,
+ std::ios_base::openmode which)
+ {
+ assert(which == std::ios_base::in);
+ ++seekoff_called;
+ return off;
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" 123456789");
+ std::istream is(&sb);
+ is.seekg(5, std::ios_base::cur);
+ assert(is.good());
+ assert(seekoff_called == 1);
+ is.seekg(-1, std::ios_base::beg);
+ assert(is.fail());
+ assert(seekoff_called == 2);
+ }
+ {
+ testbuf<wchar_t> sb(L" 123456789");
+ std::wistream is(&sb);
+ is.seekg(5, std::ios_base::cur);
+ assert(is.good());
+ assert(seekoff_called == 3);
+ is.seekg(-1, std::ios_base::beg);
+ assert(is.fail());
+ assert(seekoff_called == 4);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp
new file mode 100644
index 0000000000000..61db67cd5a5d1
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// int sync();
+
+#include <istream>
+#include <cassert>
+
+int sync_called = 0;
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+
+protected:
+ int sync()
+ {
+ ++sync_called;
+ return 5;
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" 123456789");
+ std::istream is(&sb);
+ assert(is.sync() == 0);
+ assert(sync_called == 1);
+ }
+ {
+ testbuf<wchar_t> sb(L" 123456789");
+ std::wistream is(&sb);
+ assert(is.sync() == 0);
+ assert(sync_called == 2);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/tellg.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/tellg.pass.cpp
new file mode 100644
index 0000000000000..799b46b97dea8
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/tellg.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// pos_type tellg();
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+protected:
+ typename base::pos_type seekoff(typename base::off_type off,
+ std::ios_base::seekdir way,
+ std::ios_base::openmode which)
+ {
+ assert(off == 0);
+ assert(way == std::ios_base::cur);
+ assert(which == std::ios_base::in);
+ return 5;
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" 123456789");
+ std::istream is(&sb);
+ assert(is.tellg() == 5);
+ }
+ {
+ testbuf<wchar_t> sb(L" 123456789");
+ std::wistream is(&sb);
+ assert(is.tellg() == 5);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/unget.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/unget.pass.cpp
new file mode 100644
index 0000000000000..adf0a6117c1de
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/unget.pass.cpp
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& unget();
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb(" 123456789");
+ std::istream is(&sb);
+ is.get();
+ is.get();
+ is.get();
+ is.unget();
+ assert(is.good());
+ assert(is.gcount() == 0);
+ is.unget();
+ assert(is.good());
+ assert(is.gcount() == 0);
+ is.unget();
+ assert(is.good());
+ assert(is.gcount() == 0);
+ is.unget();
+ assert(is.bad());
+ assert(is.gcount() == 0);
+ }
+ {
+ testbuf<wchar_t> sb(L" 123456789");
+ std::wistream is(&sb);
+ is.get();
+ is.get();
+ is.get();
+ is.unget();
+ assert(is.good());
+ assert(is.gcount() == 0);
+ is.unget();
+ assert(is.good());
+ assert(is.gcount() == 0);
+ is.unget();
+ assert(is.good());
+ assert(is.gcount() == 0);
+ is.unget();
+ assert(is.bad());
+ assert(is.gcount() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream/istream.assign/member_swap.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream/istream.assign/member_swap.pass.cpp
new file mode 100644
index 0000000000000..a0734b8016b57
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream/istream.assign/member_swap.pass.cpp
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// void swap(basic_istream& rhs);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+template <class CharT>
+struct test_istream
+ : public std::basic_istream<CharT>
+{
+ typedef std::basic_istream<CharT> base;
+ test_istream(testbuf<CharT>* sb) : base(sb) {}
+
+ void swap(test_istream& s) {base::swap(s);}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb1;
+ testbuf<char> sb2;
+ test_istream<char> is1(&sb1);
+ test_istream<char> is2(&sb2);
+ is1.swap(is2);
+ assert(is1.rdbuf() == &sb1);
+ assert(is1.tie() == 0);
+ assert(is1.fill() == ' ');
+ assert(is1.rdstate() == is1.goodbit);
+ assert(is1.exceptions() == is1.goodbit);
+ assert(is1.flags() == (is1.skipws | is1.dec));
+ assert(is1.precision() == 6);
+ assert(is1.getloc().name() == "C");
+ assert(is2.rdbuf() == &sb2);
+ assert(is2.tie() == 0);
+ assert(is2.fill() == ' ');
+ assert(is2.rdstate() == is2.goodbit);
+ assert(is2.exceptions() == is2.goodbit);
+ assert(is2.flags() == (is2.skipws | is2.dec));
+ assert(is2.precision() == 6);
+ assert(is2.getloc().name() == "C");
+ }
+ {
+ testbuf<wchar_t> sb1;
+ testbuf<wchar_t> sb2;
+ test_istream<wchar_t> is1(&sb1);
+ test_istream<wchar_t> is2(&sb2);
+ is1.swap(is2);
+ assert(is1.rdbuf() == &sb1);
+ assert(is1.tie() == 0);
+ assert(is1.fill() == ' ');
+ assert(is1.rdstate() == is1.goodbit);
+ assert(is1.exceptions() == is1.goodbit);
+ assert(is1.flags() == (is1.skipws | is1.dec));
+ assert(is1.precision() == 6);
+ assert(is1.getloc().name() == "C");
+ assert(is2.rdbuf() == &sb2);
+ assert(is2.tie() == 0);
+ assert(is2.fill() == ' ');
+ assert(is2.rdstate() == is2.goodbit);
+ assert(is2.exceptions() == is2.goodbit);
+ assert(is2.flags() == (is2.skipws | is2.dec));
+ assert(is2.precision() == 6);
+ assert(is2.getloc().name() == "C");
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp
new file mode 100644
index 0000000000000..2876d76c19848
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp
@@ -0,0 +1,92 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// basic_istream& operator=(basic_istream&& rhs);
+
+#include <istream>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+template <class CharT>
+struct test_istream
+ : public std::basic_istream<CharT>
+{
+ typedef std::basic_istream<CharT> base;
+ test_istream(testbuf<CharT>* sb) : base(sb) {}
+
+ test_istream& operator=(test_istream&& s)
+ {base::operator=(std::move(s)); return *this;}
+};
+
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ testbuf<char> sb1;
+ testbuf<char> sb2;
+ test_istream<char> is1(&sb1);
+ test_istream<char> is2(&sb2);
+ is2 = (std::move(is1));
+ assert(is1.rdbuf() == &sb1);
+ assert(is1.tie() == 0);
+ assert(is1.fill() == ' ');
+ assert(is1.rdstate() == is1.goodbit);
+ assert(is1.exceptions() == is1.goodbit);
+ assert(is1.flags() == (is1.skipws | is1.dec));
+ assert(is1.precision() == 6);
+ assert(is1.getloc().name() == "C");
+ assert(is2.rdbuf() == &sb2);
+ assert(is2.tie() == 0);
+ assert(is2.fill() == ' ');
+ assert(is2.rdstate() == is2.goodbit);
+ assert(is2.exceptions() == is2.goodbit);
+ assert(is2.flags() == (is2.skipws | is2.dec));
+ assert(is2.precision() == 6);
+ assert(is2.getloc().name() == "C");
+ }
+ {
+ testbuf<wchar_t> sb1;
+ testbuf<wchar_t> sb2;
+ test_istream<wchar_t> is1(&sb1);
+ test_istream<wchar_t> is2(&sb2);
+ is2 = (std::move(is1));
+ assert(is1.rdbuf() == &sb1);
+ assert(is1.tie() == 0);
+ assert(is1.fill() == ' ');
+ assert(is1.rdstate() == is1.goodbit);
+ assert(is1.exceptions() == is1.goodbit);
+ assert(is1.flags() == (is1.skipws | is1.dec));
+ assert(is1.precision() == 6);
+ assert(is1.getloc().name() == "C");
+ assert(is2.rdbuf() == &sb2);
+ assert(is2.tie() == 0);
+ assert(is2.fill() == ' ');
+ assert(is2.rdstate() == is2.goodbit);
+ assert(is2.exceptions() == is2.goodbit);
+ assert(is2.flags() == (is2.skipws | is2.dec));
+ assert(is2.precision() == 6);
+ assert(is2.getloc().name() == "C");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp
new file mode 100644
index 0000000000000..04cb9d3fb6ba9
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// basic_istream(basic_istream&& rhs);
+
+#include <istream>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+template <class CharT>
+struct test_istream
+ : public std::basic_istream<CharT>
+{
+ typedef std::basic_istream<CharT> base;
+ test_istream(testbuf<CharT>* sb) : base(sb) {}
+
+ test_istream(test_istream&& s)
+ : base(std::move(s)) {}
+};
+
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ testbuf<char> sb;
+ test_istream<char> is1(&sb);
+ test_istream<char> is(std::move(is1));
+ assert(is1.rdbuf() == &sb);
+ assert(is1.gcount() == 0);
+ assert(is.gcount() == 0);
+ assert(is.rdbuf() == 0);
+ assert(is.tie() == 0);
+ assert(is.fill() == ' ');
+ assert(is.rdstate() == is.goodbit);
+ assert(is.exceptions() == is.goodbit);
+ assert(is.flags() == (is.skipws | is.dec));
+ assert(is.precision() == 6);
+ assert(is.getloc().name() == "C");
+ }
+ {
+ testbuf<wchar_t> sb;
+ test_istream<wchar_t> is1(&sb);
+ test_istream<wchar_t> is(std::move(is1));
+ assert(is1.gcount() == 0);
+ assert(is.gcount() == 0);
+ assert(is1.rdbuf() == &sb);
+ assert(is.rdbuf() == 0);
+ assert(is.tie() == 0);
+ assert(is.fill() == L' ');
+ assert(is.rdstate() == is.goodbit);
+ assert(is.exceptions() == is.goodbit);
+ assert(is.flags() == (is.skipws | is.dec));
+ assert(is.precision() == 6);
+ assert(is.getloc().name() == "C");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream/istream.cons/streambuf.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream/istream.cons/streambuf.pass.cpp
new file mode 100644
index 0000000000000..74ed57dae6bd3
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream/istream.cons/streambuf.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// explicit basic_istream(basic_streambuf<charT,traits>* sb);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::basic_istream<char> is(&sb);
+ assert(is.rdbuf() == &sb);
+ assert(is.tie() == 0);
+ assert(is.fill() == ' ');
+ assert(is.rdstate() == is.goodbit);
+ assert(is.exceptions() == is.goodbit);
+ assert(is.flags() == (is.skipws | is.dec));
+ assert(is.precision() == 6);
+ assert(is.getloc().name() == "C");
+ assert(is.gcount() == 0);
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::basic_istream<wchar_t> is(&sb);
+ assert(is.rdbuf() == &sb);
+ assert(is.tie() == 0);
+ assert(is.fill() == L' ');
+ assert(is.rdstate() == is.goodbit);
+ assert(is.exceptions() == is.goodbit);
+ assert(is.flags() == (is.skipws | is.dec));
+ assert(is.precision() == 6);
+ assert(is.getloc().name() == "C");
+ assert(is.gcount() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream/istream_sentry/ctor.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream/istream_sentry/ctor.pass.cpp
new file mode 100644
index 0000000000000..910b36931da32
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream/istream_sentry/ctor.pass.cpp
@@ -0,0 +1,128 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream::sentry;
+
+// explicit sentry(basic_istream<charT,traits>& is, bool noskipws = false);
+
+#include <istream>
+#include <cassert>
+
+int sync_called = 0;
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_string<CharT> string_type;
+ typedef std::basic_streambuf<CharT> base;
+private:
+ string_type str_;
+public:
+
+ testbuf() {}
+ testbuf(const string_type& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()) + str_.size());
+ }
+
+ CharT* eback() const {return base::eback();}
+ CharT* gptr() const {return base::gptr();}
+ CharT* egptr() const {return base::egptr();}
+protected:
+
+ int virtual sync()
+ {
+ ++sync_called;
+ return 1;
+ }
+};
+
+int main()
+{
+ {
+ std::istream is((testbuf<char>*)0);
+ std::istream::sentry sen(is, true);
+ assert(!(bool)sen);
+ assert(!is.good());
+ assert(is.gcount() == 0);
+ assert(sync_called == 0);
+ }
+ {
+ std::wistream is((testbuf<wchar_t>*)0);
+ std::wistream::sentry sen(is, true);
+ assert(!(bool)sen);
+ assert(!is.good());
+ assert(is.gcount() == 0);
+ assert(sync_called == 0);
+ }
+ {
+ testbuf<char> sb(" 123");
+ std::istream is(&sb);
+ std::istream::sentry sen(is, true);
+ assert((bool)sen);
+ assert(is.good());
+ assert(is.gcount() == 0);
+ assert(sync_called == 0);
+ assert(sb.gptr() == sb.eback());
+ }
+ {
+ testbuf<wchar_t> sb(L" 123");
+ std::wistream is(&sb);
+ std::wistream::sentry sen(is, true);
+ assert((bool)sen);
+ assert(is.good());
+ assert(is.gcount() == 0);
+ assert(sync_called == 0);
+ assert(sb.gptr() == sb.eback());
+ }
+ {
+ testbuf<char> sb(" 123");
+ std::istream is(&sb);
+ std::istream::sentry sen(is);
+ assert((bool)sen);
+ assert(is.good());
+ assert(sync_called == 0);
+ assert(sb.gptr() == sb.eback() + 3);
+ }
+ {
+ testbuf<wchar_t> sb(L" 123");
+ std::wistream is(&sb);
+ std::wistream::sentry sen(is);
+ assert((bool)sen);
+ assert(is.good());
+ assert(sync_called == 0);
+ assert(sb.gptr() == sb.eback() + 3);
+ }
+ {
+ testbuf<char> sb(" ");
+ std::istream is(&sb);
+ std::istream::sentry sen(is);
+ assert(!(bool)sen);
+ assert(is.fail());
+ assert(is.eof());
+ assert(sync_called == 0);
+ assert(sb.gptr() == sb.eback() + 6);
+ }
+ {
+ testbuf<char> sb(" ");
+ std::istream is(&sb);
+ std::istream::sentry sen(is, true);
+ assert((bool)sen);
+ assert(is.good());
+ assert(sync_called == 0);
+ assert(sb.gptr() == sb.eback());
+ }
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream/types.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream/types.pass.cpp
new file mode 100644
index 0000000000000..36cc2029db246
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream/types.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream
+// : virtual public basic_ios<charT,traits>
+// {
+// public:
+// // types (inherited from basic_ios (27.5.4)):
+// typedef charT char_type;
+// typedef traits traits_type;
+// typedef typename traits_type::int_type int_type;
+// typedef typename traits_type::pos_type pos_type;
+// typedef typename traits_type::off_type off_type;
+
+#include <istream>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_base_of<std::basic_ios<char>, std::basic_istream<char> >::value), "");
+ static_assert((std::is_same<std::basic_istream<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::basic_istream<char>::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_istream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::basic_istream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::basic_istream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+}
diff --git a/test/std/input.output/iostream.format/input.streams/version.pass.cpp b/test/std/input.output/iostream.format/input.streams/version.pass.cpp
new file mode 100644
index 0000000000000..b03ef2aaa04e0
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+#include <istream>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostream.format/nothing_to_do.pass.cpp b/test/std/input.output/iostream.format/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/iostream.format/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.assign/member_swap.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.assign/member_swap.pass.cpp
new file mode 100644
index 0000000000000..8214d6c05b5bf
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.assign/member_swap.pass.cpp
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// void swap(basic_ostream& rhs);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+template <class CharT>
+struct test_ostream
+ : public std::basic_ostream<CharT>
+{
+ typedef std::basic_ostream<CharT> base;
+ test_ostream(testbuf<CharT>* sb) : base(sb) {}
+
+ void swap(test_ostream& s) {base::swap(s);}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb1;
+ testbuf<char> sb2;
+ test_ostream<char> os1(&sb1);
+ test_ostream<char> os2(&sb2);
+ os1.swap(os2);
+ assert(os1.rdbuf() == &sb1);
+ assert(os1.tie() == 0);
+ assert(os1.fill() == ' ');
+ assert(os1.rdstate() == os1.goodbit);
+ assert(os1.exceptions() == os1.goodbit);
+ assert(os1.flags() == (os1.skipws | os1.dec));
+ assert(os1.precision() == 6);
+ assert(os1.getloc().name() == "C");
+ assert(os2.rdbuf() == &sb2);
+ assert(os2.tie() == 0);
+ assert(os2.fill() == ' ');
+ assert(os2.rdstate() == os2.goodbit);
+ assert(os2.exceptions() == os2.goodbit);
+ assert(os2.flags() == (os2.skipws | os2.dec));
+ assert(os2.precision() == 6);
+ assert(os2.getloc().name() == "C");
+ }
+ {
+ testbuf<wchar_t> sb1;
+ testbuf<wchar_t> sb2;
+ test_ostream<wchar_t> os1(&sb1);
+ test_ostream<wchar_t> os2(&sb2);
+ os1.swap(os2);
+ assert(os1.rdbuf() == &sb1);
+ assert(os1.tie() == 0);
+ assert(os1.fill() == ' ');
+ assert(os1.rdstate() == os1.goodbit);
+ assert(os1.exceptions() == os1.goodbit);
+ assert(os1.flags() == (os1.skipws | os1.dec));
+ assert(os1.precision() == 6);
+ assert(os1.getloc().name() == "C");
+ assert(os2.rdbuf() == &sb2);
+ assert(os2.tie() == 0);
+ assert(os2.fill() == ' ');
+ assert(os2.rdstate() == os2.goodbit);
+ assert(os2.exceptions() == os2.goodbit);
+ assert(os2.flags() == (os2.skipws | os2.dec));
+ assert(os2.precision() == 6);
+ assert(os2.getloc().name() == "C");
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp
new file mode 100644
index 0000000000000..40fe0795de534
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp
@@ -0,0 +1,92 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// basic_ostream& operator=(basic_ostream&& rhs);
+
+#include <ostream>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+template <class CharT>
+struct test_ostream
+ : public std::basic_ostream<CharT>
+{
+ typedef std::basic_ostream<CharT> base;
+ test_ostream(testbuf<CharT>* sb) : base(sb) {}
+
+ test_ostream& operator=(test_ostream&& s)
+ {base::operator=(std::move(s)); return *this;}
+};
+
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ testbuf<char> sb1;
+ testbuf<char> sb2;
+ test_ostream<char> os1(&sb1);
+ test_ostream<char> os2(&sb2);
+ os2 = (std::move(os1));
+ assert(os1.rdbuf() == &sb1);
+ assert(os1.tie() == 0);
+ assert(os1.fill() == ' ');
+ assert(os1.rdstate() == os1.goodbit);
+ assert(os1.exceptions() == os1.goodbit);
+ assert(os1.flags() == (os1.skipws | os1.dec));
+ assert(os1.precision() == 6);
+ assert(os1.getloc().name() == "C");
+ assert(os2.rdbuf() == &sb2);
+ assert(os2.tie() == 0);
+ assert(os2.fill() == ' ');
+ assert(os2.rdstate() == os2.goodbit);
+ assert(os2.exceptions() == os2.goodbit);
+ assert(os2.flags() == (os2.skipws | os2.dec));
+ assert(os2.precision() == 6);
+ assert(os2.getloc().name() == "C");
+ }
+ {
+ testbuf<wchar_t> sb1;
+ testbuf<wchar_t> sb2;
+ test_ostream<wchar_t> os1(&sb1);
+ test_ostream<wchar_t> os2(&sb2);
+ os2 = (std::move(os1));
+ assert(os1.rdbuf() == &sb1);
+ assert(os1.tie() == 0);
+ assert(os1.fill() == ' ');
+ assert(os1.rdstate() == os1.goodbit);
+ assert(os1.exceptions() == os1.goodbit);
+ assert(os1.flags() == (os1.skipws | os1.dec));
+ assert(os1.precision() == 6);
+ assert(os1.getloc().name() == "C");
+ assert(os2.rdbuf() == &sb2);
+ assert(os2.tie() == 0);
+ assert(os2.fill() == ' ');
+ assert(os2.rdstate() == os2.goodbit);
+ assert(os2.exceptions() == os2.goodbit);
+ assert(os2.flags() == (os2.skipws | os2.dec));
+ assert(os2.precision() == 6);
+ assert(os2.getloc().name() == "C");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp
new file mode 100644
index 0000000000000..b3045b3232e6e
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// basic_ostream(basic_ostream&& rhs);
+
+#include <ostream>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+template <class CharT>
+struct test_ostream
+ : public std::basic_ostream<CharT>
+{
+ typedef std::basic_ostream<CharT> base;
+ test_ostream(testbuf<CharT>* sb) : base(sb) {}
+
+ test_ostream(test_ostream&& s)
+ : base(std::move(s)) {}
+};
+
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ testbuf<char> sb;
+ test_ostream<char> os1(&sb);
+ test_ostream<char> os(std::move(os1));
+ assert(os1.rdbuf() == &sb);
+ assert(os.rdbuf() == 0);
+ assert(os.tie() == 0);
+ assert(os.fill() == ' ');
+ assert(os.rdstate() == os.goodbit);
+ assert(os.exceptions() == os.goodbit);
+ assert(os.flags() == (os.skipws | os.dec));
+ assert(os.precision() == 6);
+ assert(os.getloc().name() == "C");
+ }
+ {
+ testbuf<wchar_t> sb;
+ test_ostream<wchar_t> os1(&sb);
+ test_ostream<wchar_t> os(std::move(os1));
+ assert(os1.rdbuf() == &sb);
+ assert(os.rdbuf() == 0);
+ assert(os.tie() == 0);
+ assert(os.fill() == L' ');
+ assert(os.rdstate() == os.goodbit);
+ assert(os.exceptions() == os.goodbit);
+ assert(os.flags() == (os.skipws | os.dec));
+ assert(os.precision() == 6);
+ assert(os.getloc().name() == "C");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.cons/streambuf.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.cons/streambuf.pass.cpp
new file mode 100644
index 0000000000000..7929e1845ec69
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.cons/streambuf.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// explicit basic_ostream(basic_streambuf<charT,traits>* sb);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::basic_ostream<char> os(&sb);
+ assert(os.rdbuf() == &sb);
+ assert(os.tie() == 0);
+ assert(os.fill() == ' ');
+ assert(os.rdstate() == os.goodbit);
+ assert(os.exceptions() == os.goodbit);
+ assert(os.flags() == (os.skipws | os.dec));
+ assert(os.precision() == 6);
+ assert(os.getloc().name() == "C");
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::basic_ostream<wchar_t> os(&sb);
+ assert(os.rdbuf() == &sb);
+ assert(os.tie() == 0);
+ assert(os.fill() == L' ');
+ assert(os.rdstate() == os.goodbit);
+ assert(os.exceptions() == os.goodbit);
+ assert(os.flags() == (os.skipws | os.dec));
+ assert(os.precision() == 6);
+ assert(os.getloc().name() == "C");
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/nothing_to_do.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.reqmts/tested_elsewhere.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.reqmts/tested_elsewhere.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.reqmts/tested_elsewhere.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp
new file mode 100644
index 0000000000000..13035b74436e4
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// operator<<(bool val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ bool b = false;
+ os << b;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ bool b = false;
+ os << b;
+ assert(sb.str() == "0");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ bool b = true;
+ os << b;
+ assert(sb.str() == "1");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ boolalpha(os);
+ bool b = true;
+ os << b;
+ assert(sb.str() == "true");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ boolalpha(os);
+ bool b = false;
+ os << b;
+ assert(sb.str() == "false");
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp
new file mode 100644
index 0000000000000..38ee37ff18923
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// operator<<(double val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ double n = 0;
+ os << n;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ double n = 0;
+ os << n;
+ assert(sb.str() == "0");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ double n = -10;
+ os << n;
+ assert(sb.str() == "-10");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ hex(os);
+ double n = -10.5;
+ os << n;
+ assert(sb.str() == "-10.5");
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp
new file mode 100644
index 0000000000000..1da0ac685fcbd
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// operator<<(float val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ float n = 0;
+ os << n;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ float n = 0;
+ os << n;
+ assert(sb.str() == "0");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ float n = -10;
+ os << n;
+ assert(sb.str() == "-10");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ hex(os);
+ float n = -10.5;
+ os << n;
+ assert(sb.str() == "-10.5");
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp
new file mode 100644
index 0000000000000..efcb08a3da10a
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// operator<<(int val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ int n = 0;
+ os << n;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ int n = 0;
+ os << n;
+ assert(sb.str() == "0");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ int n = -10;
+ os << n;
+ assert(sb.str() == "-10");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ hex(os);
+ int n = -10;
+ os << n;
+ assert(sb.str() == "fffffff6");
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp
new file mode 100644
index 0000000000000..6d617a453ebcd
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// operator<<(long val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ long n = 0;
+ os << n;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ long n = 0;
+ os << n;
+ assert(sb.str() == "0");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ long n = -10;
+ os << n;
+ assert(sb.str() == "-10");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ hex(os);
+ long n = 0xfffffff6;
+ os << n;
+ assert(sb.str() == "fffffff6");
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp
new file mode 100644
index 0000000000000..20b20b2231a2b
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// operator<<(long double val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ long double n = 0;
+ os << n;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ long double n = 0;
+ os << n;
+ assert(sb.str() == "0");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ long double n = -10;
+ os << n;
+ assert(sb.str() == "-10");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ hex(os);
+ long double n = -10.5;
+ os << n;
+ assert(sb.str() == "-10.5");
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp
new file mode 100644
index 0000000000000..dc77eb72192d1
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// operator<<(long long val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ long long n = 0;
+ os << n;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ long long n = 0;
+ os << n;
+ assert(sb.str() == "0");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ long long n = -10;
+ os << n;
+ assert(sb.str() == "-10");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ hex(os);
+ long long n = -10;
+ os << n;
+ assert(sb.str() == "fffffffffffffff6");
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass
new file mode 100644
index 0000000000000..27b8cfd85c960
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// operator<<( int16_t val);
+// operator<<(uint16_t val);
+// operator<<( int32_t val);
+// operator<<(uint32_t val);
+// operator<<( int64_t val);
+// operator<<(uint64_t val);
+
+// Testing to make sure that the max length values are correctly inserted
+
+#include <iostream>
+#include <sstream>
+#include <cassert>
+
+template <typename T>
+void test_octal(const char *expected)
+{
+ std::stringstream ss;
+ ss << std::oct << static_cast<T>(-1);
+
+ assert(ss.str() == expected);
+}
+
+template <typename T>
+void test_dec(const char *expected)
+{
+ std::stringstream ss;
+ ss << std::dec << static_cast<T>(-1);
+
+// std::cout << ss.str() << " " << expected << std::endl;
+ assert(ss.str() == expected);
+}
+
+template <typename T>
+void test_hex(const char *expected)
+{
+ std::stringstream ss;
+ ss << std::hex << static_cast<T>(-1);
+
+ std::string str = ss.str();
+ for (size_t i = 0; i < str.size(); ++i )
+ str[i] = std::toupper(str[i]);
+
+ assert(str == expected);
+}
+
+int main(int argc, char* argv[])
+{
+ test_octal<uint16_t>( "177777");
+ test_octal< int16_t>( "177777");
+ test_octal<uint32_t>( "37777777777");
+ test_octal< int32_t>( "37777777777");
+ test_octal<uint64_t>("1777777777777777777777");
+ test_octal< int64_t>("1777777777777777777777");
+
+ test_dec<uint16_t>( "65535");
+ test_dec< int16_t>( "-1");
+ test_dec<uint32_t>( "4294967295");
+ test_dec< int32_t>( "-1");
+ test_dec<uint64_t>("18446744073709551615");
+ test_dec< int64_t>( "-1");
+
+ test_hex<uint16_t>( "FFFF");
+ test_hex< int16_t>( "FFFF");
+ test_hex<uint32_t>( "FFFFFFFF");
+ test_hex< int32_t>( "FFFFFFFF");
+ test_hex<uint64_t>("FFFFFFFFFFFFFFFF");
+ test_hex< int64_t>("FFFFFFFFFFFFFFFF");
+
+ return 0;
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp
new file mode 100644
index 0000000000000..b74d99a34ec97
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// operator<<(const void* val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ const void* n = 0;
+ os << n;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb1;
+ std::ostream os1(&sb1);
+ int n1;
+ os1 << &n1;
+ assert(os1.good());
+ std::string s1(sb1.str());
+
+ testbuf<char> sb2;
+ std::ostream os2(&sb2);
+ int n2;
+ os2 << &n2;
+ assert(os2.good());
+ std::string s2(sb2.str());
+
+ // %p is implementation defined. Instead of validating the
+ // output, at least ensure that it does not generate an empty
+ // string. Also make sure that given two distinct addresses, the
+ // output of %p is different.
+ assert(!s1.empty());
+ assert(!s2.empty());
+ assert(s1 != s2);
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ const void* n = &sb;
+ os << n;
+ assert(os.good());
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp
new file mode 100644
index 0000000000000..ebd349bcbb79c
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// operator<<(short val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ short n = 0;
+ os << n;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ short n = 0;
+ os << n;
+ assert(sb.str() == "0");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ short n = -10;
+ os << n;
+ assert(sb.str() == "-10");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ hex(os);
+ short n = -10;
+ os << n;
+ assert(sb.str() == "fff6");
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp
new file mode 100644
index 0000000000000..ac60fa9c19792
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// operator<<(unsigned int val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ unsigned int n = 0;
+ os << n;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ unsigned int n = 0;
+ os << n;
+ assert(sb.str() == "0");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ unsigned int n = 10;
+ os << n;
+ assert(sb.str() == "10");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ hex(os);
+ unsigned int n = 0xFFF6;
+ os << n;
+ assert(sb.str() == "fff6");
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp
new file mode 100644
index 0000000000000..b5a38017dce4b
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// operator<<(unsigned long val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ unsigned long n = 0;
+ os << n;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ unsigned long n = 0;
+ os << n;
+ assert(sb.str() == "0");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ unsigned long n = 10;
+ os << n;
+ assert(sb.str() == "10");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ hex(os);
+ unsigned long n = 0xfffffff6;
+ os << n;
+ assert(sb.str() == "fffffff6");
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp
new file mode 100644
index 0000000000000..25dc4d8349753
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// operator<<(unsigned long long val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ unsigned long long n = 0;
+ os << n;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ unsigned long long n = 0;
+ os << n;
+ assert(sb.str() == "0");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ unsigned long long n = 10;
+ os << n;
+ assert(sb.str() == "10");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ hex(os);
+ unsigned long long n = -10;
+ os << n;
+ assert(sb.str() == "fffffffffffffff6");
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp
new file mode 100644
index 0000000000000..7c28a8ee79c4a
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// operator<<(unsigned short val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ unsigned short n = 0;
+ os << n;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ unsigned short n = 0;
+ os << n;
+ assert(sb.str() == "0");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ unsigned short n = 10;
+ os << n;
+ assert(sb.str() == "10");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ hex(os);
+ unsigned short n = 0xFFF6;
+ os << n;
+ assert(sb.str() == "fff6");
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp
new file mode 100644
index 0000000000000..f74e2a4abd9ef
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// template<class charT, class traits>
+// basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out, charT c);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::wostream os((std::wstreambuf*)0);
+ wchar_t c = L'a';
+ os << c;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ wchar_t c = L'a';
+ os << c;
+ assert(sb.str() == L"a");
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ os.width(5);
+ wchar_t c = L'a';
+ os << c;
+ assert(sb.str() == L" a");
+ assert(os.width() == 0);
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ os.width(5);
+ left(os);
+ wchar_t c = L'a';
+ os << c;
+ assert(sb.str() == L"a ");
+ assert(os.width() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp
new file mode 100644
index 0000000000000..2b78fa75aa305
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// template<class charT, class traits>
+// basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out, const charT* s);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::wostream os((std::wstreambuf*)0);
+ const wchar_t* c = L"123";
+ os << c;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ const wchar_t* c = L"123";
+ os << c;
+ assert(sb.str() == L"123");
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ os.width(5);
+ const wchar_t* c = L"123";
+ os << c;
+ assert(sb.str() == L" 123");
+ assert(os.width() == 0);
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ os.width(5);
+ left(os);
+ const wchar_t* c = L"123";
+ os << c;
+ assert(sb.str() == L"123 ");
+ assert(os.width() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp
new file mode 100644
index 0000000000000..253b524308c0f
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// template<class char, class traits>
+// basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out, char c);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ char c = 'a';
+ os << c;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ char c = 'a';
+ os << c;
+ assert(sb.str() == "a");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.width(5);
+ char c = 'a';
+ os << c;
+ assert(sb.str() == " a");
+ assert(os.width() == 0);
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.width(5);
+ left(os);
+ char c = 'a';
+ os << c;
+ assert(sb.str() == "a ");
+ assert(os.width() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp
new file mode 100644
index 0000000000000..c544554ae0e20
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// template<class traits>
+// basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out, const char* s);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ const char* c = "123";
+ os << c;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ const char* c = "123";
+ os << c;
+ assert(sb.str() == "123");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.width(5);
+ const char* c = "123";
+ os << c;
+ assert(sb.str() == " 123");
+ assert(os.width() == 0);
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.width(5);
+ left(os);
+ const char* c = "123";
+ os << c;
+ assert(sb.str() == "123 ");
+ assert(os.width() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp
new file mode 100644
index 0000000000000..6449a13a6426f
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// template<class charT, class traits>
+// basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out, char c);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::wostream os((std::wstreambuf*)0);
+ char c = 'a';
+ os << c;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ char c = 'a';
+ os << c;
+ assert(sb.str() == L"a");
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ os.width(5);
+ char c = 'a';
+ os << c;
+ assert(sb.str() == L" a");
+ assert(os.width() == 0);
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ os.width(5);
+ left(os);
+ char c = 'a';
+ os << c;
+ assert(sb.str() == L"a ");
+ assert(os.width() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp
new file mode 100644
index 0000000000000..e679a5c48ba4d
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// template<class charT, class traits>
+// basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out, const char* s);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::wostream os((std::wstreambuf*)0);
+ const char* c = "123";
+ os << c;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ const char* c = "123";
+ os << c;
+ assert(sb.str() == L"123");
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ os.width(5);
+ const char* c = "123";
+ os << c;
+ assert(sb.str() == L" 123");
+ assert(os.width() == 0);
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ os.width(5);
+ left(os);
+ const char* c = "123";
+ os << c;
+ assert(sb.str() == L"123 ");
+ assert(os.width() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp
new file mode 100644
index 0000000000000..dc0ee4266c775
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// template<class char, class traits>
+// basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out, signed char c);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ signed char c = 'a';
+ os << c;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ signed char c = 'a';
+ os << c;
+ assert(sb.str() == "a");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.width(5);
+ signed char c = 'a';
+ os << c;
+ assert(sb.str() == " a");
+ assert(os.width() == 0);
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.width(5);
+ left(os);
+ signed char c = 'a';
+ os << c;
+ assert(sb.str() == "a ");
+ assert(os.width() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp
new file mode 100644
index 0000000000000..e465b94b6b93c
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// template<class traits>
+// basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out, const signed char* s);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ const signed char* c = (const signed char*)"123";
+ os << c;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ const signed char* c = (const signed char*)"123";
+ os << c;
+ assert(sb.str() == "123");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.width(5);
+ const signed char* c = (const signed char*)"123";
+ os << c;
+ assert(sb.str() == " 123");
+ assert(os.width() == 0);
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.width(5);
+ left(os);
+ const signed char* c = (const signed char*)"123";
+ os << c;
+ assert(sb.str() == "123 ");
+ assert(os.width() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp
new file mode 100644
index 0000000000000..d818c5f358f2e
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// template<class char, class traits>
+// basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out, unsigned char c);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ unsigned char c = 'a';
+ os << c;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ unsigned char c = 'a';
+ os << c;
+ assert(sb.str() == "a");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.width(5);
+ unsigned char c = 'a';
+ os << c;
+ assert(sb.str() == " a");
+ assert(os.width() == 0);
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.width(5);
+ left(os);
+ unsigned char c = 'a';
+ os << c;
+ assert(sb.str() == "a ");
+ assert(os.width() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp
new file mode 100644
index 0000000000000..3257f4a776ca8
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// template<class traits>
+// basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out, const unsigned char* s);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ const unsigned char* c = (const unsigned char*)"123";
+ os << c;
+ assert(os.bad());
+ assert(os.fail());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ const unsigned char* c = (const unsigned char*)"123";
+ os << c;
+ assert(sb.str() == "123");
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.width(5);
+ const unsigned char* c = (const unsigned char*)"123";
+ os << c;
+ assert(sb.str() == " 123");
+ assert(os.width() == 0);
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.width(5);
+ left(os);
+ const unsigned char* c = (const unsigned char*)"123";
+ os << c;
+ assert(sb.str() == "123 ");
+ assert(os.width() == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp
new file mode 100644
index 0000000000000..e26466e13f6e7
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// basic_ostream<charT,traits>& operator<<(basic_ios<charT,traits>&
+// (*pf)(basic_ios<charT,traits>&));
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+template <class CharT>
+std::basic_ios<CharT>&
+f(std::basic_ios<CharT>& os)
+{
+ std::uppercase(os);
+ return os;
+}
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ assert(!(os.flags() & std::ios_base::uppercase));
+ os << f;
+ assert( (os.flags() & std::ios_base::uppercase));
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp
new file mode 100644
index 0000000000000..238a621082495
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// basic_ostream<charT,traits>& operator<<(ios_base& (*pf)(ios_base&));
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ assert(!(os.flags() & std::ios_base::uppercase));
+ os << std::uppercase;
+ assert( (os.flags() & std::ios_base::uppercase));
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp
new file mode 100644
index 0000000000000..3ed400a705caa
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// basic_ostream<charT,traits>& operator<<
+// (basic_ostream<charT,traits>& (*pf)(basic_ostream<charT,traits>&))
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+template <class CharT>
+std::basic_ostream<CharT>&
+f(std::basic_ostream<CharT>& os)
+{
+ os << "testing...";
+ return os;
+}
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os << f;
+ assert(sb.str() == "testing...");
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp
new file mode 100644
index 0000000000000..1cb9413a7cc92
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// basic_ostream<charT,traits>& operator<<(basic_streambuf<charT,traits>* sb);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+ testbuf(const std::basic_string<CharT>& str)
+ : str_(str)
+ {
+ base::setg(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ testbuf<char> sb2("testing...");
+ assert(sb.str() == "");
+ os << &sb2;
+ assert(sb.str() == "testing...");
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp
new file mode 100644
index 0000000000000..d503544a97f22
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// template <class charT, class traits>
+// basic_ostream<charT,traits>& endl(basic_ostream<charT,traits>& os);
+
+#include <ostream>
+#include <cassert>
+
+int sync_called = 0;
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+
+ virtual int
+ sync()
+ {
+ ++sync_called;
+ return 0;
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ endl(os);
+ assert(sb.str() == "\n");
+ assert(sync_called == 1);
+ assert(os.good());
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ endl(os);
+ assert(sb.str() == L"\n");
+ assert(sync_called == 2);
+ assert(os.good());
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp
new file mode 100644
index 0000000000000..975b660b4770b
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// template <class charT, class traits>
+// basic_ostream<charT,traits>& ends(basic_ostream<charT,traits>& os);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ ends(os);
+ assert(sb.str().size() == 1);
+ assert(sb.str().back() == 0);
+ assert(os.good());
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ ends(os);
+ assert(sb.str().size() == 1);
+ assert(sb.str().back() == 0);
+ assert(os.good());
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.manip/flush.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.manip/flush.pass.cpp
new file mode 100644
index 0000000000000..088826c3d5a93
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.manip/flush.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// template <class charT, class traits>
+// basic_ostream<charT,traits>& flush(basic_ostream<charT,traits>& os);
+
+#include <ostream>
+#include <cassert>
+
+int sync_called = 0;
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+public:
+ testbuf()
+ {
+ }
+
+protected:
+
+ virtual int
+ sync()
+ {
+ ++sync_called;
+ return 0;
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ flush(os);
+ assert(sync_called == 1);
+ assert(os.good());
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ flush(os);
+ assert(sync_called == 2);
+ assert(os.good());
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp
new file mode 100644
index 0000000000000..ec0e8e1e8c7a6
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// template <class charT, class traits, class T>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>&& os, const T& x);
+
+#include <ostream>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ testbuf<char> sb;
+ std::ostream(&sb) << "testing...";
+ assert(sb.str() == "testing...");
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream(&sb) << L"123";
+ assert(sb.str() == L"123");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp.pass.cpp
new file mode 100644
index 0000000000000..ec3fe48866c77
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// basic_ostream<charT,traits>& seekp(pos_type pos);
+
+#include <ostream>
+#include <cassert>
+
+int seekpos_called = 0;
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ testbuf() {}
+
+protected:
+
+ typename base::pos_type
+ seekpos(typename base::pos_type sp, std::ios_base::openmode which)
+ {
+ ++seekpos_called;
+ assert(which == std::ios_base::out);
+ return sp;
+ }
+};
+
+int main()
+{
+ {
+ seekpos_called = 0;
+ std::ostream os((std::streambuf*)0);
+ assert(&os.seekp(5) == &os);
+ assert(seekpos_called == 0);
+ }
+ {
+ seekpos_called = 0;
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ assert(&os.seekp(10) == &os);
+ assert(seekpos_called == 1);
+ assert(os.good());
+ assert(&os.seekp(-1) == &os);
+ assert(seekpos_called == 2);
+ assert(os.fail());
+ }
+ { // See https://llvm.org/bugs/show_bug.cgi?id=21361
+ seekpos_called = 0;
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.setstate(std::ios_base::eofbit);
+ assert(&os.seekp(10) == &os);
+ assert(seekpos_called == 1);
+ assert(os.rdstate() == std::ios_base::eofbit);
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp2.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp2.pass.cpp
new file mode 100644
index 0000000000000..ebfd24af91d5b
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp2.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// basic_ostream<charT,traits>& seekp(off_type off, ios_base::seekdir dir);
+
+#include <ostream>
+#include <cassert>
+
+int seekoff_called = 0;
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ testbuf() {}
+
+protected:
+
+ typename base::pos_type
+ seekoff(typename base::off_type off, std::ios_base::seekdir way,
+ std::ios_base::openmode which)
+ {
+ ++seekoff_called;
+ assert(way == std::ios_base::beg);
+ assert(which == std::ios_base::out);
+ return off;
+ }
+};
+
+int main()
+{
+ {
+ seekoff_called = 0;
+ std::ostream os((std::streambuf*)0);
+ assert(&os.seekp(5, std::ios_base::beg) == &os);
+ assert(seekoff_called == 0);
+ }
+ {
+ seekoff_called = 0;
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ assert(&os.seekp(10, std::ios_base::beg) == &os);
+ assert(seekoff_called == 1);
+ assert(os.good());
+ assert(&os.seekp(-1, std::ios_base::beg) == &os);
+ assert(seekoff_called == 2);
+ assert(os.fail());
+ }
+ { // See https://llvm.org/bugs/show_bug.cgi?id=21361
+ seekoff_called = 0;
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.setstate(std::ios_base::eofbit);
+ assert(&os.seekp(10, std::ios_base::beg) == &os);
+ assert(seekoff_called == 1);
+ assert(os.rdstate() == std::ios_base::eofbit);
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.seeks/tellp.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.seeks/tellp.pass.cpp
new file mode 100644
index 0000000000000..10a229d382b04
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.seeks/tellp.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// pos_type tellp();
+
+#include <ostream>
+#include <cassert>
+
+int seekoff_called = 0;
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ testbuf() {}
+
+protected:
+
+ typename base::pos_type
+ seekoff(typename base::off_type off, std::ios_base::seekdir way, std::ios_base::openmode which)
+ {
+ assert(off == 0);
+ assert(way == std::ios_base::cur);
+ assert(which == std::ios_base::out);
+ ++seekoff_called;
+ return 10;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ assert(os.tellp() == -1);
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ assert(os.tellp() == 10);
+ assert(seekoff_called == 1);
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.unformatted/flush.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.unformatted/flush.pass.cpp
new file mode 100644
index 0000000000000..97791f4c7a9cc
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.unformatted/flush.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// basic_ostream& flush();
+
+#include <ostream>
+#include <cassert>
+
+int sync_called = 0;
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+public:
+ testbuf()
+ {
+ }
+
+protected:
+
+ virtual int
+ sync()
+ {
+ if (sync_called++ == 1)
+ return -1;
+ return 0;
+ }
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os.flush();
+ assert(os.good());
+ assert(sync_called == 1);
+ os.flush();
+ assert(os.bad());
+ assert(sync_called == 2);
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp
new file mode 100644
index 0000000000000..396bb093f9c7e
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// basic_ostream<charT,traits>& put(char_type c);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::wostream os((std::wstreambuf*)0);
+ wchar_t c = L'a';
+ os.put(c);
+ assert(os.bad());
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ wchar_t c = L'a';
+ os.put(c);
+ assert(sb.str() == L"a");
+ assert(os.good());
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ char c = 'a';
+ os.put(c);
+ assert(sb.str() == "a");
+ assert(os.good());
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp
new file mode 100644
index 0000000000000..8dd4e4cf76a6d
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// basic_ostream& write(const char_type* s, streamsize n);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ std::basic_string<CharT> str_;
+public:
+ testbuf()
+ {
+ }
+
+ std::basic_string<CharT> str() const
+ {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+ virtual typename base::int_type
+ overflow(typename base::int_type __c = base::traits_type::eof())
+ {
+ if (__c != base::traits_type::eof())
+ {
+ int n = str_.size();
+ str_.push_back(__c);
+ str_.resize(str_.capacity());
+ base::setp(const_cast<CharT*>(str_.data()),
+ const_cast<CharT*>(str_.data() + str_.size()));
+ base::pbump(n+1);
+ }
+ return __c;
+ }
+};
+
+int main()
+{
+ {
+ std::wostream os((std::wstreambuf*)0);
+ const wchar_t s[] = L"123456790";
+ os.write(s, sizeof(s)/sizeof(s[0])-1);
+ assert(os.bad());
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ const wchar_t s[] = L"123456790";
+ os.write(s, sizeof(s)/sizeof(s[0])-1);
+ assert(os.good());
+ assert(sb.str() == s);
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ const char s[] = "123456790";
+ os.write(s, sizeof(s)/sizeof(s[0])-1);
+ assert(sb.str() == s);
+ assert(os.good());
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream/types.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream/types.pass.cpp
new file mode 100644
index 0000000000000..41ce0346c48bc
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream/types.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream
+// : virtual public basic_ios<charT,traits>
+// {
+// public:
+// // types (inherited from basic_ios (27.5.4)):
+// typedef charT char_type;
+// typedef traits traits_type;
+// typedef typename traits_type::int_type int_type;
+// typedef typename traits_type::pos_type pos_type;
+// typedef typename traits_type::off_type off_type;
+
+#include <ostream>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_base_of<std::basic_ios<char>, std::basic_ostream<char> >::value), "");
+ static_assert((std::is_same<std::basic_ostream<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::basic_ostream<char>::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_ostream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::basic_ostream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::basic_ostream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream_sentry/construct.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream_sentry/construct.pass.cpp
new file mode 100644
index 0000000000000..991fdfb357220
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream_sentry/construct.pass.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream::sentry;
+
+// explicit sentry(basic_ostream<charT,traits>& os);
+
+#include <ostream>
+#include <cassert>
+
+int sync_called = 0;
+
+template <class CharT>
+struct testbuf1
+ : public std::basic_streambuf<CharT>
+{
+ testbuf1() {}
+
+protected:
+
+ int virtual sync()
+ {
+ ++sync_called;
+ return 1;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ std::ostream::sentry s(os);
+ assert(!bool(s));
+ }
+ {
+ testbuf1<char> sb;
+ std::ostream os(&sb);
+ std::ostream::sentry s(os);
+ assert(bool(s));
+ }
+ {
+ testbuf1<char> sb;
+ std::ostream os(&sb);
+ testbuf1<char> sb2;
+ std::ostream os2(&sb2);
+ os.tie(&os2);
+ assert(sync_called == 0);
+ std::ostream::sentry s(os);
+ assert(bool(s));
+ assert(sync_called == 1);
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp
new file mode 100644
index 0000000000000..112928ca0ce68
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream::sentry;
+
+// ~sentry();
+
+#include <ostream>
+#include <cassert>
+
+int sync_called = 0;
+
+template <class CharT>
+struct testbuf1
+ : public std::basic_streambuf<CharT>
+{
+ testbuf1() {}
+
+protected:
+
+ int virtual sync()
+ {
+ ++sync_called;
+ return 1;
+ }
+};
+
+int main()
+{
+ {
+ std::ostream os((std::streambuf*)0);
+ std::ostream::sentry s(os);
+ assert(!bool(s));
+ }
+ assert(sync_called == 0);
+ {
+ testbuf1<char> sb;
+ std::ostream os(&sb);
+ std::ostream::sentry s(os);
+ assert(bool(s));
+ }
+ assert(sync_called == 0);
+ {
+ testbuf1<char> sb;
+ std::ostream os(&sb);
+ std::ostream::sentry s(os);
+ assert(bool(s));
+ unitbuf(os);
+ }
+ assert(sync_called == 1);
+ {
+ testbuf1<char> sb;
+ std::ostream os(&sb);
+ try
+ {
+ std::ostream::sentry s(os);
+ assert(bool(s));
+ unitbuf(os);
+ throw 1;
+ }
+ catch (...)
+ {
+ }
+ assert(sync_called == 1);
+ }
+}
diff --git a/test/std/input.output/iostream.format/output.streams/version.pass.cpp b/test/std/input.output/iostream.format/output.streams/version.pass.cpp
new file mode 100644
index 0000000000000..662b6987b3c81
--- /dev/null
+++ b/test/std/input.output/iostream.format/output.streams/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+#include <ostream>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp b/test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp
new file mode 100644
index 0000000000000..d09b3cae4f66e
--- /dev/null
+++ b/test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp
@@ -0,0 +1,219 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// quoted
+
+#include <iomanip>
+#include <sstream>
+#include <string>
+#include <cassert>
+
+#if _LIBCPP_STD_VER > 11
+
+bool is_skipws ( const std::istream *is ) {
+ return ( is->flags() & std::ios_base::skipws ) != 0;
+ }
+
+
+bool is_skipws ( const std::wistream *is ) {
+ return ( is->flags() & std::ios_base::skipws ) != 0;
+ }
+
+void both_ways ( const char *p ) {
+ std::string str(p);
+ auto q = std::quoted(str);
+
+ std::stringstream ss;
+ bool skippingws = is_skipws ( &ss );
+ ss << q;
+ ss >> q;
+ }
+
+void round_trip ( const char *p ) {
+ std::stringstream ss;
+ bool skippingws = is_skipws ( &ss );
+ ss << std::quoted(p);
+ std::string s;
+ ss >> std::quoted(s);
+ assert ( s == p );
+ assert ( skippingws == is_skipws ( &ss ));
+ }
+
+void round_trip_ws ( const char *p ) {
+ std::stringstream ss;
+ std::noskipws ( ss );
+ bool skippingws = is_skipws ( &ss );
+ ss << std::quoted(p);
+ std::string s;
+ ss >> std::quoted(s);
+ assert ( s == p );
+ assert ( skippingws == is_skipws ( &ss ));
+ }
+
+void round_trip_d ( const char *p, char delim ) {
+ std::stringstream ss;
+ ss << std::quoted(p, delim);
+ std::string s;
+ ss >> std::quoted(s, delim);
+ assert ( s == p );
+ }
+
+void round_trip_e ( const char *p, char escape ) {
+ std::stringstream ss;
+ ss << std::quoted(p, '"', escape );
+ std::string s;
+ ss >> std::quoted(s, '"', escape );
+ assert ( s == p );
+ }
+
+
+
+std::string quote ( const char *p, char delim='"', char escape='\\' ) {
+ std::stringstream ss;
+ ss << std::quoted(p, delim, escape);
+ std::string s;
+ ss >> s; // no quote
+ return s;
+}
+
+std::string unquote ( const char *p, char delim='"', char escape='\\' ) {
+ std::stringstream ss;
+ ss << p;
+ std::string s;
+ ss >> std::quoted(s, delim, escape);
+ return s;
+}
+
+void test_padding () {
+ {
+ std::stringstream ss;
+ ss << std::left << std::setw(10) << std::setfill('!') << std::quoted("abc", '`');
+ assert ( ss.str() == "`abc`!!!!!" );
+ }
+
+ {
+ std::stringstream ss;
+ ss << std::right << std::setw(10) << std::setfill('!') << std::quoted("abc", '`');
+ assert ( ss.str() == "!!!!!`abc`" );
+ }
+}
+
+
+void round_trip ( const wchar_t *p ) {
+ std::wstringstream ss;
+ bool skippingws = is_skipws ( &ss );
+ ss << std::quoted(p);
+ std::wstring s;
+ ss >> std::quoted(s);
+ assert ( s == p );
+ assert ( skippingws == is_skipws ( &ss ));
+ }
+
+
+void round_trip_ws ( const wchar_t *p ) {
+ std::wstringstream ss;
+ std::noskipws ( ss );
+ bool skippingws = is_skipws ( &ss );
+ ss << std::quoted(p);
+ std::wstring s;
+ ss >> std::quoted(s);
+ assert ( s == p );
+ assert ( skippingws == is_skipws ( &ss ));
+ }
+
+void round_trip_d ( const wchar_t *p, wchar_t delim ) {
+ std::wstringstream ss;
+ ss << std::quoted(p, delim);
+ std::wstring s;
+ ss >> std::quoted(s, delim);
+ assert ( s == p );
+ }
+
+void round_trip_e ( const wchar_t *p, wchar_t escape ) {
+ std::wstringstream ss;
+ ss << std::quoted(p, wchar_t('"'), escape );
+ std::wstring s;
+ ss >> std::quoted(s, wchar_t('"'), escape );
+ assert ( s == p );
+ }
+
+
+std::wstring quote ( const wchar_t *p, wchar_t delim='"', wchar_t escape='\\' ) {
+ std::wstringstream ss;
+ ss << std::quoted(p, delim, escape);
+ std::wstring s;
+ ss >> s; // no quote
+ return s;
+}
+
+std::wstring unquote ( const wchar_t *p, wchar_t delim='"', wchar_t escape='\\' ) {
+ std::wstringstream ss;
+ ss << p;
+ std::wstring s;
+ ss >> std::quoted(s, delim, escape);
+ return s;
+}
+
+int main()
+{
+ both_ways ( "" ); // This is a compilation check
+
+ round_trip ( "" );
+ round_trip_ws ( "" );
+ round_trip_d ( "", 'q' );
+ round_trip_e ( "", 'q' );
+
+ round_trip ( L"" );
+ round_trip_ws ( L"" );
+ round_trip_d ( L"", 'q' );
+ round_trip_e ( L"", 'q' );
+
+ round_trip ( "Hi" );
+ round_trip_ws ( "Hi" );
+ round_trip_d ( "Hi", '!' );
+ round_trip_e ( "Hi", '!' );
+ assert ( quote ( "Hi", '!' ) == "!Hi!" );
+ assert ( quote ( "Hi!", '!' ) == R"(!Hi\!!)" );
+
+ round_trip ( L"Hi" );
+ round_trip_ws ( L"Hi" );
+ round_trip_d ( L"Hi", '!' );
+ round_trip_e ( L"Hi", '!' );
+ assert ( quote ( L"Hi", '!' ) == L"!Hi!" );
+ assert ( quote ( L"Hi!", '!' ) == LR"(!Hi\!!)" );
+
+ round_trip ( "Hi Mom" );
+ round_trip_ws ( "Hi Mom" );
+ round_trip ( L"Hi Mom" );
+ round_trip_ws ( L"Hi Mom" );
+
+ assert ( quote ( "" ) == "\"\"" );
+ assert ( quote ( L"" ) == L"\"\"" );
+ assert ( quote ( "a" ) == "\"a\"" );
+ assert ( quote ( L"a" ) == L"\"a\"" );
+
+// missing end quote - must not hang
+ assert ( unquote ( "\"abc" ) == "abc" );
+ assert ( unquote ( L"\"abc" ) == L"abc" );
+
+ assert ( unquote ( "abc" ) == "abc" ); // no delimiter
+ assert ( unquote ( L"abc" ) == L"abc" ); // no delimiter
+ assert ( unquote ( "abc def" ) == "abc" ); // no delimiter
+ assert ( unquote ( L"abc def" ) == L"abc" ); // no delimiter
+
+ assert ( unquote ( "" ) == "" ); // nothing there
+ assert ( unquote ( L"" ) == L"" ); // nothing there
+ test_padding ();
+ }
+
+#else
+int main() {}
+#endif
diff --git a/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp b/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp
new file mode 100644
index 0000000000000..2f516f8fbc916
--- /dev/null
+++ b/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// quoted
+
+#include <iomanip>
+#include <sstream>
+#include <string>
+#include <cassert>
+
+#if _LIBCPP_STD_VER > 11
+
+void round_trip ( const char *p ) {
+ std::wstringstream ss;
+ ss << std::quoted(p);
+ std::string s;
+ ss >> std::quoted(s);
+ }
+
+
+
+int main()
+{
+ round_trip ( "Hi Mom" );
+}
+#else
+#error
+#endif
diff --git a/test/std/input.output/iostream.format/quoted.manip/quoted_traits.fail.cpp b/test/std/input.output/iostream.format/quoted.manip/quoted_traits.fail.cpp
new file mode 100644
index 0000000000000..bdd362df19c99
--- /dev/null
+++ b/test/std/input.output/iostream.format/quoted.manip/quoted_traits.fail.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// quoted
+
+#include <iomanip>
+#include <sstream>
+#include <string>
+#include <cassert>
+
+#if _LIBCPP_STD_VER > 11
+
+template <class charT>
+struct test_traits
+{
+ typedef charT char_type;
+};
+
+void round_trip ( const char *p ) {
+ std::stringstream ss;
+ ss << std::quoted(p);
+ std::basic_string<char, test_traits<char>> s;
+ ss >> std::quoted(s);
+ }
+
+
+
+int main()
+{
+ round_trip ( "Hi Mom" );
+}
+#else
+#error
+#endif
diff --git a/test/std/input.output/iostream.format/std.manip/resetiosflags.pass.cpp b/test/std/input.output/iostream.format/std.manip/resetiosflags.pass.cpp
new file mode 100644
index 0000000000000..6c01fc057da43
--- /dev/null
+++ b/test/std/input.output/iostream.format/std.manip/resetiosflags.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// T1 resetiosflags(ios_base::fmtflags mask);
+
+#include <iomanip>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::istream is(&sb);
+ assert(is.flags() & std::ios_base::skipws);
+ is >> std::resetiosflags(std::ios_base::skipws);
+ assert(!(is.flags() & std::ios_base::skipws));
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ assert(os.flags() & std::ios_base::skipws);
+ os << std::resetiosflags(std::ios_base::skipws);
+ assert(!(os.flags() & std::ios_base::skipws));
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wistream is(&sb);
+ assert(is.flags() & std::ios_base::skipws);
+ is >> std::resetiosflags(std::ios_base::skipws);
+ assert(!(is.flags() & std::ios_base::skipws));
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ assert(os.flags() & std::ios_base::skipws);
+ os << std::resetiosflags(std::ios_base::skipws);
+ assert(!(os.flags() & std::ios_base::skipws));
+ }
+}
diff --git a/test/std/input.output/iostream.format/std.manip/setbase.pass.cpp b/test/std/input.output/iostream.format/std.manip/setbase.pass.cpp
new file mode 100644
index 0000000000000..e2776a5d1ab38
--- /dev/null
+++ b/test/std/input.output/iostream.format/std.manip/setbase.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// T3 setbase(int base);
+
+#include <iomanip>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::istream is(&sb);
+ is >> std::setbase(8);
+ assert((is.flags() & std::ios_base::basefield) == std::ios_base::oct);
+ is >> std::setbase(10);
+ assert((is.flags() & std::ios_base::basefield) == std::ios_base::dec);
+ is >> std::setbase(16);
+ assert((is.flags() & std::ios_base::basefield) == std::ios_base::hex);
+ is >> std::setbase(15);
+ assert((is.flags() & std::ios_base::basefield) == 0);
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os << std::setbase(8);
+ assert((os.flags() & std::ios_base::basefield) == std::ios_base::oct);
+ os << std::setbase(10);
+ assert((os.flags() & std::ios_base::basefield) == std::ios_base::dec);
+ os << std::setbase(16);
+ assert((os.flags() & std::ios_base::basefield) == std::ios_base::hex);
+ os << std::setbase(15);
+ assert((os.flags() & std::ios_base::basefield) == 0);
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wistream is(&sb);
+ is >> std::setbase(8);
+ assert((is.flags() & std::ios_base::basefield) == std::ios_base::oct);
+ is >> std::setbase(10);
+ assert((is.flags() & std::ios_base::basefield) == std::ios_base::dec);
+ is >> std::setbase(16);
+ assert((is.flags() & std::ios_base::basefield) == std::ios_base::hex);
+ is >> std::setbase(15);
+ assert((is.flags() & std::ios_base::basefield) == 0);
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ os << std::setbase(8);
+ assert((os.flags() & std::ios_base::basefield) == std::ios_base::oct);
+ os << std::setbase(10);
+ assert((os.flags() & std::ios_base::basefield) == std::ios_base::dec);
+ os << std::setbase(16);
+ assert((os.flags() & std::ios_base::basefield) == std::ios_base::hex);
+ os << std::setbase(15);
+ assert((os.flags() & std::ios_base::basefield) == 0);
+ }
+}
diff --git a/test/std/input.output/iostream.format/std.manip/setfill.pass.cpp b/test/std/input.output/iostream.format/std.manip/setfill.pass.cpp
new file mode 100644
index 0000000000000..a4d923d70adee
--- /dev/null
+++ b/test/std/input.output/iostream.format/std.manip/setfill.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// template<charT> T4 setfill(charT c);
+
+#include <iomanip>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os << std::setfill('*');
+ assert(os.fill() == '*');
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ os << std::setfill(L'*');
+ assert(os.fill() == L'*');
+ }
+}
diff --git a/test/std/input.output/iostream.format/std.manip/setiosflags.pass.cpp b/test/std/input.output/iostream.format/std.manip/setiosflags.pass.cpp
new file mode 100644
index 0000000000000..5aaf38444ab14
--- /dev/null
+++ b/test/std/input.output/iostream.format/std.manip/setiosflags.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// T2 setiosflags (ios_base::fmtflags mask);
+
+#include <iomanip>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::istream is(&sb);
+ assert(!(is.flags() & std::ios_base::oct));
+ is >> std::setiosflags(std::ios_base::oct);
+ assert(is.flags() & std::ios_base::oct);
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ assert(!(os.flags() & std::ios_base::oct));
+ os << std::setiosflags(std::ios_base::oct);
+ assert(os.flags() & std::ios_base::oct);
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wistream is(&sb);
+ assert(!(is.flags() & std::ios_base::oct));
+ is >> std::setiosflags(std::ios_base::oct);
+ assert(is.flags() & std::ios_base::oct);
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ assert(!(os.flags() & std::ios_base::oct));
+ os << std::setiosflags(std::ios_base::oct);
+ assert(os.flags() & std::ios_base::oct);
+ }
+}
diff --git a/test/std/input.output/iostream.format/std.manip/setprecision.pass.cpp b/test/std/input.output/iostream.format/std.manip/setprecision.pass.cpp
new file mode 100644
index 0000000000000..0bea4b98623b9
--- /dev/null
+++ b/test/std/input.output/iostream.format/std.manip/setprecision.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// T5 setprecision(int n);
+
+#include <iomanip>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::istream is(&sb);
+ is >> std::setprecision(10);
+ assert(is.precision() == 10);
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os << std::setprecision(10);
+ assert(os.precision() == 10);
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wistream is(&sb);
+ is >> std::setprecision(10);
+ assert(is.precision() == 10);
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ os << std::setprecision(10);
+ assert(os.precision() == 10);
+ }
+}
diff --git a/test/std/input.output/iostream.format/std.manip/setw.pass.cpp b/test/std/input.output/iostream.format/std.manip/setw.pass.cpp
new file mode 100644
index 0000000000000..9bd96984e5c98
--- /dev/null
+++ b/test/std/input.output/iostream.format/std.manip/setw.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// T6 setw(int n);
+
+#include <iomanip>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_streambuf<CharT>
+{
+ testbuf() {}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb;
+ std::istream is(&sb);
+ is >> std::setw(10);
+ assert(is.width() == 10);
+ }
+ {
+ testbuf<char> sb;
+ std::ostream os(&sb);
+ os << std::setw(10);
+ assert(os.width() == 10);
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wistream is(&sb);
+ is >> std::setw(10);
+ assert(is.width() == 10);
+ }
+ {
+ testbuf<wchar_t> sb;
+ std::wostream os(&sb);
+ os << std::setw(10);
+ assert(os.width() == 10);
+ }
+}
diff --git a/test/std/input.output/iostream.format/std.manip/version.pass.cpp b/test/std/input.output/iostream.format/std.manip/version.pass.cpp
new file mode 100644
index 0000000000000..ca4fd3d463eeb
--- /dev/null
+++ b/test/std/input.output/iostream.format/std.manip/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+#include <iomanip>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostream.forward/iosfwd.pass.cpp b/test/std/input.output/iostream.forward/iosfwd.pass.cpp
new file mode 100644
index 0000000000000..7250c2adb2793
--- /dev/null
+++ b/test/std/input.output/iostream.forward/iosfwd.pass.cpp
@@ -0,0 +1,142 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iosfwd>
+
+#include <iosfwd>
+#include <cwchar> // for mbstate_t
+
+int main()
+{
+ {
+ std::char_traits<char>* t1 = 0;
+ std::char_traits<wchar_t>* t2 = 0;
+ std::char_traits<unsigned short>* t3 = 0;
+ }
+ {
+ std::basic_ios<char>* t1 = 0;
+ std::basic_ios<wchar_t>* t2 = 0;
+ std::basic_ios<unsigned short>* t3 = 0;
+ }
+ {
+ std::basic_streambuf<char>* t1 = 0;
+ std::basic_streambuf<wchar_t>* t2 = 0;
+ std::basic_streambuf<unsigned short>* t3 = 0;
+ }
+ {
+ std::basic_istream<char>* t1 = 0;
+ std::basic_istream<wchar_t>* t2 = 0;
+ std::basic_istream<unsigned short>* t3 = 0;
+ }
+ {
+ std::basic_ostream<char>* t1 = 0;
+ std::basic_ostream<wchar_t>* t2 = 0;
+ std::basic_ostream<unsigned short>* t3 = 0;
+ }
+ {
+ std::basic_iostream<char>* t1 = 0;
+ std::basic_iostream<wchar_t>* t2 = 0;
+ std::basic_iostream<unsigned short>* t3 = 0;
+ }
+ {
+ std::basic_stringbuf<char>* t1 = 0;
+ std::basic_stringbuf<wchar_t>* t2 = 0;
+ std::basic_stringbuf<unsigned short>* t3 = 0;
+ }
+ {
+ std::basic_istringstream<char>* t1 = 0;
+ std::basic_istringstream<wchar_t>* t2 = 0;
+ std::basic_istringstream<unsigned short>* t3 = 0;
+ }
+ {
+ std::basic_ostringstream<char>* t1 = 0;
+ std::basic_ostringstream<wchar_t>* t2 = 0;
+ std::basic_ostringstream<unsigned short>* t3 = 0;
+ }
+ {
+ std::basic_stringstream<char>* t1 = 0;
+ std::basic_stringstream<wchar_t>* t2 = 0;
+ std::basic_stringstream<unsigned short>* t3 = 0;
+ }
+ {
+ std::basic_filebuf<char>* t1 = 0;
+ std::basic_filebuf<wchar_t>* t2 = 0;
+ std::basic_filebuf<unsigned short>* t3 = 0;
+ }
+ {
+ std::basic_ifstream<char>* t1 = 0;
+ std::basic_ifstream<wchar_t>* t2 = 0;
+ std::basic_ifstream<unsigned short>* t3 = 0;
+ }
+ {
+ std::basic_ofstream<char>* t1 = 0;
+ std::basic_ofstream<wchar_t>* t2 = 0;
+ std::basic_ofstream<unsigned short>* t3 = 0;
+ }
+ {
+ std::basic_fstream<char>* t1 = 0;
+ std::basic_fstream<wchar_t>* t2 = 0;
+ std::basic_fstream<unsigned short>* t3 = 0;
+ }
+ {
+ std::istreambuf_iterator<char>* t1 = 0;
+ std::istreambuf_iterator<wchar_t>* t2 = 0;
+ std::istreambuf_iterator<unsigned short>* t3 = 0;
+ }
+ {
+ std::ostreambuf_iterator<char>* t1 = 0;
+ std::ostreambuf_iterator<wchar_t>* t2 = 0;
+ std::ostreambuf_iterator<unsigned short>* t3 = 0;
+ }
+ {
+ std::ios* t1 = 0;
+ std::wios* t2 = 0;
+ }
+ {
+ std::streambuf* t1 = 0;
+ std::istream* t2 = 0;
+ std::ostream* t3 = 0;
+ std::iostream* t4 = 0;
+ }
+ {
+ std::stringbuf* t1 = 0;
+ std::istringstream* t2 = 0;
+ std::ostringstream* t3 = 0;
+ std::stringstream* t4 = 0;
+ }
+ {
+ std::filebuf* t1 = 0;
+ std::ifstream* t2 = 0;
+ std::ofstream* t3 = 0;
+ std::fstream* t4 = 0;
+ }
+ {
+ std::wstreambuf* t1 = 0;
+ std::wistream* t2 = 0;
+ std::wostream* t3 = 0;
+ std::wiostream* t4 = 0;
+ }
+ {
+ std::wstringbuf* t1 = 0;
+ std::wistringstream* t2 = 0;
+ std::wostringstream* t3 = 0;
+ std::wstringstream* t4 = 0;
+ }
+ {
+ std::wfilebuf* t1 = 0;
+ std::wifstream* t2 = 0;
+ std::wofstream* t3 = 0;
+ std::wfstream* t4 = 0;
+ }
+ {
+ std::fpos<std::mbstate_t>* t1 = 0;
+ std::streampos* t2 = 0;
+ std::wstreampos* t3 = 0;
+ }
+}
diff --git a/test/std/input.output/iostream.forward/version.pass.cpp b/test/std/input.output/iostream.forward/version.pass.cpp
new file mode 100644
index 0000000000000..cf91332d55977
--- /dev/null
+++ b/test/std/input.output/iostream.forward/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iosfwd>
+
+#include <iosfwd>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.pass.cpp b/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.pass.cpp
new file mode 100644
index 0000000000000..cdf53f86277d8
--- /dev/null
+++ b/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iostream>
+
+// istream cerr;
+
+#include <iostream>
+#include <cassert>
+
+int main()
+{
+#if 0
+ std::cerr << "Hello World!\n";
+#else
+#ifdef _LIBCPP_HAS_NO_STDOUT
+ assert(std::cerr.tie() == NULL);
+#else
+ assert(std::cerr.tie() == &std::cout);
+#endif
+ assert(std::cerr.flags() & std::ios_base::unitbuf);
+#endif // 0
+}
diff --git a/test/std/input.output/iostream.objects/narrow.stream.objects/cin.pass.cpp b/test/std/input.output/iostream.objects/narrow.stream.objects/cin.pass.cpp
new file mode 100644
index 0000000000000..1ce04ffb15637
--- /dev/null
+++ b/test/std/input.output/iostream.objects/narrow.stream.objects/cin.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: libcpp-has-no-stdin
+
+// <iostream>
+
+// istream cin;
+
+#include <iostream>
+#include <cassert>
+
+int main()
+{
+#if 0
+ std::cout << "Hello World!\n";
+ int i;
+ std::cout << "Enter a number: ";
+ std::cin >> i;
+ std::cout << "The number is : " << i << '\n';
+#else // 0
+#ifdef _LIBCPP_HAS_NO_STDOUT
+ assert(std::cin.tie() == NULL);
+#else
+ assert(std::cin.tie() == &std::cout);
+#endif
+#endif
+}
diff --git a/test/std/input.output/iostream.objects/narrow.stream.objects/clog.pass.cpp b/test/std/input.output/iostream.objects/narrow.stream.objects/clog.pass.cpp
new file mode 100644
index 0000000000000..3812b203ae04f
--- /dev/null
+++ b/test/std/input.output/iostream.objects/narrow.stream.objects/clog.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iostream>
+
+// istream clog;
+
+#include <iostream>
+
+int main()
+{
+#if 0
+ std::clog << "Hello World!\n";
+#else
+ (void)std::clog;
+#endif
+}
diff --git a/test/std/input.output/iostream.objects/narrow.stream.objects/cout.pass.cpp b/test/std/input.output/iostream.objects/narrow.stream.objects/cout.pass.cpp
new file mode 100644
index 0000000000000..e5887e1625d7f
--- /dev/null
+++ b/test/std/input.output/iostream.objects/narrow.stream.objects/cout.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: libcpp-has-no-stdout
+
+// <iostream>
+
+// istream cout;
+
+#include <iostream>
+
+int main()
+{
+#if 0
+ std::cout << "Hello World!\n";
+ int i;
+ std::cout << "Enter a number: ";
+ std::cin >> i;
+ std::cout << "The number is : " << i << '\n';
+#else // 0
+ (void)std::cout;
+#endif
+}
diff --git a/test/std/input.output/iostream.objects/version.pass.cpp b/test/std/input.output/iostream.objects/version.pass.cpp
new file mode 100644
index 0000000000000..09b3611f6df92
--- /dev/null
+++ b/test/std/input.output/iostream.objects/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iostream>
+
+#include <iostream>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.pass.cpp b/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.pass.cpp
new file mode 100644
index 0000000000000..b050781671e66
--- /dev/null
+++ b/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iostream>
+
+// istream wcerr;
+
+#include <iostream>
+#include <cassert>
+
+int main()
+{
+#if 0
+ std::wcerr << L"Hello World!\n";
+#else
+#ifdef _LIBCPP_HAS_NO_STDOUT
+ assert(std::wcerr.tie() == NULL);
+#else
+ assert(std::wcerr.tie() == &std::wcout);
+#endif
+ assert(std::wcerr.flags() & std::ios_base::unitbuf);
+#endif // 0
+}
diff --git a/test/std/input.output/iostream.objects/wide.stream.objects/wcin.pass.cpp b/test/std/input.output/iostream.objects/wide.stream.objects/wcin.pass.cpp
new file mode 100644
index 0000000000000..6abd6afa81c45
--- /dev/null
+++ b/test/std/input.output/iostream.objects/wide.stream.objects/wcin.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: libcpp-has-no-stdin
+
+// <iostream>
+
+// istream wcin;
+
+#include <iostream>
+#include <cassert>
+
+int main()
+{
+#if 0
+ std::wcout << L"Hello World!\n";
+ int i;
+ std::wcout << L"Enter a number: ";
+ std::wcin >> i;
+ std::wcout << L"The number is : " << i << L'\n';
+#else // 0
+#ifdef _LIBCPP_HAS_NO_STDOUT
+ assert(std::wcin.tie() == NULL);
+#else
+ assert(std::wcin.tie() == &std::wcout);
+#endif
+#endif
+}
diff --git a/test/std/input.output/iostream.objects/wide.stream.objects/wclog.pass.cpp b/test/std/input.output/iostream.objects/wide.stream.objects/wclog.pass.cpp
new file mode 100644
index 0000000000000..61ff5fb5089cf
--- /dev/null
+++ b/test/std/input.output/iostream.objects/wide.stream.objects/wclog.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iostream>
+
+// istream wclog;
+
+#include <iostream>
+
+int main()
+{
+#if 0
+ std::wclog << L"Hello World!\n";
+#else
+ (void)std::wclog;
+#endif
+}
diff --git a/test/std/input.output/iostream.objects/wide.stream.objects/wcout.pass.cpp b/test/std/input.output/iostream.objects/wide.stream.objects/wcout.pass.cpp
new file mode 100644
index 0000000000000..6543e0aa56a4d
--- /dev/null
+++ b/test/std/input.output/iostream.objects/wide.stream.objects/wcout.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: libcpp-has-no-stdout
+
+// <iostream>
+
+// istream wcout;
+
+#include <iostream>
+
+int main()
+{
+#if 0
+ std::wcout << L"Hello World!\n";
+#else
+ (void)std::wcout;
+#endif
+}
diff --git a/test/std/input.output/iostreams.base/fpos/fpos.members/state.pass.cpp b/test/std/input.output/iostreams.base/fpos/fpos.members/state.pass.cpp
new file mode 100644
index 0000000000000..1da6d4406c975
--- /dev/null
+++ b/test/std/input.output/iostreams.base/fpos/fpos.members/state.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class StateT> class fpos
+
+// void state(stateT s);
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ std::fpos<int> f;
+ f.state(3);
+ assert(f.state() == 3);
+}
diff --git a/test/std/input.output/iostreams.base/fpos/fpos.operations/addition.pass.cpp b/test/std/input.output/iostreams.base/fpos/fpos.operations/addition.pass.cpp
new file mode 100644
index 0000000000000..a602e3e94beff
--- /dev/null
+++ b/test/std/input.output/iostreams.base/fpos/fpos.operations/addition.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class StateT> class fpos
+
+// Addition
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ typedef std::fpos<std::mbstate_t> P;
+ P p(5);
+ std::streamoff o(6);
+ P q = p + o;
+ assert(q == P(11));
+ p += o;
+ assert(p == q);
+}
diff --git a/test/std/input.output/iostreams.base/fpos/fpos.operations/ctor_int.pass.cpp b/test/std/input.output/iostreams.base/fpos/fpos.operations/ctor_int.pass.cpp
new file mode 100644
index 0000000000000..1b939d86e5980
--- /dev/null
+++ b/test/std/input.output/iostreams.base/fpos/fpos.operations/ctor_int.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class StateT> class fpos
+
+// fpos(int)
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ typedef std::fpos<std::mbstate_t> P;
+ P p(5);
+ assert(p == P(5));
+}
diff --git a/test/std/input.output/iostreams.base/fpos/fpos.operations/difference.pass.cpp b/test/std/input.output/iostreams.base/fpos/fpos.operations/difference.pass.cpp
new file mode 100644
index 0000000000000..47ce6870a3bae
--- /dev/null
+++ b/test/std/input.output/iostreams.base/fpos/fpos.operations/difference.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class StateT> class fpos
+
+// Subraction with fpos
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ typedef std::fpos<std::mbstate_t> P;
+ P p(11);
+ P q(6);
+ std::streamoff o = p - q;
+ assert(o == 5);
+}
diff --git a/test/std/input.output/iostreams.base/fpos/fpos.operations/eq_int.pass.cpp b/test/std/input.output/iostreams.base/fpos/fpos.operations/eq_int.pass.cpp
new file mode 100644
index 0000000000000..76f8fa12a4148
--- /dev/null
+++ b/test/std/input.output/iostreams.base/fpos/fpos.operations/eq_int.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class StateT> class fpos
+
+// == and !=
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ typedef std::fpos<std::mbstate_t> P;
+ P p(5);
+ P q(6);
+ assert(p == p);
+ assert(p != q);
+}
diff --git a/test/std/input.output/iostreams.base/fpos/fpos.operations/offset.pass.cpp b/test/std/input.output/iostreams.base/fpos/fpos.operations/offset.pass.cpp
new file mode 100644
index 0000000000000..9c6ebd9f74e2a
--- /dev/null
+++ b/test/std/input.output/iostreams.base/fpos/fpos.operations/offset.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class StateT> class fpos
+
+// converts to and from streamoff
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ typedef std::fpos<std::mbstate_t> P;
+ P p(std::streamoff(7));
+ std::streamoff offset(p);
+ assert(offset == 7);
+}
diff --git a/test/std/input.output/iostreams.base/fpos/fpos.operations/streamsize.pass.cpp b/test/std/input.output/iostreams.base/fpos/fpos.operations/streamsize.pass.cpp
new file mode 100644
index 0000000000000..eb738b492c895
--- /dev/null
+++ b/test/std/input.output/iostreams.base/fpos/fpos.operations/streamsize.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// streamsize and streamoff interconvert
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ std::streamoff o(5);
+ std::streamsize sz(o);
+ assert(sz == 5);
+ std::streamoff o2(sz);
+ assert(o == o2);
+}
diff --git a/test/std/input.output/iostreams.base/fpos/fpos.operations/subtraction.pass.cpp b/test/std/input.output/iostreams.base/fpos/fpos.operations/subtraction.pass.cpp
new file mode 100644
index 0000000000000..f9e6513e4a4ed
--- /dev/null
+++ b/test/std/input.output/iostreams.base/fpos/fpos.operations/subtraction.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class StateT> class fpos
+
+// Subraction with offset
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ typedef std::fpos<std::mbstate_t> P;
+ P p(11);
+ std::streamoff o(6);
+ P q = p - o;
+ assert(q == P(5));
+ p -= o;
+ assert(p == q);
+}
diff --git a/test/std/input.output/iostreams.base/fpos/nothing_to_do.pass.cpp b/test/std/input.output/iostreams.base/fpos/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/iostreams.base/fpos/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags.pass.cpp b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags.pass.cpp
new file mode 100644
index 0000000000000..958fcb53d89aa
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// fmtflags flags() const;
+
+#include <ios>
+#include <cassert>
+
+class test
+ : public std::ios
+{
+public:
+ test()
+ {
+ init(0);
+ }
+};
+
+int main()
+{
+ const test t;
+ assert(t.flags() == (test::skipws | test::dec));
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags_fmtflags.pass.cpp b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags_fmtflags.pass.cpp
new file mode 100644
index 0000000000000..36b5794983e28
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags_fmtflags.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// fmtflags flags(fmtflags fmtfl);
+
+#include <ios>
+#include <cassert>
+
+class test
+ : public std::ios
+{
+public:
+ test()
+ {
+ init(0);
+ }
+};
+
+int main()
+{
+ test t;
+ assert(t.flags() == (test::skipws | test::dec));
+ test::fmtflags f = t.flags(test::hex | test::right);
+ assert(f == (test::skipws | test::dec));
+ assert(t.flags() == (test::hex | test::right));
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision.pass.cpp b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision.pass.cpp
new file mode 100644
index 0000000000000..701e3de360d80
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// streamsize precision() const;
+
+#include <ios>
+#include <cassert>
+
+class test
+ : public std::ios
+{
+public:
+ test()
+ {
+ init(0);
+ }
+};
+
+int main()
+{
+ const test t;
+ assert(t.precision() == 6);
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision_streamsize.pass.cpp b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision_streamsize.pass.cpp
new file mode 100644
index 0000000000000..e0d6484c8fd36
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision_streamsize.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// streamsize precision(streamsize prec);
+
+#include <ios>
+#include <cassert>
+
+class test
+ : public std::ios
+{
+public:
+ test()
+ {
+ init(0);
+ }
+};
+
+int main()
+{
+ test t;
+ assert(t.precision() == 6);
+ std::streamsize p = t.precision(10);
+ assert(p == 6);
+ assert(t.precision() == 10);
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags.pass.cpp b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags.pass.cpp
new file mode 100644
index 0000000000000..d9ec47b7907ae
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// fmtflags setf(fmtflags fmtfl)
+
+#include <ios>
+#include <cassert>
+
+class test
+ : public std::ios
+{
+public:
+ test()
+ {
+ init(0);
+ }
+};
+
+int main()
+{
+ test t;
+ assert(t.flags() == (test::skipws | test::dec));
+ test::fmtflags f = t.setf(test::hex | test::right);
+ assert(f == (test::skipws | test::dec));
+ assert(t.flags() == (test::skipws | test::dec | test::hex | test::right));
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags_mask.pass.cpp b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags_mask.pass.cpp
new file mode 100644
index 0000000000000..b201377027db7
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags_mask.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// fmtflags setf(fmtflags fmtfl, fmtflags mask);
+
+#include <ios>
+#include <cassert>
+
+class test
+ : public std::ios
+{
+public:
+ test()
+ {
+ init(0);
+ }
+};
+
+int main()
+{
+ test t;
+ assert(t.flags() == (test::skipws | test::dec));
+ test::fmtflags f = t.setf(test::hex | test::right, test::dec | test::right);
+ assert(f == (test::skipws | test::dec));
+ assert(t.flags() == (test::skipws | test::right));
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/fmtflags.state/unsetf_mask.pass.cpp b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/unsetf_mask.pass.cpp
new file mode 100644
index 0000000000000..163fc54a1e814
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/unsetf_mask.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// void unsetf(fmtflags mask);
+
+#include <ios>
+#include <cassert>
+
+class test
+ : public std::ios
+{
+public:
+ test()
+ {
+ init(0);
+ }
+};
+
+int main()
+{
+ test t;
+ assert(t.flags() == (test::skipws | test::dec));
+ t.unsetf(test::dec | test::right);
+ assert(t.flags() == test::skipws);
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width.pass.cpp b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width.pass.cpp
new file mode 100644
index 0000000000000..287c89d296ee0
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// streamsize width() const;
+
+#include <ios>
+#include <cassert>
+
+class test
+ : public std::ios
+{
+public:
+ test()
+ {
+ init(0);
+ }
+};
+
+int main()
+{
+ const test t;
+ assert(t.width() == 0);
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width_streamsize.pass.cpp b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width_streamsize.pass.cpp
new file mode 100644
index 0000000000000..6e532deddf052
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width_streamsize.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// streamsize width(streamsize wide);
+
+#include <ios>
+#include <cassert>
+
+class test
+ : public std::ios
+{
+public:
+ test()
+ {
+ init(0);
+ }
+};
+
+int main()
+{
+ test t;
+ assert(t.width() == 0);
+ std::streamsize w = t.width(4);
+ assert(w == 0);
+ assert(t.width() == 4);
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.base.callback/register_callback.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.base.callback/register_callback.pass.cpp
new file mode 100644
index 0000000000000..c0ed3150457c4
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/ios.base.callback/register_callback.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// void register_callback(event_callback fn, int index);
+
+#include <ios>
+#include <string>
+#include <locale>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+class test
+ : public std::ios
+{
+public:
+ test()
+ {
+ init(0);
+ }
+};
+
+int f1_called = 0;
+
+void f1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::imbue_event)
+ {
+ assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+ assert(index == 4);
+ ++f1_called;
+ }
+}
+
+int main()
+{
+ test t;
+ std::ios_base& b = t;
+ b.register_callback(f1, 4);
+ b.register_callback(f1, 4);
+ b.register_callback(f1, 4);
+ std::locale l = b.imbue(std::locale(LOCALE_en_US_UTF_8));
+ assert(f1_called == 3);
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.base.cons/dtor.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.base.cons/dtor.pass.cpp
new file mode 100644
index 0000000000000..e6f334808c1b9
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/ios.base.cons/dtor.pass.cpp
@@ -0,0 +1,86 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ~ios_base()
+
+#include <ios>
+#include <string>
+#include <locale>
+#include <cassert>
+
+class test
+ : public std::ios
+{
+public:
+ test()
+ {
+ init(0);
+ }
+};
+
+bool f1_called = false;
+bool f2_called = false;
+bool f3_called = false;
+
+void f1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::erase_event)
+ {
+ assert(!f1_called);
+ assert( f2_called);
+ assert( f3_called);
+ assert(stream.getloc().name() == "C");
+ assert(index == 4);
+ f1_called = true;
+ }
+}
+
+void f2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::erase_event)
+ {
+ assert(!f1_called);
+ assert(!f2_called);
+ assert( f3_called);
+ assert(stream.getloc().name() == "C");
+ assert(index == 5);
+ f2_called = true;
+ }
+}
+
+void f3(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::erase_event)
+ {
+ assert(!f1_called);
+ assert(!f2_called);
+ assert(!f3_called);
+ assert(stream.getloc().name() == "C");
+ assert(index == 6);
+ f3_called = true;
+ }
+}
+
+int main()
+{
+ {
+ test t;
+ std::ios_base& b = t;
+ b.register_callback(f1, 4);
+ b.register_callback(f2, 5);
+ b.register_callback(f3, 6);
+ }
+ assert(f1_called);
+ assert(f2_called);
+ assert(f3_called);
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.base.locales/getloc.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.base.locales/getloc.pass.cpp
new file mode 100644
index 0000000000000..8f265bc698842
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/ios.base.locales/getloc.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// locale getloc() const;
+
+#include <ios>
+#include <string>
+#include <cassert>
+
+class test
+ : public std::ios
+{
+public:
+ test()
+ {
+ init(0);
+ }
+};
+
+int main()
+{
+ const test t;
+ assert(t.getloc().name() == std::string("C"));
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.base.locales/imbue.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.base.locales/imbue.pass.cpp
new file mode 100644
index 0000000000000..4e34c08ab0834
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/ios.base.locales/imbue.pass.cpp
@@ -0,0 +1,89 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// locale imbue(const locale& loc);
+
+#include <ios>
+#include <string>
+#include <locale>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+class test
+ : public std::ios
+{
+public:
+ test()
+ {
+ init(0);
+ }
+};
+
+bool f1_called = false;
+bool f2_called = false;
+bool f3_called = false;
+
+void f1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::imbue_event)
+ {
+ assert(!f1_called);
+ assert( f2_called);
+ assert( f3_called);
+ assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+ assert(index == 4);
+ f1_called = true;
+ }
+}
+
+void f2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::imbue_event)
+ {
+ assert(!f1_called);
+ assert(!f2_called);
+ assert( f3_called);
+ assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+ assert(index == 5);
+ f2_called = true;
+ }
+}
+
+void f3(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::imbue_event)
+ {
+ assert(!f1_called);
+ assert(!f2_called);
+ assert(!f3_called);
+ assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+ assert(index == 6);
+ f3_called = true;
+ }
+}
+
+int main()
+{
+ test t;
+ std::ios_base& b = t;
+ b.register_callback(f1, 4);
+ b.register_callback(f2, 5);
+ b.register_callback(f3, 6);
+ std::locale l = b.imbue(std::locale(LOCALE_en_US_UTF_8));
+ assert(l.name() == std::string("C"));
+ assert(b.getloc().name() == std::string(LOCALE_en_US_UTF_8));
+ assert(f1_called);
+ assert(f2_called);
+ assert(f3_called);
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.base.storage/iword.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.base.storage/iword.pass.cpp
new file mode 100644
index 0000000000000..1e2ee50632afc
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/ios.base.storage/iword.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// long& iword(int idx);
+
+#include <ios>
+#include <string>
+#include <cassert>
+
+class test
+ : public std::ios
+{
+public:
+ test()
+ {
+ init(0);
+ }
+};
+
+int main()
+{
+ test t;
+ std::ios_base& b = t;
+ for (int i = 0; i < 10000; ++i)
+ {
+ assert(b.iword(i) == 0);
+ b.iword(i) = i;
+ assert(b.iword(i) == i);
+ for (int j = 0; j <= i; ++j)
+ assert(b.iword(j) == j);
+ }
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.base.storage/pword.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.base.storage/pword.pass.cpp
new file mode 100644
index 0000000000000..5246ad8f644c4
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/ios.base.storage/pword.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// void*& pword(int idx);
+
+#include <ios>
+#include <string>
+#include <cassert>
+#include <cstdint>
+
+class test
+ : public std::ios
+{
+public:
+ test()
+ {
+ init(0);
+ }
+};
+
+int main()
+{
+ test t;
+ std::ios_base& b = t;
+ for (std::intptr_t i = 0; i < 10000; ++i)
+ {
+ assert(b.pword(i) == 0);
+ b.pword(i) = (void*)i;
+ assert(b.pword(i) == (void*)i);
+ for (std::intptr_t j = 0; j <= i; ++j)
+ assert(b.pword(j) == (void*)j);
+ }
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.base.storage/xalloc.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.base.storage/xalloc.pass.cpp
new file mode 100644
index 0000000000000..eb737b1a7dc11
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/ios.base.storage/xalloc.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// static int xalloc();
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ assert(std::ios_base::xalloc() == 0);
+ assert(std::ios_base::xalloc() == 1);
+ assert(std::ios_base::xalloc() == 2);
+ assert(std::ios_base::xalloc() == 3);
+ assert(std::ios_base::xalloc() == 4);
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.members.static/sync_with_stdio.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.members.static/sync_with_stdio.pass.cpp
new file mode 100644
index 0000000000000..5dc72b1edc0ae
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/ios.members.static/sync_with_stdio.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// bool sync_with_stdio(bool sync = true);
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ assert( std::ios_base::sync_with_stdio(false));
+ assert(!std::ios_base::sync_with_stdio(false));
+ assert(!std::ios_base::sync_with_stdio(true));
+ assert( std::ios_base::sync_with_stdio(true));
+ assert( std::ios_base::sync_with_stdio());
+ assert( std::ios_base::sync_with_stdio(false));
+ assert(!std::ios_base::sync_with_stdio());
+ assert( std::ios_base::sync_with_stdio());
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.types/ios_Init/tested_elsewhere.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.types/ios_Init/tested_elsewhere.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/ios.types/ios_Init/tested_elsewhere.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp
new file mode 100644
index 0000000000000..50f5fdad74420
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base::failure
+
+// explicit failure(const char* msg, const error_code& ec = io_errc::stream);
+
+#include <ios>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ {
+ std::string what_arg("io test message");
+ std::ios_base::failure se(what_arg.c_str(), make_error_code(std::errc::is_a_directory));
+ assert(se.code() == std::make_error_code(std::errc::is_a_directory));
+ std::string what_message(se.what());
+ assert(what_message.find(what_arg) != std::string::npos);
+ assert(what_message.find("Is a directory") != std::string::npos);
+ }
+ {
+ std::string what_arg("io test message");
+ std::ios_base::failure se(what_arg.c_str());
+ assert(se.code() == std::make_error_code(std::io_errc::stream));
+ std::string what_message(se.what());
+ assert(what_message.find(what_arg) != std::string::npos);
+ assert(what_message.find(std::iostream_category().message(static_cast<int>
+ (std::io_errc::stream))) != std::string::npos);
+ }
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp
new file mode 100644
index 0000000000000..5c9abbe53793e
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base::failure
+
+// explicit failure(const string& msg, const error_code& ec = io_errc::stream);
+
+#include <ios>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ {
+ std::string what_arg("io test message");
+ std::ios_base::failure se(what_arg, make_error_code(std::errc::is_a_directory));
+ assert(se.code() == std::make_error_code(std::errc::is_a_directory));
+ std::string what_message(se.what());
+ assert(what_message.find(what_arg) != std::string::npos);
+ assert(what_message.find("Is a directory") != std::string::npos);
+ }
+ {
+ std::string what_arg("io test message");
+ std::ios_base::failure se(what_arg);
+ assert(se.code() == std::make_error_code(std::io_errc::stream));
+ std::string what_message(se.what());
+ assert(what_message.find(what_arg) != std::string::npos);
+ assert(what_message.find(std::iostream_category().message(static_cast<int>
+ (std::io_errc::stream))) != std::string::npos);
+ }
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.types/ios_fmtflags/fmtflags.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.types/ios_fmtflags/fmtflags.pass.cpp
new file mode 100644
index 0000000000000..9f374598ff7f2
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/ios.types/ios_fmtflags/fmtflags.pass.cpp
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// static const fmtflags boolalpha;
+// static const fmtflags dec;
+// static const fmtflags fixed;
+// static const fmtflags hex;
+// static const fmtflags internal;
+// static const fmtflags left;
+// static const fmtflags oct;
+// static const fmtflags right;
+// static const fmtflags scientific;
+// static const fmtflags showbase;
+// static const fmtflags showpoint;
+// static const fmtflags showpos;
+// static const fmtflags skipws;
+// static const fmtflags unitbuf;
+// static const fmtflags uppercase;
+// static const fmtflags adjustfield = left | right | internal;
+// static const fmtflags basefield = dec | oct | hex;
+// static const fmtflags floatfield = scientific | fixed;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ assert(std::ios_base::boolalpha);
+ assert(std::ios_base::dec);
+ assert(std::ios_base::fixed);
+ assert(std::ios_base::hex);
+ assert(std::ios_base::internal);
+ assert(std::ios_base::left);
+ assert(std::ios_base::oct);
+ assert(std::ios_base::right);
+ assert(std::ios_base::scientific);
+ assert(std::ios_base::showbase);
+ assert(std::ios_base::showpoint);
+ assert(std::ios_base::showpos);
+ assert(std::ios_base::skipws);
+ assert(std::ios_base::unitbuf);
+ assert(std::ios_base::uppercase);
+
+ assert
+ (
+ ( std::ios_base::boolalpha
+ & std::ios_base::dec
+ & std::ios_base::fixed
+ & std::ios_base::hex
+ & std::ios_base::internal
+ & std::ios_base::left
+ & std::ios_base::oct
+ & std::ios_base::right
+ & std::ios_base::scientific
+ & std::ios_base::showbase
+ & std::ios_base::showpoint
+ & std::ios_base::showpos
+ & std::ios_base::skipws
+ & std::ios_base::unitbuf
+ & std::ios_base::uppercase) == 0
+ );
+
+ assert(std::ios_base::adjustfield == (std::ios_base::left
+ | std::ios_base::right
+ | std::ios_base::internal));
+ assert(std::ios_base::basefield == (std::ios_base::dec
+ | std::ios_base::oct
+ | std::ios_base::hex));
+ assert(std::ios_base::floatfield == (std::ios_base::scientific
+ | std::ios_base::fixed));
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.types/ios_iostate/iostate.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.types/ios_iostate/iostate.pass.cpp
new file mode 100644
index 0000000000000..55c02f38ce9ff
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/ios.types/ios_iostate/iostate.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// static const iostate badbit;
+// static const iostate eofbit;
+// static const iostate failbit;
+// static const iostate goodbit = 0;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ assert(std::ios_base::badbit);
+ assert(std::ios_base::eofbit);
+ assert(std::ios_base::failbit);
+
+ assert
+ (
+ ( std::ios_base::badbit
+ & std::ios_base::eofbit
+ & std::ios_base::failbit) == 0
+ );
+
+ assert(std::ios_base::goodbit == 0);
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.types/ios_openmode/openmode.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.types/ios_openmode/openmode.pass.cpp
new file mode 100644
index 0000000000000..238593feb3048
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/ios.types/ios_openmode/openmode.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// static const openmode app;
+// static const openmode ate;
+// static const openmode binary;
+// static const openmode in;
+// static const openmode out;
+// static const openmode trunc;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ assert(std::ios_base::app);
+ assert(std::ios_base::ate);
+ assert(std::ios_base::binary);
+ assert(std::ios_base::in);
+ assert(std::ios_base::out);
+ assert(std::ios_base::trunc);
+
+ assert
+ (
+ ( std::ios_base::app
+ & std::ios_base::ate
+ & std::ios_base::binary
+ & std::ios_base::in
+ & std::ios_base::out
+ & std::ios_base::trunc) == 0
+ );
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.types/ios_seekdir/seekdir.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.types/ios_seekdir/seekdir.pass.cpp
new file mode 100644
index 0000000000000..005fb61cc31d0
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/ios.types/ios_seekdir/seekdir.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// static const seekdir beg;
+// static const seekdir cur;
+// static const seekdir end;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ assert(std::ios_base::beg != std::ios_base::cur);
+ assert(std::ios_base::beg != std::ios_base::end);
+ assert(std::ios_base::cur != std::ios_base::end);
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.types/nothing_to_do.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.types/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/ios.types/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostreams.base/ios.base/nothing_to_do.pass.cpp b/test/std/input.output/iostreams.base/ios.base/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..760bfcb26d2ac
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios.base/nothing_to_do.pass.cpp
@@ -0,0 +1,16 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+#include <ios>
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.cons/ctor_streambuf.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.cons/ctor_streambuf.pass.cpp
new file mode 100644
index 0000000000000..d86059ea6f7dd
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.cons/ctor_streambuf.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// explicit basic_ios(basic_streambuf<charT,traits>* sb);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+int main()
+{
+ {
+ std::streambuf* sb = 0;
+ std::basic_ios<char> ios(sb);
+ assert(ios.rdbuf() == sb);
+ assert(ios.tie() == 0);
+ assert(ios.rdstate() == std::ios::badbit);
+ assert(ios.exceptions() == std::ios::goodbit);
+ assert(ios.flags() == (std::ios::skipws | std::ios::dec));
+ assert(ios.width() == 0);
+ assert(ios.precision() == 6);
+ assert(ios.fill() == ' ');
+ assert(ios.getloc() == std::locale());
+ }
+ {
+ std::streambuf* sb = (std::streambuf*)1;
+ std::basic_ios<char> ios(sb);
+ assert(ios.rdbuf() == sb);
+ assert(ios.tie() == 0);
+ assert(ios.rdstate() == std::ios::goodbit);
+ assert(ios.exceptions() == std::ios::goodbit);
+ assert(ios.flags() == (std::ios::skipws | std::ios::dec));
+ assert(ios.width() == 0);
+ assert(ios.precision() == 6);
+ assert(ios.fill() == ' ');
+ assert(ios.getloc() == std::locale());
+ }
+}
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp
new file mode 100644
index 0000000000000..c46e2c054e8f8
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp
@@ -0,0 +1,190 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// basic_ios& copyfmt(const basic_ios& rhs);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+struct testbuf
+ : public std::streambuf
+{
+};
+
+bool f1_called = false;
+bool f2_called = false;
+
+bool g1_called = false;
+bool g2_called = false;
+bool g3_called = false;
+
+void f1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::erase_event)
+ {
+ assert(!f1_called);
+ assert( f2_called);
+ assert(!g1_called);
+ assert(!g2_called);
+ assert(!g3_called);
+ assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+ assert(index == 4);
+ f1_called = true;
+ }
+}
+
+void f2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::erase_event)
+ {
+ assert(!f1_called);
+ assert(!f2_called);
+ assert(!g1_called);
+ assert(!g2_called);
+ assert(!g3_called);
+ assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+ assert(index == 5);
+ f2_called = true;
+ }
+}
+
+void g1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::copyfmt_event)
+ {
+ assert( f1_called);
+ assert( f2_called);
+ assert(!g1_called);
+ assert( g2_called);
+ assert( g3_called);
+ assert(stream.getloc().name() == LOCALE_fr_FR_UTF_8);
+ assert(index == 7);
+ g1_called = true;
+ }
+}
+
+void g2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::copyfmt_event)
+ {
+ assert( f1_called);
+ assert( f2_called);
+ assert(!g1_called);
+ assert(!g2_called);
+ assert( g3_called);
+ assert(stream.getloc().name() == LOCALE_fr_FR_UTF_8);
+ assert(index == 8);
+ g2_called = true;
+ }
+}
+
+void g3(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::copyfmt_event)
+ {
+ assert( f1_called);
+ assert( f2_called);
+ assert(!g1_called);
+ assert(!g2_called);
+ assert(!g3_called);
+ assert(stream.getloc().name() == LOCALE_fr_FR_UTF_8);
+ assert(index == 9);
+ g3_called = true;
+ }
+}
+
+int main()
+{
+ testbuf sb1;
+ std::ios ios1(&sb1);
+ ios1.flags(std::ios::boolalpha | std::ios::dec | std::ios::fixed);
+ ios1.precision(1);
+ ios1.width(11);
+ ios1.imbue(std::locale(LOCALE_en_US_UTF_8));
+ ios1.exceptions(std::ios::failbit);
+ ios1.setstate(std::ios::eofbit);
+ ios1.register_callback(f1, 4);
+ ios1.register_callback(f2, 5);
+ ios1.iword(0) = 1;
+ ios1.iword(1) = 2;
+ ios1.iword(2) = 3;
+ char c1, c2, c3;
+ ios1.pword(0) = &c1;
+ ios1.pword(1) = &c2;
+ ios1.pword(2) = &c3;
+ ios1.tie((std::ostream*)1);
+ ios1.fill('1');
+
+ testbuf sb2;
+ std::ios ios2(&sb2);
+ ios2.flags(std::ios::showpoint | std::ios::uppercase);
+ ios2.precision(2);
+ ios2.width(12);
+ ios2.imbue(std::locale(LOCALE_fr_FR_UTF_8));
+ ios2.exceptions(std::ios::eofbit);
+ ios2.setstate(std::ios::goodbit);
+ ios2.register_callback(g1, 7);
+ ios2.register_callback(g2, 8);
+ ios2.register_callback(g3, 9);
+ ios2.iword(0) = 4;
+ ios2.iword(1) = 5;
+ ios2.iword(2) = 6;
+ ios2.iword(3) = 7;
+ ios2.iword(4) = 8;
+ ios2.iword(5) = 9;
+ char d1, d2;
+ ios2.pword(0) = &d1;
+ ios2.pword(1) = &d2;
+ ios2.tie((std::ostream*)2);
+ ios2.fill('2');
+
+ ios1.copyfmt(ios1);
+ assert(!f1_called);
+
+ try
+ {
+ ios1.copyfmt(ios2);
+ assert(false);
+ }
+ catch (std::ios_base::failure&)
+ {
+ }
+ assert(ios1.rdstate() == std::ios::eofbit);
+ assert(ios1.rdbuf() == &sb1);
+ assert(ios1.flags() == (std::ios::showpoint | std::ios::uppercase));
+ assert(ios1.precision() == 2);
+ assert(ios1.width() == 12);
+ assert(ios1.getloc().name() == LOCALE_fr_FR_UTF_8);
+ assert(ios1.exceptions() == std::ios::eofbit);
+ assert(f1_called);
+ assert(f2_called);
+ assert(g1_called);
+ assert(g2_called);
+ assert(g3_called);
+ assert(ios1.iword(0) == 4);
+ assert(ios1.iword(1) == 5);
+ assert(ios1.iword(2) == 6);
+ assert(ios1.iword(3) == 7);
+ assert(ios1.iword(4) == 8);
+ assert(ios1.iword(5) == 9);
+ assert(ios1.pword(0) == &d1);
+ assert(ios1.pword(1) == &d2);
+ assert(ios1.tie() == (std::ostream*)2);
+ assert(ios1.fill() == '2');
+}
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/fill.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/fill.pass.cpp
new file mode 100644
index 0000000000000..f5c5aa22b65bb
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/fill.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// char_type fill() const;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ const std::ios ios(0);
+ assert(ios.fill() == ' ');
+}
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/fill_char_type.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/fill_char_type.pass.cpp
new file mode 100644
index 0000000000000..10dccca8583e5
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/fill_char_type.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// char_type fill(char_type fillch);
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ std::ios ios(0);
+ assert(ios.fill() == ' ');
+ char c = ios.fill('*');
+ assert(c == ' ');
+ assert(ios.fill() == '*');
+}
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/imbue.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/imbue.pass.cpp
new file mode 100644
index 0000000000000..6d4ce5f577f48
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/imbue.pass.cpp
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// locale imbue(const locale& loc);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+struct testbuf
+ : public std::streambuf
+{
+};
+
+bool f1_called = false;
+bool f2_called = false;
+bool f3_called = false;
+
+void f1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::imbue_event)
+ {
+ assert(!f1_called);
+ assert( f2_called);
+ assert( f3_called);
+ assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+ assert(index == 4);
+ f1_called = true;
+ }
+}
+
+void f2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::imbue_event)
+ {
+ assert(!f1_called);
+ assert(!f2_called);
+ assert( f3_called);
+ assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+ assert(index == 5);
+ f2_called = true;
+ }
+}
+
+void f3(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::imbue_event)
+ {
+ assert(!f1_called);
+ assert(!f2_called);
+ assert(!f3_called);
+ assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+ assert(index == 6);
+ f3_called = true;
+ }
+}
+
+int main()
+{
+ {
+ std::ios ios(0);
+ ios.register_callback(f1, 4);
+ ios.register_callback(f2, 5);
+ ios.register_callback(f3, 6);
+ std::locale l = ios.imbue(std::locale(LOCALE_en_US_UTF_8));
+ assert(l.name() == std::string("C"));
+ assert(ios.getloc().name() == std::string(LOCALE_en_US_UTF_8));
+ assert(f1_called);
+ assert(f2_called);
+ assert(f3_called);
+ }
+ f1_called = false;
+ f2_called = false;
+ f3_called = false;
+ {
+ testbuf sb;
+ std::ios ios(&sb);
+ ios.register_callback(f1, 4);
+ ios.register_callback(f2, 5);
+ ios.register_callback(f3, 6);
+ std::locale l = ios.imbue(std::locale(LOCALE_en_US_UTF_8));
+ assert(l.name() == std::string("C"));
+ assert(ios.getloc().name() == std::string(LOCALE_en_US_UTF_8));
+ assert(sb.getloc().name() == std::string(LOCALE_en_US_UTF_8));
+ assert(f1_called);
+ assert(f2_called);
+ assert(f3_called);
+ }
+}
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/move.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/move.pass.cpp
new file mode 100644
index 0000000000000..509b836686c53
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/move.pass.cpp
@@ -0,0 +1,140 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.fr_FR.UTF-8
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// void move(basic_ios&& rhs);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+struct testbuf
+ : public std::streambuf
+{
+};
+
+struct testios
+ : public std::ios
+{
+ testios() {}
+ testios(std::streambuf* p) : std::ios(p) {}
+ void move(std::ios& x) {std::ios::move(x);}
+};
+
+bool f1_called = false;
+bool f2_called = false;
+
+bool g1_called = false;
+bool g2_called = false;
+bool g3_called = false;
+
+void f1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ f1_called = true;
+}
+
+void f2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ f2_called = true;
+}
+
+void g1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::imbue_event)
+ {
+ assert(index == 7);
+ g1_called = true;
+ }
+}
+
+void g2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::imbue_event)
+ {
+ assert(index == 8);
+ g2_called = true;
+ }
+}
+
+void g3(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ if (ev == std::ios_base::imbue_event)
+ {
+ assert(index == 9);
+ g3_called = true;
+ }
+}
+
+int main()
+{
+ testios ios1;
+ testbuf sb2;
+ std::ios ios2(&sb2);
+ ios2.flags(std::ios::showpoint | std::ios::uppercase);
+ ios2.precision(2);
+ ios2.width(12);
+ ios2.imbue(std::locale(LOCALE_fr_FR_UTF_8));
+ ios2.exceptions(std::ios::eofbit);
+ ios2.setstate(std::ios::goodbit);
+ ios2.register_callback(g1, 7);
+ ios2.register_callback(g2, 8);
+ ios2.register_callback(g3, 9);
+ ios2.iword(0) = 4;
+ ios2.iword(1) = 5;
+ ios2.iword(2) = 6;
+ ios2.iword(3) = 7;
+ ios2.iword(4) = 8;
+ ios2.iword(5) = 9;
+ char d1, d2;
+ ios2.pword(0) = &d1;
+ ios2.pword(1) = &d2;
+ ios2.tie((std::ostream*)2);
+ ios2.fill('2');
+
+ ios1.move(ios2);
+
+ assert(ios1.rdstate() == std::ios::goodbit);
+ assert(ios1.rdbuf() == 0);
+ assert(ios1.flags() == (std::ios::showpoint | std::ios::uppercase));
+ assert(ios1.precision() == 2);
+ assert(ios1.width() == 12);
+ assert(ios1.getloc().name() == LOCALE_fr_FR_UTF_8);
+ assert(ios1.exceptions() == std::ios::eofbit);
+ assert(!f1_called);
+ assert(!f2_called);
+ assert(!g1_called);
+ assert(!g2_called);
+ assert(!g3_called);
+ assert(ios1.iword(0) == 4);
+ assert(ios1.iword(1) == 5);
+ assert(ios1.iword(2) == 6);
+ assert(ios1.iword(3) == 7);
+ assert(ios1.iword(4) == 8);
+ assert(ios1.iword(5) == 9);
+ assert(ios1.pword(0) == &d1);
+ assert(ios1.pword(1) == &d2);
+ assert(ios1.tie() == (std::ostream*)2);
+ assert(ios1.fill() == '2');
+ ios1.imbue(std::locale("C"));
+ assert(!f1_called);
+ assert(!f2_called);
+ assert(g1_called);
+ assert(g2_called);
+ assert(g3_called);
+
+ assert(ios2.rdbuf() == &sb2);
+ assert(ios2.tie() == 0);
+}
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/narow.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/narow.pass.cpp
new file mode 100644
index 0000000000000..bf865e68149d4
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/narow.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// char narrow(char_type c, char dfault) const;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ const std::ios ios(0);
+ assert(ios.narrow('c', '*') == 'c');
+ assert(ios.narrow('\xFE', '*') == '*');
+}
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf.pass.cpp
new file mode 100644
index 0000000000000..7be92e72b8699
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// basic_streambuf<charT,traits>* rdbuf() const;
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+int main()
+{
+ {
+ const std::ios ios(0);
+ assert(ios.rdbuf() == 0);
+ }
+ {
+ std::streambuf* sb = (std::streambuf*)1;
+ const std::ios ios(sb);
+ assert(ios.rdbuf() == sb);
+ }
+}
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf_streambuf.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf_streambuf.pass.cpp
new file mode 100644
index 0000000000000..cc0b3f3f169b1
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf_streambuf.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* sb);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+int main()
+{
+ std::ios ios(0);
+ assert(ios.rdbuf() == 0);
+ assert(!ios.good());
+ std::streambuf* sb = (std::streambuf*)1;
+ std::streambuf* sb2 = ios.rdbuf(sb);
+ assert(sb2 == 0);
+ assert(ios.rdbuf() == sb);
+ assert(ios.good());
+ sb2 = ios.rdbuf(0);
+ assert(sb2 == (std::streambuf*)1);
+ assert(ios.rdbuf() == 0);
+ assert(ios.bad());
+}
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp
new file mode 100644
index 0000000000000..2d4beee37ec20
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// void set_rdbuf(basic_streambuf<charT, traits>* sb);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf
+ : public std::streambuf
+{
+};
+
+struct testios
+ : public std::ios
+{
+ testios(std::streambuf* p) : std::ios(p) {}
+ void set_rdbuf(std::streambuf* x) {std::ios::set_rdbuf(x);}
+};
+
+int main()
+{
+ testbuf sb1;
+ testbuf sb2;
+ testios ios(&sb1);
+ try
+ {
+ ios.setstate(std::ios::badbit);
+ ios.exceptions(std::ios::badbit);
+ }
+ catch (...)
+ {
+ }
+ ios.set_rdbuf(&sb2);
+ assert(ios.rdbuf() == &sb2);
+ try
+ {
+ ios.setstate(std::ios::badbit);
+ ios.exceptions(std::ios::badbit);
+ }
+ catch (...)
+ {
+ }
+ ios.set_rdbuf(0);
+ assert(ios.rdbuf() == 0);
+}
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp
new file mode 100644
index 0000000000000..e44f4b32512c2
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp
@@ -0,0 +1,168 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// void move(basic_ios&& rhs);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+struct testbuf
+ : public std::streambuf
+{
+};
+
+struct testios
+ : public std::ios
+{
+ testios(std::streambuf* p) : std::ios(p) {}
+ void swap(std::ios& x) {std::ios::swap(x);}
+};
+
+bool f1_called = false;
+bool f2_called = false;
+
+bool g1_called = false;
+bool g2_called = false;
+bool g3_called = false;
+
+void f1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ assert(index == 4);
+ f1_called = true;
+}
+
+void f2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ assert(index == 5);
+ f2_called = true;
+}
+
+void g1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ assert(index == 7);
+ g1_called = true;
+}
+
+void g2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ assert(index == 8);
+ g2_called = true;
+}
+
+void g3(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+ assert(index == 9);
+ g3_called = true;
+}
+
+int main()
+{
+ testbuf sb1;
+ testios ios1(&sb1);
+ ios1.flags(std::ios::boolalpha | std::ios::dec | std::ios::fixed);
+ ios1.precision(1);
+ ios1.width(11);
+ ios1.imbue(std::locale(LOCALE_en_US_UTF_8));
+ ios1.exceptions(std::ios::failbit);
+ ios1.setstate(std::ios::eofbit);
+ ios1.register_callback(f1, 4);
+ ios1.register_callback(f2, 5);
+ ios1.iword(0) = 1;
+ ios1.iword(1) = 2;
+ ios1.iword(2) = 3;
+ char c1, c2, c3;
+ ios1.pword(0) = &c1;
+ ios1.pword(1) = &c2;
+ ios1.pword(2) = &c3;
+ ios1.tie((std::ostream*)1);
+ ios1.fill('1');
+
+ testbuf sb2;
+ testios ios2(&sb2);
+ ios2.flags(std::ios::showpoint | std::ios::uppercase);
+ ios2.precision(2);
+ ios2.width(12);
+ ios2.imbue(std::locale(LOCALE_fr_FR_UTF_8));
+ ios2.exceptions(std::ios::eofbit);
+ ios2.setstate(std::ios::goodbit);
+ ios2.register_callback(g1, 7);
+ ios2.register_callback(g2, 8);
+ ios2.register_callback(g3, 9);
+ ios2.iword(0) = 4;
+ ios2.iword(1) = 5;
+ ios2.iword(2) = 6;
+ ios2.iword(3) = 7;
+ ios2.iword(4) = 8;
+ ios2.iword(5) = 9;
+ char d1, d2;
+ ios2.pword(0) = &d1;
+ ios2.pword(1) = &d2;
+ ios2.tie((std::ostream*)2);
+ ios2.fill('2');
+
+ ios1.swap(ios2);
+
+ assert(ios1.rdstate() == std::ios::goodbit);
+ assert(ios1.rdbuf() == &sb1);
+ assert(ios1.flags() == (std::ios::showpoint | std::ios::uppercase));
+ assert(ios1.precision() == 2);
+ assert(ios1.width() == 12);
+ assert(ios1.getloc().name() == LOCALE_fr_FR_UTF_8);
+ assert(ios1.exceptions() == std::ios::eofbit);
+ assert(!f1_called);
+ assert(!f2_called);
+ assert(!g1_called);
+ assert(!g2_called);
+ assert(!g3_called);
+ assert(ios1.iword(0) == 4);
+ assert(ios1.iword(1) == 5);
+ assert(ios1.iword(2) == 6);
+ assert(ios1.iword(3) == 7);
+ assert(ios1.iword(4) == 8);
+ assert(ios1.iword(5) == 9);
+ assert(ios1.pword(0) == &d1);
+ assert(ios1.pword(1) == &d2);
+ assert(ios1.tie() == (std::ostream*)2);
+ assert(ios1.fill() == '2');
+ ios1.imbue(std::locale("C"));
+ assert(!f1_called);
+ assert(!f2_called);
+ assert(g1_called);
+ assert(g2_called);
+ assert(g3_called);
+
+ assert(ios2.rdstate() == std::ios::eofbit);
+ assert(ios2.rdbuf() == &sb2);
+ assert(ios2.flags() == (std::ios::boolalpha | std::ios::dec | std::ios::fixed));
+ assert(ios2.precision() == 1);
+ assert(ios2.width() == 11);
+ assert(ios2.getloc().name() == LOCALE_en_US_UTF_8);
+ assert(ios2.exceptions() == std::ios::failbit);
+ assert(ios2.iword(0) == 1);
+ assert(ios2.iword(1) == 2);
+ assert(ios2.iword(2) == 3);
+ assert(ios2.pword(0) == &c1);
+ assert(ios2.pword(1) == &c2);
+ assert(ios2.pword(2) == &c3);
+ assert(ios2.tie() == (std::ostream*)1);
+ assert(ios2.fill() == '1');
+ ios2.imbue(std::locale("C"));
+ assert(f1_called);
+ assert(f2_called);
+}
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/tie.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/tie.pass.cpp
new file mode 100644
index 0000000000000..71eb238469c9d
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/tie.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// basic_ostream<charT,traits>* tie() const;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ const std::basic_ios<char> ios(0);
+ assert(ios.tie() == 0);
+}
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/tie_ostream.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/tie_ostream.pass.cpp
new file mode 100644
index 0000000000000..acccbea2aa069
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/tie_ostream.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// basic_ostream<charT,traits>* tie(basic_ostream<charT,traits>* tiestr);
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ std::ios ios(0);
+ std::ostream* os = (std::ostream*)1;
+ std::ostream* r = ios.tie(os);
+ assert(r == 0);
+ assert(ios.tie() == os);
+}
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/widen.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/widen.pass.cpp
new file mode 100644
index 0000000000000..68fdf68598993
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/widen.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// char_type widen(char c) const;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ const std::ios ios(0);
+ assert(ios.widen('c') == 'c');
+}
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/bad.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/bad.pass.cpp
new file mode 100644
index 0000000000000..1005df6ef258d
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/bad.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// bool bad() const;
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ {
+ std::ios ios(0);
+ assert(ios.bad());
+ ios.setstate(std::ios::eofbit);
+ assert(ios.bad());
+ }
+ {
+ testbuf sb;
+ std::ios ios(&sb);
+ assert(!ios.bad());
+ ios.setstate(std::ios::eofbit);
+ assert(!ios.bad());
+ ios.setstate(std::ios::failbit);
+ assert(!ios.bad());
+ ios.setstate(std::ios::badbit);
+ assert(ios.bad());
+ }
+}
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/bool.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/bool.pass.cpp
new file mode 100644
index 0000000000000..0de889e549cc9
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/bool.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// operator unspecified-bool-type() const;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ std::ios ios(0);
+ assert(static_cast<bool>(ios) == !ios.fail());
+ ios.setstate(std::ios::failbit);
+ assert(static_cast<bool>(ios) == !ios.fail());
+}
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp
new file mode 100644
index 0000000000000..0c2e8f0860cef
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// void clear(iostate state = goodbit);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ {
+ std::ios ios(0);
+ ios.clear();
+ assert(ios.rdstate() == std::ios::badbit);
+ try
+ {
+ ios.exceptions(std::ios::badbit);
+ }
+ catch (...)
+ {
+ }
+ try
+ {
+ ios.clear();
+ assert(false);
+ }
+ catch (std::ios::failure&)
+ {
+ assert(ios.rdstate() == std::ios::badbit);
+ }
+ try
+ {
+ ios.clear(std::ios::eofbit);
+ assert(false);
+ }
+ catch (std::ios::failure&)
+ {
+ assert(ios.rdstate() == (std::ios::eofbit | std::ios::badbit));
+ }
+ }
+ {
+ testbuf sb;
+ std::ios ios(&sb);
+ ios.clear();
+ assert(ios.rdstate() == std::ios::goodbit);
+ ios.exceptions(std::ios::badbit);
+ ios.clear();
+ assert(ios.rdstate() == std::ios::goodbit);
+ ios.clear(std::ios::eofbit);
+ assert(ios.rdstate() == std::ios::eofbit);
+ }
+}
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/eof.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/eof.pass.cpp
new file mode 100644
index 0000000000000..64d5a3018d15e
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/eof.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// bool eof() const;
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ {
+ std::ios ios(0);
+ assert(!ios.eof());
+ ios.setstate(std::ios::eofbit);
+ assert(ios.eof());
+ }
+ {
+ testbuf sb;
+ std::ios ios(&sb);
+ assert(!ios.eof());
+ ios.setstate(std::ios::eofbit);
+ assert(ios.eof());
+ }
+}
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions.pass.cpp
new file mode 100644
index 0000000000000..d5158a1846833
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// iostate exceptions() const;
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ {
+ const std::ios ios(0);
+ assert(ios.exceptions() == std::ios::goodbit);
+ }
+ {
+ testbuf sb;
+ const std::ios ios(&sb);
+ assert(ios.exceptions() == std::ios::goodbit);
+ }
+}
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp
new file mode 100644
index 0000000000000..a0013eabdac63
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// iostate exceptions() const;
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ {
+ std::ios ios(0);
+ assert(ios.exceptions() == std::ios::goodbit);
+ ios.exceptions(std::ios::eofbit);
+ assert(ios.exceptions() == std::ios::eofbit);
+ try
+ {
+ ios.exceptions(std::ios::badbit);
+ assert(false);
+ }
+ catch (std::ios::failure&)
+ {
+ }
+ assert(ios.exceptions() == std::ios::badbit);
+ }
+ {
+ testbuf sb;
+ std::ios ios(&sb);
+ assert(ios.exceptions() == std::ios::goodbit);
+ ios.exceptions(std::ios::eofbit);
+ assert(ios.exceptions() == std::ios::eofbit);
+ ios.exceptions(std::ios::badbit);
+ assert(ios.exceptions() == std::ios::badbit);
+ }
+}
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/fail.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/fail.pass.cpp
new file mode 100644
index 0000000000000..fa9f765bfd59e
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/fail.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// bool fail() const;
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ {
+ std::ios ios(0);
+ assert(ios.fail());
+ ios.setstate(std::ios::eofbit);
+ assert(ios.fail());
+ }
+ {
+ testbuf sb;
+ std::ios ios(&sb);
+ assert(!ios.fail());
+ ios.setstate(std::ios::eofbit);
+ assert(!ios.fail());
+ ios.setstate(std::ios::badbit);
+ assert(ios.fail());
+ ios.setstate(std::ios::failbit);
+ assert(ios.fail());
+ }
+}
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/good.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/good.pass.cpp
new file mode 100644
index 0000000000000..03f89506d6fdb
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/good.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// bool good() const;
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ {
+ std::ios ios(0);
+ assert(!ios.good());
+ }
+ {
+ testbuf sb;
+ std::ios ios(&sb);
+ assert(ios.good());
+ ios.setstate(std::ios::eofbit);
+ assert(!ios.good());
+ }
+}
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/not.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/not.pass.cpp
new file mode 100644
index 0000000000000..ef534f6d0adf1
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/not.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// bool operator!() const;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ std::ios ios(0);
+ assert(!ios == ios.fail());
+ ios.setstate(std::ios::failbit);
+ assert(!ios == ios.fail());
+}
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/rdstate.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/rdstate.pass.cpp
new file mode 100644
index 0000000000000..d09e2a62ee3d7
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/rdstate.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// iostate rdstate() const;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ std::ios ios(0);
+ assert(ios.rdstate() == std::ios::badbit);
+ ios.setstate(std::ios::failbit);
+ assert(ios.rdstate() == (std::ios::failbit | std::ios::badbit));
+}
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp
new file mode 100644
index 0000000000000..b3c66c487e9f9
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// void setstate(iostate state);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ {
+ std::ios ios(0);
+ ios.setstate(std::ios::goodbit);
+ assert(ios.rdstate() == std::ios::badbit);
+ try
+ {
+ ios.exceptions(std::ios::badbit);
+ }
+ catch (...)
+ {
+ }
+ try
+ {
+ ios.setstate(std::ios::goodbit);
+ assert(false);
+ }
+ catch (std::ios::failure&)
+ {
+ assert(ios.rdstate() == std::ios::badbit);
+ }
+ try
+ {
+ ios.setstate(std::ios::eofbit);
+ assert(false);
+ }
+ catch (std::ios::failure&)
+ {
+ assert(ios.rdstate() == (std::ios::eofbit | std::ios::badbit));
+ }
+ }
+ {
+ testbuf sb;
+ std::ios ios(&sb);
+ ios.setstate(std::ios::goodbit);
+ assert(ios.rdstate() == std::ios::goodbit);
+ ios.setstate(std::ios::eofbit);
+ assert(ios.rdstate() == std::ios::eofbit);
+ ios.setstate(std::ios::failbit);
+ assert(ios.rdstate() == (std::ios::eofbit | std::ios::failbit));
+ }
+}
diff --git a/test/std/input.output/iostreams.base/ios/types.pass.cpp b/test/std/input.output/iostreams.base/ios/types.pass.cpp
new file mode 100644
index 0000000000000..22e33f61f428e
--- /dev/null
+++ b/test/std/input.output/iostreams.base/ios/types.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ios : public ios_base
+// {
+// public:
+// typedef charT char_type;
+// typedef typename traits::int_type int_type;
+// typedef typename traits::pos_type pos_type;
+// typedef typename traits::off_type off_type;
+// typedef traits traits_type;
+
+#include <ios>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_base_of<std::ios_base, std::basic_ios<char> >::value), "");
+ static_assert((std::is_same<std::basic_ios<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::basic_ios<char>::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_ios<char>::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::basic_ios<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::basic_ios<char>::off_type, std::char_traits<char>::off_type>::value), "");
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/internal.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/internal.pass.cpp
new file mode 100644
index 0000000000000..461c7774248eb
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/internal.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& internal(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::internal(ios);
+ assert(&r == &ios);
+ assert(ios.flags() & std::ios::internal);
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/left.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/left.pass.cpp
new file mode 100644
index 0000000000000..aa2ca6f27efd4
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/left.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& left(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::left(ios);
+ assert(&r == &ios);
+ assert(ios.flags() & std::ios::left);
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/right.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/right.pass.cpp
new file mode 100644
index 0000000000000..08056e8f353c8
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/right.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& right(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::right(ios);
+ assert(&r == &ios);
+ assert(ios.flags() & std::ios::right);
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/dec.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/dec.pass.cpp
new file mode 100644
index 0000000000000..cbe03bceb2bf6
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/dec.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& dec(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::dec(ios);
+ assert(&r == &ios);
+ assert(ios.flags() & std::ios::dec);
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/hex.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/hex.pass.cpp
new file mode 100644
index 0000000000000..281a59cdafd01
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/hex.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& hex(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::hex(ios);
+ assert(&r == &ios);
+ assert(ios.flags() & std::ios::hex);
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/oct.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/oct.pass.cpp
new file mode 100644
index 0000000000000..5ebfea86f4f9c
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/oct.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& oct(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::oct(ios);
+ assert(&r == &ios);
+ assert(ios.flags() & std::ios::oct);
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/iostream_category.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/iostream_category.pass.cpp
new file mode 100644
index 0000000000000..a93c7b4c2fe6c
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/iostream_category.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// const error_category& iostream_category();
+
+#include <ios>
+#include <cassert>
+#include <string>
+
+int main()
+{
+ const std::error_category& e_cat1 = std::iostream_category();
+ std::string m1 = e_cat1.name();
+ assert(m1 == "iostream");
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/make_error_code.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/make_error_code.pass.cpp
new file mode 100644
index 0000000000000..f764fa6fd797a
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/make_error_code.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// error_code make_error_code(io_errc e);
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ {
+ std::error_code ec = make_error_code(std::io_errc::stream);
+ assert(ec.value() == static_cast<int>(std::io_errc::stream));
+ assert(ec.category() == std::iostream_category());
+ }
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/make_error_condition.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/make_error_condition.pass.cpp
new file mode 100644
index 0000000000000..30931bae0bd2c
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/make_error_condition.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// error_condition make_error_condition(io_errc e);
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+ {
+ const std::error_condition ec1 = std::make_error_condition(std::io_errc::stream);
+ assert(ec1.value() == static_cast<int>(std::io_errc::stream));
+ assert(ec1.category() == std::iostream_category());
+ }
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/defaultfloat.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/defaultfloat.pass.cpp
new file mode 100644
index 0000000000000..f202bc4c88121
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/defaultfloat.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& defaultfloat(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::defaultfloat(ios);
+ assert(&r == &ios);
+ assert(!(ios.flags() & std::ios::fixed));
+ assert(!(ios.flags() & std::ios::scientific));
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/fixed.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/fixed.pass.cpp
new file mode 100644
index 0000000000000..55bf2648f3ed4
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/fixed.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& fixed(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::fixed(ios);
+ assert(&r == &ios);
+ assert(ios.flags() & std::ios::fixed);
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/hexfloat.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/hexfloat.pass.cpp
new file mode 100644
index 0000000000000..2920cca83d0ec
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/hexfloat.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& hexfloat(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::hexfloat(ios);
+ assert(&r == &ios);
+ assert(ios.flags() & std::ios::fixed);
+ assert(ios.flags() & std::ios::scientific);
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/scientific.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/scientific.pass.cpp
new file mode 100644
index 0000000000000..53cfd8171f39a
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/scientific.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& scientific(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::scientific(ios);
+ assert(&r == &ios);
+ assert(ios.flags() & std::ios::scientific);
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/boolalpha.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/boolalpha.pass.cpp
new file mode 100644
index 0000000000000..ca8cd93f05b10
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/boolalpha.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& boolalpha(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::boolalpha(ios);
+ assert(&r == &ios);
+ assert(ios.flags() & std::ios::boolalpha);
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noboolalpha.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noboolalpha.pass.cpp
new file mode 100644
index 0000000000000..ebc0aab67dbeb
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noboolalpha.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& noboolalpha(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::boolalpha(ios);
+ std::ios_base& r = std::noboolalpha(ios);
+ assert(&r == &ios);
+ assert(!(ios.flags() & std::ios::boolalpha));
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowbase.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowbase.pass.cpp
new file mode 100644
index 0000000000000..91608f0f50343
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowbase.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& noshowbase(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::showbase(ios);
+ std::ios_base& r = std::noshowbase(ios);
+ assert(&r == &ios);
+ assert(!(ios.flags() & std::ios::showbase));
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowpoint.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowpoint.pass.cpp
new file mode 100644
index 0000000000000..6e26416c5cd1a
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowpoint.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& noshowpoint(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::showpoint(ios);
+ std::ios_base& r = std::noshowpoint(ios);
+ assert(&r == &ios);
+ assert(!(ios.flags() & std::ios::showpoint));
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowpos.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowpos.pass.cpp
new file mode 100644
index 0000000000000..5e6911c22b98b
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowpos.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& noshowpos(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::showpos(ios);
+ std::ios_base& r = std::noshowpos(ios);
+ assert(&r == &ios);
+ assert(!(ios.flags() & std::ios::showpos));
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noskipws.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noskipws.pass.cpp
new file mode 100644
index 0000000000000..e78f5f884cc44
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noskipws.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& noskipws(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::skipws(ios);
+ std::ios_base& r = std::noskipws(ios);
+ assert(&r == &ios);
+ assert(!(ios.flags() & std::ios::skipws));
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/nounitbuf.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/nounitbuf.pass.cpp
new file mode 100644
index 0000000000000..5708038e5ed92
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/nounitbuf.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& nounitbuf(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::unitbuf(ios);
+ std::ios_base& r = std::nounitbuf(ios);
+ assert(&r == &ios);
+ assert(!(ios.flags() & std::ios::unitbuf));
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/nouppercase.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/nouppercase.pass.cpp
new file mode 100644
index 0000000000000..76fac604b34dc
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/nouppercase.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& nouppercase(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::uppercase(ios);
+ std::ios_base& r = std::nouppercase(ios);
+ assert(&r == &ios);
+ assert(!(ios.flags() & std::ios::uppercase));
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showbase.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showbase.pass.cpp
new file mode 100644
index 0000000000000..ddf3a85509635
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showbase.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& showbase(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::showbase(ios);
+ assert(&r == &ios);
+ assert(ios.flags() & std::ios::showbase);
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showpoint.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showpoint.pass.cpp
new file mode 100644
index 0000000000000..79ae3b6e27afc
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showpoint.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& showpoint(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::showpoint(ios);
+ assert(&r == &ios);
+ assert(ios.flags() & std::ios::showpoint);
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showpos.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showpos.pass.cpp
new file mode 100644
index 0000000000000..226542614c101
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showpos.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& showpos(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::showpos(ios);
+ assert(&r == &ios);
+ assert(ios.flags() & std::ios::showpos);
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/skipws.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/skipws.pass.cpp
new file mode 100644
index 0000000000000..4ea3e448fe041
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/skipws.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& skipws(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::skipws(ios);
+ assert(&r == &ios);
+ assert(ios.flags() & std::ios::skipws);
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/unitbuf.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/unitbuf.pass.cpp
new file mode 100644
index 0000000000000..99a33c71c893b
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/unitbuf.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& unitbuf(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::unitbuf(ios);
+ assert(&r == &ios);
+ assert(ios.flags() & std::ios::unitbuf);
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/uppercase.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/uppercase.pass.cpp
new file mode 100644
index 0000000000000..1a19e2aa6367a
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/uppercase.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& uppercase(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+ testbuf sb;
+ std::ios ios(&sb);
+ std::ios_base& r = std::uppercase(ios);
+ assert(&r == &ios);
+ assert(ios.flags() & std::ios::uppercase);
+}
diff --git a/test/std/input.output/iostreams.base/std.ios.manip/nothing_to_do.pass.cpp b/test/std/input.output/iostreams.base/std.ios.manip/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/iostreams.base/std.ios.manip/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostreams.base/stream.types/streamoff.pass.cpp b/test/std/input.output/iostreams.base/stream.types/streamoff.pass.cpp
new file mode 100644
index 0000000000000..0e9f1278ee0db
--- /dev/null
+++ b/test/std/input.output/iostreams.base/stream.types/streamoff.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// typedef OFF_T streamoff;
+
+#include <ios>
+#include <type_traits>
+
+int main()
+{
+ static_assert(std::is_integral<std::streamoff>::value, "");
+ static_assert(std::is_signed<std::streamoff>::value, "");
+}
diff --git a/test/std/input.output/iostreams.base/stream.types/streamsize.pass.cpp b/test/std/input.output/iostreams.base/stream.types/streamsize.pass.cpp
new file mode 100644
index 0000000000000..438c51138ee3c
--- /dev/null
+++ b/test/std/input.output/iostreams.base/stream.types/streamsize.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// typedef SZ_T streamsize;
+
+#include <ios>
+#include <type_traits>
+
+int main()
+{
+ static_assert(std::is_integral<std::streamsize>::value, "");
+ static_assert(std::is_signed<std::streamsize>::value, "");
+}
diff --git a/test/std/input.output/iostreams.base/version.pass.cpp b/test/std/input.output/iostreams.base/version.pass.cpp
new file mode 100644
index 0000000000000..f56846d38b8db
--- /dev/null
+++ b/test/std/input.output/iostreams.base/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+#include <ios>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostreams.requirements/iostream.limits.imbue/tested_elsewhere.pass.cpp b/test/std/input.output/iostreams.requirements/iostream.limits.imbue/tested_elsewhere.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/iostreams.requirements/iostream.limits.imbue/tested_elsewhere.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostreams.requirements/iostreams.limits.pos/nothing_to_do.pass.cpp b/test/std/input.output/iostreams.requirements/iostreams.limits.pos/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/iostreams.requirements/iostreams.limits.pos/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostreams.requirements/iostreams.threadsafety/nothing_to_do.pass.cpp b/test/std/input.output/iostreams.requirements/iostreams.threadsafety/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/iostreams.requirements/iostreams.threadsafety/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/iostreams.requirements/nothing_to_do.pass.cpp b/test/std/input.output/iostreams.requirements/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/iostreams.requirements/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/nothing_to_do.pass.cpp b/test/std/input.output/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/stream.buffers/streambuf.reqts/tested_elsewhere.pass.cpp b/test/std/input.output/stream.buffers/streambuf.reqts/tested_elsewhere.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf.reqts/tested_elsewhere.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp
new file mode 100644
index 0000000000000..469c7449971e1
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf(const basic_streambuf& rhs); // protected
+
+#include <streambuf>
+#include <cassert>
+
+std::streambuf get();
+
+int main()
+{
+ std::streambuf sb = get();
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp
new file mode 100644
index 0000000000000..c1e18392b6cec
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf(const basic_streambuf& rhs);
+
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ test() {}
+
+ test(const test& t)
+ : std::basic_streambuf<CharT>(t)
+ {
+ assert(this->eback() == t.eback());
+ assert(this->gptr() == t.gptr());
+ assert(this->egptr() == t.egptr());
+ assert(this->pbase() == t.pbase());
+ assert(this->pptr() == t.pptr());
+ assert(this->epptr() == t.epptr());
+ assert(this->getloc() == t.getloc());
+ }
+
+ void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+ void setp(CharT* pbeg, CharT* pend)
+ {
+ base::setp(pbeg, pend);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ test<char> t2 = t;
+ }
+ {
+ test<wchar_t> t;
+ test<wchar_t> t2 = t;
+ }
+ {
+ char g1, g2, g3, p1, p3;
+ test<char> t;
+ t.setg(&g1, &g2, &g3);
+ t.setp(&p1, &p3);
+ test<char> t2 = t;
+ }
+ {
+ wchar_t g1, g2, g3, p1, p3;
+ test<wchar_t> t;
+ t.setg(&g1, &g2, &g3);
+ t.setp(&p1, &p3);
+ test<wchar_t> t2 = t;
+ }
+ std::locale::global(std::locale(LOCALE_en_US_UTF_8));
+ {
+ test<char> t;
+ test<char> t2 = t;
+ }
+ {
+ test<wchar_t> t;
+ test<wchar_t> t2 = t;
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.fail.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.fail.cpp
new file mode 100644
index 0000000000000..7f57f3cf9304c
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf(); // is protected
+
+#include <streambuf>
+
+int main()
+{
+ std::basic_streambuf<char> sb;
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.pass.cpp
new file mode 100644
index 0000000000000..d8ca8aebc62b8
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf();
+
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ test()
+ {
+ assert(this->eback() == 0);
+ assert(this->gptr() == 0);
+ assert(this->egptr() == 0);
+ assert(this->pbase() == 0);
+ assert(this->pptr() == 0);
+ assert(this->epptr() == 0);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ assert(t.getloc().name() == "C");
+ }
+ {
+ test<wchar_t> t;
+ assert(t.getloc().name() == "C");
+ }
+ std::locale::global(std::locale(LOCALE_en_US_UTF_8));
+ {
+ test<char> t;
+ assert(t.getloc().name() == LOCALE_en_US_UTF_8);
+ }
+ {
+ test<wchar_t> t;
+ assert(t.getloc().name() == LOCALE_en_US_UTF_8);
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/nothing_to_do.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekoff.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekoff.pass.cpp
new file mode 100644
index 0000000000000..2c77f25c2e591
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekoff.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// pos_type pubseekoff(off_type off, ios_base::seekdir way,
+// ios_base::openmode which = ios_base::in | ios_base::out);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ test() {}
+};
+
+int main()
+{
+ {
+ test<char> t;
+ assert(t.pubseekoff(0, std::ios_base::beg) == -1);
+ assert(t.pubseekoff(0, std::ios_base::beg, std::ios_base::app) == -1);
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekpos.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekpos.pass.cpp
new file mode 100644
index 0000000000000..0b9ddff4106c2
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekpos.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// pos_type pubseekpos(pos_type sp,
+// ios_base::openmode which = ios_base::in | ios_base::out;
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ test() {}
+};
+
+int main()
+{
+ {
+ test<char> t;
+ assert(t.pubseekpos(0, std::ios_base::app) == -1);
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsetbuf.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsetbuf.pass.cpp
new file mode 100644
index 0000000000000..8cf62771e4990
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsetbuf.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf* pubsetbuf(char_type* s, streamsize n);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ test() {}
+};
+
+int main()
+{
+ {
+ test<char> t;
+ assert(t.pubsetbuf(0, 0) == &t);
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsync.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsync.pass.cpp
new file mode 100644
index 0000000000000..cc16790716100
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsync.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int pubsync();
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ test() {}
+};
+
+int main()
+{
+ {
+ test<char> t;
+ assert(t.pubsync() == 0);
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.locales/locales.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.locales/locales.pass.cpp
new file mode 100644
index 0000000000000..95dd2db75b6bb
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.locales/locales.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// locale pubimbue(const locale& loc);
+// locale getloc() const;
+
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ test() {}
+
+ void imbue(const std::locale&)
+ {
+ assert(this->getloc().name() == LOCALE_en_US_UTF_8);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ assert(t.getloc().name() == "C");
+ }
+ std::locale::global(std::locale(LOCALE_en_US_UTF_8));
+ {
+ test<char> t;
+ assert(t.getloc().name() == LOCALE_en_US_UTF_8);
+ assert(t.pubimbue(std::locale(LOCALE_fr_FR_UTF_8)).name() ==
+ LOCALE_en_US_UTF_8);
+ assert(t.getloc().name() == LOCALE_fr_FR_UTF_8);
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/in_avail.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/in_avail.pass.cpp
new file mode 100644
index 0000000000000..200150639b911
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/in_avail.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize in_avail();
+
+#include <streambuf>
+#include <cassert>
+
+int showmanyc_called = 0;
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+
+ test() {}
+
+ void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+protected:
+ std::streamsize showmanyc()
+ {
+ ++showmanyc_called;
+ return 5;
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ assert(t.in_avail() == 5);
+ assert(showmanyc_called == 1);
+ char in[5];
+ t.setg(in, in+2, in+5);
+ assert(t.in_avail() == 3);
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sbumpc.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sbumpc.pass.cpp
new file mode 100644
index 0000000000000..ac6d0cc932ae9
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sbumpc.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type sbumpc();
+
+#include <streambuf>
+#include <cassert>
+
+int uflow_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ typedef std::basic_streambuf<char> base;
+
+ test() {}
+
+ void setg(char* gbeg, char* gnext, char* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+
+protected:
+ int_type uflow()
+ {
+ ++uflow_called;
+ return 'a';
+ }
+};
+
+int main()
+{
+ {
+ test t;
+ assert(uflow_called == 0);
+ assert(t.sbumpc() == 'a');
+ assert(uflow_called == 1);
+ char in[] = "ABC";
+ t.setg(in, in, in+sizeof(in));
+ assert(t.sbumpc() == 'A');
+ assert(uflow_called == 1);
+ assert(t.sbumpc() == 'B');
+ assert(uflow_called == 1);
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetc.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetc.pass.cpp
new file mode 100644
index 0000000000000..c68930cfa84c6
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetc.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type sgetc();
+
+#include <streambuf>
+#include <cassert>
+
+int underflow_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ typedef std::basic_streambuf<char> base;
+
+ test() {}
+
+ void setg(char* gbeg, char* gnext, char* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+
+protected:
+ int_type underflow()
+ {
+ ++underflow_called;
+ return 'a';
+ }
+};
+
+int main()
+{
+ {
+ test t;
+ assert(underflow_called == 0);
+ assert(t.sgetc() == 'a');
+ assert(underflow_called == 1);
+ char in[] = "ABC";
+ t.setg(in, in, in+sizeof(in));
+ assert(t.sgetc() == 'A');
+ assert(underflow_called == 1);
+ assert(t.sgetc() == 'A');
+ assert(underflow_called == 1);
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp
new file mode 100644
index 0000000000000..730cedeea76c0
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize sgetn(char_type* s, streamsize n);
+
+#include <streambuf>
+#include <cassert>
+
+int xsgetn_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ test() {}
+
+protected:
+ std::streamsize xsgetn(char_type* s, std::streamsize n)
+ {
+ ++xsgetn_called;
+ return 10;
+ }
+};
+
+int main()
+{
+ test t;
+ assert(xsgetn_called == 0);
+ assert(t.sgetn(0, 0) == 10);
+ assert(xsgetn_called == 1);
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/snextc.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/snextc.pass.cpp
new file mode 100644
index 0000000000000..7f44245e26e39
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/snextc.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type snextc();
+
+#include <streambuf>
+#include <cassert>
+
+int uflow_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ typedef std::basic_streambuf<char> base;
+
+ test() {}
+
+ void setg(char* gbeg, char* gnext, char* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+
+protected:
+ int_type uflow()
+ {
+ ++uflow_called;
+ return 'a';
+ }
+};
+
+int main()
+{
+ {
+ test t;
+ assert(uflow_called == 0);
+ assert(t.snextc() == -1);
+ assert(uflow_called == 1);
+ char in[] = "ABC";
+ t.setg(in, in, in+sizeof(in));
+ assert(t.snextc() == 'B');
+ assert(uflow_called == 1);
+ assert(t.snextc() == 'C');
+ assert(uflow_called == 1);
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp
new file mode 100644
index 0000000000000..34a2a2dda3727
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type sputbackc(char_type c);
+
+#include <streambuf>
+#include <cassert>
+
+int pbackfail_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ typedef std::basic_streambuf<char> base;
+
+ test() {}
+
+ void setg(char* gbeg, char* gnext, char* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+
+protected:
+ int_type pbackfail(int_type c = traits_type::eof())
+ {
+ ++pbackfail_called;
+ return 'a';
+ }
+};
+
+int main()
+{
+ {
+ test t;
+ assert(pbackfail_called == 0);
+ assert(t.sputbackc('A') == 'a');
+ assert(pbackfail_called == 1);
+ char in[] = "ABC";
+ t.setg(in, in+1, in+sizeof(in));
+ assert(t.sputbackc('A') == 'A');
+ assert(pbackfail_called == 1);
+ assert(t.sputbackc('A') == 'a');
+ assert(pbackfail_called == 2);
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp
new file mode 100644
index 0000000000000..4c68fada07a8c
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type sungetc();
+
+#include <streambuf>
+#include <cassert>
+
+int pbackfail_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ typedef std::basic_streambuf<char> base;
+
+ test() {}
+
+ void setg(char* gbeg, char* gnext, char* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+
+protected:
+ int_type pbackfail(int_type c = traits_type::eof())
+ {
+ ++pbackfail_called;
+ return 'a';
+ }
+};
+
+int main()
+{
+ {
+ test t;
+ assert(pbackfail_called == 0);
+ assert(t.sungetc() == 'a');
+ assert(pbackfail_called == 1);
+ char in[] = "ABC";
+ t.setg(in, in+1, in+sizeof(in));
+ assert(t.sungetc() == 'A');
+ assert(pbackfail_called == 1);
+ assert(t.sungetc() == 'a');
+ assert(pbackfail_called == 2);
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp
new file mode 100644
index 0000000000000..b04b8b0acc91a
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type sputc(char_type c);
+
+#include <streambuf>
+#include <cassert>
+
+int overflow_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ typedef std::basic_streambuf<char> base;
+
+ test() {}
+
+ void setg(char* gbeg, char* gnext, char* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+ void setp(char* pbeg, char* pend)
+ {
+ base::setp(pbeg, pend);
+ }
+
+protected:
+ int_type overflow(int_type c = traits_type::eof())
+ {
+ ++overflow_called;
+ return 'a';
+ }
+};
+
+int main()
+{
+ {
+ test t;
+ assert(overflow_called == 0);
+ assert(t.sputc('A') == 'a');
+ assert(overflow_called == 1);
+ char out[3] = {0};
+ t.setp(out, out+sizeof(out));
+ assert(t.sputc('A') == 'A');
+ assert(overflow_called == 1);
+ assert(out[0] == 'A');
+ assert(t.sputc('B') == 'B');
+ assert(overflow_called == 1);
+ assert(out[0] == 'A');
+ assert(out[1] == 'B');
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp
new file mode 100644
index 0000000000000..e03e8e0cbda3c
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize sputn(const char_type* s, streamsize n);
+
+#include <streambuf>
+#include <cassert>
+
+int xsputn_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ test() {}
+
+protected:
+ std::streamsize xsputn(const char_type* s, std::streamsize n)
+ {
+ ++xsputn_called;
+ return 5;
+ }
+};
+
+int main()
+{
+ test t;
+ assert(xsputn_called == 0);
+ assert(t.sputn(0, 0) == 5);
+ assert(xsputn_called == 1);
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.protected/nothing_to_do.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp
new file mode 100644
index 0000000000000..803198938f6e6
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf& operator=(const basic_streambuf& rhs);
+
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ test() {}
+
+ test& operator=(const test& t)
+ {
+ base::operator=(t);
+ assert(this->eback() == t.eback());
+ assert(this->gptr() == t.gptr());
+ assert(this->egptr() == t.egptr());
+ assert(this->pbase() == t.pbase());
+ assert(this->pptr() == t.pptr());
+ assert(this->epptr() == t.epptr());
+ assert(this->getloc() == t.getloc());
+ return *this;
+ }
+
+ void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+ void setp(CharT* pbeg, CharT* pend)
+ {
+ base::setp(pbeg, pend);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ test<char> t2;
+ t2 = t;
+ }
+ {
+ test<wchar_t> t;
+ test<wchar_t> t2;
+ t2 = t;
+ }
+ {
+ char g1, g2, g3, p1, p3;
+ test<char> t;
+ t.setg(&g1, &g2, &g3);
+ t.setp(&p1, &p3);
+ test<char> t2;
+ t2 = t;
+ }
+ {
+ wchar_t g1, g2, g3, p1, p3;
+ test<wchar_t> t;
+ t.setg(&g1, &g2, &g3);
+ t.setp(&p1, &p3);
+ test<wchar_t> t2;
+ t2 = t;
+ }
+ std::locale::global(std::locale(LOCALE_en_US_UTF_8));
+ {
+ test<char> t;
+ test<char> t2;
+ t2 = t;
+ }
+ {
+ test<wchar_t> t;
+ test<wchar_t> t2;
+ t2 = t;
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp
new file mode 100644
index 0000000000000..7a23206b42dec
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// void swap(basic_streambuf& rhs);
+
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ test() {}
+
+ void swap(test& t)
+ {
+ test old_this(*this);
+ test old_that(t);
+ base::swap(t);
+ assert(this->eback() == old_that.eback());
+ assert(this->gptr() == old_that.gptr());
+ assert(this->egptr() == old_that.egptr());
+ assert(this->pbase() == old_that.pbase());
+ assert(this->pptr() == old_that.pptr());
+ assert(this->epptr() == old_that.epptr());
+ assert(this->getloc() == old_that.getloc());
+
+ assert(t.eback() == old_this.eback());
+ assert(t.gptr() == old_this.gptr());
+ assert(t.egptr() == old_this.egptr());
+ assert(t.pbase() == old_this.pbase());
+ assert(t.pptr() == old_this.pptr());
+ assert(t.epptr() == old_this.epptr());
+ assert(t.getloc() == old_this.getloc());
+ return *this;
+ }
+
+ void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+ void setp(CharT* pbeg, CharT* pend)
+ {
+ base::setp(pbeg, pend);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ test<char> t2;
+ swap(t2, t);
+ }
+ {
+ test<wchar_t> t;
+ test<wchar_t> t2;
+ swap(t2, t);
+ }
+ {
+ char g1, g2, g3, p1, p3;
+ test<char> t;
+ t.setg(&g1, &g2, &g3);
+ t.setp(&p1, &p3);
+ test<char> t2;
+ swap(t2, t);
+ }
+ {
+ wchar_t g1, g2, g3, p1, p3;
+ test<wchar_t> t;
+ t.setg(&g1, &g2, &g3);
+ t.setp(&p1, &p3);
+ test<wchar_t> t2;
+ swap(t2, t);
+ }
+ std::locale::global(std::locale(LOCALE_en_US_UTF_8));
+ {
+ test<char> t;
+ test<char> t2;
+ swap(t2, t);
+ }
+ {
+ test<wchar_t> t;
+ test<wchar_t> t2;
+ swap(t2, t);
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/gbump.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/gbump.pass.cpp
new file mode 100644
index 0000000000000..ce25a191914df
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/gbump.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// void gbump(int n);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+
+ test() {}
+
+ void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+
+ void gbump(int n)
+ {
+ CharT* gbeg = base::eback();
+ CharT* gnext = base::gptr();
+ CharT* gend = base::egptr();
+ base::gbump(n);
+ assert(base::eback() == gbeg);
+ assert(base::gptr() == gnext+n);
+ assert(base::egptr() == gend);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ char in[] = "ABCDE";
+ t.setg(in, in+1, in+sizeof(in)/sizeof(in[0]));
+ t.gbump(2);
+ }
+ {
+ test<wchar_t> t;
+ wchar_t in[] = L"ABCDE";
+ t.setg(in, in+1, in+sizeof(in)/sizeof(in[0]));
+ t.gbump(3);
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/setg.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/setg.pass.cpp
new file mode 100644
index 0000000000000..68dcf6eab8f15
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/setg.pass.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// void setg(char_type* gbeg, char_type* gnext, char_type* gend);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+
+ test() {}
+
+ void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ assert(base::eback() == gbeg);
+ assert(base::gptr() == gnext);
+ assert(base::egptr() == gend);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ char in[] = "ABC";
+ t.setg(in, in+1, in+sizeof(in)/sizeof(in[0]));
+ }
+ {
+ test<wchar_t> t;
+ wchar_t in[] = L"ABC";
+ t.setg(in, in+1, in+sizeof(in)/sizeof(in[0]));
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump.pass.cpp
new file mode 100644
index 0000000000000..47ef939142aca
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump.pass.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// void pbump(int n);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+
+ test() {}
+
+ void setp(CharT* pbeg, CharT* pend)
+ {
+ base::setp(pbeg, pend);
+ }
+
+ void pbump(int n)
+ {
+ CharT* pbeg = base::pbase();
+ CharT* pnext = base::pptr();
+ CharT* pend = base::epptr();
+ base::pbump(n);
+ assert(base::pbase() == pbeg);
+ assert(base::pptr() == pnext+n);
+ assert(base::epptr() == pend);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ char in[] = "ABCDE";
+ t.setp(in, in+sizeof(in)/sizeof(in[0]));
+ t.pbump(2);
+ t.pbump(1);
+ }
+ {
+ test<wchar_t> t;
+ wchar_t in[] = L"ABCDE";
+ t.setp(in, in+sizeof(in)/sizeof(in[0]));
+ t.pbump(3);
+ t.pbump(1);
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/setp.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/setp.pass.cpp
new file mode 100644
index 0000000000000..fa4133a475d59
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/setp.pass.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// void setp(char_type* pbeg, char_type* pend);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+
+ test() {}
+
+ void setp(CharT* pbeg, CharT* pend)
+ {
+ base::setp(pbeg, pend);
+ assert(base::pbase() == pbeg);
+ assert(base::pptr() == pbeg);
+ assert(base::epptr() == pend);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ char in[] = "ABC";
+ t.setp(in, in+sizeof(in)/sizeof(in[0]));
+ }
+ {
+ test<wchar_t> t;
+ wchar_t in[] = L"ABC";
+ t.setp(in, in+sizeof(in)/sizeof(in[0]));
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/nothing_to_do.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.buffer/tested_elsewhere.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.buffer/tested_elsewhere.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.buffer/tested_elsewhere.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/showmanyc.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/showmanyc.pass.cpp
new file mode 100644
index 0000000000000..acaf1e8461e64
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/showmanyc.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize showmanyc();
+
+#include <streambuf>
+#include <cassert>
+
+int showmanyc_called = 0;
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ test() {}
+};
+
+int main()
+{
+ test<char> t;
+ assert(t.in_avail() == 0);
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/uflow.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/uflow.pass.cpp
new file mode 100644
index 0000000000000..d25ae9b21bffd
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/uflow.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type uflow();
+
+#include <streambuf>
+#include <cassert>
+
+int underflow_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ test() {}
+
+};
+
+int main()
+{
+ test t;
+ assert(t.sgetc() == -1);
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/underflow.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/underflow.pass.cpp
new file mode 100644
index 0000000000000..1bdba0714f194
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/underflow.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type underflow();
+
+#include <streambuf>
+#include <cassert>
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ test() {}
+};
+
+int main()
+{
+ test t;
+ assert(t.sgetc() == -1);
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp
new file mode 100644
index 0000000000000..b1f15427367f0
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize xsgetn(char_type* s, streamsize n);
+
+#include <streambuf>
+#include <cassert>
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ typedef std::basic_streambuf<char> base;
+
+ test() {}
+
+ void setg(char* gbeg, char* gnext, char* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+};
+
+int main()
+{
+ test t;
+ char input[7] = "123456";
+ t.setg(input, input, input+7);
+ char output[sizeof(input)] = {0};
+ assert(t.sgetn(output, 10) == 7);
+ assert(strcmp(input, output) == 0);
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.locales/nothing_to_do.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.locales/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.locales/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.pass.cpp
new file mode 100644
index 0000000000000..3a10d8a70ad7c
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type pbackfail(int_type c = traits::eof());
+
+#include <streambuf>
+#include <cassert>
+
+int pbackfail_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ test() {}
+};
+
+int main()
+{
+ test t;
+ assert(t.sputbackc('A') == -1);
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/overflow.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/overflow.pass.cpp
new file mode 100644
index 0000000000000..dcdd45f5ff108
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/overflow.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type overflow(int_type c = traits::eof());
+
+#include <streambuf>
+#include <cassert>
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ test() {}
+};
+
+int main()
+{
+ test t;
+ assert(t.sputc('A') == -1);
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.pass.cpp
new file mode 100644
index 0000000000000..93dc15401e9f3
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize xsputn(const char_type* s, streamsize n);
+
+#include <streambuf>
+#include <cassert>
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ typedef std::basic_streambuf<char> base;
+
+ test() {}
+
+ void setp(char* pbeg, char* pend)
+ {
+ base::setp(pbeg, pend);
+ }
+};
+
+int main()
+{
+ {
+ test t;
+ char in[] = "123456";
+ assert(t.sputn(in, sizeof(in)) == 0);
+ char out[sizeof(in)] = {0};
+ t.setp(out, out+sizeof(out));
+ assert(t.sputn(in, sizeof(in)) == sizeof(in));
+ assert(strcmp(in, out) == 0);
+ }
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/types.pass.cpp b/test/std/input.output/stream.buffers/streambuf/types.pass.cpp
new file mode 100644
index 0000000000000..919caee3655fc
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/types.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf
+// {
+// public:
+// // types:
+// typedef charT char_type;
+// typedef traits traits_type;
+// typedef typename traits_type::int_type int_type;
+// typedef typename traits_type::pos_type pos_type;
+// typedef typename traits_type::off_type off_type;
+
+#include <streambuf>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_same<std::streambuf::char_type, char>::value), "");
+ static_assert((std::is_same<std::streambuf::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::streambuf::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::streambuf::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::streambuf::off_type, std::char_traits<char>::off_type>::value), "");
+
+ static_assert((std::is_same<std::wstreambuf::char_type, wchar_t>::value), "");
+ static_assert((std::is_same<std::wstreambuf::traits_type, std::char_traits<wchar_t> >::value), "");
+ static_assert((std::is_same<std::wstreambuf::int_type, std::char_traits<wchar_t>::int_type>::value), "");
+ static_assert((std::is_same<std::wstreambuf::pos_type, std::char_traits<wchar_t>::pos_type>::value), "");
+ static_assert((std::is_same<std::wstreambuf::off_type, std::char_traits<wchar_t>::off_type>::value), "");
+}
diff --git a/test/std/input.output/stream.buffers/version.pass.cpp b/test/std/input.output/stream.buffers/version.pass.cpp
new file mode 100644
index 0000000000000..c4b06be601871
--- /dev/null
+++ b/test/std/input.output/stream.buffers/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+#include <streambuf>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/std/input.output/string.streams/istringstream/istringstream.assign/member_swap.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.assign/member_swap.pass.cpp
new file mode 100644
index 0000000000000..fc5f2e7e920f3
--- /dev/null
+++ b/test/std/input.output/string.streams/istringstream/istringstream.assign/member_swap.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// void swap(basic_istringstream& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::istringstream ss0(" 123 456");
+ std::istringstream ss(" 789 321");
+ ss.swap(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss0 >> i;
+ assert(i == 789);
+ ss0 >> i;
+ assert(i == 321);
+ }
+ {
+ std::wistringstream ss0(L" 123 456");
+ std::wistringstream ss(L" 789 321");
+ ss.swap(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss0 >> i;
+ assert(i == 789);
+ ss0 >> i;
+ assert(i == 321);
+ }
+}
diff --git a/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp
new file mode 100644
index 0000000000000..e57ad55c90786
--- /dev/null
+++ b/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp
@@ -0,0 +1,86 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// basic_istringstream& operator=(basic_istringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ std::istringstream ss0(" 123 456");
+ std::istringstream ss;
+ ss = std::move(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ }
+ {
+ std::istringstream s1("Aaaaa Bbbbb Cccccccccc Dddddddddddddddddd");
+ std::string s;
+ s1 >> s;
+
+ std::istringstream s2 = std::move(s1);
+ s2 >> s;
+ assert(s == "Bbbbb");
+
+ std::istringstream s3;
+ s3 = std::move(s2);
+ s3 >> s;
+ assert(s == "Cccccccccc");
+
+ s1 = std::move(s3);
+ s1 >> s;
+ assert(s == "Dddddddddddddddddd");
+ }
+ {
+ std::wistringstream ss0(L" 123 456");
+ std::wistringstream ss;
+ ss = std::move(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ }
+ {
+ std::wistringstream s1(L"Aaaaa Bbbbb Cccccccccc Dddddddddddddddddd");
+ std::wstring s;
+ s1 >> s;
+
+ std::wistringstream s2 = std::move(s1);
+ s2 >> s;
+ assert(s == L"Bbbbb");
+
+ std::wistringstream s3;
+ s3 = std::move(s2);
+ s3 >> s;
+ assert(s == L"Cccccccccc");
+
+ s1 = std::move(s3);
+ s1 >> s;
+ assert(s == L"Dddddddddddddddddd");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/string.streams/istringstream/istringstream.assign/nonmember_swap.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.assign/nonmember_swap.pass.cpp
new file mode 100644
index 0000000000000..d72cef16076f2
--- /dev/null
+++ b/test/std/input.output/string.streams/istringstream/istringstream.assign/nonmember_swap.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// template <class charT, class traits, class Allocator>
+// void
+// swap(basic_istringstream<charT, traits, Allocator>& x,
+// basic_istringstream<charT, traits, Allocator>& y);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::istringstream ss0(" 123 456");
+ std::istringstream ss(" 789 321");
+ swap(ss, ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss0 >> i;
+ assert(i == 789);
+ ss0 >> i;
+ assert(i == 321);
+ }
+ {
+ std::wistringstream ss0(L" 123 456");
+ std::wistringstream ss(L" 789 321");
+ swap(ss, ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss0 >> i;
+ assert(i == 789);
+ ss0 >> i;
+ assert(i == 321);
+ }
+}
diff --git a/test/std/input.output/string.streams/istringstream/istringstream.cons/default.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.cons/default.pass.cpp
new file mode 100644
index 0000000000000..5d44a50a3f678
--- /dev/null
+++ b/test/std/input.output/string.streams/istringstream/istringstream.cons/default.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// explicit basic_istringstream(ios_base::openmode which = ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::istringstream ss;
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == "");
+ }
+ {
+ std::istringstream ss(std::ios_base::in);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == "");
+ }
+ {
+ std::wistringstream ss;
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L"");
+ }
+ {
+ std::wistringstream ss(std::ios_base::in);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L"");
+ }
+}
diff --git a/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp
new file mode 100644
index 0000000000000..adc46ab65f5e7
--- /dev/null
+++ b/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// basic_istringstream(basic_istringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ std::istringstream ss0(" 123 456");
+ std::istringstream ss(std::move(ss0));
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ }
+ {
+ std::wistringstream ss0(L" 123 456");
+ std::wistringstream ss(std::move(ss0));
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/string.streams/istringstream/istringstream.cons/string.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.cons/string.pass.cpp
new file mode 100644
index 0000000000000..9779236396990
--- /dev/null
+++ b/test/std/input.output/string.streams/istringstream/istringstream.cons/string.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// explicit basic_istringstream(const basic_string<charT,traits,allocator>& str,
+// ios_base::openmode which = ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::istringstream ss(" 123 456");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ }
+ {
+ std::istringstream ss(" 123 456", std::ios_base::out);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ }
+ {
+ std::wistringstream ss(L" 123 456");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ }
+ {
+ std::wistringstream ss(L" 123 456", std::ios_base::out);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ }
+}
diff --git a/test/std/input.output/string.streams/istringstream/istringstream.members/str.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.members/str.pass.cpp
new file mode 100644
index 0000000000000..448a6f89b259f
--- /dev/null
+++ b/test/std/input.output/string.streams/istringstream/istringstream.members/str.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// void str(const basic_string<charT,traits,Allocator>& s);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::istringstream ss(" 123 456");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss.str(" 789");
+ ss.clear();
+ assert(ss.good());
+ assert(ss.str() == " 789");
+ ss >> i;
+ assert(i == 789);
+ }
+ {
+ std::wistringstream ss(L" 123 456");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss.str(L" 789");
+ ss.clear();
+ assert(ss.good());
+ assert(ss.str() == L" 789");
+ ss >> i;
+ assert(i == 789);
+ }
+}
diff --git a/test/std/input.output/string.streams/istringstream/types.pass.cpp b/test/std/input.output/string.streams/istringstream/types.pass.cpp
new file mode 100644
index 0000000000000..349bcae1a1c15
--- /dev/null
+++ b/test/std/input.output/string.streams/istringstream/types.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+// : public basic_istream<charT, traits>
+// {
+// public:
+// typedef charT char_type;
+// typedef traits traits_type;
+// typedef typename traits_type::int_type int_type;
+// typedef typename traits_type::pos_type pos_type;
+// typedef typename traits_type::off_type off_type;
+// typedef Allocator allocator_type;
+
+#include <sstream>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_base_of<std::basic_istream<char>, std::basic_istringstream<char> >::value), "");
+ static_assert((std::is_same<std::basic_istringstream<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::basic_istringstream<char>::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_istringstream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::basic_istringstream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::basic_istringstream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+ static_assert((std::is_same<std::basic_istringstream<char>::allocator_type, std::allocator<char> >::value), "");
+}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.pass.cpp
new file mode 100644
index 0000000000000..eff47452c58fe
--- /dev/null
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// void swap(basic_ostringstream& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ostringstream ss0(" 123 456");
+ std::ostringstream ss;
+ ss.swap(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == "234 5676");
+ ss0 << i << ' ' << 567;;
+ assert(ss0.str() == "234 567");
+ }
+ {
+ std::wostringstream ss0(L" 123 456");
+ std::wostringstream ss;
+ ss.swap(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == L"234 5676");
+ ss0 << i << ' ' << 567;;
+ assert(ss0.str() == L"234 567");
+ }
+}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp
new file mode 100644
index 0000000000000..a6fb8ba69b2ef
--- /dev/null
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// basic_ostringstream& operator=(basic_ostringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ std::ostringstream ss0(" 123 456");
+ std::ostringstream ss;
+ ss = std::move(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == "234 5676");
+ }
+ {
+ std::wostringstream ss0(L" 123 456");
+ std::wostringstream ss;
+ ss = std::move(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == L"234 5676");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.pass.cpp
new file mode 100644
index 0000000000000..3d7081d8e2412
--- /dev/null
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// void swap(basic_ostringstream& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ostringstream ss0(" 123 456");
+ std::ostringstream ss;
+ swap(ss, ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == "234 5676");
+ ss0 << i << ' ' << 567;;
+ assert(ss0.str() == "234 567");
+ }
+ {
+ std::wostringstream ss0(L" 123 456");
+ std::wostringstream ss;
+ swap(ss, ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == L"234 5676");
+ ss0 << i << ' ' << 567;;
+ assert(ss0.str() == L"234 567");
+ }
+}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.pass.cpp
new file mode 100644
index 0000000000000..dde1dc7192384
--- /dev/null
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// explicit basic_ostringstream(ios_base::openmode which = ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ostringstream ss;
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == "");
+ }
+ {
+ std::ostringstream ss(std::ios_base::out);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == "");
+ }
+ {
+ std::wostringstream ss;
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L"");
+ }
+ {
+ std::wostringstream ss(std::ios_base::out);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L"");
+ }
+}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp
new file mode 100644
index 0000000000000..dc63b59fe39f6
--- /dev/null
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// basic_ostringstream(basic_ostringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ std::ostringstream ss0(" 123 456");
+ std::ostringstream ss(std::move(ss0));
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == "234 5676");
+ }
+ {
+ std::wostringstream ss0(L" 123 456");
+ std::wostringstream ss(std::move(ss0));
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == L"234 5676");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp
new file mode 100644
index 0000000000000..89c91bdee05d6
--- /dev/null
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// explicit basic_ostringstream(const basic_string<charT,traits,allocator>& str,
+// ios_base::openmode which = ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ostringstream ss(" 123 456");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == "234 5676");
+ }
+ {
+ std::ostringstream ss(" 123 456", std::ios_base::in);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == "234 5676");
+ }
+ {
+ std::wostringstream ss(L" 123 456");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == L"234 5676");
+ }
+ {
+ std::wostringstream ss(L" 123 456", std::ios_base::in);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == L"234 5676");
+ }
+}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.members/str.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.members/str.pass.cpp
new file mode 100644
index 0000000000000..ab277a2eeac79
--- /dev/null
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.members/str.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// void str(const basic_string<charT,traits,Allocator>& s);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ostringstream ss(" 123 456");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 0;
+ ss << i;
+ assert(ss.str() == "0123 456");
+ ss << 456;
+ assert(ss.str() == "0456 456");
+ ss.str(" 789");
+ assert(ss.str() == " 789");
+ ss << "abc";
+ assert(ss.str() == "abc9");
+ }
+ {
+ std::wostringstream ss(L" 123 456");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 0;
+ ss << i;
+ assert(ss.str() == L"0123 456");
+ ss << 456;
+ assert(ss.str() == L"0456 456");
+ ss.str(L" 789");
+ assert(ss.str() == L" 789");
+ ss << L"abc";
+ assert(ss.str() == L"abc9");
+ }
+}
diff --git a/test/std/input.output/string.streams/ostringstream/types.pass.cpp b/test/std/input.output/string.streams/ostringstream/types.pass.cpp
new file mode 100644
index 0000000000000..c9cb763784ef5
--- /dev/null
+++ b/test/std/input.output/string.streams/ostringstream/types.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+// : public basic_ostream<charT, traits>
+// {
+// public:
+// typedef charT char_type;
+// typedef traits traits_type;
+// typedef typename traits_type::int_type int_type;
+// typedef typename traits_type::pos_type pos_type;
+// typedef typename traits_type::off_type off_type;
+// typedef Allocator allocator_type;
+
+#include <sstream>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_base_of<std::basic_ostream<char>, std::basic_ostringstream<char> >::value), "");
+ static_assert((std::is_same<std::basic_ostringstream<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::basic_ostringstream<char>::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_ostringstream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::basic_ostringstream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::basic_ostringstream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+ static_assert((std::is_same<std::basic_ostringstream<char>::allocator_type, std::allocator<char> >::value), "");
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.assign/member_swap.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.assign/member_swap.pass.cpp
new file mode 100644
index 0000000000000..eaca7245461fd
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.assign/member_swap.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// void swap(basic_stringbuf& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf buf1("testing");
+ std::stringbuf buf;
+ buf.swap(buf1);
+ assert(buf.str() == "testing");
+ assert(buf1.str() == "");
+ }
+ {
+ std::stringbuf buf1("testing", std::ios_base::in);
+ std::stringbuf buf;
+ buf.swap(buf1);
+ assert(buf.str() == "testing");
+ assert(buf1.str() == "");
+ }
+ {
+ std::stringbuf buf1("testing", std::ios_base::out);
+ std::stringbuf buf;
+ buf.swap(buf1);
+ assert(buf.str() == "testing");
+ assert(buf1.str() == "");
+ }
+ {
+ std::wstringbuf buf1(L"testing");
+ std::wstringbuf buf;
+ buf.swap(buf1);
+ assert(buf.str() == L"testing");
+ assert(buf1.str() == L"");
+ }
+ {
+ std::wstringbuf buf1(L"testing", std::ios_base::in);
+ std::wstringbuf buf;
+ buf.swap(buf1);
+ assert(buf.str() == L"testing");
+ assert(buf1.str() == L"");
+ }
+ {
+ std::wstringbuf buf1(L"testing", std::ios_base::out);
+ std::wstringbuf buf;
+ buf.swap(buf1);
+ assert(buf.str() == L"testing");
+ assert(buf1.str() == L"");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.assign/move.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.assign/move.pass.cpp
new file mode 100644
index 0000000000000..716b6afa755a7
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.assign/move.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// basic_stringbuf& operator=(basic_stringbuf&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf buf1("testing");
+ std::stringbuf buf;
+ buf = move(buf1);
+ assert(buf.str() == "testing");
+ }
+ {
+ std::stringbuf buf1("testing", std::ios_base::in);
+ std::stringbuf buf;
+ buf = move(buf1);
+ assert(buf.str() == "testing");
+ }
+ {
+ std::stringbuf buf1("testing", std::ios_base::out);
+ std::stringbuf buf;
+ buf = move(buf1);
+ assert(buf.str() == "testing");
+ }
+ {
+ std::wstringbuf buf1(L"testing");
+ std::wstringbuf buf;
+ buf = move(buf1);
+ assert(buf.str() == L"testing");
+ }
+ {
+ std::wstringbuf buf1(L"testing", std::ios_base::in);
+ std::wstringbuf buf;
+ buf = move(buf1);
+ assert(buf.str() == L"testing");
+ }
+ {
+ std::wstringbuf buf1(L"testing", std::ios_base::out);
+ std::wstringbuf buf;
+ buf = move(buf1);
+ assert(buf.str() == L"testing");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.assign/nonmember_swap.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.assign/nonmember_swap.pass.cpp
new file mode 100644
index 0000000000000..dca637d39fabd
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.assign/nonmember_swap.pass.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// template <class charT, class traits, class Allocator>
+// void swap(basic_stringbuf<charT, traits, Allocator>& x,
+// basic_stringbuf<charT, traits, Allocator>& y);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf buf1("testing");
+ std::stringbuf buf;
+ swap(buf, buf1);
+ assert(buf.str() == "testing");
+ assert(buf1.str() == "");
+ }
+ {
+ std::stringbuf buf1("testing", std::ios_base::in);
+ std::stringbuf buf;
+ swap(buf, buf1);
+ assert(buf.str() == "testing");
+ assert(buf1.str() == "");
+ }
+ {
+ std::stringbuf buf1("testing", std::ios_base::out);
+ std::stringbuf buf;
+ swap(buf, buf1);
+ assert(buf.str() == "testing");
+ assert(buf1.str() == "");
+ }
+ {
+ std::wstringbuf buf1(L"testing");
+ std::wstringbuf buf;
+ swap(buf, buf1);
+ assert(buf.str() == L"testing");
+ assert(buf1.str() == L"");
+ }
+ {
+ std::wstringbuf buf1(L"testing", std::ios_base::in);
+ std::wstringbuf buf;
+ swap(buf, buf1);
+ assert(buf.str() == L"testing");
+ assert(buf1.str() == L"");
+ }
+ {
+ std::wstringbuf buf1(L"testing", std::ios_base::out);
+ std::wstringbuf buf;
+ swap(buf, buf1);
+ assert(buf.str() == L"testing");
+ assert(buf1.str() == L"");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
new file mode 100644
index 0000000000000..28007c8edf45c
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// explicit basic_stringbuf(ios_base::openmode which = ios_base::in | ios_base::out);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf buf;
+ assert(buf.str() == "");
+ }
+ {
+ std::wstringbuf buf;
+ assert(buf.str() == L"");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.cons/move.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.cons/move.pass.cpp
new file mode 100644
index 0000000000000..14fd0caa5cb98
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.cons/move.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// basic_stringbuf(basic_stringbuf&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf buf1("testing");
+ std::stringbuf buf(move(buf1));
+ assert(buf.str() == "testing");
+ }
+ {
+ std::stringbuf buf1("testing", std::ios_base::in);
+ std::stringbuf buf(move(buf1));
+ assert(buf.str() == "testing");
+ }
+ {
+ std::stringbuf buf1("testing", std::ios_base::out);
+ std::stringbuf buf(move(buf1));
+ assert(buf.str() == "testing");
+ }
+ {
+ std::wstringbuf buf1(L"testing");
+ std::wstringbuf buf(move(buf1));
+ assert(buf.str() == L"testing");
+ }
+ {
+ std::wstringbuf buf1(L"testing", std::ios_base::in);
+ std::wstringbuf buf(move(buf1));
+ assert(buf.str() == L"testing");
+ }
+ {
+ std::wstringbuf buf1(L"testing", std::ios_base::out);
+ std::wstringbuf buf(move(buf1));
+ assert(buf.str() == L"testing");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.pass.cpp
new file mode 100644
index 0000000000000..eae1b0b876535
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// explicit basic_stringbuf(const basic_string<charT,traits,Allocator>& s,
+// ios_base::openmode which = ios_base::in | ios_base::out);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf buf("testing");
+ assert(buf.str() == "testing");
+ }
+ {
+ std::stringbuf buf("testing", std::ios_base::in);
+ assert(buf.str() == "testing");
+ }
+ {
+ std::stringbuf buf("testing", std::ios_base::out);
+ assert(buf.str() == "testing");
+ }
+ {
+ std::wstringbuf buf(L"testing");
+ assert(buf.str() == L"testing");
+ }
+ {
+ std::wstringbuf buf(L"testing", std::ios_base::in);
+ assert(buf.str() == L"testing");
+ }
+ {
+ std::wstringbuf buf(L"testing", std::ios_base::out);
+ assert(buf.str() == L"testing");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.members/str.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.members/str.pass.cpp
new file mode 100644
index 0000000000000..712e0edd27b56
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.members/str.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// void str(const basic_string<charT,traits,Allocator>& s);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf buf("testing");
+ assert(buf.str() == "testing");
+ buf.str("another test");
+ assert(buf.str() == "another test");
+ }
+ {
+ std::wstringbuf buf(L"testing");
+ assert(buf.str() == L"testing");
+ buf.str(L"another test");
+ assert(buf.str() == L"another test");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp
new file mode 100644
index 0000000000000..3abf9423a12eb
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// int_type overflow(int_type c = traits::eof());
+
+#include <sstream>
+#include <cassert>
+
+int overflow_called = 0;
+
+template <class CharT>
+struct testbuf
+ : public std::basic_stringbuf<CharT>
+{
+ typedef std::basic_stringbuf<CharT> base;
+ explicit testbuf(const std::basic_string<CharT>& str,
+ std::ios_base::openmode which = std::ios_base::in | std::ios_base::out)
+ : base(str, which) {}
+
+ typename base::int_type
+ overflow(typename base::int_type c = base::type_traits::eof())
+ {++overflow_called; return base::overflow(c);}
+
+ void pbump(int n) {base::pbump(n);}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb("abc");
+ assert(sb.sputc('1') == '1');
+ assert(sb.str() == "1bc");
+ assert(sb.sputc('2') == '2');
+ assert(sb.str() == "12c");
+ assert(sb.sputc('3') == '3');
+ assert(sb.str() == "123");
+ assert(sb.sputc('4') == '4');
+ assert(sb.str() == "1234");
+ assert(sb.sputc('5') == '5');
+ assert(sb.str() == "12345");
+ assert(sb.sputc('6') == '6');
+ assert(sb.str() == "123456");
+ assert(sb.sputc('7') == '7');
+ assert(sb.str() == "1234567");
+ assert(sb.sputc('8') == '8');
+ assert(sb.str() == "12345678");
+ assert(sb.sputc('9') == '9');
+ assert(sb.str() == "123456789");
+ assert(sb.sputc('0') == '0');
+ assert(sb.str() == "1234567890");
+ assert(sb.sputc('1') == '1');
+ assert(sb.str() == "12345678901");
+ }
+ {
+ testbuf<wchar_t> sb(L"abc");
+ assert(sb.sputc(L'1') == L'1');
+ assert(sb.str() == L"1bc");
+ assert(sb.sputc(L'2') == L'2');
+ assert(sb.str() == L"12c");
+ assert(sb.sputc(L'3') == L'3');
+ assert(sb.str() == L"123");
+ assert(sb.sputc(L'4') == L'4');
+ assert(sb.str() == L"1234");
+ assert(sb.sputc(L'5') == L'5');
+ assert(sb.str() == L"12345");
+ assert(sb.sputc(L'6') == L'6');
+ assert(sb.str() == L"123456");
+ assert(sb.sputc(L'7') == L'7');
+ assert(sb.str() == L"1234567");
+ assert(sb.sputc(L'8') == L'8');
+ assert(sb.str() == L"12345678");
+ assert(sb.sputc(L'9') == L'9');
+ assert(sb.str() == L"123456789");
+ assert(sb.sputc(L'0') == L'0');
+ assert(sb.str() == L"1234567890");
+ assert(sb.sputc(L'1') == L'1');
+ assert(sb.str() == L"12345678901");
+ }
+ {
+ testbuf<char> sb("abc", std::ios_base::app | std::ios_base::out);
+ assert(sb.sputc('1') == '1');
+ assert(sb.str() == "abc1");
+ assert(sb.sputc('2') == '2');
+ assert(sb.str() == "abc12");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp
new file mode 100644
index 0000000000000..4af0e63029a7f
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp
@@ -0,0 +1,92 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// int_type pbackfail(int_type c = traits::eof());
+
+#include <sstream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_stringbuf<CharT>
+{
+ typedef std::basic_stringbuf<CharT> base;
+ explicit testbuf(const std::basic_string<CharT>& str,
+ std::ios_base::openmode which = std::ios_base::in | std::ios_base::out)
+ : base(str, which) {}
+
+ typename base::int_type
+ pbackfail(typename base::int_type c = base::type_traits::eof())
+ {return base::pbackfail(c);}
+
+ void pbump(int n) {base::pbump(n);}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb("123", std::ios_base::in);
+ assert(sb.sgetc() == '1');
+ assert(sb.snextc() == '2');
+ assert(sb.snextc() == '3');
+ assert(sb.sgetc() == '3');
+ assert(sb.snextc() == std::char_traits<char>::eof());
+ assert(sb.pbackfail('3') == '3');
+ assert(sb.pbackfail('3') == std::char_traits<char>::eof());
+ assert(sb.pbackfail('2') == '2');
+ assert(sb.pbackfail(std::char_traits<char>::eof()) != std::char_traits<char>::eof());
+ assert(sb.pbackfail(std::char_traits<char>::eof()) == std::char_traits<char>::eof());
+ assert(sb.str() == "123");
+ }
+ {
+ testbuf<char> sb("123");
+ assert(sb.sgetc() == '1');
+ assert(sb.snextc() == '2');
+ assert(sb.snextc() == '3');
+ assert(sb.sgetc() == '3');
+ assert(sb.snextc() == std::char_traits<char>::eof());
+ assert(sb.pbackfail('3') == '3');
+ assert(sb.pbackfail('3') == '3');
+ assert(sb.pbackfail(std::char_traits<char>::eof()) != std::char_traits<char>::eof());
+ assert(sb.pbackfail(std::char_traits<char>::eof()) == std::char_traits<char>::eof());
+ assert(sb.str() == "133");
+ }
+ {
+ testbuf<wchar_t> sb(L"123", std::ios_base::in);
+ assert(sb.sgetc() == L'1');
+ assert(sb.snextc() == L'2');
+ assert(sb.snextc() == L'3');
+ assert(sb.sgetc() == L'3');
+ assert(sb.snextc() == std::char_traits<wchar_t>::eof());
+ assert(sb.pbackfail(L'3') == L'3');
+ assert(sb.pbackfail(L'3') == std::char_traits<wchar_t>::eof());
+ assert(sb.pbackfail(L'2') == L'2');
+ assert(sb.pbackfail(std::char_traits<wchar_t>::eof()) != std::char_traits<wchar_t>::eof());
+ assert(sb.pbackfail(std::char_traits<wchar_t>::eof()) == std::char_traits<wchar_t>::eof());
+ assert(sb.str() == L"123");
+ }
+ {
+ testbuf<wchar_t> sb(L"123");
+ assert(sb.sgetc() == L'1');
+ assert(sb.snextc() == L'2');
+ assert(sb.snextc() == L'3');
+ assert(sb.sgetc() == L'3');
+ assert(sb.snextc() == std::char_traits<wchar_t>::eof());
+ assert(sb.pbackfail(L'3') == L'3');
+ assert(sb.pbackfail(L'3') == L'3');
+ assert(sb.pbackfail(std::char_traits<wchar_t>::eof()) != std::char_traits<wchar_t>::eof());
+ assert(sb.pbackfail(std::char_traits<wchar_t>::eof()) == std::char_traits<wchar_t>::eof());
+ assert(sb.str() == L"133");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp
new file mode 100644
index 0000000000000..6d20db13189ae
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp
@@ -0,0 +1,143 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// pos_type seekoff(off_type off, ios_base::seekdir way,
+// ios_base::openmode which = ios_base::in | ios_base::out);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf sb("0123456789", std::ios_base::in);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == 3);
+ assert(sb.sgetc() == '3');
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == 6);
+ assert(sb.sgetc() == '6');
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == 7);
+ assert(sb.sgetc() == '7');
+ }
+ {
+ std::stringbuf sb("0123456789", std::ios_base::out);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == 3);
+ assert(sb.sputc('a') == 'a');
+ assert(sb.str() == "012a456789");
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == 7);
+ assert(sb.sputc('b') == 'b');
+ assert(sb.str() == "012a456b89");
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == 7);
+ assert(sb.sputc('c') == 'c');
+ assert(sb.str() == "012a456c89");
+ }
+ {
+ std::stringbuf sb("0123456789");
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == 3);
+ assert(sb.sgetc() == '3');
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == 6);
+ assert(sb.sgetc() == '6');
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == 7);
+ assert(sb.sgetc() == '7');
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out | std::ios_base::in) == 3);
+ assert(sb.sgetc() == '3');
+ assert(sb.sputc('a') == 'a');
+ assert(sb.str() == "012a456789");
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out | std::ios_base::in) == 7);
+ assert(sb.sgetc() == '7');
+ assert(sb.sputc('c') == 'c');
+ assert(sb.str() == "012a456c89");
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == 3);
+ assert(sb.sputc('3') == '3');
+ assert(sb.str() == "0123456c89");
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == 7);
+ assert(sb.sputc('7') == '7');
+ assert(sb.str() == "0123456789");
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == 7);
+ assert(sb.sputc('c') == 'c');
+ assert(sb.str() == "0123456c89");
+ }
+ {
+ std::wstringbuf sb(L"0123456789", std::ios_base::in);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == 3);
+ assert(sb.sgetc() == L'3');
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == 6);
+ assert(sb.sgetc() == L'6');
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == 7);
+ assert(sb.sgetc() == L'7');
+ }
+ {
+ std::wstringbuf sb(L"0123456789", std::ios_base::out);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == 3);
+ assert(sb.sputc(L'a') == L'a');
+ assert(sb.str() == L"012a456789");
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == 7);
+ assert(sb.sputc(L'b') == L'b');
+ assert(sb.str() == L"012a456b89");
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == 7);
+ assert(sb.sputc(L'c') == L'c');
+ assert(sb.str() == L"012a456c89");
+ }
+ {
+ std::wstringbuf sb(L"0123456789");
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == 3);
+ assert(sb.sgetc() == L'3');
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == 6);
+ assert(sb.sgetc() == L'6');
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == 7);
+ assert(sb.sgetc() == L'7');
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out | std::ios_base::in) == 3);
+ assert(sb.sgetc() == L'3');
+ assert(sb.sputc(L'a') == L'a');
+ assert(sb.str() == L"012a456789");
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out | std::ios_base::in) == 7);
+ assert(sb.sgetc() == L'7');
+ assert(sb.sputc(L'c') == L'c');
+ assert(sb.str() == L"012a456c89");
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == 3);
+ assert(sb.sputc(L'3') == L'3');
+ assert(sb.str() == L"0123456c89");
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == 7);
+ assert(sb.sputc(L'7') == L'7');
+ assert(sb.str() == L"0123456789");
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == 7);
+ assert(sb.sputc(L'c') == L'c');
+ assert(sb.str() == L"0123456c89");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekpos.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekpos.pass.cpp
new file mode 100644
index 0000000000000..2b809a887a35a
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekpos.pass.cpp
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// pos_type seekpos(pos_type sp,
+// ios_base::openmode which = ios_base::in | ios_base::out);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf sb("0123456789", std::ios_base::in);
+ assert(sb.pubseekpos(3, std::ios_base::out) == -1);
+ assert(sb.pubseekpos(3, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekpos(3, std::ios_base::in) == 3);
+ assert(sb.sgetc() == '3');
+ }
+ {
+ std::stringbuf sb("0123456789", std::ios_base::out);
+ assert(sb.pubseekpos(3, std::ios_base::in) == -1);
+ assert(sb.pubseekpos(3, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekpos(3, std::ios_base::out) == 3);
+ assert(sb.sputc('a') == 'a');
+ assert(sb.str() == "012a456789");
+ }
+ {
+ std::stringbuf sb("0123456789");
+ assert(sb.pubseekpos(3, std::ios_base::in) == 3);
+ assert(sb.sgetc() == '3');
+ assert(sb.pubseekpos(3, std::ios_base::out | std::ios_base::in) == 3);
+ assert(sb.sgetc() == '3');
+ assert(sb.sputc('a') == 'a');
+ assert(sb.str() == "012a456789");
+ assert(sb.pubseekpos(3, std::ios_base::out) == 3);
+ assert(sb.sputc('3') == '3');
+ assert(sb.str() == "0123456789");
+ }
+ {
+ std::wstringbuf sb(L"0123456789", std::ios_base::in);
+ assert(sb.pubseekpos(3, std::ios_base::out) == -1);
+ assert(sb.pubseekpos(3, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekpos(3, std::ios_base::in) == 3);
+ assert(sb.sgetc() == L'3');
+ }
+ {
+ std::wstringbuf sb(L"0123456789", std::ios_base::out);
+ assert(sb.pubseekpos(3, std::ios_base::in) == -1);
+ assert(sb.pubseekpos(3, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekpos(3, std::ios_base::out) == 3);
+ assert(sb.sputc(L'a') == L'a');
+ assert(sb.str() == L"012a456789");
+ }
+ {
+ std::wstringbuf sb(L"0123456789");
+ assert(sb.pubseekpos(3, std::ios_base::in) == 3);
+ assert(sb.sgetc() == L'3');
+ assert(sb.pubseekpos(3, std::ios_base::out | std::ios_base::in) == 3);
+ assert(sb.sgetc() == L'3');
+ assert(sb.sputc(L'a') == L'a');
+ assert(sb.str() == L"012a456789");
+ assert(sb.pubseekpos(3, std::ios_base::out) == 3);
+ assert(sb.sputc(L'3') == L'3');
+ assert(sb.str() == L"0123456789");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/setbuf.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/setbuf.pass.cpp
new file mode 100644
index 0000000000000..7130f5b8646f3
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/setbuf.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// basic_streambuf<charT,traits>* setbuf(charT* s, streamsize n);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf sb("0123456789");
+ assert(sb.pubsetbuf(0, 0) == &sb);
+ assert(sb.str() == "0123456789");
+ }
+ {
+ std::wstringbuf sb(L"0123456789");
+ assert(sb.pubsetbuf(0, 0) == &sb);
+ assert(sb.str() == L"0123456789");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/underflow.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/underflow.pass.cpp
new file mode 100644
index 0000000000000..3641af239d7d4
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/underflow.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// int_type underflow();
+
+#include <sstream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_stringbuf<CharT>
+{
+ typedef std::basic_stringbuf<CharT> base;
+ explicit testbuf(const std::basic_string<CharT>& str)
+ : base(str) {}
+
+ typename base::int_type underflow() {return base::underflow();}
+ void pbump(int n) {base::pbump(n);}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb("123");
+ sb.pbump(3);
+ assert(sb.underflow() == '1');
+ assert(sb.underflow() == '1');
+ assert(sb.snextc() == '2');
+ assert(sb.underflow() == '2');
+ assert(sb.underflow() == '2');
+ assert(sb.snextc() == '3');
+ assert(sb.underflow() == '3');
+ assert(sb.underflow() == '3');
+ assert(sb.snextc() == std::char_traits<char>::eof());
+ assert(sb.underflow() == std::char_traits<char>::eof());
+ assert(sb.underflow() == std::char_traits<char>::eof());
+ sb.sputc('4');
+ assert(sb.underflow() == '4');
+ assert(sb.underflow() == '4');
+ }
+ {
+ testbuf<wchar_t> sb(L"123");
+ sb.pbump(3);
+ assert(sb.underflow() == L'1');
+ assert(sb.underflow() == L'1');
+ assert(sb.snextc() == L'2');
+ assert(sb.underflow() == L'2');
+ assert(sb.underflow() == L'2');
+ assert(sb.snextc() == L'3');
+ assert(sb.underflow() == L'3');
+ assert(sb.underflow() == L'3');
+ assert(sb.snextc() == std::char_traits<wchar_t>::eof());
+ assert(sb.underflow() == std::char_traits<wchar_t>::eof());
+ assert(sb.underflow() == std::char_traits<wchar_t>::eof());
+ sb.sputc(L'4');
+ assert(sb.underflow() == L'4');
+ assert(sb.underflow() == L'4');
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/types.pass.cpp b/test/std/input.output/string.streams/stringbuf/types.pass.cpp
new file mode 100644
index 0000000000000..067a3a29e0f93
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/types.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+// : public basic_streambuf<charT, traits>
+// {
+// public:
+// typedef charT char_type;
+// typedef traits traits_type;
+// typedef typename traits_type::int_type int_type;
+// typedef typename traits_type::pos_type pos_type;
+// typedef typename traits_type::off_type off_type;
+// typedef Allocator allocator_type;
+
+#include <sstream>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_base_of<std::basic_streambuf<char>, std::basic_stringbuf<char> >::value), "");
+ static_assert((std::is_same<std::basic_stringbuf<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::basic_stringbuf<char>::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_stringbuf<char>::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::basic_stringbuf<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::basic_stringbuf<char>::off_type, std::char_traits<char>::off_type>::value), "");
+ static_assert((std::is_same<std::basic_stringbuf<char>::allocator_type, std::allocator<char> >::value), "");
+}
diff --git a/test/std/input.output/string.streams/stringstream.cons/default.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/default.pass.cpp
new file mode 100644
index 0000000000000..b8905ade34085
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream.cons/default.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// explicit basic_stringstream(ios_base::openmode which = ios_base::out|ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringstream ss;
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == "");
+ }
+ {
+ std::stringstream ss(std::ios_base::in);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == "");
+ }
+ {
+ std::wstringstream ss;
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L"");
+ }
+ {
+ std::wstringstream ss(std::ios_base::in);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L"");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp
new file mode 100644
index 0000000000000..4ae3aa6e84dbc
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// basic_stringstream(basic_stringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ std::stringstream ss0(" 123 456 ");
+ std::stringstream ss(std::move(ss0));
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == "456 1236 ");
+ }
+ {
+ std::wstringstream ss0(L" 123 456 ");
+ std::wstringstream ss(std::move(ss0));
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == L"456 1236 ");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp
new file mode 100644
index 0000000000000..856cf3cbeafd9
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// basic_stringstream(basic_stringstream&& rhs);
+
+#include <sstream>
+#include <vector>
+#include <string>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ std::vector<std::istringstream> vecis;
+ vecis.push_back(std::istringstream());
+ vecis.back().str("hub started at [00 6b 8b 45 69]");
+ vecis.push_back(std::istringstream());
+ vecis.back().str("hub started at [00 6b 8b 45 69]");
+ for (int n = 0; n < vecis.size(); n++)
+ {
+ assert(vecis[n].str().size() == 31);
+ vecis[n].seekg(0, std::ios_base::beg);
+ assert(vecis[n].str().size() == 31);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp
new file mode 100644
index 0000000000000..3776f17f5304c
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// explicit basic_stringstream(const basic_string<charT,traits,Allocator>& str,
+// ios_base::openmode which = ios_base::out|ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringstream ss(" 123 456 ");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == "456 1236 ");
+ }
+ {
+ std::wstringstream ss(L" 123 456 ");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == L"456 1236 ");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/member_swap.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/member_swap.pass.cpp
new file mode 100644
index 0000000000000..95599dd254e96
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/member_swap.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// void swap(basic_stringstream& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringstream ss0(" 123 456 ");
+ std::stringstream ss;
+ ss.swap(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == "456 1236 ");
+ ss0 << i << ' ' << 123;
+ assert(ss0.str() == "456 123");
+ }
+ {
+ std::wstringstream ss0(L" 123 456 ");
+ std::wstringstream ss;
+ ss.swap(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == L"456 1236 ");
+ ss0 << i << ' ' << 123;
+ assert(ss0.str() == L"456 123");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp
new file mode 100644
index 0000000000000..ccaf72d7e5507
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// basic_stringstream& operator=(basic_stringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ std::stringstream ss0(" 123 456 ");
+ std::stringstream ss;
+ ss = std::move(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == "456 1236 ");
+ }
+ {
+ std::wstringstream ss0(L" 123 456 ");
+ std::wstringstream ss;
+ ss = std::move(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == L"456 1236 ");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/nonmember_swap.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/nonmember_swap.pass.cpp
new file mode 100644
index 0000000000000..3ec11cd9e307c
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/nonmember_swap.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// template <class charT, class traits, class Allocator>
+// void
+// swap(basic_stringstream<charT, traits, Allocator>& x,
+// basic_stringstream<charT, traits, Allocator>& y);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringstream ss0(" 123 456 ");
+ std::stringstream ss;
+ swap(ss, ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == "456 1236 ");
+ ss0 << i << ' ' << 123;
+ assert(ss0.str() == "456 123");
+ }
+ {
+ std::wstringstream ss0(L" 123 456 ");
+ std::wstringstream ss;
+ swap(ss, ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == L"456 1236 ");
+ ss0 << i << ' ' << 123;
+ assert(ss0.str() == L"456 123");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringstream.members/str.pass.cpp b/test/std/input.output/string.streams/stringstream.members/str.pass.cpp
new file mode 100644
index 0000000000000..155a262e19f9f
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream.members/str.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// void str(const basic_string<charT,traits,Allocator>& str);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringstream ss(" 123 456 ");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == "456 1236 ");
+ ss.str("5466 89 ");
+ ss >> i;
+ assert(i == 5466);
+ ss >> i;
+ assert(i == 89);
+ ss << i << ' ' << 321;
+ assert(ss.str() == "89 3219 ");
+ }
+ {
+ std::wstringstream ss(L" 123 456 ");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == L"456 1236 ");
+ ss.str(L"5466 89 ");
+ ss >> i;
+ assert(i == 5466);
+ ss >> i;
+ assert(i == 89);
+ ss << i << ' ' << 321;
+ assert(ss.str() == L"89 3219 ");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringstream/types.pass.cpp b/test/std/input.output/string.streams/stringstream/types.pass.cpp
new file mode 100644
index 0000000000000..a89daa144e9af
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream/types.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+// : public basic_iostream<charT, traits>
+// {
+// public:
+// typedef charT char_type;
+// typedef traits traits_type;
+// typedef typename traits_type::int_type int_type;
+// typedef typename traits_type::pos_type pos_type;
+// typedef typename traits_type::off_type off_type;
+// typedef Allocator allocator_type;
+
+#include <sstream>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_base_of<std::basic_iostream<char>, std::basic_stringstream<char> >::value), "");
+ static_assert((std::is_same<std::basic_stringstream<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::basic_stringstream<char>::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_stringstream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::basic_stringstream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::basic_stringstream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+ static_assert((std::is_same<std::basic_stringstream<char>::allocator_type, std::allocator<char> >::value), "");
+}
diff --git a/test/std/input.output/string.streams/version.pass.cpp b/test/std/input.output/string.streams/version.pass.cpp
new file mode 100644
index 0000000000000..103897106d37c
--- /dev/null
+++ b/test/std/input.output/string.streams/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+#include <sstream>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}