]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/iostreams/test/write_output_seq_test.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / iostreams / test / write_output_seq_test.hpp
1 // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
2 // (C) Copyright 2004-2007 Jonathan Turkanis
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
5
6 // See http://www.boost.org/libs/iostreams for documentation.
7
8 #ifndef BOOST_IOSTREAMS_TEST_WRITE_OUTPUT_SEQUENCE_HPP_INCLUDED
9 #define BOOST_IOSTREAMS_TEST_WRITE_OUTPUT_SEQUENCE_HPP_INCLUDED
10
11 #include <fstream>
12 #include <vector>
13 #include <boost/iostreams/filtering_stream.hpp>
14 #include <boost/range/iterator_range.hpp>
15 #include <boost/test/test_tools.hpp>
16 #include "detail/sequence.hpp"
17 #include "detail/temp_file.hpp"
18 #include "detail/verification.hpp"
19
20 void write_output_sequence_test()
21 {
22 using namespace std;
23 using namespace boost;
24 using namespace boost::iostreams;
25 using namespace boost::iostreams::test;
26
27 test_file test;
28
29 {
30 vector<char> first(data_reps * data_length(), '?');
31 filtering_ostream out(make_iterator_range(first), 0);
32 write_data_in_chars(out);
33 ifstream second(test.name().c_str());
34 BOOST_CHECK_MESSAGE(
35 compare_container_and_stream(first, second),
36 "failed writing to filtering_ostream based on a sequence "
37 "in chars with no buffer"
38 );
39 }
40
41 {
42 vector<char> first(data_reps * data_length(), '?');
43 filtering_ostream out(make_iterator_range(first), 0);
44 write_data_in_chunks(out);
45 ifstream second(test.name().c_str());
46 BOOST_CHECK_MESSAGE(
47 compare_container_and_stream(first, second),
48 "failed writing to filtering_ostream based on a sequence "
49 "in chunks with no buffer"
50 );
51 }
52
53 {
54 vector<char> first(data_reps * data_length(), '?');
55 filtering_ostream out(make_iterator_range(first));
56 write_data_in_chars(out);
57 ifstream second(test.name().c_str());
58 BOOST_CHECK_MESSAGE(
59 compare_container_and_stream(first, second),
60 "failed writing to filtering_ostream based on a sequence "
61 "in chars with large buffer"
62 );
63 }
64
65 {
66 vector<char> first(data_reps * data_length(), '?');
67 filtering_ostream out(make_iterator_range(first));
68 write_data_in_chunks(out);
69 ifstream second(test.name().c_str());
70 BOOST_CHECK_MESSAGE(
71 compare_container_and_stream(first, second),
72 "failed writing to filtering_ostream based on a sequence "
73 "in chunks with large buffer"
74 );
75 }
76 }
77
78 #endif // #ifndef BOOST_IOSTREAMS_TEST_WRITE_OUTPUT_SEQUENCE_HPP_INCLUDED