mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Removed deprecated section tracking implementation and tests
This commit is contained in:
parent
471bd2556a
commit
bc8840cbb8
@ -105,7 +105,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
while( !m_testCaseTracker->isSuccessfullyCompleted() && !aborting() );
|
while( !m_testCaseTracker->isSuccessfullyCompleted() && !aborting() );
|
||||||
}
|
}
|
||||||
// !TBD: deprecated
|
// !TBD: deprecated - this will be replaced by indexed trackers
|
||||||
while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() );
|
while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() );
|
||||||
|
|
||||||
Totals deltaTotals = m_totals.delta( prevTotals );
|
Totals deltaTotals = m_totals.delta( prevTotals );
|
||||||
@ -266,7 +266,6 @@ namespace Catch {
|
|||||||
double duration = 0;
|
double duration = 0;
|
||||||
try {
|
try {
|
||||||
m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal );
|
m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal );
|
||||||
// TestCaseTracker::Guard guard( *m_testCaseTracker );
|
|
||||||
|
|
||||||
seedRng( *m_config );
|
seedRng( *m_config );
|
||||||
|
|
||||||
@ -284,11 +283,9 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
catch( TestFailureException& ) {
|
catch( TestFailureException& ) {
|
||||||
// This just means the test was aborted due to failure
|
// This just means the test was aborted due to failure
|
||||||
// m_testCaseTracker->fail();
|
|
||||||
}
|
}
|
||||||
catch(...) {
|
catch(...) {
|
||||||
makeUnexpectedResultBuilder().useActiveException();
|
makeUnexpectedResultBuilder().useActiveException();
|
||||||
// m_testCaseTracker->fail();
|
|
||||||
}
|
}
|
||||||
m_testCaseTracker->close();
|
m_testCaseTracker->close();
|
||||||
handleUnfinishedSections();
|
handleUnfinishedSections();
|
||||||
|
@ -311,138 +311,6 @@ using TestCaseTracking::TrackerContext;
|
|||||||
using TestCaseTracking::SectionTracker;
|
using TestCaseTracking::SectionTracker;
|
||||||
using TestCaseTracking::IndexTracker;
|
using TestCaseTracking::IndexTracker;
|
||||||
|
|
||||||
// !TBD: Deprecated
|
|
||||||
namespace SectionTracking {
|
|
||||||
|
|
||||||
|
|
||||||
class TrackedSection {
|
|
||||||
|
|
||||||
typedef std::map<std::string, TrackedSection> TrackedSections;
|
|
||||||
|
|
||||||
public:
|
|
||||||
enum RunState {
|
|
||||||
NotStarted,
|
|
||||||
Executing,
|
|
||||||
ExecutingChildren,
|
|
||||||
Completed
|
|
||||||
};
|
|
||||||
|
|
||||||
TrackedSection( std::string const& name, TrackedSection* parent )
|
|
||||||
: m_name( name ), m_runState( NotStarted ), m_parent( parent )
|
|
||||||
{}
|
|
||||||
|
|
||||||
RunState runState() const { return m_runState; }
|
|
||||||
|
|
||||||
TrackedSection* findChild( std::string const& childName );
|
|
||||||
TrackedSection* acquireChild( std::string const& childName );
|
|
||||||
|
|
||||||
void enter() {
|
|
||||||
if( m_runState == NotStarted )
|
|
||||||
m_runState = Executing;
|
|
||||||
}
|
|
||||||
void leave();
|
|
||||||
|
|
||||||
TrackedSection* getParent() {
|
|
||||||
return m_parent;
|
|
||||||
}
|
|
||||||
bool hasChildren() const {
|
|
||||||
return !m_children.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string m_name;
|
|
||||||
RunState m_runState;
|
|
||||||
TrackedSections m_children;
|
|
||||||
TrackedSection* m_parent;
|
|
||||||
};
|
|
||||||
|
|
||||||
inline TrackedSection* TrackedSection::findChild( std::string const& childName ) {
|
|
||||||
TrackedSections::iterator it = m_children.find( childName );
|
|
||||||
return it != m_children.end()
|
|
||||||
? &it->second
|
|
||||||
: CATCH_NULL;
|
|
||||||
}
|
|
||||||
inline TrackedSection* TrackedSection::acquireChild( std::string const& childName ) {
|
|
||||||
if( TrackedSection* child = findChild( childName ) )
|
|
||||||
return child;
|
|
||||||
m_children.insert( std::make_pair( childName, TrackedSection( childName, this ) ) );
|
|
||||||
return findChild( childName );
|
|
||||||
}
|
|
||||||
inline void TrackedSection::leave() {
|
|
||||||
for( TrackedSections::const_iterator it = m_children.begin(), itEnd = m_children.end();
|
|
||||||
it != itEnd;
|
|
||||||
++it )
|
|
||||||
if( it->second.runState() != Completed ) {
|
|
||||||
m_runState = ExecutingChildren;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_runState = Completed;
|
|
||||||
}
|
|
||||||
|
|
||||||
class TestCaseTracker {
|
|
||||||
public:
|
|
||||||
TestCaseTracker( std::string const& testCaseName )
|
|
||||||
: m_testCase( testCaseName, CATCH_NULL ),
|
|
||||||
m_currentSection( &m_testCase ),
|
|
||||||
m_completedASectionThisRun( false )
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool enterSection( std::string const& name ) {
|
|
||||||
TrackedSection* child = m_currentSection->acquireChild( name );
|
|
||||||
if( m_completedASectionThisRun || child->runState() == TrackedSection::Completed )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
m_currentSection = child;
|
|
||||||
m_currentSection->enter();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
void leaveSection() {
|
|
||||||
m_currentSection->leave();
|
|
||||||
m_currentSection = m_currentSection->getParent();
|
|
||||||
assert( m_currentSection != CATCH_NULL );
|
|
||||||
m_completedASectionThisRun = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool currentSectionHasChildren() const {
|
|
||||||
return m_currentSection->hasChildren();
|
|
||||||
}
|
|
||||||
bool isCompleted() const {
|
|
||||||
return m_testCase.runState() == TrackedSection::Completed;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Guard {
|
|
||||||
public:
|
|
||||||
Guard( TestCaseTracker& tracker ) : m_tracker( tracker ) {
|
|
||||||
m_tracker.enterTestCase();
|
|
||||||
}
|
|
||||||
~Guard() {
|
|
||||||
m_tracker.leaveTestCase();
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
Guard( Guard const& );
|
|
||||||
void operator = ( Guard const& );
|
|
||||||
TestCaseTracker& m_tracker;
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
void enterTestCase() {
|
|
||||||
m_currentSection = &m_testCase;
|
|
||||||
m_completedASectionThisRun = false;
|
|
||||||
m_testCase.enter();
|
|
||||||
}
|
|
||||||
void leaveTestCase() {
|
|
||||||
m_testCase.leave();
|
|
||||||
}
|
|
||||||
|
|
||||||
TrackedSection m_testCase;
|
|
||||||
TrackedSection* m_currentSection;
|
|
||||||
bool m_completedASectionThisRun;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace SectionTracking
|
|
||||||
|
|
||||||
using SectionTracking::TestCaseTracker;
|
|
||||||
|
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_TEST_CASE_TRACKER_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_TEST_CASE_TRACKER_HPP_INCLUDED
|
||||||
|
@ -869,6 +869,6 @@ with expansion:
|
|||||||
"first" == "second"
|
"first" == "second"
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 160 | 117 passed | 42 failed | 1 failed as expected
|
test cases: 159 | 116 passed | 42 failed | 1 failed as expected
|
||||||
assertions: 927 | 827 passed | 87 failed | 13 failed as expected
|
assertions: 907 | 807 passed | 87 failed | 13 failed as expected
|
||||||
|
|
||||||
|
@ -8870,179 +8870,7 @@ PASSED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
1 > 0
|
1 > 0
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
section tracking
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
SectionTrackerTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK_FALSE( testCaseTracker.isCompleted() )
|
|
||||||
with expansion:
|
|
||||||
!false
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
section tracking
|
|
||||||
test case with no sections
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
SectionTrackerTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK_FALSE( testCaseTracker.isCompleted() )
|
|
||||||
with expansion:
|
|
||||||
!false
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( testCaseTracker.isCompleted() )
|
|
||||||
with expansion:
|
|
||||||
true
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
section tracking
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
SectionTrackerTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK_FALSE( testCaseTracker.isCompleted() )
|
|
||||||
with expansion:
|
|
||||||
!false
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
section tracking
|
|
||||||
test case with one section
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
SectionTrackerTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( testCaseTracker.enterSection( section1Name ) )
|
|
||||||
with expansion:
|
|
||||||
true
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK_FALSE( testCaseTracker.isCompleted() )
|
|
||||||
with expansion:
|
|
||||||
!false
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( testCaseTracker.isCompleted() )
|
|
||||||
with expansion:
|
|
||||||
true
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK_FALSE( testCaseTracker.enterSection( section1Name ) )
|
|
||||||
with expansion:
|
|
||||||
!false
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
section tracking
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
SectionTrackerTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK_FALSE( testCaseTracker.isCompleted() )
|
|
||||||
with expansion:
|
|
||||||
!false
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
section tracking
|
|
||||||
test case with two consecutive sections
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
SectionTrackerTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( testCaseTracker.enterSection( section1Name ) )
|
|
||||||
with expansion:
|
|
||||||
true
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK_FALSE( testCaseTracker.enterSection( section2Name ) )
|
|
||||||
with expansion:
|
|
||||||
!false
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK_FALSE( testCaseTracker.isCompleted() )
|
|
||||||
with expansion:
|
|
||||||
!false
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK_FALSE( testCaseTracker.enterSection( section1Name ) )
|
|
||||||
with expansion:
|
|
||||||
!false
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( testCaseTracker.enterSection( section2Name ) )
|
|
||||||
with expansion:
|
|
||||||
true
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( testCaseTracker.isCompleted() )
|
|
||||||
with expansion:
|
|
||||||
true
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
section tracking
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
SectionTrackerTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK_FALSE( testCaseTracker.isCompleted() )
|
|
||||||
with expansion:
|
|
||||||
!false
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
section tracking
|
|
||||||
test case with one section within another
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
SectionTrackerTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( testCaseTracker.enterSection( section1Name ) )
|
|
||||||
with expansion:
|
|
||||||
true
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( testCaseTracker.enterSection( section2Name ) )
|
|
||||||
with expansion:
|
|
||||||
true
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK_FALSE( testCaseTracker.isCompleted() )
|
|
||||||
with expansion:
|
|
||||||
!false
|
|
||||||
|
|
||||||
SectionTrackerTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( testCaseTracker.isCompleted() )
|
|
||||||
with expansion:
|
|
||||||
true
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 160 | 120 passed | 39 failed | 1 failed as expected
|
test cases: 159 | 119 passed | 39 failed | 1 failed as expected
|
||||||
assertions: 920 | 827 passed | 80 failed | 13 failed as expected
|
assertions: 900 | 807 passed | 80 failed | 13 failed as expected
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="CatchSelfTest" errors="12" failures="68" tests="920" hostname="tbd" time="{duration}" timestamp="tbd">
|
<testsuite name="CatchSelfTest" errors="12" failures="68" tests="900" hostname="tbd" time="{duration}" timestamp="tbd">
|
||||||
<testcase classname="global" name="toString(enum)" time="{duration}"/>
|
<testcase classname="global" name="toString(enum)" time="{duration}"/>
|
||||||
<testcase classname="global" name="toString(enum w/operator<<)" time="{duration}"/>
|
<testcase classname="global" name="toString(enum w/operator<<)" time="{duration}"/>
|
||||||
<testcase classname="global" name="toString(enum class)" time="{duration}"/>
|
<testcase classname="global" name="toString(enum class)" time="{duration}"/>
|
||||||
@ -644,11 +644,6 @@ TrickyTests.cpp:<line number>
|
|||||||
<testcase classname="Scenario: This is a really long scenario name to see how the list command deals with wrapping" name="Given: A section name that is so long that it cannot fit in a single console width/When: The test headers are printed as part of the normal running of the scenario/Then: The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent" time="{duration}"/>
|
<testcase classname="Scenario: This is a really long scenario name to see how the list command deals with wrapping" name="Given: A section name that is so long that it cannot fit in a single console width/When: The test headers are printed as part of the normal running of the scenario/Then: The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent" time="{duration}"/>
|
||||||
<testcase classname="Fixture" name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods/Given: No operations precede me" time="{duration}"/>
|
<testcase classname="Fixture" name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods/Given: No operations precede me" time="{duration}"/>
|
||||||
<testcase classname="Fixture" name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods/Given: No operations precede me/When: We get the count/Then: Subsequently values are higher" time="{duration}"/>
|
<testcase classname="Fixture" name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods/Given: No operations precede me/When: We get the count/Then: Subsequently values are higher" time="{duration}"/>
|
||||||
<testcase classname="section tracking" name="root" time="{duration}"/>
|
|
||||||
<testcase classname="section tracking" name="test case with no sections" time="{duration}"/>
|
|
||||||
<testcase classname="section tracking" name="test case with one section" time="{duration}"/>
|
|
||||||
<testcase classname="section tracking" name="test case with two consecutive sections" time="{duration}"/>
|
|
||||||
<testcase classname="section tracking" name="test case with one section within another" time="{duration}"/>
|
|
||||||
<system-out>
|
<system-out>
|
||||||
Message from section one
|
Message from section one
|
||||||
Message from section two
|
Message from section two
|
||||||
|
@ -9422,182 +9422,7 @@ there"
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="section tracking">
|
<OverallResults successes="807" failures="80" expectedFailures="13"/>
|
||||||
<Expression success="true" type="CHECK_FALSE" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
!testCaseTracker.isCompleted()
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
!false
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<Section name="test case with no sections">
|
|
||||||
<Expression success="true" type="CHECK_FALSE" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
!testCaseTracker.isCompleted()
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
!false
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<Expression success="true" type="CHECK" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
testCaseTracker.isCompleted()
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
true
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
|
||||||
</Section>
|
|
||||||
<Expression success="true" type="CHECK_FALSE" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
!testCaseTracker.isCompleted()
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
!false
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<Section name="test case with one section">
|
|
||||||
<Expression success="true" type="CHECK" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
testCaseTracker.enterSection( section1Name )
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
true
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<Expression success="true" type="CHECK_FALSE" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
!testCaseTracker.isCompleted()
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
!false
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<Expression success="true" type="CHECK" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
testCaseTracker.isCompleted()
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
true
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<Expression success="true" type="CHECK_FALSE" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
!testCaseTracker.enterSection( section1Name )
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
!false
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<OverallResults successes="4" failures="0" expectedFailures="0"/>
|
|
||||||
</Section>
|
|
||||||
<Expression success="true" type="CHECK_FALSE" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
!testCaseTracker.isCompleted()
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
!false
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<Section name="test case with two consecutive sections">
|
|
||||||
<Expression success="true" type="CHECK" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
testCaseTracker.enterSection( section1Name )
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
true
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<Expression success="true" type="CHECK_FALSE" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
!testCaseTracker.enterSection( section2Name )
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
!false
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<Expression success="true" type="CHECK_FALSE" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
!testCaseTracker.isCompleted()
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
!false
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<Expression success="true" type="CHECK_FALSE" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
!testCaseTracker.enterSection( section1Name )
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
!false
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<Expression success="true" type="CHECK" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
testCaseTracker.enterSection( section2Name )
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
true
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<Expression success="true" type="CHECK" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
testCaseTracker.isCompleted()
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
true
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<OverallResults successes="6" failures="0" expectedFailures="0"/>
|
|
||||||
</Section>
|
|
||||||
<Expression success="true" type="CHECK_FALSE" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
!testCaseTracker.isCompleted()
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
!false
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<Section name="test case with one section within another">
|
|
||||||
<Expression success="true" type="CHECK" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
testCaseTracker.enterSection( section1Name )
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
true
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<Expression success="true" type="CHECK" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
testCaseTracker.enterSection( section2Name )
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
true
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<Expression success="true" type="CHECK_FALSE" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
!testCaseTracker.isCompleted()
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
!false
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<Expression success="true" type="CHECK" filename="projects/SelfTest/SectionTrackerTests.cpp" >
|
|
||||||
<Original>
|
|
||||||
testCaseTracker.isCompleted()
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
true
|
|
||||||
</Expanded>
|
|
||||||
</Expression>
|
|
||||||
<OverallResults successes="4" failures="0" expectedFailures="0"/>
|
|
||||||
</Section>
|
|
||||||
<OverallResult success="true"/>
|
|
||||||
</TestCase>
|
|
||||||
<OverallResults successes="827" failures="80" expectedFailures="13"/>
|
|
||||||
</Group>
|
</Group>
|
||||||
<OverallResults successes="827" failures="80" expectedFailures="13"/>
|
<OverallResults successes="807" failures="80" expectedFailures="13"/>
|
||||||
</Catch>
|
</Catch>
|
||||||
|
@ -1,114 +0,0 @@
|
|||||||
/*
|
|
||||||
* Created by Phil on 20/07/2013.
|
|
||||||
* Copyright 2013 Two Blue Cubes Ltd
|
|
||||||
*
|
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "internal/catch_suppress_warnings.h"
|
|
||||||
#include "internal/catch_test_case_tracker.hpp"
|
|
||||||
|
|
||||||
#include "catch.hpp"
|
|
||||||
|
|
||||||
TEST_CASE( "section tracking", "" ) {
|
|
||||||
|
|
||||||
using namespace Catch;
|
|
||||||
TestCaseTracker testCaseTracker( "test case" );
|
|
||||||
|
|
||||||
const std::string section1Name = "section 1";
|
|
||||||
const std::string section2Name = "section 2";
|
|
||||||
|
|
||||||
CHECK_FALSE( testCaseTracker.isCompleted() );
|
|
||||||
|
|
||||||
SECTION( "test case with no sections", "" ) {
|
|
||||||
|
|
||||||
{
|
|
||||||
TestCaseTracker::Guard guard( testCaseTracker );
|
|
||||||
CHECK_FALSE( testCaseTracker.isCompleted() );
|
|
||||||
}
|
|
||||||
CHECK( testCaseTracker.isCompleted() );
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION( "test case with one section", "" ) {
|
|
||||||
|
|
||||||
{
|
|
||||||
TestCaseTracker::Guard guard( testCaseTracker );
|
|
||||||
|
|
||||||
// Enter section? - yes
|
|
||||||
CHECK( testCaseTracker.enterSection( section1Name ) );
|
|
||||||
CHECK_FALSE( testCaseTracker.isCompleted() );
|
|
||||||
testCaseTracker.leaveSection();
|
|
||||||
|
|
||||||
// Leave test case - now complete
|
|
||||||
}
|
|
||||||
CHECK( testCaseTracker.isCompleted() );
|
|
||||||
|
|
||||||
// ...
|
|
||||||
|
|
||||||
// Enter test case again
|
|
||||||
{
|
|
||||||
TestCaseTracker::Guard guard( testCaseTracker );
|
|
||||||
|
|
||||||
// Enter section? - no - now complete
|
|
||||||
CHECK_FALSE( testCaseTracker.enterSection( section1Name ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION( "test case with two consecutive sections", "" ) {
|
|
||||||
|
|
||||||
// Enter test case
|
|
||||||
{
|
|
||||||
TestCaseTracker::Guard guard( testCaseTracker );
|
|
||||||
|
|
||||||
// Enter section 1? - yes
|
|
||||||
CHECK( testCaseTracker.enterSection( section1Name ) );
|
|
||||||
testCaseTracker.leaveSection();
|
|
||||||
|
|
||||||
// Enter section 2? - no - we just exected section 1
|
|
||||||
CHECK_FALSE( testCaseTracker.enterSection( section2Name ) );
|
|
||||||
|
|
||||||
// Leave test case - incomplete (still need to visit section 2)
|
|
||||||
}
|
|
||||||
CHECK_FALSE( testCaseTracker.isCompleted() );
|
|
||||||
|
|
||||||
// ...
|
|
||||||
|
|
||||||
// Enter test case again
|
|
||||||
{
|
|
||||||
TestCaseTracker::Guard guard( testCaseTracker );
|
|
||||||
|
|
||||||
// Enter section 1? - no, already done now
|
|
||||||
CHECK_FALSE( testCaseTracker.enterSection( section1Name ) );
|
|
||||||
|
|
||||||
// Enter section 2? - yes
|
|
||||||
CHECK( testCaseTracker.enterSection( section2Name ) );
|
|
||||||
testCaseTracker.leaveSection();
|
|
||||||
|
|
||||||
// Leave test case - now complete
|
|
||||||
}
|
|
||||||
CHECK( testCaseTracker.isCompleted() );
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION( "test case with one section within another", "" ) {
|
|
||||||
|
|
||||||
// Enter test case again
|
|
||||||
{
|
|
||||||
TestCaseTracker::Guard guard( testCaseTracker );
|
|
||||||
|
|
||||||
// Enter section 1? - yes
|
|
||||||
CHECK( testCaseTracker.enterSection( section1Name ) );
|
|
||||||
|
|
||||||
// Enter section 2? - yes
|
|
||||||
CHECK( testCaseTracker.enterSection( section2Name ) );
|
|
||||||
|
|
||||||
CHECK_FALSE( testCaseTracker.isCompleted() );
|
|
||||||
|
|
||||||
testCaseTracker.leaveSection(); // section 2
|
|
||||||
testCaseTracker.leaveSection(); // section 1
|
|
||||||
|
|
||||||
// Leave test case - now complete
|
|
||||||
}
|
|
||||||
CHECK( testCaseTracker.isCompleted() );
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,7 +7,7 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
26059AF21BD4B94C003D575C /* PartTrackerTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26059AF11BD4B94C003D575C /* PartTrackerTests.cpp */; settings = {ASSET_TAGS = (); }; };
|
26059AF21BD4B94C003D575C /* PartTrackerTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26059AF11BD4B94C003D575C /* PartTrackerTests.cpp */; };
|
||||||
263F7A4719B6FCBF009474C2 /* EnumToString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 263F7A4619B6FCBF009474C2 /* EnumToString.cpp */; };
|
263F7A4719B6FCBF009474C2 /* EnumToString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 263F7A4619B6FCBF009474C2 /* EnumToString.cpp */; };
|
||||||
263F7A4B19B6FE1E009474C2 /* ToStringPair.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 263F7A4819B6FE1E009474C2 /* ToStringPair.cpp */; };
|
263F7A4B19B6FE1E009474C2 /* ToStringPair.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 263F7A4819B6FE1E009474C2 /* ToStringPair.cpp */; };
|
||||||
263F7A4C19B6FE1E009474C2 /* ToStringVector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 263F7A4919B6FE1E009474C2 /* ToStringVector.cpp */; };
|
263F7A4C19B6FE1E009474C2 /* ToStringVector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 263F7A4919B6FE1E009474C2 /* ToStringVector.cpp */; };
|
||||||
@ -18,7 +18,6 @@
|
|||||||
26711C8F195D465C0033EDA2 /* TagAliasTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26711C8D195D465C0033EDA2 /* TagAliasTests.cpp */; };
|
26711C8F195D465C0033EDA2 /* TagAliasTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26711C8D195D465C0033EDA2 /* TagAliasTests.cpp */; };
|
||||||
26847E5F16BBADB40043B9C1 /* catch_message.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26847E5D16BBADB40043B9C1 /* catch_message.cpp */; };
|
26847E5F16BBADB40043B9C1 /* catch_message.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26847E5D16BBADB40043B9C1 /* catch_message.cpp */; };
|
||||||
2691574C1A532A280054F1ED /* ToStringTuple.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2691574B1A532A280054F1ED /* ToStringTuple.cpp */; };
|
2691574C1A532A280054F1ED /* ToStringTuple.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2691574B1A532A280054F1ED /* ToStringTuple.cpp */; };
|
||||||
26948286179A9AB900ED166E /* SectionTrackerTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26948284179A9AB900ED166E /* SectionTrackerTests.cpp */; };
|
|
||||||
2694A1FD16A0000E004816E3 /* catch_text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2694A1FB16A0000E004816E3 /* catch_text.cpp */; };
|
2694A1FD16A0000E004816E3 /* catch_text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2694A1FB16A0000E004816E3 /* catch_text.cpp */; };
|
||||||
26E1B7D319213BC900812682 /* CmdLineTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E1B7D119213BC900812682 /* CmdLineTests.cpp */; };
|
26E1B7D319213BC900812682 /* CmdLineTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E1B7D119213BC900812682 /* CmdLineTests.cpp */; };
|
||||||
4A45DA2416161EF9004F8D6B /* catch_console_colour.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2316161EF9004F8D6B /* catch_console_colour.cpp */; };
|
4A45DA2416161EF9004F8D6B /* catch_console_colour.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2316161EF9004F8D6B /* catch_console_colour.cpp */; };
|
||||||
@ -102,7 +101,6 @@
|
|||||||
2691574B1A532A280054F1ED /* ToStringTuple.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ToStringTuple.cpp; path = ../../../SelfTest/ToStringTuple.cpp; sourceTree = "<group>"; };
|
2691574B1A532A280054F1ED /* ToStringTuple.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ToStringTuple.cpp; path = ../../../SelfTest/ToStringTuple.cpp; sourceTree = "<group>"; };
|
||||||
26926E8318D7777D004E10F2 /* clara.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = clara.h; path = ../../../../include/external/clara.h; sourceTree = "<group>"; };
|
26926E8318D7777D004E10F2 /* clara.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = clara.h; path = ../../../../include/external/clara.h; sourceTree = "<group>"; };
|
||||||
26926E8418D77809004E10F2 /* tbc_text_format.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tbc_text_format.h; path = ../../../../include/external/tbc_text_format.h; sourceTree = "<group>"; };
|
26926E8418D77809004E10F2 /* tbc_text_format.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tbc_text_format.h; path = ../../../../include/external/tbc_text_format.h; sourceTree = "<group>"; };
|
||||||
26948284179A9AB900ED166E /* SectionTrackerTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SectionTrackerTests.cpp; path = ../../../SelfTest/SectionTrackerTests.cpp; sourceTree = "<group>"; };
|
|
||||||
26948287179EF7F900ED166E /* catch_test_case_tracker.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_test_case_tracker.hpp; sourceTree = "<group>"; };
|
26948287179EF7F900ED166E /* catch_test_case_tracker.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_test_case_tracker.hpp; sourceTree = "<group>"; };
|
||||||
2694A1FB16A0000E004816E3 /* catch_text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = catch_text.cpp; sourceTree = "<group>"; };
|
2694A1FB16A0000E004816E3 /* catch_text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = catch_text.cpp; sourceTree = "<group>"; };
|
||||||
269831E519078C1600BB0CE0 /* catch_tostring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_tostring.h; sourceTree = "<group>"; };
|
269831E519078C1600BB0CE0 /* catch_tostring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_tostring.h; sourceTree = "<group>"; };
|
||||||
@ -215,7 +213,6 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
26059AF11BD4B94C003D575C /* PartTrackerTests.cpp */,
|
26059AF11BD4B94C003D575C /* PartTrackerTests.cpp */,
|
||||||
26948284179A9AB900ED166E /* SectionTrackerTests.cpp */,
|
|
||||||
26E1B7D119213BC900812682 /* CmdLineTests.cpp */,
|
26E1B7D119213BC900812682 /* CmdLineTests.cpp */,
|
||||||
26711C8D195D465C0033EDA2 /* TagAliasTests.cpp */,
|
26711C8D195D465C0033EDA2 /* TagAliasTests.cpp */,
|
||||||
);
|
);
|
||||||
@ -578,7 +575,6 @@
|
|||||||
26847E5F16BBADB40043B9C1 /* catch_message.cpp in Sources */,
|
26847E5F16BBADB40043B9C1 /* catch_message.cpp in Sources */,
|
||||||
266B06B816F3A60A004ED264 /* VariadicMacrosTests.cpp in Sources */,
|
266B06B816F3A60A004ED264 /* VariadicMacrosTests.cpp in Sources */,
|
||||||
266ECD74170F3C620030D735 /* BDDTests.cpp in Sources */,
|
266ECD74170F3C620030D735 /* BDDTests.cpp in Sources */,
|
||||||
26948286179A9AB900ED166E /* SectionTrackerTests.cpp in Sources */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user