mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Renamed mock::detail::check to mock::matcher
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@567 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
3e3746dce5
commit
a84c66c714
9 changed files with 88 additions and 65 deletions
|
|
@ -6,29 +6,29 @@
|
|||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <turtle/detail/check.hpp>
|
||||
#include <turtle/matcher.hpp>
|
||||
#include <boost/test/auto_unit_test.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
template< typename Expected, typename Actual >
|
||||
bool check( Expected expected, Actual actual )
|
||||
bool match( Expected expected, Actual actual )
|
||||
{
|
||||
return mock::detail::check< Actual, Expected >( expected )( actual );
|
||||
return mock::matcher< Actual, Expected >( expected )( actual );
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( int_and_int_can_be_compared )
|
||||
{
|
||||
BOOST_CHECK( check( 3, 3 ) );
|
||||
BOOST_CHECK( ! check( 3, 4 ) );
|
||||
BOOST_CHECK( ! check( 4, 3 ) );
|
||||
BOOST_CHECK( match( 3, 3 ) );
|
||||
BOOST_CHECK( ! match( 3, 4 ) );
|
||||
BOOST_CHECK( ! match( 4, 3 ) );
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( ref_to_int_and_int_can_be_compared )
|
||||
{
|
||||
BOOST_CHECK( check( 3, boost::cref( 3 ) ) );
|
||||
BOOST_CHECK( ! check( 4, boost::cref( 3 ) ) );
|
||||
BOOST_CHECK( match( 3, boost::cref( 3 ) ) );
|
||||
BOOST_CHECK( ! match( 4, boost::cref( 3 ) ) );
|
||||
}
|
||||
|
||||
namespace
|
||||
|
|
@ -51,27 +51,27 @@ namespace
|
|||
BOOST_FIXTURE_TEST_CASE( const_char_pointer_and_const_char_pointer_can_be_compared, fixture )
|
||||
{
|
||||
const char* expected = "same text";
|
||||
BOOST_CHECK( check( expected, actual ) );
|
||||
BOOST_CHECK( match( expected, actual ) );
|
||||
const char* unexpected = "different text";
|
||||
BOOST_CHECK( ! check( actual, unexpected ) );
|
||||
BOOST_CHECK( ! match( actual, unexpected ) );
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( const_char_pointer_and_string_literal_can_be_compared, fixture )
|
||||
{
|
||||
BOOST_CHECK( check( "same text", actual ) );
|
||||
BOOST_CHECK( ! check( "different text", actual ) );
|
||||
BOOST_CHECK( match( "same text", actual ) );
|
||||
BOOST_CHECK( ! match( "different text", actual ) );
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( const_char_pointer_and_const_char_array_can_be_compared, fixture )
|
||||
{
|
||||
const char expected[10] = "same text";
|
||||
BOOST_CHECK( check( expected, actual ) );
|
||||
BOOST_CHECK( match( expected, actual ) );
|
||||
const char unexpected[15] = "different text";
|
||||
BOOST_CHECK( ! check( unexpected, actual ) );
|
||||
BOOST_CHECK( ! match( unexpected, actual ) );
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( const_char_pointer_and_std_string_can_be_compared, fixture )
|
||||
{
|
||||
BOOST_CHECK( check( std::string( "same text" ), actual ) );
|
||||
BOOST_CHECK( ! check( std::string( "different text" ), actual ) );
|
||||
BOOST_CHECK( match( std::string( "same text" ), actual ) );
|
||||
BOOST_CHECK( ! match( std::string( "different text" ), actual ) );
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue