mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	Made ITestCase a shared object
This commit is contained in:
		| @@ -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
	 Phil Nash
					Phil Nash