Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/iostreams/test/read_bidir_test.hpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 2.6 KB
Line 
1// (C) Copyright Jonathan Turkanis 2004
2// Distributed under the Boost Software License, Version 1.0. (See accompanying
3// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
4
5// See http://www.boost.org/libs/iostreams for documentation.
6
7#ifndef BOOST_IOSTREAMS_TEST_READ_BIDIRECTIONAL_HPP_INCLUDED
8#define BOOST_IOSTREAMS_TEST_READ_BIDIRECTIONAL_HPP_INCLUDED
9
10#include <fstream>
11#include <boost/iostreams/combine.hpp>
12#include <boost/iostreams/device/file.hpp>
13#include <boost/iostreams/filtering_stream.hpp>
14#include <boost/test/test_tools.hpp>
15#include "detail/temp_file.hpp"
16#include "detail/verification.hpp"
17
18void read_bidirectional_test()
19{ 
20    using namespace std;
21    using namespace boost;
22    using namespace boost::iostreams;
23    using namespace boost::iostreams::test;
24
25    test_file test;         
26
27    {
28        test_file src;
29        temp_file dest; // Dummy.
30        filtering_stream<bidirectional> first(
31            combine(file_source(src.name()), file_sink(dest.name())), 0
32        );
33        ifstream second(test.name().c_str());
34        BOOST_CHECK_MESSAGE(
35            compare_streams_in_chars(first, second),
36            "failed reading from filtering_stream<bidirectional>"
37            "in chars with no buffer"
38        );
39    }
40
41    {
42        test_file src;
43        temp_file dest; // Dummy.
44        filtering_stream<bidirectional> first(
45            combine(file_source(src.name()), file_sink(dest.name())), 0
46        );
47        ifstream second(test.name().c_str());
48        BOOST_CHECK_MESSAGE(
49            compare_streams_in_chunks(first, second),
50            "failed reading from filtering_stream<bidirectional>"
51            "in chunks with no buffer"
52        );
53    }
54
55    {
56        test_file src;
57        temp_file dest; // Dummy.
58        filtering_stream<bidirectional> first(
59            combine(file_source(src.name()), file_sink(dest.name()))
60        );
61        ifstream second(test.name().c_str());
62        BOOST_CHECK_MESSAGE(
63            compare_streams_in_chars(first, second),
64            "failed reading from filtering_stream<bidirectional>"
65            "in chars with large buffer"
66        );
67    }
68
69    {
70        test_file src;
71        temp_file dest; // Dummy.
72        filtering_stream<bidirectional> first(
73            combine(file_source(src.name()), file_sink(dest.name()))
74        );
75        ifstream second(test.name().c_str());
76        BOOST_CHECK_MESSAGE(
77            compare_streams_in_chunks(first, second),
78            "failed reading from filtering_stream<bidirectional>"
79            "in chunks with large buffer"
80        );
81    }
82}
83
84#endif // #ifndef BOOST_IOSTREAMS_TEST_READ_BIDIRECTIONAL_HPP_INCLUDED
Note: See TracBrowser for help on using the repository browser.