]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_READ_BIDIRECTIONAL_FILTER_HPP_INCLUDED | |
9 | #define BOOST_IOSTREAMS_TEST_READ_BIDIRECTIONAL_FILTER_HPP_INCLUDED | |
10 | ||
11 | #include <fstream> | |
12 | #include <boost/iostreams/combine.hpp> | |
13 | #include <boost/iostreams/device/file.hpp> | |
14 | #include <boost/iostreams/filtering_stream.hpp> | |
15 | #include <boost/test/test_tools.hpp> | |
16 | #include "detail/filters.hpp" | |
17 | #include "detail/sequence.hpp" | |
18 | #include "detail/temp_file.hpp" | |
19 | #include "detail/verification.hpp" | |
20 | ||
21 | void read_bidirectional_filter_test() | |
22 | { | |
23 | using namespace std; | |
24 | using namespace boost; | |
25 | using namespace boost::iostreams; | |
26 | using namespace boost::iostreams::test; | |
27 | ||
28 | uppercase_file upper; | |
29 | ||
30 | //{ | |
31 | // test_file src; | |
32 | // temp_file dest; // Dummy. | |
33 | // filtering_stream<bidirectional> first; | |
34 | // first.push(combine(toupper_filter(), tolower_filter())); | |
35 | // first.push( | |
36 | // combine(file_source(src.name()), file_sink(dest.name())) | |
37 | // ); | |
38 | // ifstream second(upper.name().c_str()); | |
39 | // BOOST_CHECK_MESSAGE( | |
40 | // compare_streams_in_chars(first, second), | |
41 | // "failed reading from filtering_stream<bidirectional> in chars with an " | |
42 | // "input filter" | |
43 | // ); | |
44 | //} | |
45 | ||
46 | { | |
47 | test_file src; | |
48 | temp_file dest; // Dummy. | |
49 | filtering_stream<bidirectional> first; | |
50 | first.push(combine(toupper_filter(), tolower_filter())); | |
51 | first.push( | |
52 | combine(file_source(src.name()), file_sink(dest.name())) | |
53 | ); | |
54 | ifstream second(upper.name().c_str()); | |
55 | BOOST_CHECK_MESSAGE( | |
56 | compare_streams_in_chunks(first, second), | |
57 | "failed reading from filtering_stream<bidirectional> in chunks with an " | |
58 | "input filter" | |
59 | ); | |
60 | } | |
61 | ||
62 | //{ | |
63 | // test_file src; | |
64 | // temp_file dest; // Dummy. | |
65 | // filtering_stream<bidirectional> first( | |
66 | // combine(toupper_multichar_filter(), tolower_filter()), 0 | |
67 | // ); | |
68 | // first.push( | |
69 | // combine(file_source(src.name()), file_sink(dest.name())) | |
70 | // ); | |
71 | // ifstream second(upper.name().c_str()); | |
72 | // BOOST_CHECK_MESSAGE( | |
73 | // compare_streams_in_chars(first, second), | |
74 | // "failed reading from filtering_stream<bidirectional> in chars with " | |
75 | // "a multichar input filter with no buffer" | |
76 | // ); | |
77 | //} | |
78 | ||
79 | //{ | |
80 | // test_file src; | |
81 | // temp_file dest; // Dummy. | |
82 | // filtering_stream<bidirectional> first( | |
83 | // combine(toupper_multichar_filter(), tolower_filter()), 0 | |
84 | // ); | |
85 | // first.push( | |
86 | // combine(file_source(src.name()), file_sink(dest.name())) | |
87 | // ); | |
88 | // ifstream second(upper.name().c_str()); | |
89 | // BOOST_CHECK_MESSAGE( | |
90 | // compare_streams_in_chunks(first, second), | |
91 | // "failed reading from filtering_stream<bidirectional> in chunks " | |
92 | // "with a multichar input filter with no buffer" | |
93 | // ); | |
94 | //} | |
95 | ||
96 | //{ | |
97 | // test_file src; | |
98 | // temp_file dest; // Dummy. | |
99 | // filtering_stream<bidirectional> first( | |
100 | // combine(toupper_multichar_filter(), tolower_filter()) | |
101 | // ); | |
102 | // first.push( | |
103 | // combine(file_source(src.name()), file_sink(dest.name())) | |
104 | // ); | |
105 | // ifstream second(upper.name().c_str()); | |
106 | // BOOST_CHECK_MESSAGE( | |
107 | // compare_streams_in_chars(first, second), | |
108 | // "failed reading from filtering_stream<bidirectional> in chars with a " | |
109 | // "multichar input filter" | |
110 | // ); | |
111 | //} | |
112 | ||
113 | //{ | |
114 | // test_file src; | |
115 | // temp_file dest; // Dummy. | |
116 | // filtering_stream<bidirectional> first( | |
117 | // combine(toupper_multichar_filter(), tolower_filter()) | |
118 | // ); | |
119 | // first.push( | |
120 | // combine(file_source(src.name()), file_sink(dest.name())) | |
121 | // ); | |
122 | // ifstream second(upper.name().c_str()); | |
123 | // BOOST_CHECK_MESSAGE( | |
124 | // compare_streams_in_chunks(first, second), | |
125 | // "failed reading from filtering_stream<bidirectional> in chunks " | |
126 | // "with a multichar input filter" | |
127 | // ); | |
128 | //} | |
129 | } | |
130 | ||
131 | #endif // #ifndef BOOST_IOSTREAMS_TEST_READ_BIDIRECTIONAL_FILTER_HPP_INCLUDED |