Avoid some warnings

This commit is contained in:
Gennadiy Rozental 2015-06-27 17:54:32 -04:00
parent f3bfd8f2e8
commit 743c67845f
18 changed files with 28 additions and 26 deletions

View File

@ -1,7 +0,0 @@
Running 1 test case...
test.cpp(18): error: in "test_collections_vectors": check a == b has failed.
Mismatch at position 1: 2 != 5.
test.cpp(22): error: in "test_collections_vectors": check b >= c has failed.
Second collection has extra trailing elements.
*** 2 failures are detected in the test module "boost_test_sequence"

View File

@ -14,7 +14,7 @@ BOOST_AUTO_TEST_CASE(test1)
BOOST_TEST(false);
}
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[])
boost::unit_test::test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[])
{
std::cout << "using obsolete init" << std::endl;
return 0;

View File

@ -16,6 +16,6 @@ namespace data = boost::unit_test::data;
BOOST_TEST_DECORATOR(* utf::description("with description"))
BOOST_DATA_TEST_CASE(test_1, data::xrange(4))
{
BOOST_TEST(true);
BOOST_TEST(sample >= 0);
}
//]

View File

@ -14,7 +14,7 @@ void free_test_function()
BOOST_TEST( true /* test assertion */ );
}
test_suite* init_unit_test_suite( int argc, char* argv[] )
test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
{
framework::master_test_suite().
add( BOOST_TEST_CASE( &free_test_function ) );

View File

@ -23,7 +23,7 @@ public:
}
};
test_suite* init_unit_test_suite( int argc, char* argv[] )
test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
{
boost::shared_ptr<test_class> tester( new test_class );

View File

@ -15,7 +15,7 @@ void free_test_function( int i )
BOOST_TEST( i < 4 /* test assertion */ );
}
test_suite* init_unit_test_suite( int argc, char* argv[] )
test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
{
int params[] = { 1, 2, 3, 4, 5 };

View File

@ -15,7 +15,7 @@ BOOST_TEST_CASE_TEMPLATE_FUNCTION( my_test, T )
BOOST_TEST( sizeof(T) == 4 );
}
test_suite* init_unit_test_suite( int argc, char* argv[] )
test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
{
typedef boost::mpl::list<int,long,unsigned char> test_types;

View File

@ -14,7 +14,7 @@ void test_case2() { /* ... */ }
void test_case3() { /* ... */ }
void test_case4() { /* ... */ }
test_suite* init_unit_test_suite( int argc, char* argv[] )
test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
{
test_suite* ts1 = BOOST_TEST_SUITE( "test_suite1" );
ts1->add( BOOST_TEST_CASE( &test_case1 ) );

View File

@ -14,7 +14,7 @@ void free_test_function()
BOOST_TEST( true /* test assertion */ );
}
test_suite* init_unit_test_suite( int argc, char* argv[] )
test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
{
if( framework::master_test_suite().argc > 1 )
return 0;

View File

@ -9,13 +9,12 @@
#include <boost/test/included/unit_test.hpp>
using namespace boost::unit_test;
BOOST_AUTO_TEST_CASE( free_test_function )
{
BOOST_TEST( true /* test assertion */ );
}
test_suite* init_unit_test_suite( int argc, char* argv[] )
test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
{
framework::master_test_suite().p_name.value = "my master test suite name";
return 0;

View File

@ -2,7 +2,7 @@
> example
Running 1 test case...
unknown location(0): fatal error in "test_external_interface": signal: integer divide by zero; address of failing instruction: 0x00048090
test.cpp(13): last checkpoint: Calling foo with i=1
test.cpp(9): last checkpoint: Calling foo with i=1
*** 1 failures is detected in test suite "example"
//]

View File

@ -19,8 +19,12 @@ BOOST_AUTO_TEST_CASE( test_external_interface )
}
}
void goo( int )
{
}
void foo( int i )
{
int j = 2/(i-1);
goo( 2/(i-1) );
}
//]

View File

@ -9,6 +9,8 @@
#define BOOST_TEST_MODULE example
#include <boost/test/included/unit_test.hpp>
void foo( int ) {}
BOOST_AUTO_TEST_CASE( test_case )
{
int* p = 0;
@ -20,6 +22,6 @@ BOOST_AUTO_TEST_CASE( test_case )
++p;
BOOST_TEST_PASSPOINT();
int j = *p;
foo( *p );
}
//]

View File

@ -17,8 +17,8 @@ BOOST_TEST_DONT_PRINT_LOG_VALUE( pair_type )
BOOST_AUTO_TEST_CASE( test_list )
{
pair_type p1( 2, 5.5 );
pair_type p2( 2, 5.501 );
pair_type p1( 2, 5.5f );
pair_type p2( 2, 5.501f );
BOOST_CHECK_EQUAL( p1, p2 );
}

View File

@ -1,7 +1,7 @@
//[example_output
> example
Running 1 test case...
test.cpp(16): error in "test": incorrect exception my_exception is caught
test.cpp(18): error in "test": incorrect exception my_exception is caught
*** 1 failures is detected in test suite "example"
//]

View File

@ -19,8 +19,10 @@ struct my_exception
bool is_critical( my_exception const& ex ) { return ex.m_error_code < 0; }
void some_func( int i ) { if( i>0 ) throw my_exception( i ); }
BOOST_AUTO_TEST_CASE( test )
{
BOOST_CHECK_EXCEPTION( throw my_exception( 1 ), my_exception, is_critical );
BOOST_CHECK_EXCEPTION( some_func(1), my_exception, is_critical );
}
//]

View File

@ -11,8 +11,10 @@
class my_exception{};
void some_func( int i ) { if( i<0 ) throw my_exception(); }
BOOST_AUTO_TEST_CASE( test )
{
BOOST_CHECK_NO_THROW( throw my_exception() );
BOOST_CHECK_NO_THROW( some_func(-1) );
}
//]

View File

@ -14,7 +14,7 @@ void free_test_function()
BOOST_TEST( true /* test assertion */ );
}
test_suite* init_unit_test_suite( int argc, char* argv[] )
test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
{
for( int i=0; i < 10000; i++ )
framework::master_test_suite().