From 286dc1db33e6c6a1b850b02ed0e7a2e2b56fc585 Mon Sep 17 00:00:00 2001 From: Gennadiy Rozental Date: Sun, 2 Oct 2011 09:57:34 +0000 Subject: [PATCH] updated unit tests [SVN r74643] --- test/basic_cstring_test.cpp | 3 +- test/class_properties_test.cpp | 8 ++++++ test/errors_handling_test.cpp | 2 +- test/output_test_stream_test.cpp | 2 +- test/result_report_test.cpp | 2 +- test/run_by_name_label_test.cpp | 1 + test/test_case_template_test.cpp | 1 - test/test_files/test_tools_test.pattern | 32 +++++++++++++++++++++ test/test_fp_comparisons.cpp | 2 -- test/test_tools_test.cpp | 38 ++++++++++++++++++++++++- test/test_tree_management_test.cpp | 14 ++++----- 11 files changed, 89 insertions(+), 16 deletions(-) diff --git a/test/basic_cstring_test.cpp b/test/basic_cstring_test.cpp index 501813e8..a70cc834 100644 --- a/test/basic_cstring_test.cpp +++ b/test/basic_cstring_test.cpp @@ -19,12 +19,11 @@ // Boost.Test #include -#include #include #include #include -#include +#include namespace utf = boost::unit_test; namespace tt = boost::test_tools; using utf::const_string; diff --git a/test/class_properties_test.cpp b/test/class_properties_test.cpp index 0b8a70db..f9719a23 100644 --- a/test/class_properties_test.cpp +++ b/test/class_properties_test.cpp @@ -137,6 +137,7 @@ BOOST_AUTO_TEST_CASE( test_readonly_property ) BOOST_CHECK_EQUAL( p_two / 2, 1 ); BOOST_CHECK( !p_b_ptr ); + C::init(); BOOST_CHECK( p_b_ptr ); @@ -145,6 +146,12 @@ BOOST_AUTO_TEST_CASE( test_readonly_property ) BOOST_CHECK( p_a_ptr ); E::reset(); BOOST_CHECK( p_a_ptr ); + + if( p_a_ptr ) + delete p_a_ptr.get(); + + if( p_b_ptr ) + delete p_b_ptr.get(); } //____________________________________________________________________________// @@ -180,4 +187,5 @@ BOOST_AUTO_TEST_CASE( test_readwrite_property ) //____________________________________________________________________________// + // EOF diff --git a/test/errors_handling_test.cpp b/test/errors_handling_test.cpp index f9576a62..879f1974 100644 --- a/test/errors_handling_test.cpp +++ b/test/errors_handling_test.cpp @@ -18,7 +18,7 @@ // Boost.Test #define BOOST_TEST_MAIN #include -#include +#include #include #include #include diff --git a/test/output_test_stream_test.cpp b/test/output_test_stream_test.cpp index 6cedae9f..c2fe5d97 100644 --- a/test/output_test_stream_test.cpp +++ b/test/output_test_stream_test.cpp @@ -15,7 +15,7 @@ // Boost.Test #define BOOST_TEST_MAIN #include -#include +#include using boost::test_tools::output_test_stream; // STL diff --git a/test/result_report_test.cpp b/test/result_report_test.cpp index e17e6296..4903ff80 100644 --- a/test/result_report_test.cpp +++ b/test/result_report_test.cpp @@ -17,7 +17,7 @@ #define BOOST_TEST_MAIN #include #include -#include +#include #include #include #include diff --git a/test/run_by_name_label_test.cpp b/test/run_by_name_label_test.cpp index 34a340a5..9a48d6a6 100755 --- a/test/run_by_name_label_test.cpp +++ b/test/run_by_name_label_test.cpp @@ -531,3 +531,4 @@ BOOST_AUTO_TEST_CASE( test_dependency_handling ) //____________________________________________________________________________// // EOF + diff --git a/test/test_case_template_test.cpp b/test/test_case_template_test.cpp index 3387de52..dc1866a3 100644 --- a/test/test_case_template_test.cpp +++ b/test/test_case_template_test.cpp @@ -15,7 +15,6 @@ // Boost.Test #define BOOST_TEST_MAIN #include -#include #include #include diff --git a/test/test_files/test_tools_test.pattern b/test/test_files/test_tools_test.pattern index c7197c79..abd3c0f8 100644 --- a/test/test_files/test_tools_test.pattern +++ b/test/test_files/test_tools_test.pattern @@ -69,3 +69,35 @@ struct A 535: last checkpoint: Going to do a silly things 0: fatal error in "test_BOOST_TEST_PASSPOINT": unknown type 546: last checkpoint +603: error in "test_context_logging": check false failed +Failure occurred in a following context: + some context +607: error in "test_context_logging": check false failed +Failure occurred in a following context: + some more context: 12 +612: error in "test_context_logging": check false failed +Failure occurred in a following context: + info 1 + info 2 + info 3 +615: error in "test_context_logging": check false failed +Failure occurred in a following context: + some sticky context +618: error in "test_context_logging": check false failed +Failure occurred in a following context: + some sticky context + more context +621: error in "test_context_logging": check false failed +Failure occurred in a following context: + some sticky context + different subcontext +625: error in "test_context_logging": check false failed +Failure occurred in a following context: + outer context +628: error in "test_context_logging": check false failed +Failure occurred in a following context: + outer context + inner context +631: error in "test_context_logging": check false failed +Failure occurred in a following context: + outer context diff --git a/test/test_fp_comparisons.cpp b/test/test_fp_comparisons.cpp index 10140f11..e622d700 100644 --- a/test/test_fp_comparisons.cpp +++ b/test/test_fp_comparisons.cpp @@ -15,8 +15,6 @@ // Boost.Test #define BOOST_TEST_MAIN #include -#include -#include // Boost #include diff --git a/test/test_tools_test.cpp b/test/test_tools_test.cpp index 89ef55f1..76790925 100644 --- a/test/test_tools_test.cpp +++ b/test/test_tools_test.cpp @@ -16,7 +16,7 @@ #define BOOST_TEST_MAIN #include #include -#include +#include #include #include #include @@ -597,6 +597,42 @@ BOOST_AUTO_TEST_CASE( test_argument_handling ) //____________________________________________________________________________// +TEST_CASE( test_context_logging ) +{ + BOOST_TEST_INFO( "some context" ); + BOOST_CHECK( false ); + + int i = 12; + BOOST_TEST_INFO( "some more context: " << i ); + BOOST_CHECK( false ); + + BOOST_TEST_INFO( "info 1" ); + BOOST_TEST_INFO( "info 2" ); + BOOST_TEST_INFO( "info 3" ); + BOOST_CHECK( false ); + + BOOST_TEST_CONTEXT( "some sticky context" ) { + BOOST_CHECK( false ); + + BOOST_TEST_INFO( "more context" ); + BOOST_CHECK( false ); + + BOOST_TEST_INFO( "different subcontext" ); + BOOST_CHECK( false ); + } + + BOOST_TEST_CONTEXT( "outer context" ) { + BOOST_CHECK( false ); + + BOOST_TEST_CONTEXT( "inner context" ) { + BOOST_CHECK( false ); + } + + BOOST_CHECK( false ); + } +} + +//____________________________________________________________________________// // !! CHECK_SMALL diff --git a/test/test_tree_management_test.cpp b/test/test_tree_management_test.cpp index 4fea7f5f..deda3c69 100644 --- a/test/test_tree_management_test.cpp +++ b/test/test_tree_management_test.cpp @@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE( manual_test_case_creation_test ) BOOST_CHECK_EQUAL( tc1->p_expected_failures, 0U ); BOOST_CHECK_EQUAL( tc1->p_timeout, 0U ); BOOST_CHECK_EQUAL( tc1->p_name, const_string( "empty" ) ); - BOOST_CHECK( tc1->test_func() ); + BOOST_CHECK( tc1->p_test_func ); BOOST_CHECK( tc1->p_enabled ); BOOST_CHECK_EQUAL( &framework::get( tc1->p_id ), tc1 ); @@ -256,9 +256,9 @@ BOOST_AUTO_TEST_CASE( user_class_test_case ) BOOST_CHECK_EQUAL( tc2->p_name, const_string( "A::test_methodA2" ) ); BOOST_CHECK_EQUAL( instA->i, 0 ); - tc1->test_func()(); + tc1->p_test_func.get()(); BOOST_CHECK_EQUAL( instA->i, 1 ); - tc2->test_func()(); + tc2->p_test_func.get()(); BOOST_CHECK_EQUAL( instA->i, 2 ); boost::shared_ptr instB( new B ); @@ -269,9 +269,9 @@ BOOST_AUTO_TEST_CASE( user_class_test_case ) BOOST_CHECK_EQUAL( tc4->p_name, const_string( "B::test_methodB" ) ); BOOST_CHECK_EQUAL( instB->i, 0 ); - tc3->test_func()(); + tc3->p_test_func.get()(); BOOST_CHECK_EQUAL( instB->i, 1 ); - tc4->test_func()(); + tc4->p_test_func.get()(); BOOST_CHECK_EQUAL( instB->i, 0 ); boost::shared_ptr instC1( new D ); @@ -279,7 +279,7 @@ BOOST_AUTO_TEST_CASE( user_class_test_case ) BOOST_CHECK_EQUAL( tc5->p_name, const_string( "C::test_method" ) ); - tc5->test_func()(); + tc5->p_test_func.get()(); BOOST_CHECK_EQUAL( instC1->i, 1 ); boost::shared_ptr instC2( new E ); @@ -287,7 +287,7 @@ BOOST_AUTO_TEST_CASE( user_class_test_case ) BOOST_CHECK_EQUAL( tc6->p_name, const_string( "C::test_method" ) ); - tc6->test_func()(); + tc6->p_test_func.get()(); BOOST_CHECK_EQUAL( instC2->i, 2 ); }