Sections are, once again, eagerly entered.

When the section tracking code was rewritten a while back to simplify and iron out some bugs the order of evaluation was changed so that each new section was skipped on the first run through.
This had unwelcome consequences for some people.
This commit restores the original semantics (while maintaining the simpler, less buggy, new code).
This commit is contained in:
Phil Nash 2014-04-21 19:02:38 +01:00
parent d7e1790347
commit a020865990
10 changed files with 107 additions and 917 deletions

View File

@ -1,6 +1,6 @@
![catch logo](catch-logo-small.png) ![catch logo](catch-logo-small.png)
*v1.0 build 38 (master branch)* *v1.0 build 39 (master branch)*
Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch)

View File

@ -271,8 +271,8 @@ namespace Catch {
} }
// If sections ended prematurely due to an exception we stored their // If sections ended prematurely due to an exception we stored their
// infos here so we can tear them down outside the unwind process. // infos here so we can tear them down outside the unwind process.
for( std::vector<UnfinishedSections>::const_iterator it = m_unfinishedSections.begin(), for( std::vector<UnfinishedSections>::const_reverse_iterator it = m_unfinishedSections.rbegin(),
itEnd = m_unfinishedSections.end(); itEnd = m_unfinishedSections.rend();
it != itEnd; it != itEnd;
++it ) ++it )
sectionEnded( it->info, it->prevAssertions, it->durationInSeconds ); sectionEnded( it->info, it->prevAssertions, it->durationInSeconds );

View File

@ -33,13 +33,18 @@ namespace SectionTracking {
RunState runState() const { return m_runState; } RunState runState() const { return m_runState; }
void addChild( std::string const& childName ) { TrackedSection* findChild( std::string const& childName ) {
TrackedSections::iterator it = m_children.find( childName );
return it != m_children.end()
? &it->second
: NULL;
}
TrackedSection* acquireChild( std::string const& childName ) {
if( TrackedSection* child = findChild( childName ) )
return child;
m_children.insert( std::make_pair( childName, TrackedSection( childName, this ) ) ); m_children.insert( std::make_pair( childName, TrackedSection( childName, this ) ) );
return findChild( childName );
} }
TrackedSection* getChild( std::string const& childName ) {
return &m_children.find( childName )->second;
}
void enter() { void enter() {
if( m_runState == NotStarted ) if( m_runState == NotStarted )
m_runState = Executing; m_runState = Executing;
@ -78,21 +83,13 @@ namespace SectionTracking {
{} {}
bool enterSection( std::string const& name ) { bool enterSection( std::string const& name ) {
if( m_completedASectionThisRun ) TrackedSection* child = m_currentSection->acquireChild( name );
if( m_completedASectionThisRun || child->runState() == TrackedSection::Completed )
return false; return false;
if( m_currentSection->runState() == TrackedSection::Executing ) {
m_currentSection->addChild( name ); m_currentSection = child;
return false; m_currentSection->enter();
} return true;
else {
TrackedSection* child = m_currentSection->getChild( name );
if( child->runState() != TrackedSection::Completed ) {
m_currentSection = child;
m_currentSection->enter();
return true;
}
return false;
}
} }
void leaveSection() { void leaveSection() {
m_currentSection->leave(); m_currentSection->leave();
@ -110,9 +107,7 @@ namespace SectionTracking {
class Guard { class Guard {
public: public:
Guard( TestCaseTracker& tracker ) Guard( TestCaseTracker& tracker ) : m_tracker( tracker ) {
: m_tracker( tracker )
{
m_tracker.enterTestCase(); m_tracker.enterTestCase();
} }
~Guard() { ~Guard() {

View File

@ -13,7 +13,7 @@
namespace Catch { namespace Catch {
// These numbers are maintained by a script // These numbers are maintained by a script
Version libraryVersion( 1, 0, 38, "master" ); Version libraryVersion( 1, 0, 39, "master" );
} }
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED

View File

@ -698,26 +698,6 @@ A couple of nested sections followed by a failure
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
MiscTests.cpp:<line number>: FAILED:
explicitly with message:
to infinity and beyond
-------------------------------------------------------------------------------
A couple of nested sections followed by a failure
-------------------------------------------------------------------------------
MiscTests.cpp:<line number>
...............................................................................
MiscTests.cpp:<line number>: FAILED:
explicitly with message:
to infinity and beyond
-------------------------------------------------------------------------------
A couple of nested sections followed by a failure
-------------------------------------------------------------------------------
MiscTests.cpp:<line number>
...............................................................................
MiscTests.cpp:<line number>: FAILED: MiscTests.cpp:<line number>: FAILED:
explicitly with message: explicitly with message:
to infinity and beyond to infinity and beyond
@ -774,5 +754,5 @@ with expansion:
"first" == "second" "first" == "second"
=============================================================================== ===============================================================================
125 test cases - 38 failed (661 assertions - 93 failed) 125 test cases - 38 failed (627 assertions - 91 failed)

View File

@ -2848,25 +2848,6 @@ nested SECTION tests
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
MiscTests.cpp:<line number>:
PASSED:
REQUIRE( a != b )
with expansion:
1 != 2
MiscTests.cpp:<line number>:
PASSED:
REQUIRE( b != a )
with expansion:
2 != 1
-------------------------------------------------------------------------------
nested SECTION tests
s1
-------------------------------------------------------------------------------
MiscTests.cpp:<line number>
...............................................................................
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
REQUIRE( a != b ) REQUIRE( a != b )
@ -2906,34 +2887,6 @@ MiscTests.cpp:<line number>: FAILED:
with expansion: with expansion:
1 == 2 1 == 2
-------------------------------------------------------------------------------
more nested SECTION tests
s1
s3
-------------------------------------------------------------------------------
MiscTests.cpp:<line number>
...............................................................................
MiscTests.cpp:<line number>:
PASSED:
REQUIRE( a != b )
with expansion:
1 != 2
-------------------------------------------------------------------------------
more nested SECTION tests
s1
s4
-------------------------------------------------------------------------------
MiscTests.cpp:<line number>
...............................................................................
MiscTests.cpp:<line number>:
PASSED:
REQUIRE( a < b )
with expansion:
1 < 2
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
even more nested SECTION tests even more nested SECTION tests
c c
@ -3396,24 +3349,6 @@ vectors can be sized and resized
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
MiscTests.cpp:<line number>:
PASSED:
REQUIRE( v.size() == 5 )
with expansion:
5 == 5
MiscTests.cpp:<line number>:
PASSED:
REQUIRE( v.capacity() >= 5 )
with expansion:
5 >= 5
-------------------------------------------------------------------------------
vectors can be sized and resized
-------------------------------------------------------------------------------
MiscTests.cpp:<line number>
...............................................................................
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
REQUIRE( v.size() == 5 ) REQUIRE( v.size() == 5 )
@ -3470,43 +3405,6 @@ vectors can be sized and resized
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
MiscTests.cpp:<line number>:
PASSED:
REQUIRE( v.size() == 0 )
with expansion:
0 == 0
MiscTests.cpp:<line number>:
PASSED:
REQUIRE( v.capacity() >= 5 )
with expansion:
5 >= 5
-------------------------------------------------------------------------------
vectors can be sized and resized
-------------------------------------------------------------------------------
MiscTests.cpp:<line number>
...............................................................................
MiscTests.cpp:<line number>:
PASSED:
REQUIRE( v.size() == 5 )
with expansion:
5 == 5
MiscTests.cpp:<line number>:
PASSED:
REQUIRE( v.capacity() >= 5 )
with expansion:
5 >= 5
-------------------------------------------------------------------------------
vectors can be sized and resized
resizing smaller changes size but not capacity
-------------------------------------------------------------------------------
MiscTests.cpp:<line number>
...............................................................................
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
REQUIRE( v.size() == 0 ) REQUIRE( v.size() == 0 )
@ -3607,26 +3505,6 @@ PASSED:
with expansion: with expansion:
5 >= 5 5 >= 5
-------------------------------------------------------------------------------
A couple of nested sections followed by a failure
-------------------------------------------------------------------------------
MiscTests.cpp:<line number>
...............................................................................
MiscTests.cpp:<line number>: FAILED:
explicitly with message:
to infinity and beyond
-------------------------------------------------------------------------------
A couple of nested sections followed by a failure
-------------------------------------------------------------------------------
MiscTests.cpp:<line number>
...............................................................................
MiscTests.cpp:<line number>: FAILED:
explicitly with message:
to infinity and beyond
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
A couple of nested sections followed by a failure A couple of nested sections followed by a failure
Outer Outer
@ -6261,43 +6139,6 @@ Assertions then sections
TrickyTests.cpp:<line number> TrickyTests.cpp:<line number>
............................................................................... ...............................................................................
TrickyTests.cpp:<line number>:
PASSED:
REQUIRE( Catch::isTrue( true ) )
with expansion:
true
-------------------------------------------------------------------------------
Assertions then sections
-------------------------------------------------------------------------------
TrickyTests.cpp:<line number>
...............................................................................
TrickyTests.cpp:<line number>:
PASSED:
REQUIRE( Catch::isTrue( true ) )
with expansion:
true
-------------------------------------------------------------------------------
Assertions then sections
A section
-------------------------------------------------------------------------------
TrickyTests.cpp:<line number>
...............................................................................
TrickyTests.cpp:<line number>:
PASSED:
REQUIRE( Catch::isTrue( true ) )
with expansion:
true
-------------------------------------------------------------------------------
Assertions then sections
-------------------------------------------------------------------------------
TrickyTests.cpp:<line number>
...............................................................................
TrickyTests.cpp:<line number>: TrickyTests.cpp:<line number>:
PASSED: PASSED:
REQUIRE( Catch::isTrue( true ) ) REQUIRE( Catch::isTrue( true ) )
@ -6505,21 +6346,6 @@ Scenario: Do that thing with the thing
BDDTests.cpp:<line number> BDDTests.cpp:<line number>
............................................................................... ...............................................................................
BDDTests.cpp:<line number>:
PASSED:
REQUIRE( itDoesThis() )
with expansion:
true
-------------------------------------------------------------------------------
Scenario: Do that thing with the thing
Given: This stuff exists
When: I do this
Then: it should do this
-------------------------------------------------------------------------------
BDDTests.cpp:<line number>
...............................................................................
BDDTests.cpp:<line number>: BDDTests.cpp:<line number>:
PASSED: PASSED:
REQUIRE( itDoesThis() ) REQUIRE( itDoesThis() )
@ -6549,100 +6375,6 @@ Scenario: Vector resizing affects size and capacity
BDDTests.cpp:<line number> BDDTests.cpp:<line number>
............................................................................... ...............................................................................
BDDTests.cpp:<line number>:
PASSED:
REQUIRE( v.size() == 0 )
with expansion:
0 == 0
-------------------------------------------------------------------------------
Scenario: Vector resizing affects size and capacity
Given: an empty vector
-------------------------------------------------------------------------------
BDDTests.cpp:<line number>
...............................................................................
BDDTests.cpp:<line number>:
PASSED:
REQUIRE( v.size() == 0 )
with expansion:
0 == 0
-------------------------------------------------------------------------------
Scenario: Vector resizing affects size and capacity
Given: an empty vector
-------------------------------------------------------------------------------
BDDTests.cpp:<line number>
...............................................................................
BDDTests.cpp:<line number>:
PASSED:
REQUIRE( v.size() == 0 )
with expansion:
0 == 0
-------------------------------------------------------------------------------
Scenario: Vector resizing affects size and capacity
Given: an empty vector
When: it is made larger
Then: the size and capacity go up
-------------------------------------------------------------------------------
BDDTests.cpp:<line number>
...............................................................................
BDDTests.cpp:<line number>:
PASSED:
REQUIRE( v.size() == 10 )
with expansion:
10 == 10
BDDTests.cpp:<line number>:
PASSED:
REQUIRE( v.capacity() >= 10 )
with expansion:
10 >= 10
-------------------------------------------------------------------------------
Scenario: Vector resizing affects size and capacity
Given: an empty vector
-------------------------------------------------------------------------------
BDDTests.cpp:<line number>
...............................................................................
BDDTests.cpp:<line number>:
PASSED:
REQUIRE( v.size() == 0 )
with expansion:
0 == 0
-------------------------------------------------------------------------------
Scenario: Vector resizing affects size and capacity
Given: an empty vector
When: it is made larger
Then: the size and capacity go up
-------------------------------------------------------------------------------
BDDTests.cpp:<line number>
...............................................................................
BDDTests.cpp:<line number>:
PASSED:
REQUIRE( v.size() == 10 )
with expansion:
10 == 10
BDDTests.cpp:<line number>:
PASSED:
REQUIRE( v.capacity() >= 10 )
with expansion:
10 >= 10
-------------------------------------------------------------------------------
Scenario: Vector resizing affects size and capacity
Given: an empty vector
-------------------------------------------------------------------------------
BDDTests.cpp:<line number>
...............................................................................
BDDTests.cpp:<line number>: BDDTests.cpp:<line number>:
PASSED: PASSED:
REQUIRE( v.size() == 0 ) REQUIRE( v.size() == 0 )
@ -6700,19 +6432,6 @@ Scenario: Vector resizing affects size and capacity
BDDTests.cpp:<line number> BDDTests.cpp:<line number>
............................................................................... ...............................................................................
BDDTests.cpp:<line number>:
PASSED:
REQUIRE( v.size() == 0 )
with expansion:
0 == 0
-------------------------------------------------------------------------------
Scenario: Vector resizing affects size and capacity
Given: an empty vector
-------------------------------------------------------------------------------
BDDTests.cpp:<line number>
...............................................................................
BDDTests.cpp:<line number>: BDDTests.cpp:<line number>:
PASSED: PASSED:
REQUIRE( v.size() == 0 ) REQUIRE( v.size() == 0 )
@ -6764,18 +6483,6 @@ section tracking
SectionTrackerTests.cpp:<line number> SectionTrackerTests.cpp:<line number>
............................................................................... ...............................................................................
SectionTrackerTests.cpp:<line number>:
PASSED:
CHECK_FALSE( testCaseTracker.isCompleted() )
with expansion:
!false
-------------------------------------------------------------------------------
section tracking
-------------------------------------------------------------------------------
SectionTrackerTests.cpp:<line number>
...............................................................................
SectionTrackerTests.cpp:<line number>: SectionTrackerTests.cpp:<line number>:
PASSED: PASSED:
CHECK_FALSE( testCaseTracker.isCompleted() ) CHECK_FALSE( testCaseTracker.isCompleted() )
@ -6820,36 +6527,30 @@ section tracking
SectionTrackerTests.cpp:<line number> SectionTrackerTests.cpp:<line number>
............................................................................... ...............................................................................
SectionTrackerTests.cpp:<line number>:
PASSED:
CHECK_FALSE( testCaseTracker.enterSection( section1Name ) )
with expansion:
!false
SectionTrackerTests.cpp:<line number>:
PASSED:
CHECK_FALSE( testCaseTracker.isCompleted() )
with expansion:
!false
SectionTrackerTests.cpp:<line number>:
PASSED:
CHECK_FALSE( testCaseTracker.isCompleted() )
with expansion:
!false
SectionTrackerTests.cpp:<line number>: SectionTrackerTests.cpp:<line number>:
PASSED: PASSED:
CHECK( testCaseTracker.enterSection( section1Name ) ) CHECK( testCaseTracker.enterSection( section1Name ) )
with expansion: with expansion:
true true
SectionTrackerTests.cpp:<line number>:
PASSED:
CHECK_FALSE( testCaseTracker.isCompleted() )
with expansion:
!false
SectionTrackerTests.cpp:<line number>: SectionTrackerTests.cpp:<line number>:
PASSED: PASSED:
CHECK( testCaseTracker.isCompleted() ) CHECK( testCaseTracker.isCompleted() )
with expansion: with expansion:
true true
SectionTrackerTests.cpp:<line number>:
PASSED:
CHECK_FALSE( testCaseTracker.enterSection( section1Name ) )
with expansion:
!false
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
section tracking section tracking
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -6869,24 +6570,6 @@ section tracking
SectionTrackerTests.cpp:<line number> SectionTrackerTests.cpp:<line number>
............................................................................... ...............................................................................
SectionTrackerTests.cpp:<line number>:
PASSED:
CHECK_FALSE( testCaseTracker.enterSection( section1Name ) )
with expansion:
!false
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>: SectionTrackerTests.cpp:<line number>:
PASSED: PASSED:
CHECK( testCaseTracker.enterSection( section1Name ) ) CHECK( testCaseTracker.enterSection( section1Name ) )
@ -6942,36 +6625,6 @@ section tracking
SectionTrackerTests.cpp:<line number> SectionTrackerTests.cpp:<line number>
............................................................................... ...............................................................................
SectionTrackerTests.cpp:<line number>:
PASSED:
CHECK_FALSE( testCaseTracker.enterSection( section1Name ) )
with expansion:
!false
SectionTrackerTests.cpp:<line number>:
PASSED:
CHECK_FALSE( testCaseTracker.isCompleted() )
with expansion:
!false
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>: SectionTrackerTests.cpp:<line number>:
PASSED: PASSED:
CHECK( testCaseTracker.enterSection( section1Name ) ) CHECK( testCaseTracker.enterSection( section1Name ) )
@ -6984,6 +6637,12 @@ PASSED:
with expansion: with expansion:
true true
SectionTrackerTests.cpp:<line number>:
PASSED:
CHECK_FALSE( testCaseTracker.isCompleted() )
with expansion:
!false
SectionTrackerTests.cpp:<line number>: SectionTrackerTests.cpp:<line number>:
PASSED: PASSED:
CHECK( testCaseTracker.isCompleted() ) CHECK( testCaseTracker.isCompleted() )
@ -6991,5 +6650,5 @@ with expansion:
true true
=============================================================================== ===============================================================================
125 test cases - 53 failed (680 assertions - 112 failed) 125 test cases - 53 failed (646 assertions - 110 failed)

View File

@ -1,5 +1,5 @@
<testsuites> <testsuites>
<testsuite name="~_" errors="12" failures="100" tests="680" hostname="tbd" time="{duration}" timestamp="tbd"> <testsuite name="~_" errors="12" failures="98" tests="646" hostname="tbd" time="{duration}" timestamp="tbd">
<testcase classname="global" name="Some simple comparisons between doubles" time="{duration}"/> <testcase classname="global" name="Some simple comparisons between doubles" time="{duration}"/>
<testcase classname="global" name="Approximate comparisons with different epsilons" time="{duration}"/> <testcase classname="global" name="Approximate comparisons with different epsilons" time="{duration}"/>
<testcase classname="global" name="Approximate comparisons with floats" time="{duration}"/> <testcase classname="global" name="Approximate comparisons with floats" time="{duration}"/>
@ -323,13 +323,11 @@ MessageTests.cpp:<line number>
<testcase classname="random SECTION tests" name="s2" time="{duration}"/> <testcase classname="random SECTION tests" name="s2" time="{duration}"/>
<testcase classname="nested SECTION tests" name="s1" time="{duration}"/> <testcase classname="nested SECTION tests" name="s1" time="{duration}"/>
<testcase classname="nested SECTION tests" name="s1/s2" time="{duration}"/> <testcase classname="nested SECTION tests" name="s1/s2" time="{duration}"/>
<testcase classname="more nested SECTION tests" name="s1/s2" time="{duration}"> <testcase classname="more nested SECTION tests" name="s2/s1" time="{duration}">
<failure message="1 == 2" type="REQUIRE"> <failure message="1 == 2" type="REQUIRE">
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="more nested SECTION tests" name="s1/s3" time="{duration}"/>
<testcase classname="more nested SECTION tests" name="s1/s4" time="{duration}"/>
<testcase classname="looped SECTION tests" name="s1" time="{duration}"> <testcase classname="looped SECTION tests" name="s1" time="{duration}">
<failure message="0 > 1" type="CHECK"> <failure message="0 > 1" type="CHECK">
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
@ -431,14 +429,6 @@ MiscTests.cpp:<line number>
<testcase classname="A couple of nested sections followed by a failure" name="root" time="{duration}"> <testcase classname="A couple of nested sections followed by a failure" name="root" time="{duration}">
<failure type="FAIL"> <failure type="FAIL">
to infinity and beyond to infinity and beyond
MiscTests.cpp:<line number>
</failure>
<failure type="FAIL">
to infinity and beyond
MiscTests.cpp:<line number>
</failure>
<failure type="FAIL">
to infinity and beyond
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>

View File

@ -2957,25 +2957,6 @@
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="nested SECTION tests"> <TestCase name="nested SECTION tests">
<Section name="s1" description="doesn't equal">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
a != b
</Original>
<Expanded>
1 != 2
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
b != a
</Original>
<Expanded>
2 != 1
</Expanded>
</Expression>
<OverallResults successes="2" failures="0"/>
</Section>
<Section name="s1" description="doesn't equal"> <Section name="s1" description="doesn't equal">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
@ -3009,9 +2990,6 @@
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="more nested SECTION tests"> <TestCase name="more nested SECTION tests">
<Section name="s1" description="doesn't equal">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="s1" description="doesn't equal"> <Section name="s1" description="doesn't equal">
<Section name="s2" description="equal"> <Section name="s2" description="equal">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
@ -3026,40 +3004,9 @@
</Section> </Section>
<OverallResults successes="0" failures="1"/> <OverallResults successes="0" failures="1"/>
</Section> </Section>
<Section name="s1" description="doesn't equal">
<Section name="s3" description="not equal">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
a != b
</Original>
<Expanded>
1 != 2
</Expanded>
</Expression>
<OverallResults successes="1" failures="0"/>
</Section>
<OverallResults successes="1" failures="0"/>
</Section>
<Section name="s1" description="doesn't equal">
<Section name="s4" description="less than">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
a &lt; b
</Original>
<Expanded>
1 &lt; 2
</Expanded>
</Expression>
<OverallResults successes="1" failures="0"/>
</Section>
<OverallResults successes="1" failures="0"/>
</Section>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="even more nested SECTION tests"> <TestCase name="even more nested SECTION tests">
<Section name="c">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="c"> <Section name="c">
<Section name="d (leaf)"> <Section name="d (leaf)">
<OverallResults successes="0" failures="1"/> <OverallResults successes="0" failures="1"/>
@ -3498,22 +3445,6 @@
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="vectors can be sized and resized"> <TestCase name="vectors can be sized and resized">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
v.size() == 5
</Original>
<Expanded>
5 == 5
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
v.capacity() >= 5
</Original>
<Expanded>
5 >= 5
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
v.size() == 5 v.size() == 5
@ -3565,41 +3496,6 @@
5 >= 5 5 >= 5
</Expanded> </Expanded>
</Expression> </Expression>
<Section name="resizing smaller changes size but not capacity">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
v.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
v.capacity() >= 5
</Original>
<Expanded>
5 >= 5
</Expanded>
</Expression>
<OverallResults successes="2" failures="0"/>
</Section>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
v.size() == 5
</Original>
<Expanded>
5 == 5
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
v.capacity() >= 5
</Original>
<Expanded>
5 >= 5
</Expanded>
</Expression>
<Section name="resizing smaller changes size but not capacity"> <Section name="resizing smaller changes size but not capacity">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
@ -3703,15 +3599,6 @@
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="A couple of nested sections followed by a failure"> <TestCase name="A couple of nested sections followed by a failure">
<Failure>
to infinity and beyond
</Failure>
<Section name="Outer">
<OverallResults successes="0" failures="0"/>
</Section>
<Failure>
to infinity and beyond
</Failure>
<Section name="Outer"> <Section name="Outer">
<Section name="Inner"> <Section name="Inner">
<OverallResults successes="1" failures="0"/> <OverallResults successes="1" failures="0"/>
@ -3770,9 +3657,6 @@
</Expression> </Expression>
<OverallResults successes="5" failures="0"/> <OverallResults successes="5" failures="0"/>
</Section> </Section>
<Section name="test lists">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="test lists"> <Section name="test lists">
<Section name="1 test" description="Specify one test case using"> <Section name="1 test" description="Specify one test case using">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@ -3933,9 +3817,6 @@
</Section> </Section>
<OverallResults successes="5" failures="0"/> <OverallResults successes="5" failures="0"/>
</Section> </Section>
<Section name="reporter">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="reporter"> <Section name="reporter">
<Section name="-r/console"> <Section name="-r/console">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@ -4002,9 +3883,6 @@
</Section> </Section>
<OverallResults successes="2" failures="0"/> <OverallResults successes="2" failures="0"/>
</Section> </Section>
<Section name="debugger">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="debugger"> <Section name="debugger">
<Section name="-b"> <Section name="-b">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@ -4049,9 +3927,6 @@
</Section> </Section>
<OverallResults successes="2" failures="0"/> <OverallResults successes="2" failures="0"/>
</Section> </Section>
<Section name="abort">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="abort"> <Section name="abort">
<Section name="-a aborts after first failure"> <Section name="-a aborts after first failure">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@ -4126,9 +4001,6 @@
</Section> </Section>
<OverallResults successes="1" failures="0"/> <OverallResults successes="1" failures="0"/>
</Section> </Section>
<Section name="nothrow">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="nothrow"> <Section name="nothrow">
<Section name="-e"> <Section name="-e">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@ -4173,9 +4045,6 @@
</Section> </Section>
<OverallResults successes="2" failures="0"/> <OverallResults successes="2" failures="0"/>
</Section> </Section>
<Section name="output filename">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="output filename"> <Section name="output filename">
<Section name="-o filename"> <Section name="-o filename">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@ -4220,9 +4089,6 @@
</Section> </Section>
<OverallResults successes="2" failures="0"/> <OverallResults successes="2" failures="0"/>
</Section> </Section>
<Section name="combinations">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="combinations"> <Section name="combinations">
<Section name="Single character flags can be combined"> <Section name="Single character flags can be combined">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@ -4788,9 +4654,6 @@
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="Long strings can be wrapped"> <TestCase name="Long strings can be wrapped">
<Section name="plain string">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="plain string"> <Section name="plain string">
<Section name="No wrapping"> <Section name="No wrapping">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@ -5117,9 +4980,6 @@ ur&quot;
</Section> </Section>
<OverallResults successes="1" failures="0"/> <OverallResults successes="1" failures="0"/>
</Section> </Section>
<Section name="With newlines">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="With newlines"> <Section name="With newlines">
<Section name="No wrapping"> <Section name="No wrapping">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@ -6554,33 +6414,6 @@ there&quot;
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="Assertions then sections"> <TestCase name="Assertions then sections">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original>
Catch::isTrue( true )
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original>
Catch::isTrue( true )
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Section name="A section">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original>
Catch::isTrue( true )
</Original>
<Expanded>
true
</Expanded>
</Expression>
<OverallResults successes="1" failures="0"/>
</Section>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original> <Original>
Catch::isTrue( true ) Catch::isTrue( true )
@ -6722,32 +6555,6 @@ there&quot;
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="Scenario: Do that thing with the thing"> <TestCase name="Scenario: Do that thing with the thing">
<Section name="Given: This stuff exists">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="Given: This stuff exists">
<Section name="When: I do this">
<OverallResults successes="0" failures="0"/>
</Section>
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="Given: This stuff exists">
<Section name="When: I do this">
<Section name="Then: it should do this">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
itDoesThis()
</Original>
<Expanded>
true
</Expanded>
</Expression>
<OverallResults successes="1" failures="0"/>
</Section>
<OverallResults successes="1" failures="0"/>
</Section>
<OverallResults successes="1" failures="0"/>
</Section>
<Section name="Given: This stuff exists"> <Section name="Given: This stuff exists">
<Section name="When: I do this"> <Section name="When: I do this">
<Section name="Then: it should do this"> <Section name="Then: it should do this">
@ -6779,100 +6586,6 @@ there&quot;
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="Scenario: Vector resizing affects size and capacity"> <TestCase name="Scenario: Vector resizing affects size and capacity">
<Section name="Given: an empty vector">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<OverallResults successes="1" failures="0"/>
</Section>
<Section name="Given: an empty vector">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<Section name="When: it is made larger">
<OverallResults successes="0" failures="0"/>
</Section>
<OverallResults successes="1" failures="0"/>
</Section>
<Section name="Given: an empty vector">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<Section name="When: it is made larger">
<Section name="Then: the size and capacity go up">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.size() == 10
</Original>
<Expanded>
10 == 10
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.capacity() >= 10
</Original>
<Expanded>
10 >= 10
</Expanded>
</Expression>
<OverallResults successes="2" failures="0"/>
</Section>
<OverallResults successes="2" failures="0"/>
</Section>
<OverallResults successes="3" failures="0"/>
</Section>
<Section name="Given: an empty vector">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<Section name="When: it is made larger">
<Section name="Then: the size and capacity go up">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.size() == 10
</Original>
<Expanded>
10 == 10
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.capacity() >= 10
</Original>
<Expanded>
10 >= 10
</Expanded>
</Expression>
<Section name="And when: it is made smaller again">
<OverallResults successes="0" failures="0"/>
</Section>
<OverallResults successes="2" failures="0"/>
</Section>
<OverallResults successes="2" failures="0"/>
</Section>
<OverallResults successes="3" failures="0"/>
</Section>
<Section name="Given: an empty vector"> <Section name="Given: an empty vector">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original> <Original>
@ -6928,20 +6641,6 @@ there&quot;
</Section> </Section>
<OverallResults successes="5" failures="0"/> <OverallResults successes="5" failures="0"/>
</Section> </Section>
<Section name="Given: an empty vector">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<Section name="When: we reserve more space">
<OverallResults successes="0" failures="0"/>
</Section>
<OverallResults successes="1" failures="0"/>
</Section>
<Section name="Given: an empty vector"> <Section name="Given: an empty vector">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original> <Original>
@ -6978,15 +6677,6 @@ there&quot;
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="Scenario: This is a really long scenario name to see how the list command deals with wrapping"> <TestCase name="Scenario: This is a really long scenario name to see how the list command deals with wrapping">
<Section name="Given: A section name that is so long that it cannot fit in a single console width">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="Given: A section name that is so long that it cannot fit in a single console width">
<Section name="When: The test headers are printed as part of the normal running of the scenario">
<OverallResults successes="0" failures="0"/>
</Section>
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="Given: A section name that is so long that it cannot fit in a single console width"> <Section name="Given: A section name that is so long that it cannot fit in a single console width">
<Section name="When: The test headers are printed as part of the normal running of the scenario"> <Section name="When: The test headers are printed as part of the normal running of the scenario">
<Section name="Then: The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent"> <Section name="Then: The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent">
@ -6999,14 +6689,6 @@ there&quot;
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="section tracking"> <TestCase name="section tracking">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original> <Original>
!testCaseTracker.isCompleted() !testCaseTracker.isCompleted()
@ -7043,30 +6725,6 @@ there&quot;
</Expanded> </Expanded>
</Expression> </Expression>
<Section name="test case with one section"> <Section name="test case with one section">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.enterSection( section1Name )
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original> <Original>
testCaseTracker.enterSection( section1Name ) testCaseTracker.enterSection( section1Name )
@ -7075,6 +6733,14 @@ there&quot;
true true
</Expanded> </Expanded>
</Expression> </Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original> <Original>
testCaseTracker.isCompleted() testCaseTracker.isCompleted()
@ -7083,7 +6749,15 @@ there&quot;
true true
</Expanded> </Expanded>
</Expression> </Expression>
<OverallResults successes="5" failures="0"/> <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.enterSection( section1Name )
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<OverallResults successes="4" failures="0"/>
</Section> </Section>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original> <Original>
@ -7094,30 +6768,6 @@ there&quot;
</Expanded> </Expanded>
</Expression> </Expression>
<Section name="test case with two consecutive sections"> <Section name="test case with two consecutive sections">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.enterSection( section1Name )
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.enterSection( section2Name )
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original> <Original>
testCaseTracker.enterSection( section1Name ) testCaseTracker.enterSection( section1Name )
@ -7166,7 +6816,7 @@ there&quot;
true true
</Expanded> </Expanded>
</Expression> </Expression>
<OverallResults successes="9" failures="0"/> <OverallResults successes="6" failures="0"/>
</Section> </Section>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original> <Original>
@ -7177,46 +6827,6 @@ there&quot;
</Expanded> </Expanded>
</Expression> </Expression>
<Section name="test case with one section within another"> <Section name="test case with one section within another">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.enterSection( section1Name )
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
testCaseTracker.enterSection( section1Name )
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.enterSection( section2Name )
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original> <Original>
testCaseTracker.enterSection( section1Name ) testCaseTracker.enterSection( section1Name )
@ -7233,6 +6843,14 @@ there&quot;
true true
</Expanded> </Expanded>
</Expression> </Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original> <Original>
testCaseTracker.isCompleted() testCaseTracker.isCompleted()
@ -7241,11 +6859,11 @@ there&quot;
true true
</Expanded> </Expanded>
</Expression> </Expression>
<OverallResults successes="8" failures="0"/> <OverallResults successes="4" failures="0"/>
</Section> </Section>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<OverallResults successes="568" failures="112"/> <OverallResults successes="536" failures="110"/>
</Group> </Group>
<OverallResults successes="568" failures="112"/> <OverallResults successes="536" failures="110"/>
</Catch> </Catch>

View File

@ -38,13 +38,14 @@ TEST_CASE( "section tracking" ) {
{ {
TestCaseTracker::Guard guard( testCaseTracker ); TestCaseTracker::Guard guard( testCaseTracker );
// Enter section? - no, not yet // Enter section? - yes
CHECK_FALSE( testCaseTracker.enterSection( section1Name ) ); CHECK( testCaseTracker.enterSection( section1Name ) );
CHECK_FALSE( testCaseTracker.isCompleted() ); CHECK_FALSE( testCaseTracker.isCompleted() );
testCaseTracker.leaveSection();
// Leave test case - incomplete (still need to visit section) // Leave test case - now complete
} }
CHECK_FALSE( testCaseTracker.isCompleted() ); CHECK( testCaseTracker.isCompleted() );
// ... // ...
@ -52,13 +53,9 @@ TEST_CASE( "section tracking" ) {
{ {
TestCaseTracker::Guard guard( testCaseTracker ); TestCaseTracker::Guard guard( testCaseTracker );
// Enter section? - yes // Enter section? - no - now complete
CHECK( testCaseTracker.enterSection( section1Name ) ); CHECK_FALSE( testCaseTracker.enterSection( section1Name ) );
// Leave section and test case - now complete
testCaseTracker.leaveSection();
} }
CHECK( testCaseTracker.isCompleted() );
} }
SECTION( "test case with two consecutive sections" ) { SECTION( "test case with two consecutive sections" ) {
@ -67,27 +64,11 @@ TEST_CASE( "section tracking" ) {
{ {
TestCaseTracker::Guard guard( testCaseTracker ); TestCaseTracker::Guard guard( testCaseTracker );
// Enter section 1? - no, not yet
CHECK_FALSE( testCaseTracker.enterSection( section1Name ) );
// Enter section 2? - no, not yet
CHECK_FALSE( testCaseTracker.enterSection( section2Name ) );
// Leave test case - incomplete (still need to visit sections)
}
CHECK_FALSE( testCaseTracker.isCompleted() );
// ...
// Enter test case again
{
TestCaseTracker::Guard guard( testCaseTracker );
// Enter section 1? - yes // Enter section 1? - yes
CHECK( testCaseTracker.enterSection( section1Name ) ); CHECK( testCaseTracker.enterSection( section1Name ) );
testCaseTracker.leaveSection(); testCaseTracker.leaveSection();
// Enter section 2? - no, not yet // Enter section 2? - no - we just exected section 1
CHECK_FALSE( testCaseTracker.enterSection( section2Name ) ); CHECK_FALSE( testCaseTracker.enterSection( section2Name ) );
// Leave test case - incomplete (still need to visit section 2) // Leave test case - incomplete (still need to visit section 2)
@ -103,7 +84,7 @@ TEST_CASE( "section tracking" ) {
// Enter section 1? - no, already done now // Enter section 1? - no, already done now
CHECK_FALSE( testCaseTracker.enterSection( section1Name ) ); CHECK_FALSE( testCaseTracker.enterSection( section1Name ) );
// Enter section 2? - yes - finally // Enter section 2? - yes
CHECK( testCaseTracker.enterSection( section2Name ) ); CHECK( testCaseTracker.enterSection( section2Name ) );
testCaseTracker.leaveSection(); testCaseTracker.leaveSection();
@ -114,19 +95,6 @@ TEST_CASE( "section tracking" ) {
SECTION( "test case with one section within another" ) { SECTION( "test case with one section within another" ) {
// Enter test case
{
TestCaseTracker::Guard guard( testCaseTracker );
// Enter section 1? - no, not yet
CHECK_FALSE( testCaseTracker.enterSection( section1Name ) );
// Leave test case - incomplete (still need to visit sections)
}
CHECK_FALSE( testCaseTracker.isCompleted() );
// ...
// Enter test case again // Enter test case again
{ {
TestCaseTracker::Guard guard( testCaseTracker ); TestCaseTracker::Guard guard( testCaseTracker );
@ -134,26 +102,11 @@ TEST_CASE( "section tracking" ) {
// Enter section 1? - yes // Enter section 1? - yes
CHECK( testCaseTracker.enterSection( section1Name ) ); CHECK( testCaseTracker.enterSection( section1Name ) );
// Enter section 2? - no, not yet // Enter section 2? - yes
CHECK_FALSE( testCaseTracker.enterSection( section2Name ) );
testCaseTracker.leaveSection(); // section 1 - incomplete (section 2)
// Leave test case - incomplete
}
CHECK_FALSE( testCaseTracker.isCompleted() );
// ...
// Enter test case again
{
TestCaseTracker::Guard guard( testCaseTracker );
// Enter section 1? - yes - so we can execute section 2
CHECK( testCaseTracker.enterSection( section1Name ) );
// Enter section 2? - yes - finally
CHECK( testCaseTracker.enterSection( section2Name ) ); CHECK( testCaseTracker.enterSection( section2Name ) );
CHECK_FALSE( testCaseTracker.isCompleted() );
testCaseTracker.leaveSection(); // section 2 testCaseTracker.leaveSection(); // section 2
testCaseTracker.leaveSection(); // section 1 testCaseTracker.leaveSection(); // section 1

View File

@ -1,6 +1,6 @@
/* /*
* CATCH v1.0 build 38 (master branch) * CATCH v1.0 build 39 (master branch)
* Generated: 2014-04-18 08:47:21.504017 * Generated: 2014-04-21 18:50:19.658444
* ---------------------------------------------------------- * ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly * This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@ -4754,13 +4754,18 @@ namespace SectionTracking {
RunState runState() const { return m_runState; } RunState runState() const { return m_runState; }
void addChild( std::string const& childName ) { TrackedSection* findChild( std::string const& childName ) {
TrackedSections::iterator it = m_children.find( childName );
return it != m_children.end()
? &it->second
: NULL;
}
TrackedSection* acquireChild( std::string const& childName ) {
if( TrackedSection* child = findChild( childName ) )
return child;
m_children.insert( std::make_pair( childName, TrackedSection( childName, this ) ) ); m_children.insert( std::make_pair( childName, TrackedSection( childName, this ) ) );
return findChild( childName );
} }
TrackedSection* getChild( std::string const& childName ) {
return &m_children.find( childName )->second;
}
void enter() { void enter() {
if( m_runState == NotStarted ) if( m_runState == NotStarted )
m_runState = Executing; m_runState = Executing;
@ -4799,21 +4804,13 @@ namespace SectionTracking {
{} {}
bool enterSection( std::string const& name ) { bool enterSection( std::string const& name ) {
if( m_completedASectionThisRun ) TrackedSection* child = m_currentSection->acquireChild( name );
if( m_completedASectionThisRun || child->runState() == TrackedSection::Completed )
return false; return false;
if( m_currentSection->runState() == TrackedSection::Executing ) {
m_currentSection->addChild( name ); m_currentSection = child;
return false; m_currentSection->enter();
} return true;
else {
TrackedSection* child = m_currentSection->getChild( name );
if( child->runState() != TrackedSection::Completed ) {
m_currentSection = child;
m_currentSection->enter();
return true;
}
return false;
}
} }
void leaveSection() { void leaveSection() {
m_currentSection->leave(); m_currentSection->leave();
@ -4831,9 +4828,7 @@ namespace SectionTracking {
class Guard { class Guard {
public: public:
Guard( TestCaseTracker& tracker ) Guard( TestCaseTracker& tracker ) : m_tracker( tracker ) {
: m_tracker( tracker )
{
m_tracker.enterTestCase(); m_tracker.enterTestCase();
} }
~Guard() { ~Guard() {
@ -5117,8 +5112,8 @@ namespace Catch {
} }
// If sections ended prematurely due to an exception we stored their // If sections ended prematurely due to an exception we stored their
// infos here so we can tear them down outside the unwind process. // infos here so we can tear them down outside the unwind process.
for( std::vector<UnfinishedSections>::const_iterator it = m_unfinishedSections.begin(), for( std::vector<UnfinishedSections>::const_reverse_iterator it = m_unfinishedSections.rbegin(),
itEnd = m_unfinishedSections.end(); itEnd = m_unfinishedSections.rend();
it != itEnd; it != itEnd;
++it ) ++it )
sectionEnded( it->info, it->prevAssertions, it->durationInSeconds ); sectionEnded( it->info, it->prevAssertions, it->durationInSeconds );
@ -6702,7 +6697,7 @@ namespace Catch {
namespace Catch { namespace Catch {
// These numbers are maintained by a script // These numbers are maintained by a script
Version libraryVersion( 1, 0, 38, "master" ); Version libraryVersion( 1, 0, 39, "master" );
} }
// #included from: catch_message.hpp // #included from: catch_message.hpp