mirror of
https://github.com/unittest-cpp/unittest-cpp
synced 2026-09-27 00:28:49 +03:00
Created method for compare TestDetails
This commit is contained in:
parent
c92794c7e0
commit
546801f829
2 changed files with 27 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include "TestDetails.h"
|
||||
#include <cstring>
|
||||
|
||||
namespace UnitTest {
|
||||
|
||||
|
|
@ -18,5 +19,29 @@ namespace UnitTest {
|
|||
, timeConstraintExempt(details.timeConstraintExempt)
|
||||
{}
|
||||
|
||||
bool TestDetails::sameTest(const TestDetails & details) const
|
||||
{
|
||||
if (&details == this)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Fast pointer comparison
|
||||
if (details.suiteName == suiteName &&
|
||||
details.testName == testName &&
|
||||
details.filename == filename)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Long string comparison
|
||||
if (!strcmp(details.suiteName, suiteName) &&
|
||||
!strcmp(details.testName, testName) &&
|
||||
!strcmp(details.filename, filename))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ namespace UnitTest {
|
|||
int const lineNumber;
|
||||
mutable bool timeConstraintExempt;
|
||||
|
||||
bool sameTest(const TestDetails & details) const;
|
||||
|
||||
TestDetails(TestDetails const&); // Why is it public? --> http://gcc.gnu.org/bugs.html#cxx_rvalbind
|
||||
private:
|
||||
TestDetails& operator=(TestDetails const&);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue