mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Fixed most pedantic warnings
This commit is contained in:
parent
44488f6331
commit
db378d8939
@ -56,8 +56,8 @@ TEST_CASE( "./failing/conditions/equality", "Equality checks that should fail" )
|
|||||||
CHECK( data.int_seven == 0 );
|
CHECK( data.int_seven == 0 );
|
||||||
CHECK( data.float_nine_point_one == Approx( 9.11f ) );
|
CHECK( data.float_nine_point_one == Approx( 9.11f ) );
|
||||||
CHECK( data.float_nine_point_one == Approx( 9.0f ) );
|
CHECK( data.float_nine_point_one == Approx( 9.0f ) );
|
||||||
CHECK( data.float_nine_point_one == 1 );
|
CHECK( data.float_nine_point_one == Approx( 1 ) );
|
||||||
CHECK( data.float_nine_point_one == 0 );
|
CHECK( data.float_nine_point_one == Approx( 0 ) );
|
||||||
CHECK( data.double_pi == Approx( 3.1415 ) );
|
CHECK( data.double_pi == Approx( 3.1415 ) );
|
||||||
CHECK( data.str_hello == "goodbye" );
|
CHECK( data.str_hello == "goodbye" );
|
||||||
CHECK( data.str_hello == "hell" );
|
CHECK( data.str_hello == "hell" );
|
||||||
@ -76,8 +76,8 @@ TEST_CASE( "./succeeding/conditions/inequality", "Inequality checks that should
|
|||||||
REQUIRE( data.int_seven != 8 );
|
REQUIRE( data.int_seven != 8 );
|
||||||
REQUIRE( data.float_nine_point_one != Approx( 9.11f ) );
|
REQUIRE( data.float_nine_point_one != Approx( 9.11f ) );
|
||||||
REQUIRE( data.float_nine_point_one != Approx( 9.0f ) );
|
REQUIRE( data.float_nine_point_one != Approx( 9.0f ) );
|
||||||
REQUIRE( data.float_nine_point_one != 1 );
|
REQUIRE( data.float_nine_point_one != Approx( 1 ) );
|
||||||
REQUIRE( data.float_nine_point_one != 0 );
|
REQUIRE( data.float_nine_point_one != Approx( 0 ) );
|
||||||
REQUIRE( data.double_pi != Approx( 3.1415 ) );
|
REQUIRE( data.double_pi != Approx( 3.1415 ) );
|
||||||
REQUIRE( data.str_hello != "goodbye" );
|
REQUIRE( data.str_hello != "goodbye" );
|
||||||
REQUIRE( data.str_hello != "hell" );
|
REQUIRE( data.str_hello != "hell" );
|
||||||
|
@ -23,46 +23,46 @@ namespace Catch
|
|||||||
{
|
{
|
||||||
struct TestStats
|
struct TestStats
|
||||||
{
|
{
|
||||||
std::string element;
|
std::string m_element;
|
||||||
std::string resultType;
|
std::string m_resultType;
|
||||||
std::string message;
|
std::string m_message;
|
||||||
std::string content;
|
std::string m_content;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TestCaseStats
|
struct TestCaseStats
|
||||||
{
|
{
|
||||||
TestCaseStats( const std::string& name = std::string() )
|
TestCaseStats( const std::string& name = std::string() )
|
||||||
: name( name )
|
: m_name( name )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
double timeInSeconds;
|
double m_timeInSeconds;
|
||||||
std::string status;
|
std::string m_status;
|
||||||
std::string className;
|
std::string m_className;
|
||||||
std::string name;
|
std::string m_name;
|
||||||
std::vector<TestStats> testStats;
|
std::vector<TestStats> m_testStats;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Stats
|
struct Stats
|
||||||
{
|
{
|
||||||
Stats( const std::string& name = std::string() )
|
Stats( const std::string& name = std::string() )
|
||||||
: testsCount( 0 ),
|
: m_testsCount( 0 ),
|
||||||
failuresCount( 0 ),
|
m_failuresCount( 0 ),
|
||||||
disabledCount( 0 ),
|
m_disabledCount( 0 ),
|
||||||
errorsCount( 0 ),
|
m_errorsCount( 0 ),
|
||||||
timeInSeconds( 0 ),
|
m_timeInSeconds( 0 ),
|
||||||
name( name )
|
m_name( name )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t testsCount;
|
std::size_t m_testsCount;
|
||||||
std::size_t failuresCount;
|
std::size_t m_failuresCount;
|
||||||
std::size_t disabledCount;
|
std::size_t m_disabledCount;
|
||||||
std::size_t errorsCount;
|
std::size_t m_errorsCount;
|
||||||
double timeInSeconds;
|
double m_timeInSeconds;
|
||||||
std::string name;
|
std::string m_name;
|
||||||
|
|
||||||
std::vector<TestCaseStats> testCaseStats;
|
std::vector<TestCaseStats> m_testCaseStats;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -98,7 +98,7 @@ namespace Catch
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
virtual void EndGroup( const std::string&, std::size_t succeeded, std::size_t failed )
|
virtual void EndGroup( const std::string&, std::size_t succeeded, std::size_t failed )
|
||||||
{
|
{
|
||||||
m_currentStats->testsCount = failed+succeeded;
|
m_currentStats->m_testsCount = failed+succeeded;
|
||||||
m_currentStats = &m_testSuiteStats;
|
m_currentStats = &m_testSuiteStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ namespace Catch
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
virtual void StartTestCase( const Catch::TestCaseInfo& testInfo )
|
virtual void StartTestCase( const Catch::TestCaseInfo& testInfo )
|
||||||
{
|
{
|
||||||
m_currentStats->testCaseStats.push_back( TestCaseStats( testInfo.getName() ) );
|
m_currentStats->m_testCaseStats.push_back( TestCaseStats( testInfo.getName() ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ namespace Catch
|
|||||||
{
|
{
|
||||||
if( resultInfo.getResultType() != ResultWas::Ok || m_config.includeSuccessfulResults() )
|
if( resultInfo.getResultType() != ResultWas::Ok || m_config.includeSuccessfulResults() )
|
||||||
{
|
{
|
||||||
TestCaseStats& testCaseStats = m_currentStats->testCaseStats.back();
|
TestCaseStats& testCaseStats = m_currentStats->m_testCaseStats.back();
|
||||||
TestStats stats;
|
TestStats stats;
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
if( !resultInfo.getMessage().empty() )
|
if( !resultInfo.getMessage().empty() )
|
||||||
@ -130,37 +130,37 @@ namespace Catch
|
|||||||
oss << resultInfo.getMessage() << " at ";
|
oss << resultInfo.getMessage() << " at ";
|
||||||
}
|
}
|
||||||
oss << resultInfo.getFilename() << ":" << resultInfo.getLine();
|
oss << resultInfo.getFilename() << ":" << resultInfo.getLine();
|
||||||
stats.content = oss.str();
|
stats.m_content = oss.str();
|
||||||
stats.message = resultInfo.getExpandedExpression();
|
stats.m_message = resultInfo.getExpandedExpression();
|
||||||
stats.resultType = resultInfo.getTestMacroName();
|
stats.m_resultType = resultInfo.getTestMacroName();
|
||||||
switch( resultInfo.getResultType() )
|
switch( resultInfo.getResultType() )
|
||||||
{
|
{
|
||||||
case ResultWas::ThrewException:
|
case ResultWas::ThrewException:
|
||||||
stats.element = "error";
|
stats.m_element = "error";
|
||||||
m_currentStats->errorsCount++;
|
m_currentStats->m_errorsCount++;
|
||||||
break;
|
break;
|
||||||
case ResultWas::Info:
|
case ResultWas::Info:
|
||||||
stats.element = "info"; // !TBD ?
|
stats.m_element = "info"; // !TBD ?
|
||||||
break;
|
break;
|
||||||
case ResultWas::Warning:
|
case ResultWas::Warning:
|
||||||
stats.element = "warning"; // !TBD ?
|
stats.m_element = "warning"; // !TBD ?
|
||||||
break;
|
break;
|
||||||
case ResultWas::ExplicitFailure:
|
case ResultWas::ExplicitFailure:
|
||||||
stats.element = "failure";
|
stats.m_element = "failure";
|
||||||
m_currentStats->failuresCount++;
|
m_currentStats->m_failuresCount++;
|
||||||
break;
|
break;
|
||||||
case ResultWas::ExpressionFailed:
|
case ResultWas::ExpressionFailed:
|
||||||
stats.element = "failure";
|
stats.m_element = "failure";
|
||||||
m_currentStats->failuresCount++;
|
m_currentStats->m_failuresCount++;
|
||||||
break;
|
break;
|
||||||
case ResultWas::Ok:
|
case ResultWas::Ok:
|
||||||
stats.element = "success";
|
stats.m_element = "success";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
stats.element = "unknown";
|
stats.m_element = "unknown";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
testCaseStats.testStats.push_back( stats );
|
testCaseStats.m_testStats.push_back( stats );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,10 +190,10 @@ namespace Catch
|
|||||||
for(; it != itEnd; ++it )
|
for(; it != itEnd; ++it )
|
||||||
{
|
{
|
||||||
XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" );
|
XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" );
|
||||||
xml.writeAttribute( "name", it->name );
|
xml.writeAttribute( "name", it->m_name );
|
||||||
xml.writeAttribute( "errors", it->errorsCount );
|
xml.writeAttribute( "errors", it->m_errorsCount );
|
||||||
xml.writeAttribute( "failures", it->failuresCount );
|
xml.writeAttribute( "failures", it->m_failuresCount );
|
||||||
xml.writeAttribute( "tests", it->testsCount );
|
xml.writeAttribute( "tests", it->m_testsCount );
|
||||||
xml.writeAttribute( "hostname", "tbd" );
|
xml.writeAttribute( "hostname", "tbd" );
|
||||||
xml.writeAttribute( "time", "tbd" );
|
xml.writeAttribute( "time", "tbd" );
|
||||||
xml.writeAttribute( "timestamp", "tbd" );
|
xml.writeAttribute( "timestamp", "tbd" );
|
||||||
@ -209,16 +209,16 @@ namespace Catch
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
void OutputTestCases( XmlWriter& xml, const Stats& stats )
|
void OutputTestCases( XmlWriter& xml, const Stats& stats )
|
||||||
{
|
{
|
||||||
std::vector<TestCaseStats>::const_iterator it = stats.testCaseStats.begin();
|
std::vector<TestCaseStats>::const_iterator it = stats.m_testCaseStats.begin();
|
||||||
std::vector<TestCaseStats>::const_iterator itEnd = stats.testCaseStats.end();
|
std::vector<TestCaseStats>::const_iterator itEnd = stats.m_testCaseStats.end();
|
||||||
for(; it != itEnd; ++it )
|
for(; it != itEnd; ++it )
|
||||||
{
|
{
|
||||||
xml.writeBlankLine();
|
xml.writeBlankLine();
|
||||||
xml.writeComment( "Test case" );
|
xml.writeComment( "Test case" );
|
||||||
|
|
||||||
XmlWriter::ScopedElement e = xml.scopedElement( "testcase" );
|
XmlWriter::ScopedElement e = xml.scopedElement( "testcase" );
|
||||||
xml.writeAttribute( "classname", it->className );
|
xml.writeAttribute( "classname", it->m_className );
|
||||||
xml.writeAttribute( "name", it->name );
|
xml.writeAttribute( "name", it->m_name );
|
||||||
xml.writeAttribute( "time", "tbd" );
|
xml.writeAttribute( "time", "tbd" );
|
||||||
|
|
||||||
OutputTestResult( xml, *it );
|
OutputTestResult( xml, *it );
|
||||||
@ -229,18 +229,18 @@ namespace Catch
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
void OutputTestResult( XmlWriter& xml, const TestCaseStats& stats )
|
void OutputTestResult( XmlWriter& xml, const TestCaseStats& stats )
|
||||||
{
|
{
|
||||||
std::vector<TestStats>::const_iterator it = stats.testStats.begin();
|
std::vector<TestStats>::const_iterator it = stats.m_testStats.begin();
|
||||||
std::vector<TestStats>::const_iterator itEnd = stats.testStats.end();
|
std::vector<TestStats>::const_iterator itEnd = stats.m_testStats.end();
|
||||||
for(; it != itEnd; ++it )
|
for(; it != itEnd; ++it )
|
||||||
{
|
{
|
||||||
if( it->element != "success" )
|
if( it->m_element != "success" )
|
||||||
{
|
{
|
||||||
XmlWriter::ScopedElement e = xml.scopedElement( it->element );
|
XmlWriter::ScopedElement e = xml.scopedElement( it->m_element );
|
||||||
|
|
||||||
xml.writeAttribute( "message", it->message );
|
xml.writeAttribute( "message", it->m_message );
|
||||||
xml.writeAttribute( "type", it->resultType );
|
xml.writeAttribute( "type", it->m_resultType );
|
||||||
if( !it->content.empty() )
|
if( !it->m_content.empty() )
|
||||||
xml.writeText( it->content );
|
xml.writeText( it->m_content );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ namespace Catch
|
|||||||
inline int Main( int argc, char * const argv[] )
|
inline int Main( int argc, char * const argv[] )
|
||||||
{
|
{
|
||||||
Config config;
|
Config config;
|
||||||
ArgParser( argc, argv, config );
|
ArgParser( argc, argv, config );
|
||||||
|
|
||||||
if( !config.getMessage().empty() )
|
if( !config.getMessage().empty() )
|
||||||
{
|
{
|
||||||
|
@ -125,13 +125,13 @@ namespace Catch
|
|||||||
if( m_args.size() >= 2 )
|
if( m_args.size() >= 2 )
|
||||||
{
|
{
|
||||||
if( m_args[1] == "xml" )
|
if( m_args[1] == "xml" )
|
||||||
listSpec = (Config::List::What)( listSpec | Config::List::AsXml );
|
listSpec = static_cast<Config::List::What>( listSpec | Config::List::AsXml );
|
||||||
else if( m_args[1] == "text" )
|
else if( m_args[1] == "text" )
|
||||||
listSpec = (Config::List::What)( listSpec | Config::List::AsText );
|
listSpec = static_cast<Config::List::What>( listSpec | Config::List::AsText );
|
||||||
else
|
else
|
||||||
return setErrorMode( m_command + " expected [xml] or [text] but recieved: [" + m_args[1] + "]" );
|
return setErrorMode( m_command + " expected [xml] or [text] but recieved: [" + m_args[1] + "]" );
|
||||||
}
|
}
|
||||||
m_config.setListSpec( (Config::List::What)( m_config.getListSpec() | listSpec ) );
|
m_config.setListSpec( static_cast<Config::List::What>( m_config.getListSpec() | listSpec ) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case modeTest:
|
case modeTest:
|
||||||
|
@ -150,13 +150,13 @@ namespace Catch
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
List::What listWhat() const
|
List::What listWhat() const
|
||||||
{
|
{
|
||||||
return (List::What)( m_listSpec & List::WhatMask );
|
return static_cast<List::What>( m_listSpec & List::WhatMask );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
List::What listAs() const
|
List::What listAs() const
|
||||||
{
|
{
|
||||||
return (List::What)( m_listSpec & List::AsMask );
|
return static_cast<List::What>( m_listSpec & List::AsMask );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@ -166,9 +166,9 @@ namespace Catch
|
|||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
void setShouldDebugBreak( bool shouldDebugBreak )
|
void setShouldDebugBreak( bool shouldDebugBreakFlag )
|
||||||
{
|
{
|
||||||
m_shouldDebugBreak = shouldDebugBreak;
|
m_shouldDebugBreak = shouldDebugBreakFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@ -178,9 +178,9 @@ namespace Catch
|
|||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
void setShowHelp( bool showHelp )
|
void setShowHelp( bool showHelpFlag )
|
||||||
{
|
{
|
||||||
m_showHelp = showHelp;
|
m_showHelp = showHelpFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
// The following code snippet taken from:
|
// The following code snippet taken from:
|
||||||
// http://cocoawithlove.com/2008/03/break-into-debugger.html
|
// http://cocoawithlove.com/2008/03/break-into-debugger.html
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#if __ppc64__ || __ppc__
|
#if defined(__ppc64__) || defined(__ppc__)
|
||||||
#define DebugBreak() \
|
#define DebugBreak() \
|
||||||
if( Catch::AmIBeingDebugged() ) \
|
if( Catch::AmIBeingDebugged() ) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -24,6 +24,10 @@ namespace Catch
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
struct IReporterConfig
|
struct IReporterConfig
|
||||||
{
|
{
|
||||||
|
virtual ~IReporterConfig
|
||||||
|
()
|
||||||
|
{}
|
||||||
|
|
||||||
virtual std::ostream& stream
|
virtual std::ostream& stream
|
||||||
() const = 0;
|
() const = 0;
|
||||||
|
|
||||||
|
@ -18,6 +18,10 @@ namespace Catch
|
|||||||
{
|
{
|
||||||
struct IRunner
|
struct IRunner
|
||||||
{
|
{
|
||||||
|
virtual ~IRunner
|
||||||
|
()
|
||||||
|
{}
|
||||||
|
|
||||||
virtual void runAll
|
virtual void runAll
|
||||||
() = 0;
|
() = 0;
|
||||||
|
|
||||||
|
@ -42,8 +42,16 @@ namespace Catch
|
|||||||
|
|
||||||
struct ITestCaseRegistry
|
struct ITestCaseRegistry
|
||||||
{
|
{
|
||||||
virtual void registerTest( const TestCaseInfo& testInfo ) = 0;
|
virtual ~ITestCaseRegistry
|
||||||
virtual const std::vector<TestCaseInfo>& getAllTests() const = 0;
|
()
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual void registerTest
|
||||||
|
( const TestCaseInfo& testInfo
|
||||||
|
) = 0;
|
||||||
|
|
||||||
|
virtual const std::vector<TestCaseInfo>& getAllTests
|
||||||
|
() const = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ namespace Catch
|
|||||||
if( c != EOF )
|
if( c != EOF )
|
||||||
{
|
{
|
||||||
if( pbase() == epptr() )
|
if( pbase() == epptr() )
|
||||||
m_writer( std::string( 1, (char)c ) );
|
m_writer( std::string( 1, static_cast<char>( c ) ) );
|
||||||
else
|
else
|
||||||
sputc( c );
|
sputc( c );
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ namespace Catch
|
|||||||
(
|
(
|
||||||
TestFunction fun
|
TestFunction fun
|
||||||
)
|
)
|
||||||
: fun( fun )
|
: m_fun( fun )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@ -83,7 +83,7 @@ namespace Catch
|
|||||||
()
|
()
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
fun();
|
m_fun();
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@ -91,7 +91,7 @@ namespace Catch
|
|||||||
()
|
()
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
return new FreeFunctionTestCase( fun );
|
return new FreeFunctionTestCase( m_fun );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@ -102,7 +102,7 @@ namespace Catch
|
|||||||
const
|
const
|
||||||
{
|
{
|
||||||
const FreeFunctionTestCase* ffOther = dynamic_cast<const FreeFunctionTestCase*> ( &other );
|
const FreeFunctionTestCase* ffOther = dynamic_cast<const FreeFunctionTestCase*> ( &other );
|
||||||
return ffOther && fun == ffOther->fun;
|
return ffOther && m_fun == ffOther->m_fun;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@ -113,11 +113,11 @@ namespace Catch
|
|||||||
const
|
const
|
||||||
{
|
{
|
||||||
const FreeFunctionTestCase* ffOther = dynamic_cast<const FreeFunctionTestCase*> ( &other );
|
const FreeFunctionTestCase* ffOther = dynamic_cast<const FreeFunctionTestCase*> ( &other );
|
||||||
return ffOther && fun < ffOther->fun;
|
return ffOther && m_fun < ffOther->m_fun;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TestFunction fun;
|
TestFunction m_fun;
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -22,34 +22,34 @@ template<typename C>
|
|||||||
struct MethodTestCase : ITestCase
|
struct MethodTestCase : ITestCase
|
||||||
{
|
{
|
||||||
MethodTestCase( void (C::*method)() )
|
MethodTestCase( void (C::*method)() )
|
||||||
: method( method )
|
: m_method( method )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void invoke() const
|
virtual void invoke() const
|
||||||
{
|
{
|
||||||
C obj;
|
C obj;
|
||||||
(obj.*method)();
|
(obj.*m_method)();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ITestCase* clone() const
|
virtual ITestCase* clone() const
|
||||||
{
|
{
|
||||||
return new MethodTestCase<C>( method );
|
return new MethodTestCase<C>( m_method );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool operator == ( const ITestCase& other ) const
|
virtual bool operator == ( const ITestCase& other ) const
|
||||||
{
|
{
|
||||||
const MethodTestCase* mtOther = dynamic_cast<const MethodTestCase*>( &other );
|
const MethodTestCase* mtOther = dynamic_cast<const MethodTestCase*>( &other );
|
||||||
return mtOther && method == mtOther->method;
|
return mtOther && m_method == mtOther->m_method;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool operator < ( const ITestCase& other ) const
|
virtual bool operator < ( const ITestCase& other ) const
|
||||||
{
|
{
|
||||||
const MethodTestCase* mtOther = dynamic_cast<const MethodTestCase*>( &other );
|
const MethodTestCase* mtOther = dynamic_cast<const MethodTestCase*>( &other );
|
||||||
return mtOther && &method < &mtOther->method;
|
return mtOther && &m_method < &mtOther->m_method;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void (C::*method)();
|
void (C::*m_method)();
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void(*TestFunction)();
|
typedef void(*TestFunction)();
|
||||||
|
Loading…
Reference in New Issue
Block a user