Made ITestCase a shared object
This commit is contained in:
1 parent
a67d833091
commit
9c6ce97f01
6 files changed
+19
-79
No files matched your search
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user