Boost logo

Boost :

Subject: [boost] Unit Test Framework - strange behaviour of test_unit::depends_on
From: Me here (rhjrjlbk2002_at_[hidden])
Date: 2008-12-16 07:52:21


Hi there,

Why the code below does not run test case TC_TestCase and reports that the whole test suite is skipped? Nothing is executed from my code. If the line /*1*/ is commented out, then behaviour is as expected.

I use MSVC 2008 SP1 Win32, boost 1.36.0 or boost 1.37.0.

I have to admit that test_unit::depends_on is not documented. Unit test framework is changed in 1.37.0 but changes are not documented anywhere.

Regards,
Alexander

----------- code in question ------
#include <boost/test/included/unit_test.hpp>

using boost::unit_test::test_suite;

void Dependency()
{
  BOOST_MESSAGE( "Dependency!" );
  BOOST_CHECK( 1 );
}

void TC_TestCase()
{
  BOOST_MESSAGE( "A test case!" );
  BOOST_CHECK( 1 );
}

test_suite*
init_unit_test_suite( int argc, char* argv[] )
{
  test_suite* ts = BOOST_TEST_SUITE( "Test_Test" );

  ts->add( BOOST_TEST_CASE( &TC_TestCase ) );

/*1*/ ts->depends_on( BOOST_TEST_CASE( &Dependency ) );

  return ts;
}
-------- end code in question ------

------------ output -----------
Running 1 test case...
Entering test suite "Master Test Suite"
Test suite "Test_Test"is skipped
Leaving test suite "Master Test Suite"

*** No errors detected
---------- end output -----------

      


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk