mirror of
https://github.com/boostorg/test.git
synced 2026-02-15 01:22:08 +00:00
60 lines
2.8 KiB
HTML
Executable File
60 lines
2.8 KiB
HTML
Executable File
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>The Test Tools</TITLE>
|
|
<LINK rel="stylesheet" type="text/css" href="../../../style/btl.css" media="screen">
|
|
<LINK rel="stylesheet" type="text/css" href="../../../style/btl-print.css" media="print">
|
|
<META http-equiv="Content-Language" content="en-us">
|
|
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<STYLE type="text/css">
|
|
H4
|
|
{
|
|
margin: 0px;
|
|
}
|
|
</STYLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<DIV class="body">
|
|
<H3>BOOST_WARN_EQUAL_COLLECTIONS( left_begin, left_end, right_begin, right_end
|
|
)<BR>
|
|
BOOST_CHECK_EQUAL_COLLECTIONS( left_begin, left_end, right_begin, right_end
|
|
)<BR>
|
|
BOOST_REQUIRE_EQUAL_COLLECTIONS( left_begin, left_end, right_begin, right_end
|
|
)</H3>
|
|
<P class="first-line-indented">These tools are used to perform an element by
|
|
element comparison of two collections. They print all mismatched
|
|
positions, collection elements at these positions and check that
|
|
the collections have the same size.</P>
|
|
<P class="first-line-indented">The first two parameters designate begin
|
|
and end of the first collection. The next two parameters designate begin
|
|
and end of the second collection. </P>
|
|
<H4>Example: test.cpp</H4>
|
|
<PRE class="code">#<SPAN class="reserv-word">define</SPAN> BOOST_TEST_MAIN<BR>#<SPAN class="reserv-word">include</SPAN> <<SPAN class="literal">boost/test/unit_test.hpp</SPAN>><BR>
|
|
BOOST_AUTO_TEST_CASE( test )
|
|
{
|
|
<SPAN class="cpp-type">int</SPAN> col1 [] = { <SPAN class="literal">1</SPAN>, <SPAN class="literal">2</SPAN>, <SPAN class="literal">3</SPAN>, <SPAN class="literal">4</SPAN>, <SPAN class="literal">5</SPAN>, <SPAN class="literal">6</SPAN>, <SPAN class="literal">7</SPAN> };
|
|
<SPAN class="cpp-type">int</SPAN> col2 [] = { <SPAN class="literal">1</SPAN>, <SPAN class="literal">2</SPAN>, <SPAN class="literal">4</SPAN>, <SPAN class="literal">4</SPAN>, <SPAN class="literal">5</SPAN>, <SPAN class="literal">7</SPAN>, <SPAN class="literal">7</SPAN> };
|
|
|
|
BOOST_CHECK_EQUAL_COLLECTIONS( col1, col1+<SPAN class="literal">7</SPAN>, col2, col2+7 );
|
|
}</PRE>
|
|
<H4>Output:</H4>
|
|
<P class="test-output">Running 1 test case...<BR>
|
|
test.cpp(9): error in "test": check { col1, col1+7 } == { col2,
|
|
col2+7 } failed.<BR>
|
|
Mismatch in a position 2: 3 != 4<BR>
|
|
Mismatch in a position 5: 6 != 7<BR>
|
|
<BR>
|
|
*** 1 failure detected in test suite "Master
|
|
Test Suite"
|
|
</P>
|
|
<DIV class="see_also">
|
|
<H4>See Also</H4>
|
|
<P class="see-also-content"><A href="BOOST_CHECK_EQUAL.html" target="descr">BOOST_CHECK_EQUAL</A></P>
|
|
</DIV>
|
|
</DIV>
|
|
</BODY>
|
|
</HTML>
|
|
<!-- Copyright Gennadiy Rozental 2001-2006.
|
|
Distributed under the Boost Software License, Version 1.0.
|
|
(See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt) -->
|