• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Expected failures specification</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="../testing_tools.html" title="Writing unit tests">
9<link rel="prev" href="timeout.html" title="Time-out for test cases">
10<link rel="next" href="custom_predicates.html" title="Custom predicate support">
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="timeout.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../testing_tools.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="custom_predicates.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="boost_test.testing_tools.expected_failures"></a><a class="link" href="expected_failures.html" title="Expected failures specification">Expected
28      failures specification</a>
29</h3></div></div></div>
30<p>
31        While in a perfect world all test assertions should pass in order for a test
32        module to pass, in some situations it is desirable to temporarily allow particular
33        tests to fail. For example, where a particular feature is not implemented
34        yet and one needs to prepare a library for the release or when particular
35        test fails on some platforms. To avoid a nagging red box in regression tests
36        table, you can use the expected failures feature.
37      </p>
38<p>
39        This feature allows specifying an expected number of failed assertions per
40        test unit. The value is specified during test tree construction, and can't
41        be updated during test execution.
42      </p>
43<p>
44        The feature is not intended to be used to check for expected functionality
45        failures. To check that a particular input is causing an exception to be
46        thrown use <a class="link" href="../utf_reference/testing_tool_ref/assertion_boost_level_throw.html" title="BOOST_&lt;level&gt;_THROW"><code class="computeroutput"><span class="identifier">BOOST_</span><span class="special">&lt;</span><span class="identifier">level</span><span class="special">&gt;</span><span class="identifier">_THROW</span></code></a> family of testing tools.
47      </p>
48<p>
49        The usage of this feature should be limited and employed only after careful
50        consideration. In general you should only use this feature when it is necessary
51        to force a test module to pass without actually fixing the problem. Obviously,
52        an excessive usage of expected failures defeats the purpose of the unit test.
53        In most cases it only needs be applied temporarily.
54      </p>
55<p>
56        You also need to remember that the expected failure specification is per
57        test case. This means that any failed assertion within that test case can
58        satisfy the expected failures quota. Meaning it is possible for an unexpected
59        failure to occur to satisfy this quota.
60      </p>
61<div class="note"><table border="0" summary="Note">
62<tr>
63<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td>
64<th align="left">Note</th>
65</tr>
66<tr><td align="left" valign="top"><p>
67          If an assertion at fault is fixed and passed while an expected failures
68          specification still present, the number of failures becomes smaller than
69          expected. The test is going to be reported as passed; instead, a warning
70          message will be issued.
71        </p></td></tr>
72</table></div>
73<a name="l_expected_failure"></a><h4>
74<a name="boost_test.testing_tools.expected_failures.h0"></a>
75        <span class="phrase"><a name="boost_test.testing_tools.expected_failures.expected_failure_specification"></a></span><a class="link" href="expected_failures.html#boost_test.testing_tools.expected_failures.expected_failure_specification">Expected
76        failure specification</a>
77      </h4>
78<p>
79        The decorator <a class="link" href="../utf_reference/testing_tool_ref/decorator_expected_failures.html" title="expected_failures (decorator)"><code class="computeroutput"><span class="identifier">expected_failures</span></code></a> defines the number
80        of assertions that are expected to fail within the corresponding test unit.
81        It is reported as failure when the number of failed assertions is greater
82        than the declared expected number of failures. If the number of failed assertions
83        is less than the number of expected failures a message is reported. The total
84        number of expected failures for a given test suite <code class="computeroutput"><span class="identifier">S</span></code>
85        is the sum of the declared expected failures in <code class="computeroutput"><span class="identifier">S</span></code>
86        and the sum of expected failures in all nested test units:
87      </p>
88<h6>
89<a name="boost_test.testing_tools.expected_failures.h1"></a>
90        <span class="phrase"><a name="boost_test.testing_tools.expected_failures.example_descr"></a></span><a class="link" href="expected_failures.html#boost_test.testing_tools.expected_failures.example_descr">Example:
91        decorator expected_failures</a>
92      </h6>
93<div class="informaltable"><table class="table">
94<colgroup><col></colgroup>
95<thead><tr><th>
96                <p>
97                  Code
98                </p>
99              </th></tr></thead>
100<tbody><tr><td>
101<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#define</span> <span class="identifier">BOOST_TEST_MODULE</span> <span class="identifier">decorator_10</span>
102<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">test</span><span class="special">/</span><span class="identifier">included</span><span class="special">/</span><span class="identifier">unit_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
103<span class="keyword">namespace</span> <span class="identifier">utf</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">unit_test</span><span class="special">;</span>
104
105<span class="identifier">BOOST_AUTO_TEST_SUITE</span><span class="special">(</span><span class="identifier">suite1</span><span class="special">,</span>
106  <span class="special">*</span> <span class="identifier">utf</span><span class="special">::</span><span class="identifier">expected_failures</span><span class="special">(</span><span class="number">1</span><span class="special">))</span>
107
108  <span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span><span class="identifier">test1</span><span class="special">,</span>
109    <span class="special">*</span> <span class="identifier">utf</span><span class="special">::</span><span class="identifier">expected_failures</span><span class="special">(</span><span class="number">2</span><span class="special">))</span>
110  <span class="special">{</span>
111    <span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="keyword">false</span><span class="special">);</span>
112    <span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="keyword">false</span><span class="special">);</span>
113  <span class="special">}</span>
114
115  <span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span><span class="identifier">test2</span><span class="special">)</span>
116  <span class="special">{</span>
117    <span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="keyword">false</span><span class="special">);</span>
118    <span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="keyword">false</span><span class="special">);</span>
119  <span class="special">}</span>
120
121<span class="identifier">BOOST_AUTO_TEST_SUITE_END</span><span class="special">()</span>
122</pre>
123              </td></tr></tbody>
124</table></div>
125<div class="informaltable"><table class="table">
126<colgroup><col></colgroup>
127<thead><tr><th>
128                <p>
129                  Output
130                </p>
131              </th></tr></thead>
132<tbody><tr><td>
133<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="special">&gt;</span> <span class="identifier">decorator_10</span>
134<span class="identifier">Running</span> <span class="number">2</span> <span class="identifier">test</span> <span class="identifier">cases</span><span class="special">...</span>
135<span class="identifier">test</span><span class="special">.</span><span class="identifier">cpp</span><span class="special">(</span><span class="number">11</span><span class="special">):</span> <span class="identifier">error</span><span class="special">:</span> <span class="identifier">in</span> <span class="string">"suite1/test1"</span><span class="special">:</span> <span class="identifier">check</span> <span class="keyword">false</span> <span class="identifier">has</span> <span class="identifier">failed</span>
136<span class="identifier">test</span><span class="special">.</span><span class="identifier">cpp</span><span class="special">(</span><span class="number">12</span><span class="special">):</span> <span class="identifier">error</span><span class="special">:</span> <span class="identifier">in</span> <span class="string">"suite1/test1"</span><span class="special">:</span> <span class="identifier">check</span> <span class="keyword">false</span> <span class="identifier">has</span> <span class="identifier">failed</span>
137<span class="identifier">test</span><span class="special">.</span><span class="identifier">cpp</span><span class="special">(</span><span class="number">17</span><span class="special">):</span> <span class="identifier">error</span><span class="special">:</span> <span class="identifier">in</span> <span class="string">"suite1/test2"</span><span class="special">:</span> <span class="identifier">check</span> <span class="keyword">false</span> <span class="identifier">has</span> <span class="identifier">failed</span>
138<span class="identifier">test</span><span class="special">.</span><span class="identifier">cpp</span><span class="special">(</span><span class="number">18</span><span class="special">):</span> <span class="identifier">error</span><span class="special">:</span> <span class="identifier">in</span> <span class="string">"suite1/test2"</span><span class="special">:</span> <span class="identifier">check</span> <span class="keyword">false</span> <span class="identifier">has</span> <span class="identifier">failed</span>
139
140<span class="special">***</span> <span class="number">4</span> <span class="identifier">failures</span> <span class="identifier">are</span> <span class="identifier">detected</span> <span class="special">(</span><span class="number">3</span> <span class="identifier">failures</span> <span class="identifier">are</span> <span class="identifier">expected</span><span class="special">)</span> <span class="identifier">in</span> <span class="identifier">the</span> <span class="identifier">test</span> <span class="identifier">module</span> <span class="string">"decorator_10"</span>
141
142
143<span class="special">&gt;</span> <span class="identifier">decorator_10</span> <span class="special">--</span><span class="identifier">run_test</span><span class="special">=</span><span class="identifier">suite1</span><span class="special">/</span><span class="identifier">test1</span>
144<span class="identifier">Running</span> <span class="number">1</span> <span class="identifier">test</span> <span class="keyword">case</span><span class="special">...</span>
145<span class="identifier">test</span><span class="special">.</span><span class="identifier">cpp</span><span class="special">(</span><span class="number">11</span><span class="special">):</span> <span class="identifier">error</span><span class="special">:</span> <span class="identifier">in</span> <span class="string">"suite1/test1"</span><span class="special">:</span> <span class="identifier">check</span> <span class="keyword">false</span> <span class="identifier">has</span> <span class="identifier">failed</span>
146<span class="identifier">test</span><span class="special">.</span><span class="identifier">cpp</span><span class="special">(</span><span class="number">12</span><span class="special">):</span> <span class="identifier">error</span><span class="special">:</span> <span class="identifier">in</span> <span class="string">"suite1/test1"</span><span class="special">:</span> <span class="identifier">check</span> <span class="keyword">false</span> <span class="identifier">has</span> <span class="identifier">failed</span>
147
148<span class="special">***</span> <span class="identifier">No</span> <span class="identifier">errors</span> <span class="identifier">detected</span>
149</pre>
150              </td></tr></tbody>
151</table></div>
152<p>
153        In the above example, we first run all test cases with four failed assertions.
154        The total number of expected failures is 3: 1 (for test <code class="computeroutput"><span class="identifier">suite1</span></code>)
155        + 2 (for <code class="computeroutput"><span class="identifier">test1</span></code>). Because
156        the expected failure count is exceeded, the error is reported. In the second
157        case, we only run test case <code class="computeroutput"><span class="identifier">suite1</span><span class="special">/</span><span class="identifier">test1</span></code>:
158        two failures occur, two failures are expected, therefore no error is reported.
159      </p>
160<h4>
161<a name="boost_test.testing_tools.expected_failures.h2"></a>
162        <span class="phrase"><a name="boost_test.testing_tools.expected_failures.usage_with_automatically_registe"></a></span><a class="link" href="expected_failures.html#boost_test.testing_tools.expected_failures.usage_with_automatically_registe">Usage
163        with automatically registered test cases</a>
164      </h4>
165<div class="caution"><table border="0" summary="Caution">
166<tr>
167<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../../../doc/src/images/caution.png"></td>
168<th align="left">Caution</th>
169</tr>
170<tr><td align="left" valign="top"><p>
171          this usage is considered as deprecated. Please consider using the <a class="link" href="expected_failures.html#l_expected_failure"><code class="computeroutput"><span class="identifier">expected_failures</span></code></a>
172          decorator instead.
173        </p></td></tr>
174</table></div>
175<p>
176        For backwards compatibility, it is possible to indicate the expected failures
177        with <a class="link" href="../utf_reference/testing_tool_ref/test_org_boost_test_case_expected_failure.html" title="BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES"><code class="computeroutput"><span class="identifier">BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES</span></code></a>
178        <a href="#ftn.boost_test.testing_tools.expected_failures.f0" class="footnote" name="boost_test.testing_tools.expected_failures.f0"><sup class="footnote">[15]</sup></a> before the test case definition.
179      </p>
180<pre class="programlisting"><span class="identifier">BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES</span><span class="special">(</span><span class="identifier">test_case_name</span><span class="special">,</span> <span class="identifier">number_of_expected_failures</span><span class="special">);</span>
181</pre>
182<p>
183        You can use this macro both on a file scope and inside a test suite. Moreover
184        you can use it even if name of test units coincide in different test suites.
185        Expected failures specification applies to the test unit belonging to the
186        same test suite where <a class="link" href="../utf_reference/testing_tool_ref/test_org_boost_test_case_expected_failure.html" title="BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES"><code class="computeroutput"><span class="identifier">BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES</span></code></a>
187        resides.
188      </p>
189<h6>
190<a name="boost_test.testing_tools.expected_failures.h3"></a>
191        <span class="phrase"><a name="boost_test.testing_tools.expected_failures.example_descr0"></a></span><a class="link" href="expected_failures.html#boost_test.testing_tools.expected_failures.example_descr0">Example:
192        Expected failures specification for automatically registered test case</a>
193      </h6>
194<div class="informaltable"><table class="table">
195<colgroup><col></colgroup>
196<thead><tr><th>
197                <p>
198                  Code
199                </p>
200              </th></tr></thead>
201<tbody><tr><td>
202<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#define</span> <span class="identifier">BOOST_TEST_MODULE</span> <span class="identifier">example</span>
203<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">test</span><span class="special">/</span><span class="identifier">included</span><span class="special">/</span><span class="identifier">unit_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
204
205<span class="identifier">BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES</span><span class="special">(</span> <span class="identifier">my_test1</span><span class="special">,</span> <span class="number">1</span> <span class="special">)</span>
206
207<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">my_test1</span> <span class="special">)</span>
208<span class="special">{</span>
209  <span class="identifier">BOOST_TEST</span><span class="special">(</span> <span class="number">2</span> <span class="special">==</span> <span class="number">1</span> <span class="special">);</span>
210<span class="special">}</span>
211
212<span class="identifier">BOOST_AUTO_TEST_SUITE</span><span class="special">(</span> <span class="identifier">internal</span> <span class="special">)</span>
213
214<span class="identifier">BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES</span><span class="special">(</span> <span class="identifier">my_test1</span><span class="special">,</span> <span class="number">2</span> <span class="special">)</span>
215
216<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">my_test1</span> <span class="special">)</span>
217<span class="special">{</span>
218  <span class="identifier">BOOST_CHECK_EQUAL</span><span class="special">(</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="keyword">int</span><span class="special">),</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="keyword">char</span><span class="special">)</span> <span class="special">);</span>
219  <span class="identifier">BOOST_CHECK_EQUAL</span><span class="special">(</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="keyword">int</span><span class="special">*),</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="keyword">char</span><span class="special">)</span> <span class="special">);</span>
220<span class="special">}</span>
221
222<span class="identifier">BOOST_AUTO_TEST_SUITE_END</span><span class="special">()</span>
223</pre>
224              </td></tr></tbody>
225</table></div>
226<div class="informaltable"><table class="table">
227<colgroup><col></colgroup>
228<thead><tr><th>
229                <p>
230                  Output
231                </p>
232              </th></tr></thead>
233<tbody><tr><td>
234<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="special">&gt;</span> <span class="identifier">example</span> <span class="special">--</span><span class="identifier">report_level</span><span class="special">=</span><span class="keyword">short</span>
235<span class="identifier">Running</span> <span class="number">2</span> <span class="identifier">test</span> <span class="identifier">cases</span><span class="special">...</span>
236<span class="identifier">test</span><span class="special">.</span><span class="identifier">cpp</span><span class="special">(</span><span class="number">10</span><span class="special">):</span> <span class="identifier">error</span> <span class="identifier">in</span> <span class="string">"my_test1"</span><span class="special">:</span> <span class="identifier">check</span> <span class="number">2</span> <span class="special">==</span> <span class="number">1</span> <span class="identifier">has</span> <span class="identifier">failed</span>
237<span class="identifier">test</span><span class="special">.</span><span class="identifier">cpp</span><span class="special">(</span><span class="number">21</span><span class="special">):</span> <span class="identifier">error</span> <span class="identifier">in</span> <span class="string">"my_test1"</span><span class="special">:</span> <span class="identifier">check</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="keyword">char</span><span class="special">)</span> <span class="identifier">has</span> <span class="identifier">failed</span> <span class="special">[</span><span class="number">4</span> <span class="special">!=</span> <span class="number">1</span><span class="special">]</span>
238<span class="identifier">test</span><span class="special">.</span><span class="identifier">cpp</span><span class="special">(</span><span class="number">22</span><span class="special">):</span> <span class="identifier">error</span> <span class="identifier">in</span> <span class="string">"my_test1"</span><span class="special">:</span> <span class="identifier">check</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="keyword">int</span><span class="special">*)</span> <span class="special">==</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="keyword">char</span><span class="special">)</span> <span class="identifier">has</span> <span class="identifier">failed</span> <span class="special">[</span><span class="number">4</span> <span class="special">!=</span> <span class="number">1</span><span class="special">]</span>
239
240<span class="identifier">Test</span> <span class="identifier">suite</span> <span class="string">"example"</span> <span class="identifier">passed</span> <span class="identifier">with</span><span class="special">:</span>
241  <span class="number">3</span> <span class="identifier">assertions</span> <span class="identifier">out</span> <span class="identifier">of</span> <span class="number">3</span> <span class="identifier">failed</span>
242  <span class="number">3</span> <span class="identifier">failures</span> <span class="identifier">expected</span>
243  <span class="number">2</span> <span class="identifier">test</span> <span class="identifier">cases</span> <span class="identifier">out</span> <span class="identifier">of</span> <span class="number">2</span> <span class="identifier">passed</span>
244</pre>
245              </td></tr></tbody>
246</table></div>
247<h4>
248<a name="boost_test.testing_tools.expected_failures.h4"></a>
249        <span class="phrase"><a name="boost_test.testing_tools.expected_failures.usage_with_manually_registered_t"></a></span><a class="link" href="expected_failures.html#boost_test.testing_tools.expected_failures.usage_with_manually_registered_t">Usage
250        with manually registered test cases</a>
251      </h4>
252<div class="caution"><table border="0" summary="Caution">
253<tr>
254<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../../../doc/src/images/caution.png"></td>
255<th align="left">Caution</th>
256</tr>
257<tr><td align="left" valign="top"><p>
258          this usage is considered as deprecated. Please consider using the <a class="link" href="expected_failures.html#l_expected_failure"><code class="computeroutput"><span class="identifier">expected_failures</span></code></a>
259          decorator instead.
260        </p></td></tr>
261</table></div>
262<p>
263        To set the value of expected failures for the manually registered test unit
264        pass it as a second argument for the <a class="link" href="../tests_organization/test_tree/test_suite.html#ref_test_case_registration"><code class="computeroutput"><span class="identifier">test_suite</span><span class="special">::</span><span class="identifier">add</span></code></a> call during test unit registration.
265      </p>
266<h6>
267<a name="boost_test.testing_tools.expected_failures.h5"></a>
268        <span class="phrase"><a name="boost_test.testing_tools.expected_failures.example_descr1"></a></span><a class="link" href="expected_failures.html#boost_test.testing_tools.expected_failures.example_descr1">Example:
269        Expected failures specification for manually registered test case</a>
270      </h6>
271<div class="informaltable"><table class="table">
272<colgroup><col></colgroup>
273<thead><tr><th>
274                <p>
275                  Code
276                </p>
277              </th></tr></thead>
278<tbody><tr><td>
279<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">test</span><span class="special">/</span><span class="identifier">included</span><span class="special">/</span><span class="identifier">unit_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
280<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">unit_test</span><span class="special">;</span>
281
282<span class="keyword">void</span> <span class="identifier">free_test_function</span><span class="special">()</span>
283<span class="special">{</span>
284  <span class="identifier">BOOST_TEST</span><span class="special">(</span> <span class="number">2</span> <span class="special">==</span> <span class="number">1</span> <span class="special">);</span>
285<span class="special">}</span>
286
287<span class="identifier">test_suite</span><span class="special">*</span> <span class="identifier">init_unit_test_suite</span><span class="special">(</span> <span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">*</span> <span class="special">[]</span> <span class="special">)</span>
288<span class="special">{</span>
289  <span class="identifier">framework</span><span class="special">::</span><span class="identifier">master_test_suite</span><span class="special">().</span>
290    <span class="identifier">add</span><span class="special">(</span> <span class="identifier">BOOST_TEST_CASE</span><span class="special">(</span> <span class="special">&amp;</span><span class="identifier">free_test_function</span> <span class="special">),</span> <span class="number">2</span> <span class="special">);</span>
291
292  <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
293<span class="special">}</span>
294</pre>
295              </td></tr></tbody>
296</table></div>
297<div class="informaltable"><table class="table">
298<colgroup><col></colgroup>
299<thead><tr><th>
300                <p>
301                  Output
302                </p>
303              </th></tr></thead>
304<tbody><tr><td>
305<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="special">&gt;</span> <span class="identifier">example</span> <span class="special">--</span><span class="identifier">log_level</span><span class="special">=</span><span class="identifier">message</span>
306<span class="identifier">Running</span> <span class="number">1</span> <span class="identifier">test</span> <span class="keyword">case</span><span class="special">...</span>
307<span class="identifier">test</span><span class="special">.</span><span class="identifier">cpp</span><span class="special">(</span><span class="number">8</span><span class="special">):</span> <span class="identifier">error</span> <span class="identifier">in</span> <span class="string">"free_test_function"</span><span class="special">:</span> <span class="identifier">check</span> <span class="number">2</span> <span class="special">==</span> <span class="number">1</span> <span class="identifier">has</span> <span class="identifier">failed</span>
308<span class="identifier">Test</span> <span class="keyword">case</span> <span class="identifier">has</span> <span class="identifier">less</span> <span class="identifier">failures</span> <span class="identifier">then</span> <span class="identifier">expected</span>
309
310<span class="special">***</span> <span class="identifier">No</span> <span class="identifier">errors</span> <span class="identifier">detected</span>
311</pre>
312              </td></tr></tbody>
313</table></div>
314<div class="footnotes">
315<br><hr style="width:100; text-align:left;margin-left: 0">
316<div id="ftn.boost_test.testing_tools.expected_failures.f0" class="footnote"><p><a href="#boost_test.testing_tools.expected_failures.f0" class="para"><sup class="para">[15] </sup></a>
317          deprecated
318        </p></div>
319</div>
320</div>
321<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
322<td align="left"></td>
323<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
324        Distributed under the Boost Software License, Version 1.0. (See accompanying
325        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>)
326      </p>
327</div></td>
328</tr></table>
329<hr>
330<div class="spirit-nav">
331<a accesskey="p" href="timeout.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../testing_tools.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="custom_predicates.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
332</div>
333</body>
334</html>
335