diff options
Diffstat (limited to 'libcxx/test/std/input.output/iostreams.base/ios.base')
26 files changed, 1018 insertions, 0 deletions
diff --git a/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags.pass.cpp new file mode 100644 index 00000000000..958fcb53d89 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags_fmtflags.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags_fmtflags.pass.cpp new file mode 100644 index 00000000000..36b5794983e --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision.pass.cpp new file mode 100644 index 00000000000..701e3de360d --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision_streamsize.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision_streamsize.pass.cpp new file mode 100644 index 00000000000..e0d6484c8fd --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags.pass.cpp new file mode 100644 index 00000000000..d9ec47b7907 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags_mask.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags_mask.pass.cpp new file mode 100644 index 00000000000..b201377027d --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/unsetf_mask.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/unsetf_mask.pass.cpp new file mode 100644 index 00000000000..163fc54a1e8 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width.pass.cpp new file mode 100644 index 00000000000..287c89d296e --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width_streamsize.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width_streamsize.pass.cpp new file mode 100644 index 00000000000..6e532deddf0 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/ios.base.callback/register_callback.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.base.callback/register_callback.pass.cpp new file mode 100644 index 00000000000..c0ed3150457 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/ios.base.cons/dtor.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.base.cons/dtor.pass.cpp new file mode 100644 index 00000000000..e6f334808c1 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/ios.base.locales/getloc.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.base.locales/getloc.pass.cpp new file mode 100644 index 00000000000..8f265bc6988 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/ios.base.locales/imbue.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.base.locales/imbue.pass.cpp new file mode 100644 index 00000000000..4e34c08ab08 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/ios.base.storage/iword.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.base.storage/iword.pass.cpp new file mode 100644 index 00000000000..1e2ee50632a --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/ios.base.storage/pword.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.base.storage/pword.pass.cpp new file mode 100644 index 00000000000..5246ad8f644 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/ios.base.storage/xalloc.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.base.storage/xalloc.pass.cpp new file mode 100644 index 00000000000..eb737b1a7dc --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/ios.members.static/sync_with_stdio.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.members.static/sync_with_stdio.pass.cpp new file mode 100644 index 00000000000..5dc72b1edc0 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_Init/tested_elsewhere.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_Init/tested_elsewhere.pass.cpp new file mode 100644 index 00000000000..b58f5c55b64 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp new file mode 100644 index 00000000000..50f5fdad744 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp new file mode 100644 index 00000000000..5c9abbe5379 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_fmtflags/fmtflags.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_fmtflags/fmtflags.pass.cpp new file mode 100644 index 00000000000..9f374598ff7 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_iostate/iostate.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_iostate/iostate.pass.cpp new file mode 100644 index 00000000000..55c02f38ce9 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_openmode/openmode.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_openmode/openmode.pass.cpp new file mode 100644 index 00000000000..238593feb30 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_seekdir/seekdir.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_seekdir/seekdir.pass.cpp new file mode 100644 index 00000000000..005fb61cc31 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/nothing_to_do.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/nothing_to_do.pass.cpp new file mode 100644 index 00000000000..b58f5c55b64 --- /dev/null +++ b/libcxx/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/libcxx/test/std/input.output/iostreams.base/ios.base/nothing_to_do.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/nothing_to_do.pass.cpp new file mode 100644 index 00000000000..760bfcb26d2 --- /dev/null +++ b/libcxx/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() +{ +} |