• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Class test_results</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/results_collector_hpp.html" title="Header &lt;boost/test/results_collector.hpp&gt;">
9<link rel="prev" href="results_collector_t.html" title="Class results_collector_t">
10<link rel="next" href="../../header/boost/test/results_reporter_hpp.html" title="Header &lt;boost/test/results_reporter.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="results_collector_t.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../header/boost/test/results_collector_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/results_reporter_hpp.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="refentry">
26<a name="boost.unit_test.test_results"></a><div class="titlepage"></div>
27<div class="refnamediv">
28<h2><span class="refentrytitle">Class test_results</span></h2>
29<p>boost::unit_test::test_results — Collection of attributes constituting test unit results. </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/results_collector_hpp.html" title="Header &lt;boost/test/results_collector.hpp&gt;">boost/test/results_collector.hpp</a>&gt;
33
34</span>
35<span class="keyword">class</span> <a class="link" href="test_results.html" title="Class test_results">test_results</a> <span class="special">{</span>
36<span class="keyword">public</span><span class="special">:</span>
37  <span class="comment">// <a class="link" href="test_results.html#boost.unit_test.test_resultsconstruct-copy-destruct">construct/copy/destruct</a></span>
38  <a class="link" href="test_results.html#idm45267287148288-bb"><span class="identifier">test_results</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
39
40  <span class="comment">// <a class="link" href="test_results.html#idm45267287171472-bb">public member functions</a></span>
41  <span class="keyword">typedef</span> <a class="link" href="test_results.html#idm45267287170912-bb"><span class="identifier">BOOST_READONLY_PROPERTY</span></a><span class="special">(</span><span class="identifier">counter_t</span><span class="special">,</span>
42                                  <span class="special">(</span><a class="link" href="results_collector_t.html" title="Class results_collector_t">results_collector_t</a><span class="special">)</span><span class="special">(</span><a class="link" href="test_results.html" title="Class test_results">test_results</a><span class="special">)</span><span class="special">(</span><span class="identifier">results_collect_helper</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
43  <span class="keyword">typedef</span> <a class="link" href="test_results.html#idm45267287167456-bb"><span class="identifier">BOOST_READONLY_PROPERTY</span></a><span class="special">(</span><span class="keyword">bool</span><span class="special">,</span>
44                                  <span class="special">(</span><a class="link" href="results_collector_t.html" title="Class results_collector_t">results_collector_t</a><span class="special">)</span><span class="special">(</span><a class="link" href="test_results.html" title="Class test_results">test_results</a><span class="special">)</span><span class="special">(</span><span class="identifier">results_collect_helper</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
45  <span class="keyword">bool</span> <a class="link" href="test_results.html#idm45267287164000-bb"><span class="identifier">passed</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
46  <span class="keyword">bool</span> <a class="link" href="test_results.html#idm45267287162576-bb"><span class="identifier">skipped</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
47  <span class="keyword">bool</span> <a class="link" href="test_results.html#idm45267287160608-bb"><span class="identifier">aborted</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
48  <span class="keyword">int</span> <a class="link" href="test_results.html#idm45267287159152-bb"><span class="identifier">result_code</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
49  <span class="keyword">void</span> <a class="link" href="test_results.html#idm45267287153104-bb"><span class="keyword">operator</span><span class="special">+=</span></a><span class="special">(</span><a class="link" href="test_results.html" title="Class test_results">test_results</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
50  <span class="keyword">void</span> <a class="link" href="test_results.html#idm45267287149616-bb"><span class="identifier">clear</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
51
52  <span class="comment">// public data members</span>
53  <span class="identifier">counter_prop</span> <span class="identifier">p_test_suites</span><span class="special">;</span>  <span class="comment">// Number of test suites. </span>
54  <span class="identifier">counter_prop</span> <span class="identifier">p_assertions_passed</span><span class="special">;</span>  <span class="comment">// Number of successful assertions. </span>
55  <span class="identifier">counter_prop</span> <span class="identifier">p_assertions_failed</span><span class="special">;</span>  <span class="comment">// Number of failing assertions. </span>
56  <span class="identifier">counter_prop</span> <span class="identifier">p_warnings_failed</span><span class="special">;</span>  <span class="comment">// Number of warnings. </span>
57  <span class="identifier">counter_prop</span> <span class="identifier">p_expected_failures</span><span class="special">;</span>
58  <span class="identifier">counter_prop</span> <span class="identifier">p_test_cases_passed</span><span class="special">;</span>  <span class="comment">// Number of successfull test cases. </span>
59  <span class="identifier">counter_prop</span> <span class="identifier">p_test_cases_warned</span><span class="special">;</span>  <span class="comment">// Number of warnings in test cases. </span>
60  <span class="identifier">counter_prop</span> <span class="identifier">p_test_cases_failed</span><span class="special">;</span>  <span class="comment">// Number of failing test cases. </span>
61  <span class="identifier">counter_prop</span> <span class="identifier">p_test_cases_skipped</span><span class="special">;</span>  <span class="comment">// Number of skipped test cases. </span>
62  <span class="identifier">counter_prop</span> <span class="identifier">p_test_cases_aborted</span><span class="special">;</span>  <span class="comment">// Number of aborted test cases. </span>
63  <span class="identifier">counter_prop</span> <span class="identifier">p_test_cases_timed_out</span><span class="special">;</span>  <span class="comment">// Number of timed out test cases. </span>
64  <span class="identifier">counter_prop</span> <span class="identifier">p_test_suites_timed_out</span><span class="special">;</span>  <span class="comment">// Number of timed out test suites. </span>
65  <span class="identifier">counter_prop</span> <span class="identifier">p_duration_microseconds</span><span class="special">;</span>  <span class="comment">// Duration of the test in microseconds. </span>
66  <span class="identifier">bool_prop</span> <span class="identifier">p_aborted</span><span class="special">;</span>  <span class="comment">// Indicates that the test unit execution has been aborted. </span>
67  <span class="identifier">bool_prop</span> <span class="identifier">p_skipped</span><span class="special">;</span>  <span class="comment">// Indicates that the test unit execution has been skipped. </span>
68  <span class="identifier">bool_prop</span> <span class="identifier">p_timed_out</span><span class="special">;</span>  <span class="comment">// Indicates that the test unit has timed out. </span>
69<span class="special">}</span><span class="special">;</span></pre></div>
70<div class="refsect1">
71<a name="idm46175617081008"></a><h2>Description</h2>
72<p>This class is a collection of attributes describing a test result.</p>
73<p>The attributes presented as public properties on an instance of the class. In addition summary conclusion methods are presented to generate simple answer to pass/fail question </p>
74<div class="refsect2">
75<a name="idm46175617079808"></a><h3>
76<a name="boost.unit_test.test_resultsconstruct-copy-destruct"></a><code class="computeroutput">test_results</code>
77        public
78       construct/copy/destruct</h3>
79<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><pre class="literallayout"><a name="idm45267287148288-bb"></a><span class="identifier">test_results</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre></li></ol></div>
80</div>
81<div class="refsect2">
82<a name="idm46175617073968"></a><h3>
83<a name="idm45267287171472-bb"></a><code class="computeroutput">test_results</code> public member functions</h3>
84<div class="orderedlist"><ol class="orderedlist" type="1">
85<li class="listitem">
86<pre class="literallayout"><span class="keyword">typedef</span> <a name="idm45267287170912-bb"></a><span class="identifier">BOOST_READONLY_PROPERTY</span><span class="special">(</span><span class="identifier">counter_t</span><span class="special">,</span>
87                                <span class="special">(</span><a class="link" href="results_collector_t.html" title="Class results_collector_t">results_collector_t</a><span class="special">)</span><span class="special">(</span><a class="link" href="test_results.html" title="Class test_results">test_results</a><span class="special">)</span><span class="special">(</span><span class="identifier">results_collect_helper</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre>Type representing counter like public property. </li>
88<li class="listitem">
89<pre class="literallayout"><span class="keyword">typedef</span> <a name="idm45267287167456-bb"></a><span class="identifier">BOOST_READONLY_PROPERTY</span><span class="special">(</span><span class="keyword">bool</span><span class="special">,</span>
90                                <span class="special">(</span><a class="link" href="results_collector_t.html" title="Class results_collector_t">results_collector_t</a><span class="special">)</span><span class="special">(</span><a class="link" href="test_results.html" title="Class test_results">test_results</a><span class="special">)</span><span class="special">(</span><span class="identifier">results_collect_helper</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre>Type representing boolean like public property. </li>
91<li class="listitem">
92<pre class="literallayout"><span class="keyword">bool</span> <a name="idm45267287164000-bb"></a><span class="identifier">passed</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns true if test unit passed. </li>
93<li class="listitem">
94<pre class="literallayout"><span class="keyword">bool</span> <a name="idm45267287162576-bb"></a><span class="identifier">skipped</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns true if test unit skipped. <p>For test suites, this indicates if the test suite itself has been marked as skipped, and not if the test suite contains any skipped test. </p>
95</li>
96<li class="listitem">
97<pre class="literallayout"><span class="keyword">bool</span> <a name="idm45267287160608-bb"></a><span class="identifier">aborted</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns true if the test unit was aborted (hard failure) </li>
98<li class="listitem">
99<pre class="literallayout"><span class="keyword">int</span> <a name="idm45267287159152-bb"></a><span class="identifier">result_code</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Produces result code for the test unit execution. <p>This methhod return one of the result codes defined in <code class="computeroutput">boost/cstdlib.hpp</code>
100</p>
101<div class="variablelist"><table border="0" class="variablelist compact">
102<colgroup>
103<col align="left" valign="top">
104<col>
105</colgroup>
106<tbody><tr>
107<td><p><span class="term">Returns:</span></p></td>
108<td>
109<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
110<li class="listitem"><p><code class="computeroutput">boost::exit_success</code> on success,</p></li>
111<li class="listitem"><p><code class="computeroutput">boost::exit_exception_failure</code> in case test unit was aborted for any reason (including uncaught exception)</p></li>
112<li class="listitem"><p>and <code class="computeroutput">boost::exit_test_failure</code> otherwise </p></li>
113</ul></div>
114<p>
115</p>
116</td>
117</tr></tbody>
118</table></div>
119</li>
120<li class="listitem">
121<pre class="literallayout"><span class="keyword">void</span> <a name="idm45267287153104-bb"></a><span class="keyword">operator</span><span class="special">+=</span><span class="special">(</span><a class="link" href="test_results.html" title="Class test_results">test_results</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span></pre>Combines the results of the current instance with another. <p>Only the counters are updated and the <code class="computeroutput">p_aborted</code> and <code class="computeroutput">p_skipped</code> are left unchanged. </p>
122</li>
123<li class="listitem">
124<pre class="literallayout"><span class="keyword">void</span> <a name="idm45267287149616-bb"></a><span class="identifier">clear</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Resets the current state of the result. </li>
125</ol></div>
126</div>
127</div>
128</div>
129<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
130<td align="left"></td>
131<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
132        Distributed under the Boost Software License, Version 1.0. (See accompanying
133        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>)
134      </p>
135</div></td>
136</tr></table>
137<hr>
138<div class="spirit-nav">
139<a accesskey="p" href="results_collector_t.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../header/boost/test/results_collector_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/results_reporter_hpp.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
140</div>
141</body>
142</html>
143