]>
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_SEEK_HPP_INCLUDED | |
9 | #define BOOST_IOSTREAMS_TEST_SEEK_HPP_INCLUDED | |
10 | ||
11 | ||
12 | #include <boost/config.hpp> // BOOST_MSVC, make sure size_t is in std. | |
13 | #include <cstddef> // std::size_t. | |
14 | #include <string> | |
15 | #include <boost/iostreams/device/array.hpp> | |
16 | #include <boost/iostreams/filtering_stream.hpp> | |
17 | #include <boost/test/test_tools.hpp> | |
18 | #include "../example/container_device.hpp" // We use container_device instead | |
19 | #include "detail/verification.hpp" // of make_iterator_range to | |
20 | // reduce dependence on Boost.Range | |
21 | ||
22 | void seek_test() | |
23 | { | |
24 | using namespace std; | |
25 | using namespace boost; | |
26 | using namespace boost::iostreams; | |
27 | using namespace boost::iostreams::example; | |
28 | using namespace boost::iostreams::test; | |
29 | ||
30 | { | |
31 | string test(data_reps * data_length(), '\0'); | |
32 | filtering_stream<seekable> io; | |
33 | io.push(container_device<string>(test)); | |
34 | BOOST_CHECK_MESSAGE( | |
35 | test_seekable_in_chars(io), | |
36 | "failed seeking within a filtering_stream<seekable>, in chars" | |
37 | ); | |
38 | } | |
39 | ||
40 | { | |
41 | string test(data_reps * data_length(), '\0'); | |
42 | filtering_stream<seekable> io; | |
43 | io.push(container_device<string>(test)); | |
44 | BOOST_CHECK_MESSAGE( | |
45 | test_seekable_in_chunks(io), | |
46 | "failed seeking within a filtering_stream<seekable>, in chunks" | |
47 | ); | |
48 | } | |
49 | } | |
50 | ||
51 | #endif // #ifndef BOOST_IOSTREAMS_TEST_SEEK_HPP_INCLUDED |