...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::test_tools::output_test_stream — Class to be used to simplify testing of ostream-based output operations.
// In header: <boost/test/tools/output_test_stream.hpp> class output_test_stream : public wrapped_stream { public: // construct/copy/destruct explicit output_test_stream(const_string = const_string(), bool = true, bool = true); ~output_test_stream(); // public member functions virtual assertion_result is_empty(bool = true); virtual assertion_result check_length(std::size_t, bool = true); virtual assertion_result is_equal(const_string, bool = true); virtual assertion_result match_pattern(bool = true); void flush(); // protected member functions virtual std::string get_stream_string_representation() const; // private member functions std::size_t length(); virtual void sync(); };
output_test_stream
public
construct/copy/destructexplicit output_test_stream(const_string pattern_file_name = const_string(), bool match_or_save = true, bool text_or_binary = true);Constructor.
Parameters: |
|
~output_test_stream();
output_test_stream
public member functionsvirtual assertion_result is_empty(bool flush_stream = true);Checks if the stream is empty.
Parameters: |
|
virtual assertion_result check_length(std::size_t length, bool flush_stream = true);Checks the length of the stream.
Parameters: |
|
virtual assertion_result is_equal(const_string arg_, bool flush_stream = true);Checks the content of the stream against a string.
Parameters: |
|
virtual assertion_result match_pattern(bool flush_stream = true);Checks the content of the stream against a pattern file.
Parameters: |
|
void flush();Flushes the stream.