mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-25 14:09:26 +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
|
@ -33,30 +33,13 @@ namespace Catch {
|
|||
m_description()
|
||||
{}
|
||||
|
||||
TestCaseInfo( const TestCaseInfo& other )
|
||||
: m_test( other.m_test->clone() ),
|
||||
m_name( other.m_name ),
|
||||
m_description( other.m_description ),
|
||||
m_lineInfo( other.m_lineInfo )
|
||||
{}
|
||||
|
||||
TestCaseInfo( const TestCaseInfo& other, const std::string& name )
|
||||
: m_test( other.m_test->clone() ),
|
||||
: m_test( other.m_test ),
|
||||
m_name( name ),
|
||||
m_description( other.m_description ),
|
||||
m_lineInfo( other.m_lineInfo )
|
||||
{}
|
||||
|
||||
TestCaseInfo& operator = ( const TestCaseInfo& other ) {
|
||||
TestCaseInfo temp( other );
|
||||
swap( temp );
|
||||
return *this;
|
||||
}
|
||||
|
||||
~TestCaseInfo() {
|
||||
delete m_test;
|
||||
}
|
||||
|
||||
|
||||
void invoke() const {
|
||||
m_test->invoke();
|
||||
}
|
||||
|
@ -78,14 +61,14 @@ namespace Catch {
|
|||
}
|
||||
|
||||
void swap( TestCaseInfo& other ) {
|
||||
std::swap( m_test, other.m_test );
|
||||
m_test.swap( other.m_test );
|
||||
m_name.swap( other.m_name );
|
||||
m_description.swap( other.m_description );
|
||||
m_lineInfo.swap( other.m_lineInfo );
|
||||
}
|
||||
|
||||
bool operator == ( const TestCaseInfo& other ) const {
|
||||
return *m_test == *other.m_test && m_name == other.m_name;
|
||||
return m_test.get() == other.m_test.get() && m_name == other.m_name;
|
||||
}
|
||||
|
||||
bool operator < ( const TestCaseInfo& other ) const {
|
||||
|
@ -93,7 +76,7 @@ namespace Catch {
|
|||
}
|
||||
|
||||
private:
|
||||
ITestCase* m_test;
|
||||
Ptr<ITestCase> m_test;
|
||||
std::string m_name;
|
||||
std::string m_description;
|
||||
SourceLineInfo m_lineInfo;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue