[DEV] add v1.76.0

This commit is contained in:
2021-10-05 21:37:46 +02:00
parent a97e9ae7d4
commit d0115b733d
45133 changed files with 4744437 additions and 1026325 deletions

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>BOOST_TEST: universal and general purpose assertions</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -409,7 +409,7 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Custom predicate support</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -165,7 +165,7 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Debugging the assertions</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -87,7 +87,7 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Exception correctness</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -151,7 +151,7 @@
<span class="comment">//! @returns true on success, false otherwise</span>
<span class="keyword">bool</span> <span class="identifier">process</span><span class="special">()</span> <span class="special">{</span>
<span class="keyword">if</span><span class="special">(!</span><span class="identifier">is_processed</span><span class="special">)</span> <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
<span class="keyword">if</span><span class="special">(</span><span class="identifier">is_processed</span><span class="special">)</span> <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
<span class="comment">// ...</span>
<span class="identifier">is_processed</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
@@ -246,7 +246,7 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Expected failures specification</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -261,7 +261,7 @@
</table></div>
<p>
To set the value of expected failures for the manually registered test unit
pass it as a second argument for the <a class="link" href="../tests_organization/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.
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.
</p>
<h6>
<a name="boost_test.testing_tools.expected_failures.h5"></a>
@@ -320,7 +320,7 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Extended comparisons support</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -48,7 +48,7 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bitwise comparison</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -115,7 +115,7 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Collections comparison</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -116,17 +116,17 @@
<li class="listitem">
none of the comparison operand is a C-Array, in which case we use the
<a class="link" href="collections.html#ref_boost_test_coll_default_comp_container">container
default behaviour</a>
default behavior</a>
</li>
<li class="listitem">
one of the comparison operand is a C-array, in which case we <a class="link" href="collections.html#ref_boost_test_coll_c_arrays">mimic <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></code></a>
behaviour
behavior
</li>
</ol></div>
<a name="ref_boost_test_coll_default_comp_container"></a><h5>
<a name="boost_test.testing_tools.extended_comparison.collections.h1"></a>
<span class="phrase"><a name="boost_test.testing_tools.extended_comparison.collections.container_default_behaviour"></a></span><a class="link" href="collections.html#boost_test.testing_tools.extended_comparison.collections.container_default_behaviour">Container
default behaviour</a>
<span class="phrase"><a name="boost_test.testing_tools.extended_comparison.collections.container_default_behavior"></a></span><a class="link" href="collections.html#boost_test.testing_tools.extended_comparison.collections.container_default_behavior">Container
default behavior</a>
</h5>
<p>
Given two containers <code class="computeroutput"><span class="identifier">c_a</span></code>
@@ -216,14 +216,14 @@
</table></div>
<a name="ref_boost_test_coll_c_arrays"></a><h5>
<a name="boost_test.testing_tools.extended_comparison.collections.h3"></a>
<span class="phrase"><a name="boost_test.testing_tools.extended_comparison.collections.c_arrays_default_behaviour"></a></span><a class="link" href="collections.html#boost_test.testing_tools.extended_comparison.collections.c_arrays_default_behaviour">C-arrays
default behaviour</a>
<span class="phrase"><a name="boost_test.testing_tools.extended_comparison.collections.c_arrays_default_behavior"></a></span><a class="link" href="collections.html#boost_test.testing_tools.extended_comparison.collections.c_arrays_default_behavior">C-arrays
default behavior</a>
</h5>
<p>
As soon as one of the operands is a C-array, there is no <span class="emphasis"><em>default
behaviour</em></span> the <span class="emphasis"><em>Unit Test Framework</em></span> can dispatch
behavior</em></span> the <span class="emphasis"><em>Unit Test Framework</em></span> can dispatch
to. This is why in that case, the comparison mimics the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></code>
behaviour.
behavior.
</p>
<h6>
<a name="boost_test.testing_tools.extended_comparison.collections.h4"></a>
@@ -756,28 +756,64 @@
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
either a C-array, where the underlying type is neither <code class="computeroutput"><span class="keyword">char</span></code> or <code class="computeroutput"><span class="keyword">wchar_t</span></code>,
either a C-array,
</li>
<li class="listitem">
or a <code class="computeroutput"><span class="keyword">class</span></code>/<code class="computeroutput"><span class="keyword">struct</span></code> that implements the member functions
<code class="computeroutput"><span class="identifier">begin</span></code> and <code class="computeroutput"><span class="identifier">end</span></code> and for which <code class="computeroutput"><span class="identifier">value_type</span></code>
is neither <code class="computeroutput"><span class="keyword">char</span></code> or <code class="computeroutput"><span class="keyword">wchar_t</span></code>
<code class="computeroutput"><span class="identifier">begin</span></code> and <code class="computeroutput"><span class="identifier">end</span></code>.
</li>
</ul></div>
<p>
When the stored type <code class="computeroutput"><span class="keyword">char</span></code>
or <code class="computeroutput"><span class="keyword">wchar_t</span></code>, then the container
is considered as a string and is dispatched on <a class="link" href="strings.html" title="Strings and C-strings comparison">string
comparison</a> instead.
For collection comparisons, both sequences are also required to be different
than <code class="computeroutput"><span class="identifier">string</span></code> sequences.
In that case, the sequences are dispatched to string <a class="link" href="strings.html" title="Strings and C-strings comparison">comparison
instead</a>.
</p>
<div class="warning"><table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../../../../../doc/src/images/warning.png"></td>
<th align="left">Warning</th>
</tr>
<tr><td align="left" valign="top"><p>
<code class="computeroutput"><span class="identifier">string</span></code> (or <code class="computeroutput"><span class="identifier">wstring</span></code>) meets the sequence concept
by definition, but their handling with <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a> is done differently.
See <a class="link" href="strings.html" title="Strings and C-strings comparison">Strings
and C-strings comparison</a> for more details.
</p></td></tr>
</table></div>
<div class="tip"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../../doc/src/images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>
If the behavior of <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a> is not the one you
expect, you can always use raw comparison. See <a class="link" href="../boost_test_universal_macro.html#boost_test_statement_limitations">this
section</a> for details.
</p></td></tr>
</table></div>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
Since Boost.Test 3.6 (Boost 1.65) the requirements for the collection
concepts have been relaxed to include C-arrays as well
Since <a class="link" href="../../change_log.html#ref_CHANGE_LOG_3_6">Boost.Test 3.6</a> (Boost
1.65) the requirements for the collection concepts have been relaxed
to include C-arrays as well
</p></td></tr>
</table></div>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
Since <a class="link" href="../../change_log.html#ref_CHANGE_LOG_3_7">Boost.Test 3.7</a> (Boost
1.67) the definition of <code class="computeroutput"><span class="identifier">const_iterator</span></code>
and <code class="computeroutput"><span class="identifier">value_type</span></code> in the
collection type is not required anymore (for the compilers properly supporting
<code class="computeroutput"><span class="keyword">decltype</span></code>).
</p></td></tr>
</table></div>
<p>
@@ -816,7 +852,7 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Floating point comparison</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -36,22 +36,38 @@
behind floating point comparisons</a></span></dt>
</dl></div>
<p>
Unless you specify otherwise, when two values of floating-point type are
compared inside assertion <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a>, operators <code class="computeroutput"><span class="special">==</span></code> and <code class="computeroutput"><span class="special">!=</span></code>
defined for these types are used. In most cases, however, what we need
is not an <span class="emphasis"><em>exact</em></span> equality (or inequality), but to check
that the two numbers are 'sufficiently close' or 'sufficiently different'.
In order to do that we need to provide a <span class="emphasis"><em>tolerance</em></span>
parameter that will instruct the framework what we consider 'sufficiently
close'.
Unless specified otherwise, when a value of floating-point type is compared
inside a <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a> assertion, operators
<code class="computeroutput"><span class="special">==</span></code>, <code class="computeroutput"><span class="special">!=</span></code>
, <code class="computeroutput"><span class="special">&lt;</span></code> etc. defined for this
type are used. However for floating point type, in most cases what is needed
is not an <span class="emphasis"><em>exact</em></span> equality (or inequality), but a verification
that two numbers are <span class="emphasis"><em>sufficiently close</em></span> or <span class="emphasis"><em>sufficiently
different</em></span>. For that purpose, a <span class="bold"><strong>tolerance</strong></span>
parameter that will instruct the framework what is considered <span class="emphasis"><em>sufficiently
close</em></span> needs to provided.
</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
How the tolerance parameter is processed in detail is described <a class="link" href="floating_point/floating_points_comparison_impl.html" title="Tolerance-based comparisons">here</a>.
</p></td></tr>
</table></div>
<h5>
<a name="boost_test.testing_tools.extended_comparison.floating_point.h0"></a>
<span class="phrase"><a name="boost_test.testing_tools.extended_comparison.floating_point.test_unit_tolerance"></a></span><a class="link" href="floating_point.html#boost_test.testing_tools.extended_comparison.floating_point.test_unit_tolerance">Test-unit
tolerance</a>
</h5>
<p>
We can define a per-<a class="link" href="../../section_glossary.html#ref_test_unit">test unit</a> tolerance
for a given floating point type by using <a class="link" href="../../tests_organization/decorators.html" title="Decorators">decorator</a>
It is possible to define a per-<a class="link" href="../../section_glossary.html#ref_test_unit">test unit</a>
tolerance for a given floating point type by using <a class="link" href="../../tests_organization/decorators.html" title="Decorators">decorator</a>
<a class="link" href="../../utf_reference/testing_tool_ref/decorator_tolerance.html" title="tolerance (decorator)"><code class="computeroutput"><span class="identifier">tolerance</span></code></a>:
</p>
<h6>
<a name="boost_test.testing_tools.extended_comparison.floating_point.h0"></a>
<a name="boost_test.testing_tools.extended_comparison.floating_point.h1"></a>
<span class="phrase"><a name="boost_test.testing_tools.extended_comparison.floating_point.example_descr"></a></span><a class="link" href="floating_point.html#boost_test.testing_tools.extended_comparison.floating_point.example_descr">Example:
specifying tolerance per test case</a>
</h6>
@@ -94,16 +110,18 @@
</pre>
</td></tr></tbody>
</table></div>
<p>
How the tolerance parameter is processed in detail is described <a class="link" href="floating_point/floating_points_comparison_impl.html" title="Tolerance-based comparisons">here</a>.
</p>
<h5>
<a name="boost_test.testing_tools.extended_comparison.floating_point.h2"></a>
<span class="phrase"><a name="boost_test.testing_tools.extended_comparison.floating_point.assertion_tolerance"></a></span><a class="link" href="floating_point.html#boost_test.testing_tools.extended_comparison.floating_point.assertion_tolerance">Assertion
tolerance</a>
</h5>
<p>
It is possible to specify floating point comparison tolerance per single
assertion, by providing <span class="emphasis"><em>manipulator</em></span> <code class="computeroutput"><a class="link" href="../../../boost/test_tools/tolerance.html" title="Function tolerance">boost::test_tools::tolerance</a></code>
as the second argument to <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a>.
assertion, by providing the <span class="emphasis"><em>manipulator</em></span> <code class="computeroutput"><a class="link" href="../../../boost/test_tools/tolerance.html" title="Function tolerance">boost::test_tools::tolerance</a></code>
as the second argument to <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a>:
</p>
<h6>
<a name="boost_test.testing_tools.extended_comparison.floating_point.h1"></a>
<a name="boost_test.testing_tools.extended_comparison.floating_point.h3"></a>
<span class="phrase"><a name="boost_test.testing_tools.extended_comparison.floating_point.example_descr0"></a></span><a class="link" href="floating_point.html#boost_test.testing_tools.extended_comparison.floating_point.example_descr0">Example:
specifying tolerance per assertion</a>
</h6>
@@ -157,14 +175,17 @@
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>
The support for manipulators requires that your compiler supports variadic
macros, <code class="computeroutput"><span class="keyword">auto</span></code> for type deduction
and <code class="computeroutput"><span class="keyword">decltype</span></code>. These are
C++11 features, but are also available on some pre-C++11 compilers. On
compilers that are lacking these features resort to defining tolerance
per test unit, or to compatibility test assertions: <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_level_close.html" title="BOOST_&lt;level&gt;_CLOSE"><code class="computeroutput"><span class="identifier">BOOST_CHECK_CLOSE</span></code></a> and <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_level_small.html" title="BOOST_&lt;level&gt;_SMALL"><code class="computeroutput"><span class="identifier">BOOST_CHECK_SMALL</span></code></a>.
Manipulators requires a compiler that supports variadic macros, <code class="computeroutput"><span class="keyword">auto</span></code> for type deduction and <code class="computeroutput"><span class="keyword">decltype</span></code>. These are C++11 features, but
are also available on some pre-C++11 compilers. On compilers that are
lacking these features, resort to defining tolerance per test unit or
to compatibility test assertions: <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_level_close.html" title="BOOST_&lt;level&gt;_CLOSE"><code class="computeroutput"><span class="identifier">BOOST_CHECK_CLOSE</span></code></a> and <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_level_small.html" title="BOOST_&lt;level&gt;_SMALL"><code class="computeroutput"><span class="identifier">BOOST_CHECK_SMALL</span></code></a>.
</p></td></tr>
</table></div>
<h5>
<a name="boost_test.testing_tools.extended_comparison.floating_point.h4"></a>
<span class="phrase"><a name="boost_test.testing_tools.extended_comparison.floating_point.tolerance_expressed_in_percentag"></a></span><a class="link" href="floating_point.html#boost_test.testing_tools.extended_comparison.floating_point.tolerance_expressed_in_percentag">Tolerance
expressed in percentage</a>
</h5>
<p>
It is possible to specify the tolerance as percentage. At test unit level,
the decorator syntax is:
@@ -179,6 +200,11 @@
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">test_tools</span><span class="special">::</span><span class="identifier">tolerance</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">test_tools</span><span class="special">::</span><span class="identifier">fpc</span><span class="special">::</span><span class="identifier">percent_tolerance</span><span class="special">(</span><span class="number">2.0</span><span class="special">)</span> <span class="special">)</span>
<span class="comment">// both equivalent to: boost::test_tools::tolerance( 2.0 / 100 )</span>
</pre>
<h5>
<a name="boost_test.testing_tools.extended_comparison.floating_point.h5"></a>
<span class="phrase"><a name="boost_test.testing_tools.extended_comparison.floating_point.type_of_the_tolerance"></a></span><a class="link" href="floating_point.html#boost_test.testing_tools.extended_comparison.floating_point.type_of_the_tolerance">Type
of the tolerance</a>
</h5>
<p>
Manipulator <code class="computeroutput"><span class="identifier">tolerance</span></code> specifies
the tolerance only for a single floating-point type. This type is deduced
@@ -314,9 +340,9 @@
</table></div>
<p>
This is also the case for decorator <code class="computeroutput"><span class="identifier">tolerance</span></code>.
In case of the decorator, however, it is possible to apply multiple decorators
<code class="computeroutput"><span class="identifier">tolerance</span></code> defining the
tolerance for different types.
In the case of the decorator however, it is possible to apply multiple
decorators <code class="computeroutput"><span class="identifier">tolerance</span></code> defining
the tolerance for different types.
</p>
<p>
When values of two different floating point types <code class="computeroutput"><span class="identifier">T</span></code>
@@ -330,12 +356,30 @@
and <code class="computeroutput"><span class="identifier">U</span></code> and their common
type <code class="computeroutput"><span class="identifier">C</span></code>, the tolerance specified
for type <code class="computeroutput"><span class="identifier">C</span></code> is applied only
when types <code class="computeroutput"><span class="identifier">T</span></code> and <code class="computeroutput"><span class="identifier">U</span></code> are appear as sub-expressions of the
full expression inside assertion <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a>. It is not applied
when types <code class="computeroutput"><span class="identifier">T</span></code> and <code class="computeroutput"><span class="identifier">U</span></code> appear as sub-expressions of the full
expression inside assertion <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a>. It is not applied
when <code class="computeroutput"><span class="identifier">T</span></code> and <code class="computeroutput"><span class="identifier">U</span></code> are compared inside a function invoked
during the evaluation of the expression:
</p>
<pre class="programlisting"><span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span><span class="identifier">test</span><span class="special">,</span> <span class="special">*</span> <span class="identifier">utf</span><span class="special">::</span><span class="identifier">tolerance</span><span class="special">(</span><span class="number">0.02</span><span class="special">))</span>
<h6>
<a name="boost_test.testing_tools.extended_comparison.floating_point.h6"></a>
<span class="phrase"><a name="boost_test.testing_tools.extended_comparison.floating_point.example_descr1"></a></span><a class="link" href="floating_point.html#boost_test.testing_tools.extended_comparison.floating_point.example_descr1">Example:
tolerance applied to different types</a>
</h6>
<div class="informaltable"><table class="table">
<colgroup><col></colgroup>
<thead><tr><th>
<p>
Code
</p>
</th></tr></thead>
<tbody><tr><td>
<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">tolerance_05</span>
<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>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">optional</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">optional</span><span class="special">/</span><span class="identifier">optional_io</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span><span class="identifier">test</span><span class="special">,</span> <span class="special">*</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">unit_test</span><span class="special">::</span><span class="identifier">tolerance</span><span class="special">(</span><span class="number">0.02</span><span class="special">))</span>
<span class="special">{</span>
<span class="keyword">double</span> <span class="identifier">d1</span> <span class="special">=</span> <span class="number">1.00</span><span class="special">,</span> <span class="identifier">d2</span> <span class="special">=</span> <span class="number">0.99</span><span class="special">;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">optional</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">o1</span> <span class="special">=</span> <span class="number">1.00</span><span class="special">,</span> <span class="identifier">o2</span> <span class="special">=</span> <span class="number">0.99</span><span class="special">;</span>
@@ -346,15 +390,134 @@
<span class="identifier">BOOST_TEST</span><span class="special">(*</span><span class="identifier">o1</span> <span class="special">==</span> <span class="special">*</span><span class="identifier">o2</span><span class="special">);</span> <span class="comment">// with tolerance (double vs. double)</span>
<span class="special">}</span>
</pre>
</td></tr></tbody>
</table></div>
<div class="informaltable"><table class="table">
<colgroup><col></colgroup>
<thead><tr><th>
<p>
Output
</p>
</th></tr></thead>
<tbody><tr><td>
<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="special">&gt;</span> <span class="identifier">tolerance_05</span>
<span class="identifier">Running</span> <span class="number">1</span> <span class="identifier">test</span> <span class="keyword">case</span><span class="special">...</span>
<span class="special">../</span><span class="identifier">doc</span><span class="special">/</span><span class="identifier">examples</span><span class="special">/</span><span class="identifier">tolerance_05</span><span class="special">.</span><span class="identifier">run</span><span class="special">.</span><span class="identifier">cpp</span><span class="special">(</span><span class="number">20</span><span class="special">):</span> <span class="identifier">error</span><span class="special">:</span> <span class="identifier">in</span> <span class="string">"test"</span><span class="special">:</span> <span class="identifier">check</span> <span class="identifier">o1</span> <span class="special">==</span> <span class="identifier">o2</span> <span class="identifier">has</span> <span class="identifier">failed</span> <span class="special">[</span> <span class="number">1</span> <span class="special">!=</span> <span class="number">0.99</span><span class="special">]</span>
<span class="special">../</span><span class="identifier">doc</span><span class="special">/</span><span class="identifier">examples</span><span class="special">/</span><span class="identifier">tolerance_05</span><span class="special">.</span><span class="identifier">run</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="special">:</span> <span class="identifier">in</span> <span class="string">"test"</span><span class="special">:</span> <span class="identifier">check</span> <span class="identifier">o1</span> <span class="special">==</span> <span class="identifier">d2</span> <span class="identifier">has</span> <span class="identifier">failed</span> <span class="special">[</span> <span class="number">1</span> <span class="special">!=</span> <span class="number">0.98999999999999999</span><span class="special">]</span>
<span class="special">***</span> <span class="number">2</span> <span class="identifier">failures</span> <span class="identifier">are</span> <span class="identifier">detected</span> <span class="identifier">in</span> <span class="identifier">the</span> <span class="identifier">test</span> <span class="identifier">module</span> <span class="string">"tolerance_05"</span>
</pre>
</td></tr></tbody>
</table></div>
<h5>
<a name="boost_test.testing_tools.extended_comparison.floating_point.h7"></a>
<span class="phrase"><a name="boost_test.testing_tools.extended_comparison.floating_point.type_promotion_of_the_operands"></a></span><a class="link" href="floating_point.html#boost_test.testing_tools.extended_comparison.floating_point.type_promotion_of_the_operands">Type
promotion of the operands</a>
</h5>
<p>
Given two types <code class="computeroutput"><span class="identifier">T</span></code> and
<code class="computeroutput"><span class="identifier">U</span></code> being compared inside
an assertion <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a>, tolerance based comparison
is invoked
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
whenever the types <code class="computeroutput"><span class="identifier">T</span></code>
and <code class="computeroutput"><span class="identifier">U</span></code> are both <a class="link" href="floating_point/customizing_for_tolerance.html" title="Enabling tolerance for user-defined types">tolerance
based</a> types
</li>
<li class="listitem">
whenever <code class="computeroutput"><span class="identifier">T</span></code> is <span class="emphasis"><em>tolerance</em></span>
based and <code class="computeroutput"><span class="identifier">U</span></code> is <span class="emphasis"><em>arithmetic</em></span>,
in the sense that <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&gt;::</span><span class="identifier">value</span></code>
evaluates to <code class="computeroutput"><span class="keyword">true</span></code> (or
the other way round)
</li>
</ol></div>
<p>
In all cases, the type of the tolerance is deduced as <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">&gt;::</span><span class="identifier">type</span></code>, and both type may be cast to this
tolerance type.
</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top">
<p>
This behavior has been introduced in Boost 1.70 / <span class="emphasis"><em>Unit Test
Framework</em></span> <a class="link" href="../../change_log.html#ref_CHANGE_LOG_3_10">3.10</a>.
Previously tolerance based comparison was used only when the type of
the two operands were tolerance based types, which was silently ignoring
the tolerance for expressions such as
</p>
<pre class="programlisting"><span class="keyword">double</span> <span class="identifier">x</span> <span class="special">=</span> <span class="number">1E-9</span><span class="special">;</span>
<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">x</span> <span class="special">==</span> <span class="number">0</span><span class="special">);</span> <span class="comment">// U is int</span>
</pre>
</td></tr>
</table></div>
<h6>
<a name="boost_test.testing_tools.extended_comparison.floating_point.h8"></a>
<span class="phrase"><a name="boost_test.testing_tools.extended_comparison.floating_point.example_descr2"></a></span><a class="link" href="floating_point.html#boost_test.testing_tools.extended_comparison.floating_point.example_descr2">Example:
operands type promotion</a>
</h6>
<div class="informaltable"><table class="table">
<colgroup><col></colgroup>
<thead><tr><th>
<p>
Code
</p>
</th></tr></thead>
<tbody><tr><td>
<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">tolerance_06</span>
<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>
<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>
<span class="keyword">namespace</span> <span class="identifier">tt</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">test_tools</span><span class="special">;</span>
<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span><span class="identifier">test1</span><span class="special">,</span> <span class="special">*</span> <span class="identifier">utf</span><span class="special">::</span><span class="identifier">tolerance</span><span class="special">(</span><span class="number">0.1415</span> <span class="special">/</span> <span class="number">3</span><span class="special">))</span> <span class="comment">// == 0.047166667</span>
<span class="special">{</span>
<span class="keyword">double</span> <span class="identifier">x</span> <span class="special">=</span> <span class="number">3.141592404915836</span><span class="special">;</span>
<span class="comment">// x is 'double' which is tolerance based, 3 is 'int' which is arithmetic:</span>
<span class="comment">// tolerance based comparison will be used.</span>
<span class="comment">// Type of tolerance for this comparison will be boost::common_type&lt;double, int&gt;::type == double</span>
<span class="comment">// Value for this tolerance type is set by the decorator.</span>
<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">x</span> <span class="special">==</span> <span class="number">3</span><span class="special">);</span>
<span class="special">}</span>
</pre>
</td></tr></tbody>
</table></div>
<div class="informaltable"><table class="table">
<colgroup><col></colgroup>
<thead><tr><th>
<p>
Output
</p>
</th></tr></thead>
<tbody><tr><td>
<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="special">&gt;</span> <span class="identifier">tolerance_06</span>
<span class="identifier">Running</span> <span class="number">1</span> <span class="identifier">test</span> <span class="keyword">case</span><span class="special">...</span>
<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="special">:</span> <span class="identifier">in</span> <span class="string">"test1"</span><span class="special">:</span> <span class="identifier">check</span> <span class="identifier">x</span> <span class="special">==</span> <span class="number">3</span> <span class="identifier">has</span> <span class="identifier">failed</span> <span class="special">[</span><span class="number">3.1415924049158361</span> <span class="special">!=</span> <span class="number">3</span><span class="special">].</span> <span class="identifier">Relative</span> <span class="identifier">difference</span> <span class="identifier">exceeds</span> <span class="identifier">tolerance</span> <span class="special">[</span><span class="number">0.0471975</span> <span class="special">&gt;</span> <span class="number">0.0471667</span><span class="special">]</span>
<span class="special">***</span> <span class="number">1</span> <span class="identifier">failure</span> <span class="identifier">is</span> <span class="identifier">detected</span> <span class="identifier">in</span> <span class="identifier">the</span> <span class="identifier">test</span> <span class="identifier">module</span> <span class="string">"tolerance_06"</span>
</pre>
</td></tr></tbody>
</table></div>
<h5>
<a name="boost_test.testing_tools.extended_comparison.floating_point.h9"></a>
<span class="phrase"><a name="boost_test.testing_tools.extended_comparison.floating_point.other_relational_operators"></a></span><a class="link" href="floating_point.html#boost_test.testing_tools.extended_comparison.floating_point.other_relational_operators">Other
relational operators</a>
</h5>
<p>
Finally, note that comparisons for tolerance are also applied to <code class="computeroutput"><span class="keyword">operator</span><span class="special">&lt;</span></code>
with semantics 'less by more than some tolerance`, and other relational
operators. Also, the tolerance-based comparisons are involved when a more
complicated expression tree is processed within the assertion body:
with semantics <span class="emphasis"><em>less by more than some tolerance</em></span>, and
other relational operators. Also, the tolerance-based comparisons are involved
when a more complicated expression tree is processed within the assertion
body. The section on <a class="link" href="floating_point/floating_points_comparison_impl.html#boost_test.testing_tools.extended_comparison.floating_point.floating_points_comparison_impl.tolerance_in_operator">relational
operators</a> defines how <code class="computeroutput"><span class="keyword">operator</span><span class="special">&lt;</span></code> relates to tolerance.
</p>
<h6>
<a name="boost_test.testing_tools.extended_comparison.floating_point.h2"></a>
<span class="phrase"><a name="boost_test.testing_tools.extended_comparison.floating_point.example_descr1"></a></span><a class="link" href="floating_point.html#boost_test.testing_tools.extended_comparison.floating_point.example_descr1">Example:
<a name="boost_test.testing_tools.extended_comparison.floating_point.h10"></a>
<span class="phrase"><a name="boost_test.testing_tools.extended_comparison.floating_point.example_descr3"></a></span><a class="link" href="floating_point.html#boost_test.testing_tools.extended_comparison.floating_point.example_descr3">Example:
tolerance applied in more complex expressions</a>
</h6>
<div class="informaltable"><table class="table">
@@ -413,7 +576,7 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Enabling tolerance for user-defined types</title>
<link rel="stylesheet" href="../../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -31,8 +31,9 @@
The <span class="emphasis"><em>Unit Test Framework</em></span> recognizes that a given
type <code class="computeroutput"><span class="identifier">T</span></code> is suitable for
tolerance-based comparisons using the expression <code class="computeroutput"><a class="link" href="../../../../boost/math/fpc/tolerance_based.html" title="Struct template tolerance_based">boost::math::fpc::tolerance_based</a></code><code class="computeroutput"><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">value</span></code>.
This meta-function already returns true for built-in floating-point types
as well as any other types that match the following compile-time expression:
This meta-function already returns <code class="computeroutput"><span class="keyword">true</span></code>
for built-in floating-point types as well as any other types that match
the following compile-time expression:
</p>
<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_floating_point</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">value</span> <span class="special">||</span>
<span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">is_specialized</span> <span class="special">&amp;&amp;</span>
@@ -117,7 +118,7 @@
of</a>
</h5>
<p>
<code class="computeroutput"><span class="identifier">MoveConstructible</span></code>, <a href="http://www.sgi.com/tech/stl/EqualityComparable.html" target="_top"><code class="computeroutput"><span class="identifier">EqualityComparable</span></code></a>, <a href="http://www.sgi.com/tech/stl/LessThanComparable.html" target="_top"><code class="computeroutput"><span class="identifier">LessThanComparable</span></code></a>
<a href="https://en.cppreference.com/w/cpp/named_req/MoveConstructible" target="_top"><code class="computeroutput"><span class="identifier">MoveConstructible</span></code></a>, <a href="https://en.cppreference.com/w/cpp/named_req/EqualityComparable" target="_top"><code class="computeroutput"><span class="identifier">EqualityComparable</span></code></a>, <a href="https://en.cppreference.com/w/cpp/named_req/LessThanComparable" target="_top"><code class="computeroutput"><span class="identifier">LessThanComparable</span></code></a>
</p>
<h5>
<a name="boost_test.testing_tools.extended_comparison.floating_point.customizing_for_tolerance.h3"></a>
@@ -395,7 +396,7 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Tolerance-based comparisons</title>
<link rel="stylesheet" href="../../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -147,7 +147,7 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Theory behind floating point comparisons</title>
<link rel="stylesheet" href="../../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -71,7 +71,7 @@
necessarily implies <a class="link" href="floating_points_comparison_theory.html#equ3">(3)</a>.
</p>
<p>
The multiplication in the right side of inequations may cause an unwanted
The multiplication in the right side of inequalities may cause an unwanted
underflow condition. To prevent this, the implementation is using modified
version of <a class="link" href="floating_points_comparison_theory.html#equ2">(2)</a> and <a class="link" href="floating_points_comparison_theory.html#equ3">(3)</a>,
which scales the checked difference rather than <code class="computeroutput"><span class="identifier">epsilon</span></code>:
@@ -190,7 +190,7 @@
<dd><p>
Donald. E. Knuth, 1998, Addison-Wesley Longman, Inc., ISBN 0-201-89684-2,
Addison-Wesley Professional; 3rd edition. (The relevant equations
are in &#167;4.2.2, Eq. 36 and 37.)
are in §4.2.2, Eq. 36 and 37.)
</p></dd>
<dt><span class="term">Rounding near zero, in <a href="http://www.amazon.com/Advanced-Arithmetic-Digital-Computer-Kulisch/dp/3211838708" target="_top">Advanced
Arithmetic for the Digital Computer</a></span></dt>
@@ -247,7 +247,7 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Strings and C-strings comparison</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -32,11 +32,12 @@
type of the the pointers are <code class="computeroutput"><span class="keyword">char</span><span class="special">*</span></code> or <code class="computeroutput"><span class="keyword">wchar_t</span><span class="special">*</span></code>, <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a> promotes them as null
terminated <code class="computeroutput"><span class="keyword">char</span></code> arrays and
string comparison is used instead. <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>
(or any <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span></code>) is eligible for string
(or any <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span></code>) and <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string_view</span></code>
(or any <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string_view</span></code>) are eligible for string
comparison.
</p>
<p>
String comparison can be used only if the the operands to compare in <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a> can both be considered
String comparison can be used only if the operands to compare in <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a> can both be considered
as strings type.
</p>
<div class="tip"><table border="0" summary="Tip">
@@ -45,8 +46,8 @@
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>
In this form, the comparison method and reporting can be overridden an
additional argument to <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a>. See the <a class="link" href="collections.html" title="Collections comparison">collection
In this form, the comparison method and reporting can be overridden by
providing an additional argument to <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a>. See the <a class="link" href="collections.html" title="Collections comparison">collection
comparison</a> section for more details, in particular <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">test_tools</span><span class="special">::</span><span class="identifier">per_element</span><span class="special">()</span></code>
and <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">test_tools</span><span class="special">::</span><span class="identifier">lexicographic</span><span class="special">()</span></code>
modifiers.
@@ -116,10 +117,20 @@
</pre>
</td></tr></tbody>
</table></div>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string_view</span></code> support added in Boost.Test
<a class="link" href="../../change_log.html#ref_CHANGE_LOG_3_12">Boost 1.72</a>.
</p></td></tr>
</table></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>BOOST_TEST: details on expressions</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -254,7 +254,7 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Output streams testing tool</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -124,7 +124,7 @@
<tbody><tr><td>
<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>
<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>
<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">output_test_stream</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<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">tools</span><span class="special">/</span><span class="identifier">output_test_stream</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">test_tools</span><span class="special">::</span><span class="identifier">output_test_stream</span><span class="special">;</span>
<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">test</span> <span class="special">)</span>
@@ -211,12 +211,12 @@ File: test.cpp Line:XXX
<tbody><tr><td>
<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>
<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>
<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">output_test_stream</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<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">tools</span><span class="special">/</span><span class="identifier">output_test_stream</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">test_tools</span><span class="special">::</span><span class="identifier">output_test_stream</span><span class="special">;</span>
<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">test</span> <span class="special">)</span>
<span class="special">{</span>
<span class="identifier">output_test_stream</span> <span class="identifier">output</span><span class="special">(</span> <span class="string">"pattern_file"</span><span class="special">,</span> <span class="keyword">true</span> <span class="special">);</span>
<span class="identifier">output_test_stream</span> <span class="identifier">output</span><span class="special">(</span> <span class="string">"pattern_file"</span><span class="special">,</span> <span class="special">!</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unit_test</span><span class="special">::</span><span class="identifier">runtime_config</span><span class="special">::</span><span class="identifier">save_pattern</span><span class="special">()</span> <span class="special">);</span>
<span class="keyword">int</span> <span class="identifier">i</span><span class="special">=</span><span class="number">2</span><span class="special">;</span>
<span class="identifier">output</span> <span class="special">&lt;&lt;</span> <span class="string">"i="</span> <span class="special">&lt;&lt;</span> <span class="identifier">i</span><span class="special">;</span>
<span class="identifier">BOOST_TEST</span><span class="special">(</span> <span class="identifier">output</span><span class="special">.</span><span class="identifier">match_pattern</span><span class="special">()</span> <span class="special">);</span>
@@ -270,7 +270,7 @@ File: test.cpp Line:XXX
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Reported information</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -188,8 +188,8 @@
</h4>
<p>
While perfectly exact and precise, the file name, test case name, line number
of a failed statement carries an information that is partial with regards
to the meaning of the failed statement. Sometimes these information are not
of a failed statement carry an information that is partial with regards to
the meaning of the failed statement. Sometimes these information are not
informative enough. The <code class="computeroutput"><span class="identifier">BOOST_TEST</span></code>
macro let you override the default message by the use of a second argument,
as shown on the following example.
@@ -243,7 +243,7 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Summary of the API for writing tests</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -418,7 +418,7 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Time-out for test cases</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -28,9 +28,33 @@
</h3></div></div></div>
<p>
The <span class="emphasis"><em>Unit Test Framework</em></span> provides the decorator <a class="link" href="../utf_reference/testing_tool_ref/decorator_timeout.html" title="timeout (decorator)"><code class="computeroutput"><span class="identifier">timeout</span></code></a> that specifies a time-out
for a specific <span class="bold"><strong>test case</strong></span>, The argument time
(in seconds) sets the maximum allowed duration of a test case. If this time
is exceeded the test case is forced to stop and is reported as failure.
for a specific <span class="bold"><strong>test unit</strong></span>. The argument time
is always expressed in <span class="bold"><strong>seconds ans wall-clock</strong></span>
time.
</p>
<p>
For test-cases, the time-out value sets the maximum allowed duration for
the test. If this time is exceeded, the test case is reported as failed.
On some systems, the <span class="emphasis"><em>Unit Test Framework</em></span> is able to
force the test-case to stop through a <code class="computeroutput"><span class="identifier">SIGALRM</span></code>
signal (see below).
</p>
<p>
For test-suites, the time-out value sets the maximum allowed duration for
the entire suite to complete. This duration is the accumulated time of all
the test-cases contained in the sub-tree rooted on the test-suite, plus some
extra execution time needed by the <span class="emphasis"><em>Unit Test Framework</em></span>.
For each test-units under a test-suite with time-out, the maximum allowed
duration is set as being the test-suite time out minus the accumulated execution
time before the execution of the test-unit. If this test-unit is a test-case,
it is equivalent to setting the decorator <a class="link" href="../utf_reference/testing_tool_ref/decorator_timeout.html" title="timeout (decorator)"><code class="computeroutput"><span class="identifier">timeout</span></code></a> to the test-case with a
time-out value expressed as before.
</p>
<p>
In case the test-suite times out, the suite is flagged as <code class="computeroutput"><span class="identifier">timed</span><span class="special">-</span><span class="identifier">out</span></code> and
<code class="computeroutput"><span class="identifier">failed</span></code>, and all the test
units (suites and cases) that have not been executed up to the time-out point
are all skipped.
</p>
<h6>
<a name="boost_test.testing_tools.timeout.h0"></a>
@@ -84,23 +108,27 @@
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
Applied at test suite level, this decorator has no effect.
The macro <code class="computeroutput"><span class="identifier">BOOST_SIGACTION_BASED_SIGNAL_HANDLING</span></code>
is defined if Boost.Test is able to force the test-case to stop. This feature
is for instance not supported on Windows. The <span class="emphasis"><em>Unit Test Framework</em></span>
will still be able to report the test-case as failed (once the test-case
finishes).
</p></td></tr>
</table></div>
<div class="caution"><table border="0" summary="Caution">
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../../../doc/src/images/caution.png"></td>
<th align="left">Caution</th>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
Decorator <code class="computeroutput"><span class="identifier">timeout</span></code> has no
effect on Windows build. This feature is not implemented on Windows yet.
The support of test suite level time-out has been added in <a class="link" href="../change_log.html#ref_CHANGE_LOG_3_10">Boost
1.70 / <span class="emphasis"><em>Unit Test Framework</em></span> v3.10</a>
</p></td></tr>
</table></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>

View File

@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Assertion severity level</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
@@ -85,7 +85,7 @@
</li>
</ol></div>
<div class="table">
<a name="boost_test.testing_tools.tools_assertion_severity_level.assertions_severity_levels"></a><p class="title"><b>Table&#160;3.&#160;Assertions severity levels</b></p>
<a name="boost_test.testing_tools.tools_assertion_severity_level.assertions_severity_levels"></a><p class="title"><b>Table 3. Assertions severity levels</b></p>
<div class="table-contents"><table class="table" summary="Assertions severity levels">
<colgroup>
<col>
@@ -221,7 +221,7 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2017 Boost.Test contributors<p>
<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>