Chris@16
|
1 // (C) Copyright Gennadiy Rozental 2001-2008.
|
Chris@16
|
2 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
3 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
4 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
5
|
Chris@16
|
6 // See http://www.boost.org/libs/test for the library home page.
|
Chris@16
|
7 //
|
Chris@16
|
8 // File : $RCSfile$
|
Chris@16
|
9 //
|
Chris@101
|
10 // Version : $Revision$
|
Chris@16
|
11 //
|
Chris@16
|
12 // Description : output_test_stream class definition
|
Chris@16
|
13 // ***************************************************************************
|
Chris@16
|
14
|
Chris@16
|
15 #ifndef BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER
|
Chris@16
|
16 #define BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER
|
Chris@16
|
17
|
Chris@16
|
18 // Boost.Test
|
Chris@16
|
19 #include <boost/test/detail/global_typedef.hpp>
|
Chris@16
|
20 #include <boost/test/utils/wrap_stringstream.hpp>
|
Chris@16
|
21 #include <boost/test/predicate_result.hpp>
|
Chris@16
|
22
|
Chris@16
|
23 // STL
|
Chris@16
|
24 #include <cstddef> // for std::size_t
|
Chris@16
|
25
|
Chris@16
|
26 #include <boost/test/detail/suppress_warnings.hpp>
|
Chris@16
|
27
|
Chris@16
|
28 //____________________________________________________________________________//
|
Chris@16
|
29
|
Chris@16
|
30 // ************************************************************************** //
|
Chris@16
|
31 // ************** output_test_stream ************** //
|
Chris@16
|
32 // ************************************************************************** //
|
Chris@16
|
33
|
Chris@16
|
34 // class to be used to simplify testing of ostream-based output operations
|
Chris@16
|
35
|
Chris@16
|
36 namespace boost {
|
Chris@16
|
37
|
Chris@16
|
38 namespace test_tools {
|
Chris@16
|
39
|
Chris@16
|
40 class BOOST_TEST_DECL output_test_stream : public wrap_stringstream::wrapped_stream {
|
Chris@16
|
41 typedef unit_test::const_string const_string;
|
Chris@16
|
42 typedef predicate_result result_type;
|
Chris@16
|
43 public:
|
Chris@16
|
44 // Constructor
|
Chris@16
|
45 explicit output_test_stream( const_string pattern_file_name = const_string(),
|
Chris@16
|
46 bool match_or_save = true,
|
Chris@16
|
47 bool text_or_binary = true );
|
Chris@16
|
48
|
Chris@16
|
49 // Destructor
|
Chris@16
|
50 ~output_test_stream();
|
Chris@16
|
51
|
Chris@16
|
52 // checking function
|
Chris@16
|
53 result_type is_empty( bool flush_stream = true );
|
Chris@16
|
54 result_type check_length( std::size_t length, bool flush_stream = true );
|
Chris@16
|
55 result_type is_equal( const_string arg_, bool flush_stream = true );
|
Chris@16
|
56 result_type match_pattern( bool flush_stream = true );
|
Chris@16
|
57
|
Chris@16
|
58 // explicit flush
|
Chris@16
|
59 void flush();
|
Chris@16
|
60
|
Chris@16
|
61 private:
|
Chris@16
|
62 // helper functions
|
Chris@16
|
63 std::size_t length();
|
Chris@16
|
64 void sync();
|
Chris@16
|
65
|
Chris@16
|
66 struct Impl;
|
Chris@16
|
67 Impl* m_pimpl;
|
Chris@16
|
68 };
|
Chris@16
|
69
|
Chris@16
|
70 } // namespace test_tools
|
Chris@16
|
71
|
Chris@16
|
72 } // namespace boost
|
Chris@16
|
73
|
Chris@16
|
74 //____________________________________________________________________________//
|
Chris@16
|
75
|
Chris@16
|
76 #include <boost/test/detail/enable_warnings.hpp>
|
Chris@16
|
77
|
Chris@16
|
78 #endif // BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER
|