1 | // (C) Copyright Gennadiy Rozental 2001-2005. |
---|
2 | // Distributed under the Boost Software License, Version 1.0. |
---|
3 | // (See accompanying file LICENSE_1_0.txt or copy at |
---|
4 | // http://www.boost.org/LICENSE_1_0.txt) |
---|
5 | |
---|
6 | // See http://www.boost.org/libs/test for the library home page. |
---|
7 | // |
---|
8 | // File : $RCSfile: output_test_stream.hpp,v $ |
---|
9 | // |
---|
10 | // Version : $Revision: 1.5 $ |
---|
11 | // |
---|
12 | // Description : output_test_stream class definition |
---|
13 | // *************************************************************************** |
---|
14 | |
---|
15 | #ifndef BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER |
---|
16 | #define BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER |
---|
17 | |
---|
18 | // Boost.Test |
---|
19 | #include <boost/test/detail/global_typedef.hpp> |
---|
20 | #include <boost/test/utils/wrap_stringstream.hpp> |
---|
21 | #include <boost/test/predicate_result.hpp> |
---|
22 | |
---|
23 | // STL |
---|
24 | #include <cstddef> // for std::size_t |
---|
25 | |
---|
26 | #include <boost/test/detail/suppress_warnings.hpp> |
---|
27 | |
---|
28 | //____________________________________________________________________________// |
---|
29 | |
---|
30 | // ************************************************************************** // |
---|
31 | // ************** output_test_stream ************** // |
---|
32 | // ************************************************************************** // |
---|
33 | |
---|
34 | // class to be used to simplify testing of ostream-based output operations |
---|
35 | |
---|
36 | namespace boost { |
---|
37 | |
---|
38 | namespace test_tools { |
---|
39 | |
---|
40 | class BOOST_TEST_DECL output_test_stream : public wrap_stringstream::wrapped_stream { |
---|
41 | typedef unit_test::const_string const_string; |
---|
42 | typedef predicate_result result_type; |
---|
43 | public: |
---|
44 | // Constructor |
---|
45 | explicit output_test_stream( const_string pattern_file_name = const_string(), |
---|
46 | bool match_or_save = true, |
---|
47 | bool text_or_binary = true ); |
---|
48 | |
---|
49 | // Destructor |
---|
50 | ~output_test_stream(); |
---|
51 | |
---|
52 | // checking function |
---|
53 | result_type is_empty( bool flush_stream = true ); |
---|
54 | result_type check_length( std::size_t length, bool flush_stream = true ); |
---|
55 | result_type is_equal( const_string arg_, bool flush_stream = true ); |
---|
56 | result_type match_pattern( bool flush_stream = true ); |
---|
57 | |
---|
58 | // explicit flush |
---|
59 | void flush(); |
---|
60 | |
---|
61 | private: |
---|
62 | // helper functions |
---|
63 | std::size_t length(); |
---|
64 | void sync(); |
---|
65 | |
---|
66 | struct Impl; |
---|
67 | Impl* m_pimpl; |
---|
68 | }; |
---|
69 | |
---|
70 | } // namespace test_tools |
---|
71 | |
---|
72 | } // namespace boost |
---|
73 | |
---|
74 | //____________________________________________________________________________// |
---|
75 | |
---|
76 | #include <boost/test/detail/enable_warnings.hpp> |
---|
77 | |
---|
78 | // *************************************************************************** |
---|
79 | // Revision History : |
---|
80 | // |
---|
81 | // $Log: output_test_stream.hpp,v $ |
---|
82 | // Revision 1.5 2005/12/14 05:10:34 rogeeff |
---|
83 | // dll support introduced |
---|
84 | // introduced an ability to match agains binary openned file |
---|
85 | // |
---|
86 | // Revision 1.4 2005/03/23 21:02:15 rogeeff |
---|
87 | // Sunpro CC 5.3 fixes |
---|
88 | // |
---|
89 | // Revision 1.3 2005/02/20 08:27:06 rogeeff |
---|
90 | // This a major update for Boost.Test framework. See release docs for complete list of fixes/updates |
---|
91 | // |
---|
92 | // Revision 1.2 2005/02/01 06:40:06 rogeeff |
---|
93 | // copyright update |
---|
94 | // old log entries removed |
---|
95 | // minor stilistic changes |
---|
96 | // depricated tools removed |
---|
97 | // |
---|
98 | // Revision 1.1 2005/01/30 03:25:24 rogeeff |
---|
99 | // output_test_stream moved into separate file |
---|
100 | // |
---|
101 | // *************************************************************************** |
---|
102 | |
---|
103 | #endif // BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER |
---|