summaryrefslogtreecommitdiff
path: root/test/std/input.output/iostream.format/std.manip
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/input.output/iostream.format/std.manip')
-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
7 files changed, 340 insertions, 0 deletions
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()
+{
+}