blob: ae86de7daf391b358f098a33693dbb8b159f03fd [file] [log] [blame]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>BOOST_TEST_MESSAGE</title>
<link rel="stylesheet" href="../../../../style/style.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
<link rel="home" href="../../../index.html" title="Boost Test Library">
<link rel="up" href="test-log.html" title="Test log output">
<link rel="prev" href="test-log.html" title="Test log output">
<link rel="next" href="BOOST_TEST_CHECKPOINT.html" title="BOOST_TEST_CHECKPOINT">
<script language="JavaScript1.2" src="../../../../js/boost-test.js"></script>
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table width="100%"><tr>
<td width="10%"><a href="../../../index.html"><img alt="Home" width="229" height="61" border="0" src="../../../../../../../libs/test/docbook/img/boost.test.logo.png"></a></td>
<td valign="middle" align="left"> &gt; <a href="../../../utf.html">The Unit Test Framework</a> &gt; <a href="../../user-guide.html">User's guide</a><a href="../../testing-tools.html">
&gt;
</a><a href="../test-output.html">Test Output </a><a href="../runtime-config.html">
&gt;
</a><a href="test-log.html">Test log</a><a href="results-report.html">
&gt;
</a><b>BOOST_TEST_MESSAGE</b>
</td>
<td><div class="spirit-nav">
<a href="test-log.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a href="BOOST_TEST_CHECKPOINT.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
</div></td>
</tr></table>
<hr>
<div class="section" lang="en">
<div class="titlepage"><div><div><h6 class="title">
<a name="utf.user-guide.test-output.log.BOOST_TEST_MESSAGE"></a>BOOST_TEST_MESSAGE</h6></div></div></div>
<p class="first-line-indented">
The macro BOOST_TEST_MESSAGE is intended to be used for the purpose of injecting an additional message into the
<acronym class="acronym">UTF</acronym> test log. These messages are not intended to indicate any error or warning conditions, but rather as
information/status notifications. The macro signature is as follows:
</p>
<pre class="inline-synopsis">
<a name="BOOST_TEST_MESSAGE"></a>BOOST_TEST_MESSAGE(<span class="emphasis"><em>test_message</em></span>)</pre>
<p class="first-line-indented">
The test_message argument can be as simple as C string literal or any custom expression that you can produce
with in a manner similar to standard iostream operation.
</p>
<div class="important"><table border="0" summary="Important">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../../../../../doc/html/images/important.png"></td>
<th align="left">Important</th>
</tr>
<tr><td align="left" valign="top"><p>
Messages generated by this tool do not appear in test log output with default value of the active log level
threshold. For these messages to appear the active log level threshold has to be set to a value below or equal
to "message".
</p></td></tr>
</table></div>
<div class="example">
<a name="utf.user-guide.test-output.log.BOOST_TEST_MESSAGE.example21"></a><p class="title"><b>Example 27. BOOST_TEST_MESSAGE usage</b></p>
<div class="example-contents">
<pre class="programlisting">#define BOOST_TEST_MODULE example
#include &lt;boost/test/included/unit_test.hpp&gt;
//____________________________________________________________________________//
BOOST_AUTO_TEST_CASE( test_init )
{
int current_time = 0; // real call is required here
BOOST_TEST_MESSAGE( "Testing initialization :" );
BOOST_TEST_MESSAGE( "Current time:" &lt;&lt; current_time );
}
//____________________________________________________________________________//
BOOST_AUTO_TEST_CASE( test_update )
{
std::string field_name = "Volume";
int value = 100;
BOOST_TEST_MESSAGE( "Testing update :" );
BOOST_TEST_MESSAGE( "Update " &lt;&lt; field_name &lt;&lt; " with " &lt;&lt; value );
}
//____________________________________________________________________________//
</pre>
<table class="simplelist" border="0" summary="Simple list"><tr>
<td><code class="literal"><a href="../../../../src/examples/example21.cpp" target="_top">Source code</a></code></td>
<td> | </td>
<td><code class="literal"><a href="#" target="_top" id="id654029" onclick="toggle_element( 'example21-output', 'id654029', 'Show output', 'Hide output' ); return false;">Show output</a></code></td>
</tr></table>
<pre class="example-output" id="example21-output">&gt; example --log_level=message
Running 2 test cases...
Testing initialization :
Current time:0
Testing update :
Update Volume with 100
*** No errors detected
</pre>
</div>
</div>
<br class="example-break">
</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 © 2001-2007 Gennadiy Rozental</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="test-log.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="test-log.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_TEST_CHECKPOINT.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
</div>
</body>
</html>