Skip to content

Commit

Permalink
Preparing for supporting both new and old testing tools implementatio…
Browse files Browse the repository at this point in the history
…n, including macros to manage which one is to be used. Start using new tools internally. Completely split new and old tools implementation so they do not interfere with each other and also can be stitched on/off by macro separately.

Added support for collection comparison interface using BOOST_CHECK( c1 == c2 ). This interface supports all forward iterable collections (including boost::range, but it is currently broken due to error in boost::range.
Added support for floating point comparisons using BOOST_CHECK( a == b, tolerance ) interface. Both percent and fraction tolerance are supported.
NEW feature: added support for floating point comparisons using BOOST_CHECK( a >= b, tolerance ) interface (all kinds of comparisons: != >= >, <= <). Both percent and fraction tolerance are supported.
NEW feature: added support for bitwise comparison using BOOST_CHECK( a == b, bitwise ) interface
NEW feature:  sticky tolerance. We now can specify type specific tolerance once and use it in multiple BOOST_CHECK( a==b ) with floating point values without specifying one. More over one can now specify a tolerance for the test case using the new decorator decorator::tolerance()
NEW feature: added support for fixture decorator with an argument
Rerouted printing values in new tools message formatting implementation through the print_helper_t interface to facilitate used defined overwrite.
predicate_result-> assertion_result to better convey the intended use
Implemented new error message formatting helpers
check_is_close_t, check_is_small_t eliminated. Use either functions or new tools API instead.
Added full set of comparison routines for basic_cstring
New traits: is_cstring 
is_forward_iterable implementation improved
Failure to open a pattern file is not a warning, but just a message now
Use new C++11 config macros

[SVN r82718]
  • Loading branch information
rogeeff committed Feb 4, 2013
1 parent 0a13a6c commit bae8de1
Show file tree
Hide file tree
Showing 37 changed files with 2,224 additions and 822 deletions.
4 changes: 2 additions & 2 deletions include/boost/test/data/monomorphic/generators/random.hpp
Expand Up @@ -18,7 +18,7 @@
// Boost.Test
#include <boost/test/data/config.hpp>

#ifndef BOOST_NO_CXX11_HDR_RANDOM
#ifndef BOOST_NO_0X_HDR_RANDOM

#include <boost/test/data/monomorphic/generate.hpp>
#include <boost/test/data/monomorphic/generators/keywords.hpp>
Expand Down Expand Up @@ -158,7 +158,7 @@ random( Params const& params )

#include <boost/test/detail/enable_warnings.hpp>

#endif // BOOST_NO_CXX11_HDR_RANDOM
#endif // BOOST_NO_0X_HDR_RANDOM


#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_RANDOM_HPP_101512GER
2 changes: 1 addition & 1 deletion include/boost/test/detail/global_typedef.hpp
Expand Up @@ -18,7 +18,7 @@
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
#include <boost/test/detail/workaround.hpp>

#define BOOST_TEST_L( s ) boost::unit_test::const_string( s, sizeof( s ) - 1 )
#define BOOST_TEST_L( s ) ::boost::unit_test::const_string( s, sizeof( s ) - 1 )
#define BOOST_TEST_STRINGIZE( s ) BOOST_TEST_L( BOOST_STRINGIZE( s ) )
#define BOOST_TEST_EMPTY_STRING BOOST_TEST_L( "" )

Expand Down
3 changes: 2 additions & 1 deletion include/boost/test/impl/exception_safety.ipp
Expand Up @@ -27,12 +27,13 @@
#include <boost/test/utils/iterator/token_iterator.hpp>

#include <boost/test/interaction/interaction_based.hpp>
#include <boost/test/test_tools.hpp>
#include <boost/test/unit_test_log.hpp>
#include <boost/test/framework.hpp>
#include <boost/test/tree/observer.hpp>
#include <boost/test/debug.hpp>

#include <boost/test/test_tools.hpp> // BOOST_REQUIRE_MESSAGE

#include <boost/test/detail/suppress_warnings.hpp>

// Boost
Expand Down
2 changes: 1 addition & 1 deletion include/boost/test/impl/framework.ipp
Expand Up @@ -24,7 +24,6 @@
#include <boost/test/results_collector.hpp>
#include <boost/test/progress_monitor.hpp>
#include <boost/test/results_reporter.hpp>
#include <boost/test/test_tools.hpp>

#include <boost/test/tree/observer.hpp>
#include <boost/test/tree/test_unit.hpp>
Expand All @@ -40,6 +39,7 @@
#include <boost/test/detail/global_typedef.hpp>

#include <boost/test/utils/foreach.hpp>
#include <boost/test/utils/basic_cstring/io.hpp>

// Boost
#include <boost/timer.hpp>
Expand Down
29 changes: 17 additions & 12 deletions include/boost/test/impl/logged_expectations.ipp
Expand Up @@ -21,13 +21,13 @@
#if BOOST_TEST_SUPPORT_INTERACTION_TESTING

#include <boost/test/detail/global_typedef.hpp>
#include <boost/test/detail/suppress_warnings.hpp>

#include <boost/test/utils/iterator/token_iterator.hpp>

#include <boost/test/interaction/interaction_based.hpp>
#include <boost/test/test_tools.hpp>

#include <boost/test/detail/suppress_warnings.hpp>
#include <boost/test/test_tools.hpp> // BOOST_REQUIRE_MESSAGE

// Boost
#include <boost/lexical_cast.hpp>
Expand Down Expand Up @@ -96,9 +96,9 @@ expectations_logger::expectations_logger( const_string log_file_name, bool test_
const_string cline( line );
string_token_iterator tit( cline, (dropped_delimeters = CLMN_SEP, kept_delimeters = dt_none));

BOOST_CHECK_EQUAL( *tit, FILE_SIG );
BOOST_CHECK( *tit == FILE_SIG );
++tit;
BOOST_CHECK_EQUAL( *tit, ELOG_VER );
BOOST_CHECK( *tit == ELOG_VER );
}
else {
m_log_file << FILE_SIG << CLMN_SEP << ELOG_VER << LINE_SEP;
Expand All @@ -118,7 +118,8 @@ expectations_logger::decision_point( const_string, std::size_t )
const_string cline( line );
string_token_iterator tit( cline, (dropped_delimeters = CLMN_SEP, kept_delimeters = dt_none));

BOOST_CHECK_EQUAL( *tit, DP_SIG ); ++tit;
BOOST_CHECK( *tit == DP_SIG );
++tit;
return lexical_cast<bool>( *tit );
}
else {
Expand All @@ -141,8 +142,9 @@ expectations_logger::enter_scope( const_string, std::size_t, const_string scope_
const_string cline( line );
string_token_iterator tit( cline, (dropped_delimeters = CLMN_SEP, kept_delimeters = dt_none));

BOOST_CHECK_EQUAL( *tit, SCOPE_SIG ); ++tit;
BOOST_CHECK_EQUAL( *tit, scope_name );
BOOST_CHECK( *tit == SCOPE_SIG );
++tit;
BOOST_CHECK( *tit == scope_name );
}
else {
m_log_file << SCOPE_SIG << CLMN_SEP << scope_name << LINE_SEP;
Expand All @@ -164,8 +166,9 @@ expectations_logger::allocated( const_string, std::size_t, void*, std::size_t s
const_string cline( line );
string_token_iterator tit( cline, (dropped_delimeters = CLMN_SEP, kept_delimeters = dt_none));

BOOST_CHECK_EQUAL( *tit, ALLOC_SIG ); ++tit;
BOOST_CHECK_EQUAL( lexical_cast<std::size_t>( *tit ), s );
BOOST_CHECK( *tit == ALLOC_SIG );
++tit;
BOOST_CHECK( lexical_cast<std::size_t>( *tit ) == s );
}
else {
m_log_file << ALLOC_SIG << CLMN_SEP << s << LINE_SEP;
Expand All @@ -185,8 +188,9 @@ expectations_logger::data_flow( const_string d )
const_string cline( line );
string_token_iterator tit( cline, (dropped_delimeters = CLMN_SEP, kept_delimeters = dt_none));

BOOST_CHECK_EQUAL( *tit, DATA_SIG ); ++tit;
BOOST_CHECK_EQUAL( *tit, d );
BOOST_CHECK( *tit == DATA_SIG );
++tit;
BOOST_CHECK( *tit == d );
}
else {
m_log_file << DATA_SIG << CLMN_SEP << d << LINE_SEP;
Expand All @@ -206,7 +210,8 @@ expectations_logger::return_value( const_string default_value )
const_string cline( line );
string_token_iterator tit( cline, (dropped_delimeters = CLMN_SEP, kept_delimeters = dt_none));

BOOST_CHECK_EQUAL( *tit, RETURN_SIG ); ++tit;
BOOST_CHECK( *tit == RETURN_SIG );
++tit;

return std::string( tit->begin(), tit->size() );
}
Expand Down
1 change: 0 additions & 1 deletion include/boost/test/impl/test_main.ipp
Expand Up @@ -18,7 +18,6 @@

// Boost.Test
#include <boost/test/framework.hpp>
#include <boost/test/test_tools.hpp>
#include <boost/test/unit_test_suite.hpp>

// Boost
Expand Down

0 comments on commit bae8de1

Please sign in to comment.