Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/iostreams/test/file_test.cpp @ 35

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

updated boost from 1_33_1 to 1_34_1

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 <boost/iostreams/device/file.hpp>
8#include <boost/test/test_tools.hpp>
9#include <boost/test/unit_test.hpp>
10#include "detail/temp_file.hpp"
11#include "detail/verification.hpp"
12
13using namespace boost;
14using namespace boost::iostreams;
15using namespace boost::iostreams::test;
16using std::ifstream;
17using boost::unit_test::test_suite;   
18
19void file_test()
20{
21    test_file  test;   
22                   
23    //--------------Test file_source------------------------------------------//
24
25    {
26        file_source f(test.name());
27        BOOST_CHECK(f.is_open());
28        f.close();
29        BOOST_CHECK(!f.is_open());
30        f.open(test.name());
31        BOOST_CHECK(f.is_open());
32    }
33
34    //--------------Test file_sink--------------------------------------------//
35                                                   
36    {
37        file_sink f(test.name());
38        BOOST_CHECK(f.is_open());
39        f.close();
40        BOOST_CHECK(!f.is_open());
41        f.open(test.name());
42        BOOST_CHECK(f.is_open());
43    }
44
45    //--------------Test file-------------------------------------------------//
46                                                   
47    {
48        file f(test.name());
49        BOOST_CHECK(f.is_open());
50        f.close();
51        BOOST_CHECK(!f.is_open());
52        f.open(test.name());
53        BOOST_CHECK(f.is_open());
54    }
55}
56
57test_suite* init_unit_test_suite(int, char* []) 
58{
59    test_suite* test = BOOST_TEST_SUITE("file test");
60    test->add(BOOST_TEST_CASE(&file_test));
61    return test;
62}
Note: See TracBrowser for help on using the repository browser.