mirror of
https://github.com/boostorg/test.git
synced 2026-01-26 19:12:10 +00:00
97 lines
6.6 KiB
HTML
97 lines
6.6 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>The Test Tools</TITLE>
|
|
<LINK rel="stylesheet" type="text/css" href="../../style/btl.css" media="screen">
|
|
<LINK rel="stylesheet" type="text/css" href="../../style/btl-print.css" media="print">
|
|
<META http-equiv="Content-Language" content="en-us">
|
|
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
</HEAD>
|
|
<BODY>
|
|
<DIV class="header"> <A href="../../index.html">Boost.Test</A> > <A href="../index.html">Components</A>
|
|
> <A href="index.html">The Test Tools</A> > <A href="output_test_stream.html">Output operations testing</A>
|
|
> <SPAN class="current_article">boost::test_toolbox::ostream_test_stream</SPAN></DIV>
|
|
<DIV class="body"> <IMG src='../../btl.gif' width='252' height='43' alt="Boost Test logo">
|
|
<H1 class="subtitle">boost::test_toolbox::ostream_test_stream</H1>
|
|
<P class="first_line_indented">.The class boost::test_toolbox::ostream_test_stream encapsulates procedures
|
|
needed for effective and convenient operator<<( std::ostream&, ... ) correctness check.</P>
|
|
<PRE class="code"><SPAN class="reserv-word">class</SPAN> <SPAN class="new-term">output_test_stream</SPAN> {
|
|
<SPAN class="reserv-word">pubic</SPAN>:
|
|
<SPAN class="reserv-word">explicit</SPAN> output_test_stream( <SPAN class="cpp-type">char</SPAN> <SPAN class="reserv-word">const</SPAN>* pattern_file = NULL,
|
|
<SPAN class="cpp-type">bool</SPAN> match_or_save = <SPAN class="reserv-word">true</SPAN> );
|
|
|
|
~output_test_stream();
|
|
|
|
<SPAN class="cpp-type">bool</SPAN> is_empty( <SPAN class="cpp-type">bool</SPAN> flush_stream = <SPAN class="reserv-word">true</SPAN> );
|
|
<SPAN class="cpp-type">bool</SPAN> check_length( std::size_t length, <SPAN class="cpp-type">bool</SPAN> flush_stream = <SPAN class="reserv-word">true</SPAN> );
|
|
<SPAN class="cpp-type">bool</SPAN> is_equal( <SPAN class="cpp-type">char</SPAN> <SPAN class="reserv-word">const</SPAN>* arg, <SPAN class="cpp-type">bool</SPAN> flush_stream = <SPAN class="reserv-word">true</SPAN> );
|
|
<SPAN class="cpp-type">bool</SPAN> is_equal( <SPAN class="cpp-type">std::string</SPAN> <SPAN class="reserv-word">const</SPAN>& arg, <SPAN class="cpp-type">bool</SPAN> flush_stream = <SPAN class="reserv-word">true</SPAN> );
|
|
<SPAN class="cpp-type">bool</SPAN> is_equal( <SPAN class="cpp-type">char</SPAN> <SPAN class="reserv-word">const</SPAN>* arg, <SPAN class="cpp-type">std::size_t</SPAN> n,
|
|
<SPAN class="cpp-type">bool</SPAN> flush_stream = <SPAN class="reserv-word">true</SPAN> );
|
|
|
|
<SPAN class="cpp-type">bool</SPAN> match_pattern( <SPAN class="cpp-type">bool</SPAN> flush_stream = <SPAN class="reserv-word">true</SPAN> );
|
|
|
|
<SPAN class="cpp-type">void</SPAN> flush();
|
|
};
|
|
</PRE>
|
|
<H3>explicit <SPAN class="new-term"><A name="constructor">output_test_stream</A></SPAN>( char const*
|
|
pattern_file, bool match_or_save )</H3>
|
|
<P class="first_line_indented">The class output_test_stream constructor accept pattern file name and
|
|
boolean switch match_or_save that are used by <A href="#match_pattern">match_pattern</A> facility.
|
|
If they are not present you can still use other testing mechanisms.</P>
|
|
<H3>void <SPAN class="new-term">flush</SPAN>()</H3>
|
|
<P>Effects:</P>
|
|
<P class="first_line_indented">This method cleans the content of the output_test_stream instance.</P>
|
|
<H3>bool <SPAN class="new-term">is_empty</SPAN>( bool flush_stream )</H3>
|
|
<P>Effects:</P>
|
|
<P class="first_line_indented">This method checks that the content of the output_test_stream instance
|
|
is empty. The flush_stream argument manage automatic call of the method output_test_stream::flush()
|
|
after check is done.</P>
|
|
<P>Returns:
|
|
<P>
|
|
<P class="first_line_indented"><I>true</I> if check successful, <I>false</I> otherwise.</P>
|
|
<H3> bool <SPAN class="new-term">check_length</SPAN>( std::size_t length, bool flush_stream )</H3>
|
|
<P>Effects:</P>
|
|
<P class="first_line_indented">This method checks that the length of the content of the output_test_stream
|
|
instance is equal to supplied length value. The flush_stream argument manage automatic call of the
|
|
method output_test_stream::flush() after check is done.</P>
|
|
<P>Returns:
|
|
<P>
|
|
<P class="first_line_indented"><I>true</I> if check successful, <I>false</I> otherwise.</P>
|
|
<H3> bool <SPAN class="new-term">is_equal</SPAN>( char const* arg, bool flush_stream )<BR>
|
|
bool <SPAN class="new-term">is_equal</SPAN>( std::string const& arg, bool flush_stream )<BR>
|
|
bool <SPAN class="new-term">is_equal</SPAN>( char const* arg, std::size_t n, bool flush_stream )</H3>
|
|
<P>Effects:</P>
|
|
<P class="first_line_indented">The overloaded method output_test_stream::is_equal(...) checks that the
|
|
content of the output_test_stream instance is equal to supplied character string. The first version
|
|
compare with null-terminated string. The second compare with a reference to std::string object. And
|
|
finally the third version compare with probably not null-terminated string defined by pointer to the
|
|
string begin and the string length. The flush_stream argument manage automatic call of the method
|
|
output_test_stream::flush() after check is done.</P>
|
|
<P>Returns:
|
|
<P>
|
|
<P class="first_line_indented"><I>true</I> if check successful, <I>false</I> otherwise.</P>
|
|
<H3>bool <SPAN class="new-term"><A name="match_pattern">match_pattern</A></SPAN>( bool flush_stream
|
|
)</H3>
|
|
<P>Effects:</P>
|
|
<P class="first_line_indented">This method 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 <A href="#constructor">constructor</A>.
|
|
If second argument of the class output_test_stream <A href="#constructor">constructor</A> is false,
|
|
then every call of the method output_test_stream::match_pattern(...) will cause the output_test_stream
|
|
instance content to be <U>stored</U> at the end of the pattern file. The flush_stream argument manage
|
|
automatic call of the method output_test_stream::flush() after check is done.</P>
|
|
<P>Returns:
|
|
<P>
|
|
<P class="first_line_indented"><I>true</I> if check successful, <I>false</I> otherwise.</P>
|
|
</DIV>
|
|
<DIV class="footer">
|
|
<DIV class="footer-body">
|
|
<P>Copyright © <A href='mailto:rogeeff@emailaccount.com'>Gennadiy Rozental</A> 2001-2003.<BR>
|
|
Permission to copy, use, modify, sell and distribute this document is granted provided this copyright
|
|
notice appears in all copies. This document is provided "as is" without express or implied warranty
|
|
and with no claim as to its suitability for any purpose.</P>
|
|
<P>Revised: 9 June, 2003</P>
|
|
</DIV>
|
|
</DIV>
|
|
</BODY>
|
|
</HTML>
|