• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>BOOST_&lt;level&gt;_BITWISE_EQUAL</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_level.html" title="BOOST_&lt;level&gt;">
10<link rel="next" href="assertion_boost_level_eq.html" title="BOOST_&lt;level&gt;_EQUAL">
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_level.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_level_eq.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_level_bitwise_eq"></a><a class="link" href="assertion_boost_level_bitwise_eq.html" title="BOOST_&lt;level&gt;_BITWISE_EQUAL"><code class="computeroutput"><span class="identifier">BOOST_</span><span class="special">&lt;</span><span class="identifier">level</span><span class="special">&gt;</span><span class="identifier">_BITWISE_EQUAL</span></code></a>
28</h4></div></div></div>
29<pre class="programlisting"><span class="identifier">BOOST_WARN_BITWISE_EQUAL</span><span class="special">(</span><span class="identifier">left</span><span class="special">,</span> <span class="identifier">right</span><span class="special">);</span>
30<span class="identifier">BOOST_CHECK_BITWISE_EQUAL</span><span class="special">(</span><span class="identifier">left</span><span class="special">,</span> <span class="identifier">right</span><span class="special">);</span>
31<span class="identifier">BOOST_REQUIRE_BITWISE_EQUAL</span><span class="special">(</span><span class="identifier">left</span><span class="special">,</span> <span class="identifier">right</span><span class="special">);</span>
32</pre>
33<p>
34          These tools are used to perform bitwise comparison of two values. The check
35          shows all positions where left and right value's bits mismatch.
36        </p>
37<p>
38          The first parameter is the left compared value. The second parameter is
39          the right compared value. Parameters are not required to be of the same
40          type, but warning is issued if their type's size does not coincide.
41        </p>
42<h6>
43<a name="boost_test.utf_reference.testing_tool_ref.assertion_boost_level_bitwise_eq.h0"></a>
44          <span class="phrase"><a name="boost_test.utf_reference.testing_tool_ref.assertion_boost_level_bitwise_eq.example_descr"></a></span><a class="link" href="assertion_boost_level_bitwise_eq.html#boost_test.utf_reference.testing_tool_ref.assertion_boost_level_bitwise_eq.example_descr">Example:
45          BOOST_&lt;level&gt;_BITWISE_EQUAL usage</a>
46        </h6>
47<div class="informaltable"><table class="table">
48<colgroup><col></colgroup>
49<thead><tr><th>
50                  <p>
51                    Code
52                  </p>
53                </th></tr></thead>
54<tbody><tr><td>
55<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>
56<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>
57
58<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">test</span> <span class="special">)</span>
59<span class="special">{</span>
60  <span class="identifier">BOOST_CHECK_BITWISE_EQUAL</span><span class="special">(</span> <span class="special">(</span><span class="keyword">char</span><span class="special">)</span><span class="number">0x26</span><span class="special">,</span> <span class="number">0x04</span> <span class="special">);</span>
61<span class="special">}</span>
62</pre>
63                </td></tr></tbody>
64</table></div>
65<div class="informaltable"><table class="table">
66<colgroup><col></colgroup>
67<thead><tr><th>
68                  <p>
69                    Output
70                  </p>
71                </th></tr></thead>
72<tbody><tr><td>
73<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="special">&gt;</span> <span class="identifier">example</span>
74<span class="identifier">Running</span> <span class="number">1</span> <span class="identifier">test</span> <span class="keyword">case</span><span class="special">...</span>
75<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">error</span> <span class="identifier">in</span> <span class="string">"test"</span><span class="special">:</span> <span class="identifier">check</span> <span class="special">(</span><span class="keyword">char</span><span class="special">)</span><span class="number">0x26</span> <span class="special">=.=</span> <span class="number">0x04</span> <span class="identifier">failed</span><span class="special">.</span>
76<span class="identifier">Mismatch</span> <span class="identifier">in</span> <span class="identifier">a</span> <span class="identifier">position</span> <span class="number">1</span>
77<span class="identifier">Mismatch</span> <span class="identifier">in</span> <span class="identifier">a</span> <span class="identifier">position</span> <span class="number">5</span>
78<span class="identifier">Operands</span> <span class="identifier">bit</span> <span class="identifier">sizes</span> <span class="identifier">mismatch</span><span class="special">:</span> <span class="number">8</span> <span class="special">!=</span> <span class="number">32</span>
79
80<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>
81</pre>
82                </td></tr></tbody>
83</table></div>
84<p>
85          See also:
86        </p>
87<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
88              <a class="link" href="assertion_boost_level_eq.html" title="BOOST_&lt;level&gt;_EQUAL"><code class="computeroutput"><span class="identifier">BOOST_</span><span class="special">&lt;</span><span class="identifier">level</span><span class="special">&gt;</span><span class="identifier">_EQUAL</span></code></a>
89            </li></ul></div>
90</div>
91<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
92<td align="left"></td>
93<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
94        Distributed under the Boost Software License, Version 1.0. (See accompanying
95        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>)
96      </p>
97</div></td>
98</tr></table>
99<hr>
100<div class="spirit-nav">
101<a accesskey="p" href="assertion_boost_level.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_level_eq.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
102</div>
103</body>
104</html>
105