1 | // (C) Copyright Jonathan Turkanis 2004-5. |
---|
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/iostreams/filter/test.hpp> |
---|
9 | #include <boost/iostreams/invert.hpp> |
---|
10 | #include <boost/test/test_tools.hpp> |
---|
11 | #include <boost/test/unit_test.hpp> |
---|
12 | #include "detail/filters.hpp" |
---|
13 | #include "detail/temp_file.hpp" |
---|
14 | |
---|
15 | using namespace boost::iostreams; |
---|
16 | using namespace boost::iostreams::test; |
---|
17 | using boost::unit_test::test_suite; |
---|
18 | |
---|
19 | void inverse_test() |
---|
20 | { |
---|
21 | |
---|
22 | test_file test; |
---|
23 | lowercase_file lower; |
---|
24 | uppercase_file upper; |
---|
25 | |
---|
26 | BOOST_CHECK( test_input_filter( |
---|
27 | invert(tolower_filter()), |
---|
28 | file_source(test.name(), in_mode), |
---|
29 | file_source(lower.name(), in_mode) ) ); |
---|
30 | |
---|
31 | BOOST_CHECK( test_output_filter( |
---|
32 | invert(toupper_filter()), |
---|
33 | file_source(test.name(), in_mode), |
---|
34 | file_source(upper.name(), in_mode) ) ); |
---|
35 | } |
---|
36 | |
---|
37 | |
---|
38 | test_suite* init_unit_test_suite(int, char* []) |
---|
39 | { |
---|
40 | test_suite* test = BOOST_TEST_SUITE("reverse test"); |
---|
41 | test->add(BOOST_TEST_CASE(&inverse_test)); |
---|
42 | return test; |
---|
43 | } |
---|