2
0
mirror of https://github.com/boostorg/test.git synced 2026-02-14 13:12:10 +00:00
Files
test/doc/components/test_tools/output_test_stream_spec.html
Gennadiy Rozental 0958a0a7e7 in progress
[SVN r33190]
2006-03-01 16:57:33 +00:00

161 lines
8.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<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> &gt; <A href="../index.html">Components</A>
&gt; <A href="index.html">The Test Tools</A> &gt; <A href="output_test_stream.html">Output operations testing</A>
&gt; <SPAN class="current_article">boost::test_tools::ostream_test_stream</SPAN></DIV>
<DIV class="body"> <IMG src="../../btl1.gif" width="252" height="43" alt="Boost Test logo">
<H1 class="subtitle">boost::test_tools::ostream_test_stream</H1>
<P class="first-line-indented">The class boost::test_tools::<SPAN class="new-term">ostream_test_stream</SPAN> encapsulates
procedures needed for effective and convenient operator&lt;&lt;( std::ostream&amp;,
... ) correctness checks.</P>
<H2 class="first-line-indented"> Synopsis</H2>
<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">const_string</SPAN> pattern_file = <SPAN class="cpp-type">const_string</SPAN>(),
<SPAN class="cpp-type">bool</SPAN> match_or_save = <SPAN class="reserv-word">true</SPAN>,
<SPAN class="cpp-type">bool</SPAN> text_or_binary = <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( <SPAN class="cpp-type">std::size_t</SPAN> 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">const_string</SPAN> arg, <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>Description</H3>
<P class="first-line-indented">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) </P>
<H3>explicit <SPAN class="new-term"><A name="constructor">output_test_stream</A></SPAN>(
const_string pattern_file, bool match_or_save, bool text_or_binary )</H3>
<P class="first-line-indented">Effects:</P>
<P class="indented">Initilize output test stream object based on arguments
provided</P>
<P class="first-line-indented">Arguments:</P>
<TABLE border="0" class="indented">
<TR>
<TH align="left" valign="top" scope="row">pattern_file</TH>
<TD valign="top">-</TD>
<TD>the pattern file name. If provided file matching/saving operation is
permitted. If not only explicit checks on formatted content are permitted </TD>
</TR>
<TR>
<TH align="left" valign="top" scope="row">match_or_save</TH>
<TD valign="top">-</TD>
<TD>boolean switch between matching and saving to pattern file operating
modes. Ignored if pattern file name is not supplied </TD>
</TR>
<TR>
<TH align="left" valign="top" scope="row">text_or_binary</TH>
<TD valign="top">-</TD>
<TD>boolean switch between text and binary mode for pattern file reading/writting
operations. Ignored if pattern file name is not supplied</TD>
</TR>
</TABLE>
<H3>void <SPAN class="new-term">flush</SPAN>()</H3>
<P class="first-line-indented">Effects:</P>
<P class="indented">Clears the content of an output_test_stream
object.</P>
<H3>bool <SPAN class="new-term">is_empty</SPAN>( bool flush_stream )</H3>
<P class="first-line-indented">Effects:</P>
<P class="indented">Checks that the content of the output_test_stream
instance is empty. </P>
<P class="first-line-indented">Arguments:</P>
<TABLE border="0" class="indented">
<TR>
<TH align="left" valign="top" scope="row">flush_stream</TH>
<TD valign="top">-</TD>
<TD>boolean flag indicating wheather output_test_strean object content
needs to be cleared at the end of the check</TD>
</TR>
</TABLE>
<P class="first-line-indented">Returns: </P>
<P class="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 class="first-line-indented">Effects:</P>
<P class="indented">Checks that the length of the output_test_stream
object content is equal to supplied
length value. </P>
<P class="first-line-indented">Arguments:</P>
<TABLE border="0" class="indented">
<TR>
<TH align="left" valign="top" scope="row">length</TH>
<TD valign="top">-</TD>
<TD>length value to be matched against </TD>
</TR>
<TR>
<TH align="left" valign="top" scope="row">flush_stream</TH>
<TD valign="top">-</TD>
<TD>boolean flag indicating wheather output_test_strean object content
needs to be cleared at the end of the check</TD>
</TR>
</TABLE>
<P class="first-line-indented">Returns:</P>
<P class="indented"><I>true</I> if check successful, <I>false</I> otherwise.</P>
<H3> bool <SPAN class="new-term">is_equal</SPAN>( const_string arg, bool flush_stream
)</H3>
<P class="first-line-indented">Effects:</P>
<P class="indented">Checks that the content of the output_test_stream instance
match the supplied string.</P>
<P class="first-line-indented">Arguments:</P>
<TABLE border="0" class="indented">
<TR>
<TH align="left" valign="top" scope="row">arg</TH>
<TD valign="top">-</TD>
<TD>character string to be matched against </TD>
</TR>
<TR>
<TH align="left" valign="top" scope="row">flush_stream</TH>
<TD valign="top">-</TD>
<TD>boolean flag indicating wheather output_test_strean object content
needs to be cleared at the end of the check</TD>
</TR>
</TABLE>
<P class="first-line-indented">Returns:</P>
<P class="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 class="first-line-indented">Effects:</P>
<P class="indented">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 this method causes the output_test_stream object
content to be <STRONG>stored</STRONG> at
the end of the pattern file. </P>
<P class="first-line-indented">Arguments:</P>
<TABLE border="0" class="indented">
<TR>
<TH align="left" valign="top" scope="row">flush_stream</TH>
<TD valign="top">-</TD>
<TD>boolean flag indicating wheather output_test_strean object content
needs to be cleared at the end of the check</TD>
</TR>
</TABLE>
<P class="first-line-indented">Returns: </P>
<P class="indented">In matching mode: <I>true</I> if check successful, <I>false</I> otherwise.
In saving mode always true </P>
</DIV>
<DIV class="footer">
<DIV class="footer-body">
<P> &copy; <A name="Copyright">Copyright</A> <A href="mailto:boost-test%20at%20emailaccount%20dot%20com%20%28please%20unobscure%29">Gennadiy Rozental</A> 2001-2006. <BR>
Distributed under the Boost Software License, Version 1.0.
(See accompanying file <A href="../../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A> or copy at
<A href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</A>)</P>
<P>Revised: <!-- #BeginDate format:Sw1 -->28 February, 2006<!-- #EndDate --> </P>
</DIV>
</DIV>
</BODY>
</HTML>