The class boost::test_tools::ostream_test_stream encapsulates procedures needed for effective and convenient operator<<( std::ostream&, ... ) correctness checks.
class output_test_stream { pubic: explicit output_test_stream( const_string pattern_file = const_string(), bool match_or_save = true, bool text_or_binary = true ); ~output_test_stream(); bool is_empty( bool flush_stream = true ); bool check_length( std::size_t length, bool flush_stream = true ); bool is_equal( const_string arg, bool flush_stream = true ); bool match_pattern( bool flush_stream = true ); void flush(); };
The class output_test_stream models output stream. Formatted output is storred inside of output_test_stream object until check operations are performed at which time the content gets flushed (unless expletely told not to)
Effects:
Initilize output test stream object based on arguments provided
Arguments:
pattern_file | - | the pattern file name. If provided file matching/saving operation is permitted. If not only explicit checks on formatted content are permitted |
---|---|---|
match_or_save | - | boolean switch between matching and saving to pattern file operating modes. Ignored if pattern file name is not supplied |
text_or_binary | - | boolean switch between text and binary mode for pattern file reading/writting operations. Ignored if pattern file name is not supplied |
Effects:
Clears the content of an output_test_stream object.
Effects:
Checks that the content of the output_test_stream instance is empty.
Arguments:
flush_stream | - | boolean flag indicating wheather output_test_strean object content needs to be cleared at the end of the check |
---|
Returns:
true if check successful, false otherwise.
Effects:
Checks that the length of the output_test_stream object content is equal to supplied length value.
Arguments:
length | - | length value to be matched against |
---|---|---|
flush_stream | - | boolean flag indicating wheather output_test_strean object content needs to be cleared at the end of the check |
Returns:
true if check successful, false otherwise.
Effects:
Checks that the content of the output_test_stream instance match the supplied string.
Arguments:
arg | - | character string to be matched against |
---|---|---|
flush_stream | - | boolean flag indicating wheather output_test_strean object content needs to be cleared at the end of the check |
Returns:
true if check successful, false otherwise.
Effects:
Matches the content of the output_test_stream instance versus the pattern file. The pattern file name is specified in the class output_test_stream constructor. If second argument of the class output_test_stream constructor is false, then every call of this method causes the output_test_stream object content to be stored at the end of the pattern file.
Arguments:
flush_stream | - | boolean flag indicating wheather output_test_strean object content needs to be cleared at the end of the check |
---|
Returns:
In matching mode: true if check successful, false otherwise. In saving mode always true