1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>BOOST_TEST</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_tool_ref.html" title="Reference API for writing tests"> 9<link rel="prev" href="../testing_tool_ref.html" title="Reference API for writing tests"> 10<link rel="next" href="decorator_expected_failures.html" title="expected_failures (decorator)"> 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="../testing_tool_ref.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../testing_tool_ref.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="decorator_expected_failures.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h4 class="title"> 27<a name="boost_test.utf_reference.testing_tool_ref.assertion_boost_test_universal_macro"></a><a class="link" href="assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a> 28</h4></div></div></div> 29<pre class="programlisting"><span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">statement</span><span class="special">);</span> 30<span class="identifier">BOOST_TEST_</span><span class="special"><</span><span class="identifier">level</span><span class="special">>(</span><span class="identifier">statement</span><span class="special">);</span> 31 32<span class="comment">// replacement failure message, requires variadic macros</span> 33<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">statement</span><span class="special">,</span> <span class="string">"failure message"</span><span class="special">);</span> 34 35<span class="comment">// Floating point comparison, requires variadic macros, auto and decltype</span> 36<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">statement</span><span class="special">,</span> <span class="identifier">floating_point_comparison_manipulation</span><span class="special">);</span> 37 38<span class="comment">// bitwise comparison, requires variadic macros, auto and decltype</span> 39<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">statement</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">bitwise</span><span class="special">()</span> <span class="special">);</span> 40 41<span class="comment">// element-wise comparison, for containers</span> 42<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">statement</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">per_element</span><span class="special">()</span> <span class="special">);</span> 43 44<span class="comment">// lexicographic comparison, for containers</span> 45<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">statement</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">lexicographic</span><span class="special">()</span> <span class="special">);</span> 46</pre> 47<p> 48 The full documentation of this macro is located <a class="link" href="../../testing_tools/boost_test_universal_macro.html" title="BOOST_TEST: universal and general purpose assertions">here</a>. 49 </p> 50<p> 51 The macro is available in three variants, corresponding to different <a class="link" href="../../testing_tools/tools_assertion_severity_level.html" title="Assertion severity level">assertion 52 severity levels</a>: 53 </p> 54<pre class="programlisting"><span class="identifier">BOOST_TEST</span> <span class="comment">// or BOOST_TEST_CHECK</span> 55<span class="identifier">BOOST_TEST_REQUIRE</span> 56<span class="identifier">BOOST_TEST_WARN</span> 57</pre> 58<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 59<li class="listitem"> 60 <code class="computeroutput"><span class="string">"failure message"</span></code> 61 is a C-string printed in case of failure in place of the default message. 62 See <a class="link" href="../../testing_tools/reports.html" title="Reported information">this section</a> 63 for more details. 64 </li> 65<li class="listitem"> 66 <code class="computeroutput"><span class="identifier">floating_point_comparison_manipulation</span></code> 67 is one of the floating point comparison manipulators. See <a class="link" href="../../testing_tools/boost_test_universal_macro.html" title="BOOST_TEST: universal and general purpose assertions">this 68 section</a> for more details. 69 </li> 70<li class="listitem"> 71 <code class="computeroutput"><a class="link" href="../../../boost/test_tools/bitwise.html" title="Struct bitwise">boost::test_tools::bitwise</a></code> 72 is a manipulator indicating that the comparison should be performed 73 bitwise. See <a class="link" href="../../testing_tools/extended_comparison/bitwise.html" title="Bitwise comparison">this 74 section</a> for more details 75 </li> 76<li class="listitem"> 77 <code class="computeroutput"><a class="link" href="../../../boost/test_tools/per_element.html" title="Struct per_element">boost::test_tools::per_element</a></code> 78 is a manipulator indicating that the comparison should be performed 79 on each element, in sequence, rather than on containers. See <a class="link" href="../../testing_tools/extended_comparison/collections.html#boost_test_coll_perelement">this section</a> for more details 80 </li> 81<li class="listitem"> 82 <code class="computeroutput"><a class="link" href="../../../boost/test_tools/lexicographic.html" title="Struct lexicographic">boost::test_tools::lexicographic</a></code> 83 is a manipulator indicating that the comparison should be performed 84 with the lexicographic order. See <a class="link" href="../../testing_tools/extended_comparison/collections.html#boost_test_coll_default_lex">this 85 section</a> for more details 86 </li> 87</ul></div> 88<h4> 89<a name="boost_test.utf_reference.testing_tool_ref.assertion_boost_test_universal_macro.h0"></a> 90 <span class="phrase"><a name="boost_test.utf_reference.testing_tool_ref.assertion_boost_test_universal_macro.limitations_and_workaround"></a></span><a class="link" href="assertion_boost_test_universal_macro.html#boost_test.utf_reference.testing_tool_ref.assertion_boost_test_universal_macro.limitations_and_workaround">Limitations 91 and workaround</a> 92 </h4> 93<p> 94 There are some restrictions on the statements that are supported by this 95 tool. Those are explained in details in <a class="link" href="../../testing_tools/boost_test_universal_macro.html#boost_test_statement_limitations">this</a> 96 section. 97 </p> 98</div> 99<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 100<td align="left"></td> 101<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p> 102 Distributed under the Boost Software License, Version 1.0. (See accompanying 103 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>) 104 </p> 105</div></td> 106</tr></table> 107<hr> 108<div class="spirit-nav"> 109<a accesskey="p" href="../testing_tool_ref.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../testing_tool_ref.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="decorator_expected_failures.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 110</div> 111</body> 112</html> 113