mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-25 05:59:24 +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
|
@ -68,31 +68,18 @@ namespace Catch {
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class FreeFunctionTestCase : public ITestCase {
|
||||
class FreeFunctionTestCase : public SharedImpl<ITestCase> {
|
||||
public:
|
||||
|
||||
FreeFunctionTestCase( TestFunction fun ) : m_fun( fun ) {}
|
||||
virtual ~FreeFunctionTestCase();
|
||||
|
||||
|
||||
virtual void invoke() const {
|
||||
m_fun();
|
||||
}
|
||||
|
||||
virtual ITestCase* clone() const {
|
||||
return new FreeFunctionTestCase( m_fun );
|
||||
}
|
||||
|
||||
virtual bool operator == ( const ITestCase& other ) const {
|
||||
const FreeFunctionTestCase* ffOther = dynamic_cast<const FreeFunctionTestCase*> ( &other );
|
||||
return ffOther && m_fun == ffOther->m_fun;
|
||||
}
|
||||
|
||||
virtual bool operator < ( const ITestCase& other ) const {
|
||||
const FreeFunctionTestCase* ffOther = dynamic_cast<const FreeFunctionTestCase*> ( &other );
|
||||
return ffOther && m_fun < ffOther->m_fun;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
virtual ~FreeFunctionTestCase();
|
||||
|
||||
TestFunction m_fun;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue