#include <boost/test/framework.hpp>
#include <boost/test/unit_test_parameters.hpp>
#include <boost/test/utils/nullstream.hpp>
+#include <boost/test/execution_monitor.hpp>
+
typedef boost::onullstream onullstream_type;
// BOOST
void bad_foo2() { bad_foo(); } // tests with clashing names
+void timeout_foo()
+{
+ using boost::execution_exception;
+ execution_exception::location dummy;
+ throw execution_exception(
+ execution_exception::timeout_error,
+ "fake timeout",
+ dummy);
+}
+
//____________________________________________________________________________//
void check( output_test_stream& output,
BOOST_AUTO_TEST_CASE( test_logs )
{
guard G;
- ut_detail::ignore_unused_variable_warning( G );
+ boost::ignore_unused( G );
#define PATTERN_FILE_NAME "log-formatter-test.pattern"
ts_main->add( ts_3 );
ts_main->add( ts_4 );
+ test_suite* ts_timeout = BOOST_TEST_SUITE( "Timeout" );
+ ts_timeout->add( BOOST_TEST_CASE( good_foo ) );
+ test_case * tc_timeout = BOOST_TEST_CASE( timeout_foo );
+ ts_timeout->add( tc_timeout );
+
+ test_suite* ts_timeout_nested = BOOST_TEST_SUITE( "Timeout-nested" );
+ ts_timeout_nested->add( BOOST_TEST_CASE( good_foo ) );
+ test_suite* ts_timeout_internal = BOOST_TEST_SUITE( "Timeout" );
+ ts_timeout_internal->add( BOOST_TEST_CASE( good_foo ) );
+ test_case * tc_timeout_internal = BOOST_TEST_CASE( timeout_foo );
+ ts_timeout_internal->add( tc_timeout_internal );
+ ts_timeout_nested->add( ts_timeout_internal );
+ ts_timeout_nested->add( BOOST_TEST_CASE_NAME( good_foo, "good_foo2" ) );
+
check( test_output, ts_1 );
check( test_output, ts_1b );
ts_3->depends_on( ts_1 );
check( test_output, ts_main );
+
+ check( test_output, ts_timeout );
+
+ check( test_output, ts_timeout_nested );
}
//____________________________________________________________________________//
BOOST_AUTO_TEST_CASE( test_logs_junit_info_closing_tags )
{
guard G;
- ut_detail::ignore_unused_variable_warning( G );
+ boost::ignore_unused( G );
#define PATTERN_FILE_NAME_JUNIT "log-formatter-test.pattern.junit"
boost::unit_test::framework::impl::setup_for_execution( *ts_main );
check( test_output, OF_JUNIT, ts_main->p_id, log_successful_tests );
+
+ test_suite* ts_timeout = BOOST_TEST_SUITE( "Timeout" );
+ ts_timeout->add( BOOST_TEST_CASE( good_foo ) );
+ test_case * tc_timeout = BOOST_TEST_CASE( timeout_foo );
+ ts_timeout->add( tc_timeout );
+
+ check( test_output, OF_JUNIT, ts_timeout->p_id, log_successful_tests );
+
+
+ test_suite* ts_account_failures = BOOST_TEST_SUITE( "1 junit failure is not error" );
+ ts_account_failures->add( BOOST_TEST_CASE( bad_foo ) );
+ ts_account_failures->add( BOOST_TEST_CASE( very_bad_foo ) );
+ ts_account_failures->add( BOOST_TEST_CASE( good_foo ) );
+ ts_account_failures->add( BOOST_TEST_CASE( bad_foo2 ) );
+
+ char const* argv2[] = { "a.exe", "--run_test=*", "--build_info=false" };
+ int argc2 = sizeof(argv2)/sizeof(argv2[0]);
+ boost::unit_test::runtime_config::init( argc2, (char**)argv2 );
+ boost::unit_test::framework::impl::setup_for_execution( *ts_account_failures );
+
+ check( test_output, OF_JUNIT, ts_account_failures->p_id, log_messages );
}
// EOF