From 783722fae8e7df895c04c011117eedafaa068737 Mon Sep 17 00:00:00 2001 From: Gennadiy Rozental Date: Fri, 25 Jul 2008 03:55:03 +0000 Subject: [PATCH] date [SVN r47790] --- test/test_files/test_tools_test.pattern | 81 ++++++++++--------- test/test_fp_comparisons.cpp | 2 +- test/test_tools_test.cpp | 9 ++- test/test_tree_management_test.cpp | 77 +++++++++++++++++- test/token_iterator_test.cpp | 2 +- .../src/console_test_runner.cpp | 2 +- .../test/test_runner_test.cpp | 2 +- 7 files changed, 128 insertions(+), 47 deletions(-) diff --git a/test/test_files/test_tools_test.pattern b/test/test_files/test_tools_test.pattern index e09d3116..752a31d6 100644 --- a/test/test_files/test_tools_test.pattern +++ b/test/test_files/test_tools_test.pattern @@ -13,50 +13,51 @@ 208: error in "test_BOOST_CHECK_MESSAGE": Well, may be that what I believe in 210: error in "test_BOOST_CHECK_MESSAGE": Checking predicate failed. Some explanation 213: info: check 'Could it fail?' passed -220: fatal error in "test_BOOST_REQUIRE_MESSAGE": Here we should stop -223: info: check 'That's OK' passed -223: error in "test_BOOST_REQUIRE_MESSAGE": not aborted -230: error in "test_BOOST_ERROR": Fail to miss an error -237: fatal error in "test_BOOST_FAIL": No! No! Show must go on. -253: error in "test_BOOST_CHECK_THROW": exception my_exception is expected -256: warning in "test_BOOST_CHECK_THROW": exception my_exception is expected -259: fatal error in "test_BOOST_CHECK_THROW": exception my_exception is expected -262: info: check 'exception my_exception is caught' passed -269: error in "test_BOOST_CHECK_EXCEPTION": incorrect exception my_exception is caught -272: info: check 'incorrect exception my_exception is caught' passed -282: error in "test_BOOST_CHECK_NO_THROW": exception thrown by throw my_exception() -328: error in "test_BOOST_CHECK_EQUAL": check i == j failed [1 != 2] -334: error in "test_BOOST_CHECK_EQUAL": check str1 == str2 failed [test1 != test12] -337: error in "test_BOOST_CHECK_EQUAL": check i+1 == j failed [4 != 2] -340: info: check str1 == str3+1 passed -349: fatal error in "test_BOOST_CHECK_EQUAL": critical check str1 == str2 failed [test != null string] -355: warning in "test_BOOST_CHECK_EQUAL": condition b1 == b2 is not satisfied [B(1) != B(2)] -361: error in "test_BOOST_CHECK_EQUAL": check c1 == c3 failed [C(0,100) != C(1,102)]. Index mismatch -362: error in "test_BOOST_CHECK_EQUAL": check c1 == c2 failed [C(0,100) != C(0,101)]. Id mismatch -366: error in "test_BOOST_CHECK_EQUAL": check ch1 == ch2 failed [0xfffffffe != 0xfffffffd] -377: error in "test_BOOST_CHECK_LOGICAL_EXPR": check ++i != j failed [2 == 2] -379: error in "test_BOOST_CHECK_LOGICAL_EXPR": check i < j failed [2 >= 2] -380: error in "test_BOOST_CHECK_LOGICAL_EXPR": check i > j failed [2 <= 2] -387: error in "test_BOOST_CHECK_LOGICAL_EXPR": check i <= j failed [3 > 2] -388: error in "test_BOOST_CHECK_LOGICAL_EXPR": check j >= i failed [2 < 3] -393: error in "test_BOOST_CHECK_LOGICAL_EXPR": check str1 != str2 failed [test1 == test1] -423: error in "test_BOOST_CHECK_PREDICATE": check is_even( i ) failed for ( 17 ) -426: error in "test_BOOST_CHECK_PREDICATE": check not_equal_to()( i, 17 ) failed for ( 17, 17 ) -432: warning in "test_BOOST_CHECK_PREDICATE": condition moo( 12, i, j ) is not satisfied for ( 12, 17, 15 ) -440: error in "test_BOOST_CHECK_PREDICATE": check compare_lists( l1, l2 ) failed for ( , ). Different sizes [2!=0] -451: error in "test_BOOST_REQUIRE_PREDICATE": not aborted -453: fatal error in "test_BOOST_REQUIRE_PREDICATE": critical check less_equal()( arg2, arg1 ) failed for ( 2, 1 ) -474: error in "test_BOOST_CHECK_EQUAL_COLLECTIONS": check { testlist.begin(), testlist.end() } == { pattern, pattern+7 } failed. +218: error in "test_BOOST_CHECK_MESSAGE": Comparing 1 and 2: some explanation +225: fatal error in "test_BOOST_REQUIRE_MESSAGE": Here we should stop +228: info: check 'That's OK' passed +228: error in "test_BOOST_REQUIRE_MESSAGE": not aborted +235: error in "test_BOOST_ERROR": Fail to miss an error +242: fatal error in "test_BOOST_FAIL": No! No! Show must go on. +258: error in "test_BOOST_CHECK_THROW": exception my_exception is expected +261: warning in "test_BOOST_CHECK_THROW": exception my_exception is expected +264: fatal error in "test_BOOST_CHECK_THROW": exception my_exception is expected +267: info: check 'exception my_exception is caught' passed +274: error in "test_BOOST_CHECK_EXCEPTION": incorrect exception my_exception is caught +277: info: check 'incorrect exception my_exception is caught' passed +287: error in "test_BOOST_CHECK_NO_THROW": exception thrown by throw my_exception() +333: error in "test_BOOST_CHECK_EQUAL": check i == j failed [1 != 2] +339: error in "test_BOOST_CHECK_EQUAL": check str1 == str2 failed [test1 != test12] +342: error in "test_BOOST_CHECK_EQUAL": check i+1 == j failed [4 != 2] +345: info: check str1 == str3+1 passed +354: fatal error in "test_BOOST_CHECK_EQUAL": critical check str1 == str2 failed [test != null string] +360: warning in "test_BOOST_CHECK_EQUAL": condition b1 == b2 is not satisfied [B(1) != B(2)] +366: error in "test_BOOST_CHECK_EQUAL": check c1 == c3 failed [C(0,100) != C(1,102)]. Index mismatch +367: error in "test_BOOST_CHECK_EQUAL": check c1 == c2 failed [C(0,100) != C(0,101)]. Id mismatch +371: error in "test_BOOST_CHECK_EQUAL": check ch1 == ch2 failed [0xfffffffe != 0xfffffffd] +382: error in "test_BOOST_CHECK_LOGICAL_EXPR": check ++i != j failed [2 == 2] +384: error in "test_BOOST_CHECK_LOGICAL_EXPR": check i < j failed [2 >= 2] +385: error in "test_BOOST_CHECK_LOGICAL_EXPR": check i > j failed [2 <= 2] +392: error in "test_BOOST_CHECK_LOGICAL_EXPR": check i <= j failed [3 > 2] +393: error in "test_BOOST_CHECK_LOGICAL_EXPR": check j >= i failed [2 < 3] +398: error in "test_BOOST_CHECK_LOGICAL_EXPR": check str1 != str2 failed [test1 == test1] +428: error in "test_BOOST_CHECK_PREDICATE": check is_even( i ) failed for ( 17 ) +431: error in "test_BOOST_CHECK_PREDICATE": check not_equal_to()( i, 17 ) failed for ( 17, 17 ) +437: warning in "test_BOOST_CHECK_PREDICATE": condition moo( 12, i, j ) is not satisfied for ( 12, 17, 15 ) +445: error in "test_BOOST_CHECK_PREDICATE": check compare_lists( l1, l2 ) failed for ( , ). Different sizes [2!=0] +456: error in "test_BOOST_REQUIRE_PREDICATE": not aborted +458: fatal error in "test_BOOST_REQUIRE_PREDICATE": critical check less_equal()( arg2, arg1 ) failed for ( 2, 1 ) +479: error in "test_BOOST_CHECK_EQUAL_COLLECTIONS": check { testlist.begin(), testlist.end() } == { pattern, pattern+7 } failed. Mismatch in a position 2: 4 != 3 Mismatch in a position 5: 7 != 6 -475: error in "test_BOOST_CHECK_EQUAL_COLLECTIONS": check { testlist.begin(), testlist.end() } == { pattern, pattern+2 } failed. +480: error in "test_BOOST_CHECK_EQUAL_COLLECTIONS": check { testlist.begin(), testlist.end() } == { pattern, pattern+2 } failed. Collections size mismatch: 7 != 2 -484: error in "test_BOOST_CHECK_BITWISE_EQUAL": check (char)0x06 =.= (char)0x16 failed. +489: error in "test_BOOST_CHECK_BITWISE_EQUAL": check (char)0x06 =.= (char)0x16 failed. Mismatch in a position 4 -487: warning in "test_BOOST_CHECK_BITWISE_EQUAL": condition (char)0x26 =.= (char)0x04 is not satisfied. +492: warning in "test_BOOST_CHECK_BITWISE_EQUAL": condition (char)0x26 =.= (char)0x04 is not satisfied. Mismatch in a position 1 Mismatch in a position 5 -490: fatal error in "test_BOOST_CHECK_BITWISE_EQUAL": critical check (char)0x26 =.= (int)0x26 failed. +495: fatal error in "test_BOOST_CHECK_BITWISE_EQUAL": critical check (char)0x26 =.= (int)0x26 failed. Operands bit sizes mismatch: 8 != 32 still testing 1+1=2 @@ -65,6 +66,6 @@ struct A 0x14 20 0: fatal error in "test_BOOST_TEST_CHECKPOINT": C string: some error -525: last checkpoint: Going to do a silly things +530: last checkpoint: Going to do a silly things 0: fatal error in "test_BOOST_TEST_PASSPOINT": unknown type -536: last checkpoint +541: last checkpoint diff --git a/test/test_fp_comparisons.cpp b/test/test_fp_comparisons.cpp index 2be99750..fb95eee8 100644 --- a/test/test_fp_comparisons.cpp +++ b/test/test_fp_comparisons.cpp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2001-2007. +// (C) Copyright Gennadiy Rozental 2001-2008. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/test_tools_test.cpp b/test/test_tools_test.cpp index 4cf6846b..33589989 100644 --- a/test/test_tools_test.cpp +++ b/test/test_tools_test.cpp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2001-2007. +// (C) Copyright Gennadiy Rozental 2001-2008. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -211,6 +211,11 @@ TEST_CASE( test_BOOST_CHECK_MESSAGE ) unit_test_log.set_threshold_level( log_successful_tests ); BOOST_CHECK_MESSAGE( 2+2 == 4, "Could it fail?" ); + + int i = 1; + int j = 2; + std::string msg = "some explanation"; + BOOST_CHECK_MESSAGE( i > j, "Comparing " << i << " and " << j << ": " << msg ); } //____________________________________________________________________________// @@ -509,7 +514,7 @@ TEST_CASE( test_BOOST_TEST_MESSAGE ) A a = A(); BOOST_TEST_MESSAGE( a ); -#if !defined(BOOST_NO_STD_LOCALE) && ( !defined(BOOST_MSVC) || BOOST_WORKAROUND(BOOST_MSVC, >= 1310)) +#if BOOST_TEST_USE_STD_LOCALE BOOST_TEST_MESSAGE( std::hex << std::showbase << 20 ); #else BOOST_TEST_MESSAGE( "0x14" ); diff --git a/test/test_tree_management_test.cpp b/test/test_tree_management_test.cpp index a76bd0ad..701a65b2 100644 --- a/test/test_tree_management_test.cpp +++ b/test/test_tree_management_test.cpp @@ -152,7 +152,7 @@ BOOST_AUTO_TEST_CASE( automated_test_units_registration ) { test_suite& mts = framework::master_test_suite(); - BOOST_CHECK_EQUAL( mts.size(), 7U ); + BOOST_CHECK_EQUAL( mts.size(), 8U ); BOOST_CHECK_EQUAL( mts.p_expected_failures, 2U ); BOOST_CHECK_EQUAL( framework::get( mts.get( "automated_test_units_registration" ) ).p_expected_failures, 0U ); @@ -180,4 +180,79 @@ BOOST_AUTO_TEST_CASE( automated_test_units_registration ) //____________________________________________________________________________// +struct A { + A() : i(0){} + void test_methodA1() { i++; } + void test_methodA2() { i++; } + + int i; +}; + +struct B : public A { + void test_methodB() { i--; } +}; + +struct C { + C() : i( 0 ) {} + + void virtual test_method() = 0; + + int i; +}; + +struct D : public C { + void virtual test_method() { i++; } +}; + +struct E : public C { + void virtual test_method() { i+=2; } +}; + +BOOST_AUTO_TEST_CASE( user_class_test_case ) +{ + boost::shared_ptr instA( new A ); + test_case* tc1 = BOOST_CLASS_TEST_CASE( &A::test_methodA1, instA ); + test_case* tc2 = BOOST_CLASS_TEST_CASE( &A::test_methodA2, instA ); + + BOOST_CHECK_EQUAL( tc1->p_name, const_string( "A::test_methodA1" ) ); + BOOST_CHECK_EQUAL( tc2->p_name, const_string( "A::test_methodA2" ) ); + + BOOST_CHECK_EQUAL( instA->i, 0 ); + tc1->test_func()(); + BOOST_CHECK_EQUAL( instA->i, 1 ); + tc2->test_func()(); + BOOST_CHECK_EQUAL( instA->i, 2 ); + + boost::shared_ptr instB( new B ); + test_case* tc3 = BOOST_CLASS_TEST_CASE( &A::test_methodA1, instB ); + test_case* tc4 = BOOST_CLASS_TEST_CASE( &B::test_methodB, instB ); + + BOOST_CHECK_EQUAL( tc3->p_name, const_string( "A::test_methodA1" ) ); + BOOST_CHECK_EQUAL( tc4->p_name, const_string( "B::test_methodB" ) ); + + BOOST_CHECK_EQUAL( instB->i, 0 ); + tc3->test_func()(); + BOOST_CHECK_EQUAL( instB->i, 1 ); + tc4->test_func()(); + BOOST_CHECK_EQUAL( instB->i, 0 ); + + boost::shared_ptr instC1( new D ); + test_case* tc5 = BOOST_CLASS_TEST_CASE( &C::test_method, instC1 ); + + BOOST_CHECK_EQUAL( tc5->p_name, const_string( "C::test_method" ) ); + + tc5->test_func()(); + BOOST_CHECK_EQUAL( instC1->i, 1 ); + + boost::shared_ptr instC2( new E ); + test_case* tc6 = BOOST_CLASS_TEST_CASE( &C::test_method, instC2 ); + + BOOST_CHECK_EQUAL( tc6->p_name, const_string( "C::test_method" ) ); + + tc6->test_func()(); + BOOST_CHECK_EQUAL( instC2->i, 2 ); +} + +//____________________________________________________________________________// + // EOF diff --git a/test/token_iterator_test.cpp b/test/token_iterator_test.cpp index b7c9536e..1116e127 100644 --- a/test/token_iterator_test.cpp +++ b/test/token_iterator_test.cpp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2001-2007. +// (C) Copyright Gennadiy Rozental 2001-2008. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/tools/console_test_runner/src/console_test_runner.cpp b/tools/console_test_runner/src/console_test_runner.cpp index c10d6aff..ebfb154f 100644 --- a/tools/console_test_runner/src/console_test_runner.cpp +++ b/tools/console_test_runner/src/console_test_runner.cpp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2005. +// (C) Copyright Gennadiy Rozental 2005-2007. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/tools/console_test_runner/test/test_runner_test.cpp b/tools/console_test_runner/test/test_runner_test.cpp index b4a9061a..64cb051a 100644 --- a/tools/console_test_runner/test/test_runner_test.cpp +++ b/tools/console_test_runner/test/test_runner_test.cpp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2005. +// (C) Copyright Gennadiy Rozental 2005-2007. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt)