1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>BOOST_FAIL</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="assertion_boost_error.html" title="BOOST_ERROR"> 10<link rel="next" href="assertion_boost_is_defined.html" title="BOOST_IS_DEFINED"> 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="assertion_boost_error.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="assertion_boost_is_defined.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_fail"></a><a class="link" href="assertion_boost_fail.html" title="BOOST_FAIL"><code class="computeroutput"><span class="identifier">BOOST_FAIL</span></code></a> 28</h4></div></div></div> 29<pre class="programlisting"><span class="identifier">BOOST_FAIL</span><span class="special">(</span><span class="identifier">message</span><span class="special">);</span> 30</pre> 31<p> 32 <code class="computeroutput"><a class="link" href="assertion_boost_fail.html" title="BOOST_FAIL"><code class="computeroutput"><span class="identifier">BOOST_FAIL</span></code></a><span class="special">(</span><span class="identifier">message</span><span class="special">)</span></code> 33 behave the same way as <code class="computeroutput"><a class="link" href="assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST_REQUIRE</span></code></a><span class="special">(</span><span class="keyword">false</span><span class="special">,</span> <span class="identifier">message</span><span class="special">)</span></code>. 34 This tool is used for an unconditional error counter increasing, message 35 logging and the current test case aborting. 36 </p> 37<p> 38 The tool's only parameter is an error message to log. 39 </p> 40<h6> 41<a name="boost_test.utf_reference.testing_tool_ref.assertion_boost_fail.h0"></a> 42 <span class="phrase"><a name="boost_test.utf_reference.testing_tool_ref.assertion_boost_fail.example_descr"></a></span><a class="link" href="assertion_boost_fail.html#boost_test.utf_reference.testing_tool_ref.assertion_boost_fail.example_descr">Example: 43 BOOST_FAIL usage</a> 44 </h6> 45<div class="informaltable"><table class="table"> 46<colgroup><col></colgroup> 47<thead><tr><th> 48 <p> 49 Code 50 </p> 51 </th></tr></thead> 52<tbody><tr><td> 53<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> 54<span class="preprocessor">#include</span> <span class="special"><</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">></span> 55 56<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">test</span> <span class="special">)</span> 57<span class="special">{</span> 58 <span class="identifier">BOOST_FAIL</span><span class="special">(</span> <span class="string">"Test is not ready yet"</span> <span class="special">);</span> 59<span class="special">}</span> 60</pre> 61 </td></tr></tbody> 62</table></div> 63<div class="informaltable"><table class="table"> 64<colgroup><col></colgroup> 65<thead><tr><th> 66 <p> 67 Output 68 </p> 69 </th></tr></thead> 70<tbody><tr><td> 71<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="special">></span> <span class="identifier">example</span> 72<span class="identifier">Running</span> <span class="number">1</span> <span class="identifier">test</span> <span class="keyword">case</span><span class="special">...</span> 73<span class="identifier">test</span><span class="special">.</span><span class="identifier">cpp</span><span class="special">(</span><span class="number">8</span><span class="special">):</span> <span class="identifier">fatal</span> <span class="identifier">error</span> <span class="identifier">in</span> <span class="string">"test"</span><span class="special">:</span> <span class="identifier">Test</span> <span class="identifier">is</span> <span class="keyword">not</span> <span class="identifier">ready</span> <span class="identifier">yet</span> 74 75<span class="special">***</span> <span class="number">1</span> <span class="identifier">failures</span> <span class="identifier">is</span> <span class="identifier">detected</span> <span class="identifier">in</span> <span class="identifier">test</span> <span class="identifier">suite</span> <span class="string">"example"</span> 76</pre> 77 </td></tr></tbody> 78</table></div> 79<p> 80 See also: 81 </p> 82<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 83<li class="listitem"> 84 <a class="link" href="assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a> 85 </li> 86<li class="listitem"> 87</ul></div> 88</div> 89<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 90<td align="left"></td> 91<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p> 92 Distributed under the Boost Software License, Version 1.0. (See accompanying 93 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>) 94 </p> 95</div></td> 96</tr></table> 97<hr> 98<div class="spirit-nav"> 99<a accesskey="p" href="assertion_boost_error.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="assertion_boost_is_defined.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 100</div> 101</body> 102</html> 103