Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / test / doc / html / boost / test_tools / output_test_stream.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Class output_test_stream</title>
5 <link rel="stylesheet" href="../../boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../index.html" title="Boost.Test">
8 <link rel="up" href="../../header/boost/test/tools/output_test_stream_hpp.html" title="Header &lt;boost/test/tools/output_test_stream.hpp&gt;">
9 <link rel="prev" href="../../header/boost/test/tools/output_test_stream_hpp.html" title="Header &lt;boost/test/tools/output_test_stream.hpp&gt;">
10 <link rel="next" href="../../header/boost/test/tree/observer_hpp.html" title="Header &lt;boost/test/tree/observer.hpp&gt;">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="../../header/boost/test/tools/output_test_stream_hpp.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../header/boost/test/tools/output_test_stream_hpp.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../header/boost/test/tree/observer_hpp.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="refentry">
26 <a name="boost.test_tools.output_test_stream"></a><div class="titlepage"></div>
27 <div class="refnamediv">
28 <h2><span class="refentrytitle">Class output_test_stream</span></h2>
29 <p>boost::test_tools::output_test_stream &#8212; Class to be used to simplify testing of ostream-based output operations. </p>
30 </div>
31 <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
32 <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../header/boost/test/tools/output_test_stream_hpp.html" title="Header &lt;boost/test/tools/output_test_stream.hpp&gt;">boost/test/tools/output_test_stream.hpp</a>&gt;
33
34 </span>
35 <span class="keyword">class</span> <a class="link" href="output_test_stream.html" title="Class output_test_stream">output_test_stream</a> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">wrapped_stream</span> <span class="special">{</span>
36 <span class="keyword">public</span><span class="special">:</span>
37   <span class="comment">// <a class="link" href="output_test_stream.html#boost.test_tools.output_test_streamconstruct-copy-destruct">construct/copy/destruct</a></span>
38   <span class="keyword">explicit</span> <a class="link" href="output_test_stream.html#idm46279113082448-bb"><span class="identifier">output_test_stream</span></a><span class="special">(</span><span class="identifier">const_string</span> <span class="special">=</span> <span class="identifier">const_string</span><span class="special">(</span><span class="special">)</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">,</span> 
39                               <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span>
40   <a class="link" href="output_test_stream.html#idm46279113076704-bb"><span class="special">~</span><span class="identifier">output_test_stream</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
41
42   <span class="comment">// <a class="link" href="output_test_stream.html#idm46279113100192-bb">public member functions</a></span>
43   <span class="keyword">virtual</span> <a class="link" href="assertion_result.html" title="Class assertion_result">assertion_result</a> <a class="link" href="output_test_stream.html#idm46279113099632-bb"><span class="identifier">is_empty</span></a><span class="special">(</span><span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span>
44   <span class="keyword">virtual</span> <a class="link" href="assertion_result.html" title="Class assertion_result">assertion_result</a> <a class="link" href="output_test_stream.html#idm46279113096240-bb"><span class="identifier">check_length</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span>
45   <span class="keyword">virtual</span> <a class="link" href="assertion_result.html" title="Class assertion_result">assertion_result</a> <a class="link" href="output_test_stream.html#idm46279113091680-bb"><span class="identifier">is_equal</span></a><span class="special">(</span><span class="identifier">const_string</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span>
46   <span class="keyword">virtual</span> <a class="link" href="assertion_result.html" title="Class assertion_result">assertion_result</a> <a class="link" href="output_test_stream.html#idm46279113087168-bb"><span class="identifier">match_pattern</span></a><span class="special">(</span><span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span>
47   <span class="keyword">void</span> <a class="link" href="output_test_stream.html#idm46279113083744-bb"><span class="identifier">flush</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
48
49   <span class="comment">// <a class="link" href="output_test_stream.html#idm46279113076416-bb">protected member functions</a></span>
50   <span class="keyword">virtual</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <a class="link" href="output_test_stream.html#idm46279113075840-bb"><span class="identifier">get_stream_string_representation</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
51
52   <span class="comment">// <a class="link" href="output_test_stream.html#idm46279113073472-bb">private member functions</a></span>
53   <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <a class="link" href="output_test_stream.html#idm46279113072896-bb"><span class="identifier">length</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
54   <span class="keyword">virtual</span> <span class="keyword">void</span> <a class="link" href="output_test_stream.html#idm46279113071760-bb"><span class="identifier">sync</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
55 <span class="special">}</span><span class="special">;</span></pre></div>
56 <div class="refsect1">
57 <a name="idm45313886628048"></a><h2>Description</h2>
58 <div class="refsect2">
59 <a name="idm45313886627632"></a><h3>
60 <a name="boost.test_tools.output_test_streamconstruct-copy-destruct"></a><code class="computeroutput">output_test_stream</code> 
61         public
62        construct/copy/destruct</h3>
63 <div class="orderedlist"><ol class="orderedlist" type="1">
64 <li class="listitem">
65 <pre class="literallayout"><span class="keyword">explicit</span> <a name="idm46279113082448-bb"></a><span class="identifier">output_test_stream</span><span class="special">(</span><span class="identifier">const_string</span> pattern_file_name <span class="special">=</span> <span class="identifier">const_string</span><span class="special">(</span><span class="special">)</span><span class="special">,</span> 
66                             <span class="keyword">bool</span> match_or_save <span class="special">=</span> <span class="keyword">true</span><span class="special">,</span> 
67                             <span class="keyword">bool</span> text_or_binary <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span></pre>Constructor. <p>
68 </p>
69 <div class="variablelist"><table border="0" class="variablelist compact">
70 <colgroup>
71 <col align="left" valign="top">
72 <col>
73 </colgroup>
74 <tbody><tr>
75 <td><p><span class="term">Parameters:</span></p></td>
76 <td><div class="variablelist"><table border="0" class="variablelist compact">
77 <colgroup>
78 <col align="left" valign="top">
79 <col>
80 </colgroup>
81 <tbody>
82 <tr>
83 <td><p><span class="term"><code class="computeroutput">match_or_save</code></span></p></td>
84 <td><p>if true, the pattern file will be read, otherwise it will be written </p></td>
85 </tr>
86 <tr>
87 <td><p><span class="term"><code class="computeroutput">pattern_file_name</code></span></p></td>
88 <td><p>indicates the name of the file for matching. If the string is empty, the standard input or output streams are used instead (depending on match_or_save) </p></td>
89 </tr>
90 <tr>
91 <td><p><span class="term"><code class="computeroutput">text_or_binary</code></span></p></td>
92 <td><p>if false, opens the stream in binary mode. Otherwise the stream is opened with default flags and the carriage returns are ignored. </p></td>
93 </tr>
94 </tbody>
95 </table></div></td>
96 </tr></tbody>
97 </table></div>
98 </li>
99 <li class="listitem"><pre class="literallayout"><a name="idm46279113076704-bb"></a><span class="special">~</span><span class="identifier">output_test_stream</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre></li>
100 </ol></div>
101 </div>
102 <div class="refsect2">
103 <a name="idm45313886602672"></a><h3>
104 <a name="idm46279113100192-bb"></a><code class="computeroutput">output_test_stream</code> public member functions</h3>
105 <div class="orderedlist"><ol class="orderedlist" type="1">
106 <li class="listitem">
107 <pre class="literallayout"><span class="keyword">virtual</span> <a class="link" href="assertion_result.html" title="Class assertion_result">assertion_result</a> <a name="idm46279113099632-bb"></a><span class="identifier">is_empty</span><span class="special">(</span><span class="keyword">bool</span> flush_stream <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span></pre>Checks if the stream is empty. <p>
108 </p>
109 <div class="variablelist"><table border="0" class="variablelist compact">
110 <colgroup>
111 <col align="left" valign="top">
112 <col>
113 </colgroup>
114 <tbody><tr>
115 <td><p><span class="term">Parameters:</span></p></td>
116 <td><div class="variablelist"><table border="0" class="variablelist compact">
117 <colgroup>
118 <col align="left" valign="top">
119 <col>
120 </colgroup>
121 <tbody><tr>
122 <td><p><span class="term"><code class="computeroutput">flush_stream</code></span></p></td>
123 <td><p>if true, flushes the stream after the call </p></td>
124 </tr></tbody>
125 </table></div></td>
126 </tr></tbody>
127 </table></div>
128 </li>
129 <li class="listitem">
130 <pre class="literallayout"><span class="keyword">virtual</span> <a class="link" href="assertion_result.html" title="Class assertion_result">assertion_result</a> 
131 <a name="idm46279113096240-bb"></a><span class="identifier">check_length</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> length<span class="special">,</span> <span class="keyword">bool</span> flush_stream <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span></pre>Checks the length of the stream. <p>
132 </p>
133 <div class="variablelist"><table border="0" class="variablelist compact">
134 <colgroup>
135 <col align="left" valign="top">
136 <col>
137 </colgroup>
138 <tbody><tr>
139 <td><p><span class="term">Parameters:</span></p></td>
140 <td><div class="variablelist"><table border="0" class="variablelist compact">
141 <colgroup>
142 <col align="left" valign="top">
143 <col>
144 </colgroup>
145 <tbody>
146 <tr>
147 <td><p><span class="term"><code class="computeroutput">flush_stream</code></span></p></td>
148 <td><p>if true, flushes the stream after the call. Set to false to call additional checks on the same content. </p></td>
149 </tr>
150 <tr>
151 <td><p><span class="term"><code class="computeroutput">length</code></span></p></td>
152 <td><p>target length </p></td>
153 </tr>
154 </tbody>
155 </table></div></td>
156 </tr></tbody>
157 </table></div>
158 </li>
159 <li class="listitem">
160 <pre class="literallayout"><span class="keyword">virtual</span> <a class="link" href="assertion_result.html" title="Class assertion_result">assertion_result</a> <a name="idm46279113091680-bb"></a><span class="identifier">is_equal</span><span class="special">(</span><span class="identifier">const_string</span> arg_<span class="special">,</span> <span class="keyword">bool</span> flush_stream <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span></pre>Checks the content of the stream against a string. <p>
161 </p>
162 <div class="variablelist"><table border="0" class="variablelist compact">
163 <colgroup>
164 <col align="left" valign="top">
165 <col>
166 </colgroup>
167 <tbody><tr>
168 <td><p><span class="term">Parameters:</span></p></td>
169 <td><div class="variablelist"><table border="0" class="variablelist compact">
170 <colgroup>
171 <col align="left" valign="top">
172 <col>
173 </colgroup>
174 <tbody>
175 <tr>
176 <td><p><span class="term"><code class="computeroutput">arg_</code></span></p></td>
177 <td><p>the target stream </p></td>
178 </tr>
179 <tr>
180 <td><p><span class="term"><code class="computeroutput">flush_stream</code></span></p></td>
181 <td><p>if true, flushes the stream after the call. </p></td>
182 </tr>
183 </tbody>
184 </table></div></td>
185 </tr></tbody>
186 </table></div>
187 </li>
188 <li class="listitem">
189 <pre class="literallayout"><span class="keyword">virtual</span> <a class="link" href="assertion_result.html" title="Class assertion_result">assertion_result</a> <a name="idm46279113087168-bb"></a><span class="identifier">match_pattern</span><span class="special">(</span><span class="keyword">bool</span> flush_stream <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span></pre>Checks the content of the stream against a pattern file. <p>
190 </p>
191 <div class="variablelist"><table border="0" class="variablelist compact">
192 <colgroup>
193 <col align="left" valign="top">
194 <col>
195 </colgroup>
196 <tbody><tr>
197 <td><p><span class="term">Parameters:</span></p></td>
198 <td><div class="variablelist"><table border="0" class="variablelist compact">
199 <colgroup>
200 <col align="left" valign="top">
201 <col>
202 </colgroup>
203 <tbody><tr>
204 <td><p><span class="term"><code class="computeroutput">flush_stream</code></span></p></td>
205 <td><p>if true, flushes/resets the stream after the call. </p></td>
206 </tr></tbody>
207 </table></div></td>
208 </tr></tbody>
209 </table></div>
210 </li>
211 <li class="listitem">
212 <pre class="literallayout"><span class="keyword">void</span> <a name="idm46279113083744-bb"></a><span class="identifier">flush</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Flushes the stream. </li>
213 </ol></div>
214 </div>
215 <div class="refsect2">
216 <a name="idm45313886547664"></a><h3>
217 <a name="idm46279113076416-bb"></a><code class="computeroutput">output_test_stream</code> protected member functions</h3>
218 <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
219 <pre class="literallayout"><span class="keyword">virtual</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <a name="idm46279113075840-bb"></a><span class="identifier">get_stream_string_representation</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns the string representation of the stream. <p>May be overriden in order to mutate the string before the matching operations. </p>
220 </li></ol></div>
221 </div>
222 <div class="refsect2">
223 <a name="idm45313886538128"></a><h3>
224 <a name="idm46279113073472-bb"></a><code class="computeroutput">output_test_stream</code> private member functions</h3>
225 <div class="orderedlist"><ol class="orderedlist" type="1">
226 <li class="listitem">
227 <pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <a name="idm46279113072896-bb"></a><span class="identifier">length</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Length of the stream. </li>
228 <li class="listitem">
229 <pre class="literallayout"><span class="keyword">virtual</span> <span class="keyword">void</span> <a name="idm46279113071760-bb"></a><span class="identifier">sync</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Synching the stream into an internal string representation. </li>
230 </ol></div>
231 </div>
232 </div>
233 </div>
234 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
235 <td align="left"></td>
236 <td align="right"><div class="copyright-footer">Copyright &#169; 2001-2019 Boost.Test
237       contributors<p>
238         Distributed under the Boost Software License, Version 1.0. (See accompanying
239         file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
240       </p>
241 </div></td>
242 </tr></table>
243 <hr>
244 <div class="spirit-nav">
245 <a accesskey="p" href="../../header/boost/test/tools/output_test_stream_hpp.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../header/boost/test/tools/output_test_stream_hpp.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../header/boost/test/tree/observer_hpp.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
246 </div>
247 </body>
248 </html>