blob: 4f0ab0231741530d3b6e218f544caf805b405d37 [file] [log] [blame]
Jeff Thompsonef2d5a42013-08-22 19:09:24 -07001// (C) Copyright Gennadiy Rozental 2001-2008.
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$
9//
10// Version : $Revision: 49312 $
11//
12// Description : output_test_stream class definition
13// ***************************************************************************
14
Jeff Thompson3d613fd2013-10-15 15:39:04 -070015#ifndef NDNBOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER
16#define NDNBOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070017
18// Boost.Test
19#include <ndnboost/test/detail/global_typedef.hpp>
20#include <ndnboost/test/utils/wrap_stringstream.hpp>
21#include <ndnboost/test/predicate_result.hpp>
22
23// STL
24#include <cstddef> // for std::size_t
25
26#include <ndnboost/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
36namespace ndnboost {
37
38namespace test_tools {
39
Jeff Thompson3d613fd2013-10-15 15:39:04 -070040class NDNBOOST_TEST_DECL output_test_stream : public wrap_stringstream::wrapped_stream {
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070041 typedef unit_test::const_string const_string;
42 typedef predicate_result result_type;
43public:
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
61private:
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 ndnboost
73
74//____________________________________________________________________________//
75
76#include <ndnboost/test/detail/enable_warnings.hpp>
77
Jeff Thompson3d613fd2013-10-15 15:39:04 -070078#endif // NDNBOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER