mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Preview of clang-format changes and CI
This commit is contained in:
parent
bfd1701fcb
commit
805e3b02bf
98 changed files with 6339 additions and 11357 deletions
|
|
@ -9,70 +9,66 @@
|
|||
#include <turtle/detail/function.hpp>
|
||||
#include <boost/test/auto_unit_test.hpp>
|
||||
|
||||
namespace
|
||||
namespace {
|
||||
template<typename Expected, typename Actual>
|
||||
bool match(Expected expected, Actual actual)
|
||||
{
|
||||
template< typename Expected, typename Actual >
|
||||
bool match( Expected expected, Actual actual )
|
||||
{
|
||||
return mock::matcher< Actual, Expected >( expected )( actual );
|
||||
}
|
||||
return mock::matcher<Actual, Expected>(expected)(actual);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
BOOST_AUTO_TEST_CASE(int_and_int_can_be_compared)
|
||||
{
|
||||
BOOST_CHECK(match(3, 3));
|
||||
BOOST_CHECK(!match(3, 4));
|
||||
BOOST_CHECK(!match(4, 3));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( int_and_int_can_be_compared )
|
||||
{
|
||||
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_AUTO_TEST_CASE(ref_to_int_and_int_can_be_compared)
|
||||
{
|
||||
const int i = 3;
|
||||
BOOST_CHECK( match( 3, boost::cref( i ) ) );
|
||||
BOOST_CHECK( ! match( 4, boost::cref( i ) ) );
|
||||
BOOST_CHECK(match(3, boost::cref(i)));
|
||||
BOOST_CHECK(!match(4, boost::cref(i)));
|
||||
}
|
||||
|
||||
namespace
|
||||
namespace {
|
||||
struct fixture
|
||||
{
|
||||
struct fixture
|
||||
fixture() : text("same text"), actual(text.c_str())
|
||||
{
|
||||
fixture()
|
||||
: text( "same text" )
|
||||
, actual( text.c_str() )
|
||||
{
|
||||
const char* static_string = "same text";
|
||||
BOOST_REQUIRE( actual != static_string );
|
||||
BOOST_REQUIRE( actual == std::string( static_string ) );
|
||||
}
|
||||
std::string text;
|
||||
const char* actual;
|
||||
};
|
||||
}
|
||||
const char* static_string = "same text";
|
||||
BOOST_REQUIRE(actual != static_string);
|
||||
BOOST_REQUIRE(actual == std::string(static_string));
|
||||
}
|
||||
std::string text;
|
||||
const char* actual;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( const_char_pointer_and_const_char_pointer_can_be_compared, fixture )
|
||||
BOOST_FIXTURE_TEST_CASE(const_char_pointer_and_const_char_pointer_can_be_compared, fixture)
|
||||
{
|
||||
const char* expected = "same text";
|
||||
BOOST_CHECK( match( expected, actual ) );
|
||||
BOOST_CHECK(match(expected, actual));
|
||||
const char* unexpected = "different text";
|
||||
BOOST_CHECK( ! match( actual, unexpected ) );
|
||||
BOOST_CHECK(!match(actual, unexpected));
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( const_char_pointer_and_string_literal_can_be_compared, fixture )
|
||||
BOOST_FIXTURE_TEST_CASE(const_char_pointer_and_string_literal_can_be_compared, fixture)
|
||||
{
|
||||
BOOST_CHECK( match( "same text", actual ) );
|
||||
BOOST_CHECK( ! match( "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 )
|
||||
BOOST_FIXTURE_TEST_CASE(const_char_pointer_and_const_char_array_can_be_compared, fixture)
|
||||
{
|
||||
const char expected[10] = "same text";
|
||||
BOOST_CHECK( match( expected, actual ) );
|
||||
BOOST_CHECK(match(expected, actual));
|
||||
const char unexpected[15] = "different text";
|
||||
BOOST_CHECK( ! match( unexpected, actual ) );
|
||||
BOOST_CHECK(!match(unexpected, actual));
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( const_char_pointer_and_std_string_can_be_compared, fixture )
|
||||
BOOST_FIXTURE_TEST_CASE(const_char_pointer_and_std_string_can_be_compared, fixture)
|
||||
{
|
||||
BOOST_CHECK( match( std::string( "same text" ), actual ) );
|
||||
BOOST_CHECK( ! match( 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