summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/io
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/io
parentInitial commit. (diff)
downloadceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz
ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/io')
-rw-r--r--src/boost/libs/io/CMakeLists.txt15
-rw-r--r--src/boost/libs/io/README.md9
-rw-r--r--src/boost/libs/io/index.html17
-rw-r--r--src/boost/libs/io/meta/libraries.json17
-rw-r--r--src/boost/libs/io/test/Jamfile19
-rw-r--r--src/boost/libs/io/test/ios_state_test.cpp171
-rw-r--r--src/boost/libs/io/test/ios_state_unit_test.cpp461
-rw-r--r--src/boost/libs/io/test/make_ostream_joiner_test.cpp21
-rw-r--r--src/boost/libs/io/test/ostream_joiner_test.cpp117
-rw-r--r--src/boost/libs/io/test/ostream_put_test.cpp136
-rw-r--r--src/boost/libs/io/test/quoted_fill_test.cpp136
-rw-r--r--src/boost/libs/io/test/quoted_test.cpp110
12 files changed, 1229 insertions, 0 deletions
diff --git a/src/boost/libs/io/CMakeLists.txt b/src/boost/libs/io/CMakeLists.txt
new file mode 100644
index 000000000..c9c1dd040
--- /dev/null
+++ b/src/boost/libs/io/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright 2018 Mike Dev
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (http://www.boost.org/LICENSE_1_0.txt)
+
+cmake_minimum_required(VERSION 3.5)
+
+project(BoostIO LANGUAGES CXX)
+
+add_library(boost_io INTERFACE)
+add_library(Boost::io ALIAS boost_io)
+
+target_include_directories(boost_io INTERFACE include)
+
+target_link_libraries(boost_io INTERFACE Boost::config)
diff --git a/src/boost/libs/io/README.md b/src/boost/libs/io/README.md
new file mode 100644
index 000000000..e0ffd1dcf
--- /dev/null
+++ b/src/boost/libs/io/README.md
@@ -0,0 +1,9 @@
+# Boost.IO
+
+The Boost IO C++ library provides utilities for dealing with the C++ standard
+library IO streams.
+
+### License
+
+Distributed under the
+[Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
diff --git a/src/boost/libs/io/index.html b/src/boost/libs/io/index.html
new file mode 100644
index 000000000..991630065
--- /dev/null
+++ b/src/boost/libs/io/index.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<!--
+Copyright Beman Dawes, 2001
+
+Distributed under the Boost Software License, Version 1.0.
+(http://www.boost.org/LICENSE_1_0.txt)
+-->
+<html>
+<head>
+<meta charset="utf-8">
+<meta http-equiv="refresh" content="0; url=doc/html/io.html">
+<title>IO</title>
+</head>
+<body>
+Redirecting you to <a href="doc/html/io.html">IO</a>.
+</body>
+</html>
diff --git a/src/boost/libs/io/meta/libraries.json b/src/boost/libs/io/meta/libraries.json
new file mode 100644
index 000000000..280c7086b
--- /dev/null
+++ b/src/boost/libs/io/meta/libraries.json
@@ -0,0 +1,17 @@
+{
+ "key": "io",
+ "name": "IO",
+ "authors": [
+ "Daryle Walker",
+ "Beman Dawes",
+ "Glen Fernandes"
+ ],
+ "description": "Utilities for the standard I/O library.",
+ "documentation": "doc/html/io.html",
+ "category": [
+ "IO"
+ ],
+ "maintainers": [
+ "Glen Fernandes <glenjofe -at- gmail.com>"
+ ]
+}
diff --git a/src/boost/libs/io/test/Jamfile b/src/boost/libs/io/test/Jamfile
new file mode 100644
index 000000000..3c5141b63
--- /dev/null
+++ b/src/boost/libs/io/test/Jamfile
@@ -0,0 +1,19 @@
+# Copyright 2003 Daryle Walker
+#
+# Copyright 2019 Glen Joseph Fernandes
+# (glenjofe@gmail.com)
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (http://www.boost.org/LICENSE_1_0.txt)
+
+import testing ;
+
+project : requirements <warnings>pedantic <warnings-as-errors>on ;
+
+run ios_state_unit_test.cpp ;
+run ios_state_test.cpp ;
+run quoted_test.cpp ;
+run quoted_fill_test.cpp ;
+run ostream_joiner_test.cpp ;
+run make_ostream_joiner_test.cpp ;
+run ostream_put_test.cpp ;
diff --git a/src/boost/libs/io/test/ios_state_test.cpp b/src/boost/libs/io/test/ios_state_test.cpp
new file mode 100644
index 000000000..675085cb7
--- /dev/null
+++ b/src/boost/libs/io/test/ios_state_test.cpp
@@ -0,0 +1,171 @@
+/*
+Copyright 2002, 2003 Daryle Walker
+
+Copyright 2019 Glen Joseph Fernandes
+(glenjofe@gmail.com)
+
+Distributed under the Boost Software License, Version 1.0.
+(http://www.boost.org/LICENSE_1_0.txt)
+*/
+#include <boost/io/ios_state.hpp>
+#include <boost/core/lightweight_test.hpp>
+#include <boost/config.hpp>
+#include <iomanip>
+#include <ios>
+#include <istream>
+#include <locale>
+#include <ostream>
+#include <sstream>
+#if defined(BOOST_GCC) || (defined(BOOST_CLANG) && defined(BOOST_GNU_STDLIB))
+#include <stdexcept>
+#endif
+#include <streambuf>
+#include <string>
+#include <cstddef>
+
+class backward_bool_names
+ : public std::numpunct<char> {
+ typedef std::numpunct<char> base_type;
+
+public:
+ explicit backward_bool_names(std::size_t refs = 0)
+ : base_type( refs ) { }
+
+protected:
+ ~backward_bool_names() { }
+
+ base_type::string_type do_truename() const {
+ return "eurt";
+ }
+
+ base_type::string_type do_falsename() const {
+ return "eslaf";
+ }
+};
+
+void saver_tests_1(int index,
+ std::istream& input,
+ std::ostream& output,
+ std::ostream& err)
+{
+ boost::io::ios_flags_saver ifls(output);
+ boost::io::ios_precision_saver iprs(output);
+ boost::io::ios_width_saver iws(output);
+ boost::io::ios_tie_saver its(input);
+ boost::io::ios_rdbuf_saver irs(output);
+ boost::io::ios_fill_saver ifis(output);
+ boost::io::ios_locale_saver ils(output);
+ boost::io::ios_iword_saver iis(output, index);
+ boost::io::ios_pword_saver ipws(output, index);
+ std::locale loc(std::locale::classic(), new backward_bool_names);
+ input.tie(&err);
+ output.rdbuf(err.rdbuf());
+ output.iword(index) = 69L;
+ output.pword(index) = &err;
+ output.setf(std::ios_base::showpos | std::ios_base::boolalpha);
+ output.setf(std::ios_base::internal, std::ios_base::adjustfield);
+ output.fill('@');
+ output.precision( 9 );
+ output << "Hello world";
+ output << std::setw(10) << -16;
+ output << std::setw(15) << 34.5678901234;
+ output.imbue(loc);
+ output << true;
+ BOOST_TEST(&err == output.pword(index));
+ BOOST_TEST(69L == output.iword(index));
+ try {
+ boost::io::ios_exception_saver ies(output);
+ boost::io::ios_iostate_saver ias(output);
+ output.exceptions(std::ios_base::eofbit | std::ios_base::badbit);
+ output.setstate(std::ios_base::eofbit);
+ BOOST_ERROR("previous line should have thrown");
+#if defined(BOOST_GCC) || (defined(BOOST_CLANG) && defined(BOOST_GNU_STDLIB))
+ } catch (std::exception&) {
+#else
+ } catch (std::ios_base::failure&) {
+#endif
+ BOOST_TEST(output.exceptions() == std::ios_base::goodbit );
+ }
+}
+
+void saver_tests_2(int index,
+ std::istream& input,
+ std::ostream& output,
+ std::ostream& err)
+{
+ boost::io::ios_tie_saver its(input, &err);
+ boost::io::ios_rdbuf_saver irs(output, err.rdbuf());
+ boost::io::ios_iword_saver iis(output, index, 69L);
+ boost::io::ios_pword_saver ipws(output, index, &err);
+ boost::io::ios_flags_saver ifls(output,
+ (output.flags() & ~std::ios_base::adjustfield) |
+ std::ios_base::showpos |
+ std::ios_base::boolalpha |
+ (std::ios_base::internal & std::ios_base::adjustfield));
+ boost::io::ios_precision_saver iprs(output, 9);
+ boost::io::ios_fill_saver ifis(output, '@');
+ output << "Hello world";
+ boost::io::ios_width_saver iws(output, 12);
+ output << -16 + 34.5678901234;
+ std::locale loc(std::locale::classic(), new backward_bool_names);
+ boost::io::ios_locale_saver ils(output, loc);
+ output << true;
+ BOOST_TEST(&err == output.pword(index));
+ BOOST_TEST(69L == output.iword(index));
+ try {
+ boost::io::ios_exception_saver ies(output, std::ios_base::eofbit);
+ boost::io::ios_iostate_saver ias(output,
+ output.rdstate() | std::ios_base::eofbit );
+ BOOST_ERROR("previous line should have thrown");
+#if defined(BOOST_GCC) || (defined(BOOST_CLANG) && defined(BOOST_GNU_STDLIB))
+ } catch (std::exception&) {
+#else
+ } catch (std::ios_base::failure&) {
+#endif
+ BOOST_TEST(output.exceptions() == std::ios_base::goodbit);
+ }
+}
+
+int main()
+{
+ int index = std::ios_base::xalloc();
+ std::ostringstream out;
+ std::ostringstream err;
+ std::istringstream in;
+ std::ios_base::fmtflags out_flags = out.flags();
+ std::streamsize out_precision = out.precision();
+ std::streamsize out_width = out.width();
+ std::ios_base::iostate out_iostate = out.rdstate();
+ std::ios_base::iostate out_exceptions = out.exceptions();
+ std::ostream* in_tie = in.tie();
+ std::streambuf* out_sb = out.rdbuf();
+ char out_fill = out.fill();
+ std::locale out_locale = out.getloc();
+ out.iword(index) = 42L;
+ out.pword(index) = &in;
+ saver_tests_1(index, in, out, err);
+ BOOST_TEST(&in == out.pword(index));
+ BOOST_TEST(42L == out.iword(index));
+ BOOST_TEST(out_locale == out.getloc());
+ BOOST_TEST(out_fill == out.fill());
+ BOOST_TEST(out_sb == out.rdbuf());
+ BOOST_TEST(in_tie == in.tie());
+ BOOST_TEST(out_exceptions == out.exceptions());
+ BOOST_TEST(out_iostate == out.rdstate());
+ BOOST_TEST(out_width == out.width());
+ BOOST_TEST(out_precision == out.precision());
+ BOOST_TEST(out_flags == out.flags());
+ saver_tests_2(index, in, out, err);
+ BOOST_TEST(&in == out.pword(index));
+ BOOST_TEST(42L == out.iword(index));
+ BOOST_TEST(out_locale == out.getloc());
+ BOOST_TEST(out_fill == out.fill());
+ BOOST_TEST(out_sb == out.rdbuf());
+ BOOST_TEST(in_tie == in.tie());
+ BOOST_TEST(out_exceptions == out.exceptions());
+ BOOST_TEST(out_iostate == out.rdstate());
+ BOOST_TEST(out_width == out.width());
+ BOOST_TEST(out_precision == out.precision());
+ BOOST_TEST(out_flags == out.flags());
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/io/test/ios_state_unit_test.cpp b/src/boost/libs/io/test/ios_state_unit_test.cpp
new file mode 100644
index 000000000..d46ffab54
--- /dev/null
+++ b/src/boost/libs/io/test/ios_state_unit_test.cpp
@@ -0,0 +1,461 @@
+/*
+Copyright 2003 Daryle Walker
+
+Copyright 2019 Glen Joseph Fernandes
+(glenjofe@gmail.com)
+
+Distributed under the Boost Software License, Version 1.0.
+(http://www.boost.org/LICENSE_1_0.txt)
+*/
+#include <boost/io/ios_state.hpp>
+#include <boost/core/lightweight_test.hpp>
+#include <boost/config.hpp>
+#include <iomanip>
+#include <ios>
+#include <iostream>
+#include <istream>
+#include <locale>
+#if defined(BOOST_GCC) || (defined(BOOST_CLANG) && defined(BOOST_GNU_STDLIB))
+#include <stdexcept>
+#endif
+#include <sstream>
+#include <cstddef>
+
+class backward_bool_names
+ : public std::numpunct<char> {
+ typedef std::numpunct<char> base_type;
+
+public:
+ explicit backward_bool_names(std::size_t refs = 0)
+ : base_type(refs) { }
+
+protected:
+ ~backward_bool_names() { }
+
+ base_type::string_type do_truename() const {
+ return "eurt";
+ }
+
+ base_type::string_type do_falsename() const {
+ return "eslaf";
+ }
+};
+
+void
+ios_flags_saver_unit_test()
+{
+ std::stringstream ss;
+ BOOST_TEST_EQ(std::ios_base::skipws | std::ios_base::dec, ss.flags());
+ {
+ boost::io::ios_flags_saver ifs(ss);
+ BOOST_TEST_EQ(std::ios_base::skipws | std::ios_base::dec, ss.flags());
+ ss << std::noskipws << std::fixed << std::boolalpha;
+ BOOST_TEST_EQ(std::ios_base::boolalpha |
+ std::ios_base::dec |
+ std::ios_base::fixed, ss.flags());
+ }
+ BOOST_TEST_EQ(std::ios_base::skipws | std::ios_base::dec, ss.flags());
+ {
+ boost::io::ios_flags_saver ifs(ss,
+ std::ios_base::showbase | std::ios_base::internal);
+ BOOST_TEST_EQ(std::ios_base::showbase |
+ std::ios_base::internal, ss.flags());
+ ss << std::setiosflags(std::ios_base::unitbuf);
+ BOOST_TEST_EQ(std::ios_base::showbase |
+ std::ios_base::internal |
+ std::ios_base::unitbuf, ss.flags());
+ }
+ BOOST_TEST_EQ(std::ios_base::skipws | std::ios_base::dec, ss.flags());
+}
+
+void
+ios_precision_saver_unit_test()
+{
+ std::stringstream ss;
+ BOOST_TEST_EQ(6, ss.precision());
+ {
+ boost::io::ios_precision_saver ips(ss);
+ BOOST_TEST_EQ(6, ss.precision());
+ ss << std::setprecision(4);
+ BOOST_TEST_EQ(4, ss.precision());
+ }
+ BOOST_TEST_EQ(6, ss.precision());
+ {
+ boost::io::ios_precision_saver ips(ss, 8);
+ BOOST_TEST_EQ(8, ss.precision());
+ ss << std::setprecision(10);
+ BOOST_TEST_EQ(10, ss.precision());
+ }
+ BOOST_TEST_EQ(6, ss.precision());
+}
+
+void
+ios_width_saver_unit_test()
+{
+ std::stringstream ss;
+ BOOST_TEST_EQ(0, ss.width());
+ {
+ boost::io::ios_width_saver iws(ss);
+ BOOST_TEST_EQ(0, ss.width());
+ ss << std::setw(4);
+ BOOST_TEST_EQ(4, ss.width());
+ }
+ BOOST_TEST_EQ(0, ss.width());
+ {
+ boost::io::ios_width_saver iws(ss, 8);
+ BOOST_TEST_EQ(8, ss.width());
+ ss << std::setw(10);
+ BOOST_TEST_EQ(10, ss.width());
+ }
+ BOOST_TEST_EQ(0, ss.width());
+}
+
+void
+ios_iostate_saver_unit_test()
+{
+ std::stringstream ss;
+ BOOST_TEST_EQ(std::ios_base::goodbit, ss.rdstate());
+ BOOST_TEST(ss.good());
+ {
+ boost::io::ios_iostate_saver iis(ss);
+ char c;
+ BOOST_TEST_EQ(std::ios_base::goodbit, ss.rdstate());
+ BOOST_TEST(ss.good());
+ ss >> c;
+ BOOST_TEST_EQ(std::ios_base::eofbit | std::ios_base::failbit,
+ ss.rdstate());
+ BOOST_TEST(ss.eof());
+ BOOST_TEST(ss.fail());
+ BOOST_TEST(!ss.bad());
+ }
+ BOOST_TEST_EQ(std::ios_base::goodbit, ss.rdstate());
+ BOOST_TEST(ss.good());
+ {
+ boost::io::ios_iostate_saver iis(ss, std::ios_base::eofbit);
+ BOOST_TEST_EQ(std::ios_base::eofbit, ss.rdstate());
+ BOOST_TEST(ss.eof());
+ ss.setstate(std::ios_base::badbit);
+ BOOST_TEST_EQ(std::ios_base::eofbit | std::ios_base::badbit,
+ ss.rdstate());
+ BOOST_TEST(ss.eof());
+ BOOST_TEST(ss.fail());
+ BOOST_TEST(ss.bad());
+ }
+ BOOST_TEST_EQ(std::ios_base::goodbit, ss.rdstate());
+ BOOST_TEST(ss.good());
+}
+
+void
+ios_exception_saver_unit_test()
+{
+ std::stringstream ss;
+ BOOST_TEST_EQ(std::ios_base::goodbit, ss.exceptions());
+ {
+ boost::io::ios_exception_saver ies(ss);
+ BOOST_TEST_EQ(std::ios_base::goodbit, ss.exceptions());
+ ss.exceptions(std::ios_base::failbit);
+ BOOST_TEST_EQ(std::ios_base::failbit, ss.exceptions());
+ {
+ boost::io::ios_iostate_saver iis(ss);
+ ss.exceptions(std::ios_base::failbit | std::ios_base::badbit);
+ char c;
+#if defined(BOOST_GCC) || (defined(BOOST_CLANG) && defined(BOOST_GNU_STDLIB))
+ BOOST_TEST_THROWS(ss >> c, std::exception);
+#else
+ BOOST_TEST_THROWS(ss >> c, std::ios_base::failure);
+#endif
+ }
+ }
+ BOOST_TEST_EQ(std::ios_base::goodbit, ss.exceptions());
+ {
+ boost::io::ios_exception_saver ies(ss, std::ios_base::eofbit);
+ BOOST_TEST_EQ(std::ios_base::eofbit, ss.exceptions());
+ ss.exceptions(std::ios_base::badbit);
+ BOOST_TEST_EQ(std::ios_base::badbit, ss.exceptions());
+ {
+ boost::io::ios_iostate_saver iis(ss);
+ char c;
+ BOOST_TEST_NOT(ss >> c);
+ }
+ }
+ BOOST_TEST_EQ(std::ios_base::goodbit, ss.exceptions());
+}
+
+void
+ios_tie_saver_unit_test()
+{
+ BOOST_TEST(NULL == std::cout.tie());
+ {
+ boost::io::ios_tie_saver its(std::cout);
+ BOOST_TEST(NULL == std::cout.tie());
+ std::cout.tie(&std::clog);
+ BOOST_TEST_EQ(&std::clog, std::cout.tie());
+ }
+ BOOST_TEST(NULL == std::cout.tie());
+ {
+ boost::io::ios_tie_saver its(std::cout, &std::clog);
+ BOOST_TEST_EQ(&std::clog, std::cout.tie());
+ std::cout.tie(&std::cerr);
+ BOOST_TEST_EQ(&std::cerr, std::cout.tie());
+ }
+ BOOST_TEST(NULL == std::cout.tie());
+}
+
+void
+ios_rdbuf_saver_unit_test()
+{
+ std::iostream s(NULL);
+ BOOST_TEST(NULL == s.rdbuf());
+ {
+ std::stringbuf sb;
+ boost::io::ios_rdbuf_saver irs(s);
+ BOOST_TEST(NULL == s.rdbuf());
+ s.rdbuf(&sb);
+ BOOST_TEST_EQ(&sb, s.rdbuf());
+ }
+ BOOST_TEST(NULL == s.rdbuf());
+ {
+ std::stringbuf sb1, sb2("Hi there");
+ boost::io::ios_rdbuf_saver irs(s, &sb1);
+ BOOST_TEST_EQ(&sb1, s.rdbuf());
+ s.rdbuf(&sb2);
+ BOOST_TEST_EQ(&sb2, s.rdbuf());
+ }
+ BOOST_TEST(NULL == s.rdbuf());
+}
+
+void
+ios_fill_saver_unit_test()
+{
+ std::stringstream ss;
+ BOOST_TEST_EQ(' ', ss.fill());
+ {
+ boost::io::ios_fill_saver ifs(ss);
+ BOOST_TEST_EQ(' ', ss.fill());
+ ss.fill('x');
+ BOOST_TEST_EQ('x', ss.fill());
+ }
+ BOOST_TEST_EQ(' ', ss.fill());
+ {
+ boost::io::ios_fill_saver ifs(ss, '3');
+ BOOST_TEST_EQ('3', ss.fill());
+ ss.fill('+');
+ BOOST_TEST_EQ('+', ss.fill());
+ }
+ BOOST_TEST_EQ(' ', ss.fill());
+}
+
+void
+ios_locale_saver_unit_test()
+{
+ typedef std::numpunct<char> npc_type;
+ std::stringstream ss;
+ BOOST_TEST(std::locale() == ss.getloc());
+ BOOST_TEST(!std::has_facet<npc_type>(ss.getloc()) ||
+ !dynamic_cast<const backward_bool_names*>(&
+ std::use_facet<npc_type>(ss.getloc())));
+ {
+ boost::io::ios_locale_saver ils(ss);
+ BOOST_TEST(std::locale() == ss.getloc());
+ ss.imbue(std::locale::classic());
+ BOOST_TEST(std::locale::classic() == ss.getloc());
+ }
+ BOOST_TEST(std::locale() == ss.getloc());
+ BOOST_TEST(!std::has_facet<npc_type>(ss.getloc()) ||
+ !dynamic_cast<const backward_bool_names*>(&
+ std::use_facet<npc_type>(ss.getloc())));
+ {
+ boost::io::ios_locale_saver ils(ss, std::locale::classic());
+ BOOST_TEST(std::locale::classic() == ss.getloc());
+ BOOST_TEST(!std::has_facet<npc_type>(ss.getloc()) ||
+ !dynamic_cast<const backward_bool_names*>(&
+ std::use_facet<npc_type>(ss.getloc())));
+ ss.imbue(std::locale(std::locale::classic(), new backward_bool_names));
+ BOOST_TEST(std::locale::classic() != ss.getloc());
+ BOOST_TEST(std::has_facet<npc_type>(ss.getloc()) &&
+ dynamic_cast<const backward_bool_names*>(&
+ std::use_facet<npc_type>(ss.getloc())));
+ }
+ BOOST_TEST(std::locale() == ss.getloc());
+ BOOST_TEST(!std::has_facet<npc_type>(ss.getloc()) ||
+ !dynamic_cast<const backward_bool_names*>(&
+ std::use_facet<npc_type>(ss.getloc())));
+}
+
+void
+ios_iword_saver_unit_test(int index)
+{
+ std::stringstream ss;
+ BOOST_TEST_EQ(0, ss.iword(index));
+ {
+ boost::io::ios_iword_saver iis(ss, index);
+ BOOST_TEST_EQ(0, ss.iword(index));
+ ss.iword(index) = 6;
+ BOOST_TEST_EQ(6, ss.iword(index));
+ }
+ BOOST_TEST_EQ(0, ss.iword(index));
+ {
+ boost::io::ios_iword_saver iis(ss, index, 100);
+ BOOST_TEST_EQ(100, ss.iword(index));
+ ss.iword(index) = -2000;
+ BOOST_TEST_EQ(-2000, ss.iword(index));
+ }
+ BOOST_TEST_EQ(0, ss.iword(index));
+}
+
+void
+ios_pword_saver_unit_test(int index)
+{
+ std::stringstream ss;
+ BOOST_TEST(NULL == ss.pword(index));
+ {
+ boost::io::ios_pword_saver ips(ss, index);
+ BOOST_TEST(NULL == ss.pword(index));
+ ss.pword(index) = &ss;
+ BOOST_TEST_EQ(&ss, ss.pword(index));
+ }
+ BOOST_TEST(NULL == ss.pword(index));
+ {
+ boost::io::ios_pword_saver ips(ss, index, ss.rdbuf());
+ BOOST_TEST_EQ(ss.rdbuf(), ss.pword(index));
+ ss.pword(index) = &ss;
+ BOOST_TEST_EQ(&ss, ss.pword(index));
+ }
+ BOOST_TEST(NULL == ss.pword(index));
+}
+
+void
+ios_base_all_saver_unit_test()
+{
+ std::stringstream ss;
+ BOOST_TEST_EQ(std::ios_base::skipws | std::ios_base::dec, ss.flags());
+ BOOST_TEST_EQ(6, ss.precision());
+ BOOST_TEST_EQ(0, ss.width());
+ {
+ boost::io::ios_base_all_saver ibas(ss);
+ BOOST_TEST_EQ(std::ios_base::skipws | std::ios_base::dec, ss.flags());
+ BOOST_TEST_EQ(6, ss.precision());
+ BOOST_TEST_EQ(0, ss.width());
+ ss << std::hex << std::unitbuf << std::setprecision(5) << std::setw(7);
+ BOOST_TEST_EQ(std::ios_base::unitbuf |
+ std::ios_base::hex |
+ std::ios_base::skipws, ss.flags());
+ BOOST_TEST_EQ(5, ss.precision());
+ BOOST_TEST_EQ(7, ss.width());
+ }
+ BOOST_TEST_EQ(std::ios_base::skipws | std::ios_base::dec, ss.flags());
+ BOOST_TEST_EQ(6, ss.precision());
+ BOOST_TEST_EQ(0, ss.width());
+}
+
+void
+ios_all_saver_unit_test()
+{
+ typedef std::numpunct<char> npc_type;
+ std::stringbuf sb;
+ std::iostream ss(&sb);
+ BOOST_TEST_EQ(std::ios_base::skipws | std::ios_base::dec, ss.flags());
+ BOOST_TEST_EQ(6, ss.precision());
+ BOOST_TEST_EQ(0, ss.width());
+ BOOST_TEST_EQ(std::ios_base::goodbit, ss.rdstate());
+ BOOST_TEST(ss.good());
+ BOOST_TEST_EQ(std::ios_base::goodbit, ss.exceptions());
+ BOOST_TEST(NULL == ss.tie());
+ BOOST_TEST(&sb == ss.rdbuf());
+ BOOST_TEST_EQ(' ', ss.fill());
+ BOOST_TEST(std::locale() == ss.getloc());
+ {
+ boost::io::ios_all_saver ias(ss);
+ BOOST_TEST_EQ(std::ios_base::skipws | std::ios_base::dec, ss.flags());
+ BOOST_TEST_EQ(6, ss.precision());
+ BOOST_TEST_EQ(0, ss.width());
+ BOOST_TEST_EQ(std::ios_base::goodbit, ss.rdstate());
+ BOOST_TEST(ss.good());
+ BOOST_TEST_EQ(std::ios_base::goodbit, ss.exceptions());
+ BOOST_TEST(NULL == ss.tie());
+ BOOST_TEST(&sb == ss.rdbuf());
+ BOOST_TEST_EQ(' ', ss.fill());
+ BOOST_TEST(std::locale() == ss.getloc());
+ ss << std::oct << std::showpos << std::noskipws;
+ BOOST_TEST_EQ(std::ios_base::showpos | std::ios_base::oct, ss.flags());
+ ss << std::setprecision(3);
+ BOOST_TEST_EQ(3, ss.precision());
+ ss << std::setw(9);
+ BOOST_TEST_EQ(9, ss.width());
+ ss.setstate(std::ios_base::eofbit);
+ BOOST_TEST_EQ(std::ios_base::eofbit, ss.rdstate());
+ BOOST_TEST(ss.eof());
+ ss.exceptions(std::ios_base::failbit);
+ BOOST_TEST_EQ(std::ios_base::failbit, ss.exceptions());
+ {
+ boost::io::ios_iostate_saver iis(ss);
+ ss.exceptions(std::ios_base::failbit | std::ios_base::badbit);
+ char c;
+#if defined(BOOST_GCC) || (defined(BOOST_CLANG) && defined(BOOST_GNU_STDLIB))
+ BOOST_TEST_THROWS(ss >> c, std::exception);
+#else
+ BOOST_TEST_THROWS(ss >> c, std::ios_base::failure);
+#endif
+ }
+ ss.tie(&std::clog);
+ BOOST_TEST_EQ(&std::clog, ss.tie());
+ ss.rdbuf(std::cerr.rdbuf());
+ BOOST_TEST_EQ(std::cerr.rdbuf(), ss.rdbuf());
+ ss << std::setfill('x');
+ BOOST_TEST_EQ('x', ss.fill());
+ ss.imbue(std::locale(std::locale::classic(), new backward_bool_names));
+ BOOST_TEST(std::locale() != ss.getloc());
+ BOOST_TEST(std::has_facet<npc_type>(ss.getloc()) &&
+ dynamic_cast<const backward_bool_names*>(&
+ std::use_facet<npc_type>(ss.getloc())));
+ }
+ BOOST_TEST_EQ(std::ios_base::skipws | std::ios_base::dec, ss.flags());
+ BOOST_TEST_EQ(6, ss.precision());
+ BOOST_TEST_EQ(0, ss.width());
+ BOOST_TEST_EQ(std::ios_base::goodbit, ss.rdstate());
+ BOOST_TEST(ss.good());
+ BOOST_TEST_EQ(std::ios_base::goodbit, ss.exceptions());
+ BOOST_TEST(NULL == ss.tie());
+ BOOST_TEST(&sb == ss.rdbuf());
+ BOOST_TEST_EQ(' ', ss.fill());
+ BOOST_TEST(std::locale() == ss.getloc());
+}
+
+void
+ios_word_saver_unit_test(int index)
+{
+ std::stringstream ss;
+ BOOST_TEST_EQ(0, ss.iword(index));
+ BOOST_TEST(NULL == ss.pword(index));
+ {
+ boost::io::ios_all_word_saver iaws(ss, index);
+ BOOST_TEST_EQ(0, ss.iword(index));
+ BOOST_TEST(NULL == ss.pword(index));
+ ss.iword(index) = -11;
+ ss.pword(index) = ss.rdbuf();
+ BOOST_TEST_EQ(-11, ss.iword(index));
+ BOOST_TEST_EQ(ss.rdbuf(), ss.pword(index));
+ }
+ BOOST_TEST_EQ(0, ss.iword(index));
+ BOOST_TEST(NULL == ss.pword(index));
+}
+
+int main()
+{
+ int index = std::ios_base::xalloc();
+ ios_flags_saver_unit_test();
+ ios_precision_saver_unit_test();
+ ios_width_saver_unit_test();
+ ios_iostate_saver_unit_test();
+ ios_exception_saver_unit_test();
+ ios_tie_saver_unit_test();
+ ios_rdbuf_saver_unit_test();
+ ios_fill_saver_unit_test();
+ ios_locale_saver_unit_test();
+ ios_iword_saver_unit_test(index);
+ ios_pword_saver_unit_test(index);
+ ios_base_all_saver_unit_test();
+ ios_all_saver_unit_test();
+ ios_word_saver_unit_test(index);
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/io/test/make_ostream_joiner_test.cpp b/src/boost/libs/io/test/make_ostream_joiner_test.cpp
new file mode 100644
index 000000000..2860c4169
--- /dev/null
+++ b/src/boost/libs/io/test/make_ostream_joiner_test.cpp
@@ -0,0 +1,21 @@
+/*
+Copyright 2019 Glen Joseph Fernandes
+(glenjofe@gmail.com)
+
+Distributed under the Boost Software License, Version 1.0.
+(http://www.boost.org/LICENSE_1_0.txt)
+*/
+#include <boost/io/ostream_joiner.hpp>
+#include <boost/core/lightweight_test.hpp>
+#include <sstream>
+
+int main()
+{
+ std::ostringstream o;
+ boost::io::ostream_joiner<char> j = boost::io::make_ostream_joiner(o, ',');
+ *j++ = 1;
+ *j++ = '2';
+ *j++ = "3";
+ BOOST_TEST_EQ(o.str(), "1,2,3");
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/io/test/ostream_joiner_test.cpp b/src/boost/libs/io/test/ostream_joiner_test.cpp
new file mode 100644
index 000000000..0643e63c2
--- /dev/null
+++ b/src/boost/libs/io/test/ostream_joiner_test.cpp
@@ -0,0 +1,117 @@
+/*
+Copyright 2019 Glen Joseph Fernandes
+(glenjofe@gmail.com)
+
+Distributed under the Boost Software License, Version 1.0.
+(http://www.boost.org/LICENSE_1_0.txt)
+*/
+#include <boost/io/ostream_joiner.hpp>
+#include <boost/core/is_same.hpp>
+#include <boost/core/lightweight_test.hpp>
+#include <sstream>
+
+void test_char_type()
+{
+ BOOST_TEST((boost::core::is_same<char,
+ boost::io::ostream_joiner<const char*>::char_type>::value));
+}
+
+void test_traits_type()
+{
+ BOOST_TEST((boost::core::is_same<std::char_traits<char>,
+ boost::io::ostream_joiner<const char*>::traits_type>::value));
+}
+
+void test_ostream_type()
+{
+ BOOST_TEST((boost::core::is_same<std::ostream,
+ boost::io::ostream_joiner<const char*>::ostream_type>::value));
+}
+
+void test_iterator_category()
+{
+ BOOST_TEST((boost::core::is_same<std::output_iterator_tag,
+ boost::io::ostream_joiner<const char*>::iterator_category>::value));
+}
+
+void test_value_type()
+{
+ BOOST_TEST((boost::core::is_same<void,
+ boost::io::ostream_joiner<const char*>::value_type>::value));
+}
+
+void test_difference_type()
+{
+ BOOST_TEST((boost::core::is_same<void,
+ boost::io::ostream_joiner<const char*>::difference_type>::value));
+}
+
+void test_pointer()
+{
+ BOOST_TEST((boost::core::is_same<void,
+ boost::io::ostream_joiner<const char*>::pointer>::value));
+}
+
+void test_reference()
+{
+ BOOST_TEST((boost::core::is_same<void,
+ boost::io::ostream_joiner<const char*>::reference>::value));
+}
+
+void test_construct()
+{
+ std::ostringstream o;
+ boost::io::ostream_joiner<const char*> j(o, ",");
+ BOOST_TEST(o.str().empty());
+}
+
+void test_assign()
+{
+ std::ostringstream o;
+ boost::io::ostream_joiner<const char*> j(o, ",");
+ j = 1;
+ BOOST_TEST_EQ(o.str(), "1");
+ j = '2';
+ BOOST_TEST_EQ(o.str(), "1,2");
+ j = "3";
+ BOOST_TEST_EQ(o.str(), "1,2,3");
+}
+
+void test_increment()
+{
+ std::ostringstream o;
+ boost::io::ostream_joiner<const char*> j(o, ",");
+ BOOST_TEST_EQ(&++j, &j);
+}
+
+void test_post_increment()
+{
+ std::ostringstream o;
+ boost::io::ostream_joiner<const char*> j(o, ",");
+ BOOST_TEST_EQ(&j++, &j);
+}
+
+void test_value()
+{
+ std::ostringstream o;
+ boost::io::ostream_joiner<const char*> j(o, ",");
+ BOOST_TEST_EQ(&*j, &j);
+}
+
+int main()
+{
+ test_char_type();
+ test_traits_type();
+ test_ostream_type();
+ test_iterator_category();
+ test_value_type();
+ test_difference_type();
+ test_pointer();
+ test_reference();
+ test_construct();
+ test_assign();
+ test_increment();
+ test_post_increment();
+ test_value();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/io/test/ostream_put_test.cpp b/src/boost/libs/io/test/ostream_put_test.cpp
new file mode 100644
index 000000000..814d46e5d
--- /dev/null
+++ b/src/boost/libs/io/test/ostream_put_test.cpp
@@ -0,0 +1,136 @@
+/*
+Copyright 2019 Glen Joseph Fernandes
+(glenjofe@gmail.com)
+
+Distributed under the Boost Software License, Version 1.0.
+(http://www.boost.org/LICENSE_1_0.txt)
+*/
+#include <boost/io/ostream_put.hpp>
+#include <boost/core/lightweight_test.hpp>
+#include <sstream>
+#include <string>
+
+int main()
+{
+ {
+ std::ostringstream os;
+ os.width(1);
+ os.fill('.');
+ os.setf(std::ios_base::left, std::ios_base::adjustfield);
+ boost::io::ostream_put(os, "xy", 2);
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == "xy");
+ }
+ {
+ std::wostringstream os;
+ os.width(1);
+ os.fill(L'.');
+ os.setf(std::ios_base::left, std::ios_base::adjustfield);
+ boost::io::ostream_put(os, L"xy", 2);
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == L"xy");
+ }
+ {
+ std::ostringstream os;
+ os.width(1);
+ os.fill('.');
+ os.setf(std::ios_base::right, std::ios_base::adjustfield);
+ boost::io::ostream_put(os, "xy", 2);
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == "xy");
+ }
+ {
+ std::wostringstream os;
+ os.width(1);
+ os.fill(L'.');
+ os.setf(std::ios_base::right, std::ios_base::adjustfield);
+ boost::io::ostream_put(os, L"xy", 2);
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == L"xy");
+ }
+ {
+ std::ostringstream os;
+ os.width(4);
+ os.fill('.');
+ os.setf(std::ios_base::left, std::ios_base::adjustfield);
+ boost::io::ostream_put(os, "xy", 2);
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == "xy..");
+ }
+ {
+ std::wostringstream os;
+ os.width(4);
+ os.fill(L'.');
+ os.setf(std::ios_base::left, std::ios_base::adjustfield);
+ boost::io::ostream_put(os, L"xy", 2);
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == L"xy..");
+ }
+ {
+ std::ostringstream os;
+ os.width(4);
+ os.fill('.');
+ os.setf(std::ios_base::right, std::ios_base::adjustfield);
+ boost::io::ostream_put(os, "xy", 2);
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == "..xy");
+ }
+ {
+ std::wostringstream os;
+ os.width(4);
+ os.fill(L'.');
+ os.setf(std::ios_base::right, std::ios_base::adjustfield);
+ boost::io::ostream_put(os, L"xy", 2);
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == L"..xy");
+ }
+ {
+ std::ostringstream os;
+ os.width(12);
+ os.fill('.');
+ os.setf(std::ios_base::left, std::ios_base::adjustfield);
+ boost::io::ostream_put(os, "xy", 2);
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == "xy..........");
+ }
+ {
+ std::wostringstream os;
+ os.width(12);
+ os.fill(L'.');
+ os.setf(std::ios_base::left, std::ios_base::adjustfield);
+ boost::io::ostream_put(os, L"xy", 2);
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == L"xy..........");
+ }
+ {
+ std::ostringstream os;
+ os.width(12);
+ os.fill('.');
+ os.setf(std::ios_base::right, std::ios_base::adjustfield);
+ boost::io::ostream_put(os, "xy", 2);
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == "..........xy");
+ }
+ {
+ std::wostringstream os;
+ os.width(12);
+ os.fill(L'.');
+ os.setf(std::ios_base::right, std::ios_base::adjustfield);
+ boost::io::ostream_put(os, L"xy", 2);
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == L"..........xy");
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/io/test/quoted_fill_test.cpp b/src/boost/libs/io/test/quoted_fill_test.cpp
new file mode 100644
index 000000000..906dfe12c
--- /dev/null
+++ b/src/boost/libs/io/test/quoted_fill_test.cpp
@@ -0,0 +1,136 @@
+/*
+Copyright 2019-2020 Glen Joseph Fernandes
+(glenjofe@gmail.com)
+
+Distributed under the Boost Software License, Version 1.0.
+(http://www.boost.org/LICENSE_1_0.txt)
+*/
+#include <boost/io/quoted.hpp>
+#include <boost/core/lightweight_test.hpp>
+#include <sstream>
+#include <string>
+
+int main()
+{
+ {
+ std::ostringstream os;
+ os.width(2);
+ os.fill('.');
+ os.setf(std::ios_base::left, std::ios_base::adjustfield);
+ os << boost::io::quoted("xy");
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == "\"xy\"");
+ }
+ {
+ std::wostringstream os;
+ os.width(2);
+ os.fill(L'.');
+ os.setf(std::ios_base::left, std::ios_base::adjustfield);
+ os << boost::io::quoted(L"xy");
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == L"\"xy\"");
+ }
+ {
+ std::ostringstream os;
+ os.width(2);
+ os.fill('.');
+ os.setf(std::ios_base::right, std::ios_base::adjustfield);
+ os << boost::io::quoted("xy");
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == "\"xy\"");
+ }
+ {
+ std::wostringstream os;
+ os.width(2);
+ os.fill(L'.');
+ os.setf(std::ios_base::right, std::ios_base::adjustfield);
+ os << boost::io::quoted(L"xy");
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == L"\"xy\"");
+ }
+ {
+ std::ostringstream os;
+ os.width(6);
+ os.fill('.');
+ os.setf(std::ios_base::left, std::ios_base::adjustfield);
+ os << boost::io::quoted("xy");
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == "\"xy\"..");
+ }
+ {
+ std::wostringstream os;
+ os.width(6);
+ os.fill(L'.');
+ os.setf(std::ios_base::left, std::ios_base::adjustfield);
+ os << boost::io::quoted(L"xy");
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == L"\"xy\"..");
+ }
+ {
+ std::ostringstream os;
+ os.width(6);
+ os.fill('.');
+ os.setf(std::ios_base::right, std::ios_base::adjustfield);
+ os << boost::io::quoted("xy");
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == "..\"xy\"");
+ }
+ {
+ std::wostringstream os;
+ os.width(6);
+ os.fill(L'.');
+ os.setf(std::ios_base::right, std::ios_base::adjustfield);
+ os << boost::io::quoted(L"xy");
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == L"..\"xy\"");
+ }
+ {
+ std::ostringstream os;
+ os.width(14);
+ os.fill('.');
+ os.setf(std::ios_base::left, std::ios_base::adjustfield);
+ os << boost::io::quoted("xy");
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == "\"xy\"..........");
+ }
+ {
+ std::wostringstream os;
+ os.width(14);
+ os.fill(L'.');
+ os.setf(std::ios_base::left, std::ios_base::adjustfield);
+ os << boost::io::quoted(L"xy");
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == L"\"xy\"..........");
+ }
+ {
+ std::ostringstream os;
+ os.width(14);
+ os.fill('.');
+ os.setf(std::ios_base::right, std::ios_base::adjustfield);
+ os << boost::io::quoted("xy");
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == "..........\"xy\"");
+ }
+ {
+ std::wostringstream os;
+ os.width(14);
+ os.fill(L'.');
+ os.setf(std::ios_base::right, std::ios_base::adjustfield);
+ os << boost::io::quoted(L"xy");
+ BOOST_TEST(os.good());
+ BOOST_TEST(os.width() == 0);
+ BOOST_TEST(os.str() == L"..........\"xy\"");
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/io/test/quoted_test.cpp b/src/boost/libs/io/test/quoted_test.cpp
new file mode 100644
index 000000000..2ca0a25b9
--- /dev/null
+++ b/src/boost/libs/io/test/quoted_test.cpp
@@ -0,0 +1,110 @@
+/*
+Copyright 2010 Beman Dawes
+
+Copyright 2019 Glen Joseph Fernandes
+(glenjofe@gmail.com)
+
+Distributed under the Boost Software License, Version 1.0.
+(http://www.boost.org/LICENSE_1_0.txt)
+*/
+#include <boost/io/quoted.hpp>
+#include <boost/core/lightweight_test.hpp>
+#include <iostream>
+#include <sstream>
+
+int main()
+{
+ const std::string s0("foo");
+ std::string r;
+ {
+ std::stringstream ss;
+ ss << boost::io::quoted(s0);
+ ss >> r;
+ BOOST_TEST(r == "\"foo\"");
+ }
+ {
+ std::stringstream ss;
+ ss << boost::io::quoted(s0);
+ ss >> boost::io::quoted(r);
+ BOOST_TEST(r == "foo");
+ }
+ const std::string s0s("foo bar");
+ {
+ std::stringstream ss;
+ ss << boost::io::quoted(s0s);
+ ss >> r;
+ BOOST_TEST(r == "\"foo");
+ }
+ {
+ std::stringstream ss;
+ ss << boost::io::quoted(s0s);
+ ss >> boost::io::quoted(r);
+ BOOST_TEST(r == "foo bar");
+ }
+ const std::string s1("foo\\bar, \" *");
+ {
+ std::stringstream ss;
+ ss << boost::io::quoted(s1);
+ ss >> r;
+ BOOST_TEST(r == "\"foo\\\\bar,");
+ }
+ {
+ std::stringstream ss;
+ ss << boost::io::quoted("foo\\bar, \" *");
+ ss >> r;
+ BOOST_TEST(r == "\"foo\\\\bar,");
+ }
+ {
+ std::stringstream ss;
+ ss << boost::io::quoted(s1);
+ ss >> boost::io::quoted(r);
+ BOOST_TEST(r == s1);
+ }
+ {
+ std::stringstream ss;
+ ss << boost::io::quoted(s1.c_str());
+ ss >> boost::io::quoted(r);
+ BOOST_TEST(r == s1);
+ }
+ std::string s2("'Jack & Jill'");
+ {
+ std::stringstream ss;
+ ss << boost::io::quoted(s2, '&', '\'');
+ ss >> boost::io::quoted(r, '&', '\'');
+ BOOST_TEST(r == s2);
+ }
+ const std::wstring ws1(L"foo$bar, \" *");
+ std::wstring wr;
+ {
+ std::wstringstream wss;
+ wss << boost::io::quoted(ws1, L'$');
+ wss >> boost::io::quoted(wr, L'$');
+ BOOST_TEST(wr == ws1);
+ }
+ const std::string s3("const string");
+ {
+ std::stringstream ss;
+ ss << boost::io::quoted(s3);
+ ss >> boost::io::quoted(r);
+ BOOST_TEST(r == s3);
+ }
+ {
+ std::stringstream ss;
+ ss << "\"abc";
+ ss >> boost::io::quoted(r);
+ BOOST_TEST(r == "abc");
+ }
+ {
+ std::stringstream ss;
+ ss << "abc";
+ ss >> boost::io::quoted(r);
+ BOOST_TEST(r == "abc");
+ }
+ {
+ std::stringstream ss;
+ ss << "abc def";
+ ss >> boost::io::quoted(r);
+ BOOST_TEST(r == "abc");
+ }
+ return boost::report_errors();
+}