mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-28 07:29:25 +00:00
Made ITestCase a shared object
This commit is contained in:
parent
a67d833091
commit
9c6ce97f01
6 changed files with 19 additions and 79 deletions
|
@ -14,7 +14,7 @@
|
|||
namespace Catch {
|
||||
|
||||
template<typename C>
|
||||
class MethodTestCase : public ITestCase {
|
||||
class MethodTestCase : public SharedImpl<ITestCase> {
|
||||
|
||||
public:
|
||||
MethodTestCase( void (C::*method)() ) : m_method( method ) {}
|
||||
|
@ -24,21 +24,9 @@ public:
|
|||
(obj.*m_method)();
|
||||
}
|
||||
|
||||
virtual ITestCase* clone() const {
|
||||
return new MethodTestCase<C>( m_method );
|
||||
}
|
||||
|
||||
virtual bool operator == ( const ITestCase& other ) const {
|
||||
const MethodTestCase* mtOther = dynamic_cast<const MethodTestCase*>( &other );
|
||||
return mtOther && m_method == mtOther->m_method;
|
||||
}
|
||||
|
||||
virtual bool operator < ( const ITestCase& other ) const {
|
||||
const MethodTestCase* mtOther = dynamic_cast<const MethodTestCase*>( &other );
|
||||
return mtOther && &m_method < &mtOther->m_method;
|
||||
}
|
||||
|
||||
private:
|
||||
virtual ~MethodTestCase() {}
|
||||
|
||||
void (C::*m_method)();
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue