Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

libs/test/doc/src/examples/example31.cpp

#define BOOST_TEST_MODULE example
#include <boost/test/included/unit_test.hpp>

//____________________________________________________________________________//

boost::test_tools::predicate_result
compare_lists( std::list<int> const& l1, std::list<int> const& l2 )
{
    if( l1.size() != l2.size() ) {
        boost::test_tools::predicate_result res( false );

        res.message() << "Different sizes [" << l1.size() << "!=" << l2.size() << "]";

        return res;
    }

    return true;
}

//____________________________________________________________________________//

BOOST_AUTO_TEST_CASE( test_list_comparizon )
{
    std::list<int> l1, l2;
    l1.push_back( 1 );
    l1.push_back( 2 );

    BOOST_CHECK( compare_lists( l1, l2 ) );
}

//____________________________________________________________________________//