Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/iostreams/test/seekable_file_test.cpp @ 14

Last change on this file since 14 was 12, checked in by landauf, 17 years ago

added boost

  • Property svn:executable set to *
File size: 1.7 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#include <fstream>
8#include <boost/iostreams/device/file.hpp>
9#include <boost/iostreams/filtering_stream.hpp>
10#include <boost/test/test_tools.hpp>
11#include <boost/test/unit_test.hpp>
12#include "detail/temp_file.hpp"
13#include "detail/verification.hpp"
14
15using namespace std;
16using namespace boost;
17using namespace boost::iostreams;
18using namespace boost::iostreams::test;
19using boost::unit_test::test_suite;     
20
21void seekable_file_test()
22{
23    {
24        temp_file temp;
25        file f( temp.name(), 
26                BOOST_IOS::in | BOOST_IOS::out | 
27                BOOST_IOS::trunc | BOOST_IOS::binary);
28        filtering_stream<seekable> io(f);
29        io.exceptions(BOOST_IOS::failbit | BOOST_IOS::badbit);
30        BOOST_CHECK_MESSAGE(
31            test_seekable_in_chars(io),
32            "failed seeking within a file, in chars"
33        );
34    }
35
36    {
37        temp_file temp;
38        file f( temp.name(), 
39                BOOST_IOS::in | BOOST_IOS::out | 
40                BOOST_IOS::trunc | BOOST_IOS::binary);
41        filtering_stream<seekable> io(f);
42        io.exceptions(BOOST_IOS::failbit | BOOST_IOS::badbit);
43        BOOST_CHECK_MESSAGE(
44            test_seekable_in_chunks(io),
45            "failed seeking within a file, in chunks"
46        );
47    }
48}
49
50test_suite* init_unit_test_suite(int, char* []) 
51{
52    test_suite* test = BOOST_TEST_SUITE("seekable file test");
53    test->add(BOOST_TEST_CASE(&seekable_file_test));
54    return test;
55}
Note: See TracBrowser for help on using the repository browser.