catch3
Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.
Clonegit clone https://git.progmasoft.com/catch3
Small logic tweaks
- Commit
3d6be037e92fc1f7ac7cb65b7717bc5da2be274a- Author
- Phil Nash ·
- Parents
6f2343bf6441
Changes
include/internal/catch_running_test.hpp | 14 +++++--------- include/internal/catch_section_info.hpp | 11 +++++------ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/include/internal/catch_running_test.hpp b/include/internal/catch_running_test.hpp index 6f0ec7bf..7f89ab70 100644 --- a/include/internal/catch_running_test.hpp +++ b/include/internal/catch_running_test.hpp @@ -55,16 +55,12 @@ namespace Catch { } void ranToCompletion() { - if( m_runStatus == RanAtLeastOneSection || - m_runStatus == EncounteredASection ) { - m_runStatus = RanToCompletionWithSections; - if( m_lastSectionToRun ) { - m_lastSectionToRun->ranToCompletion(); - m_changed = true; - } - } - else { + if( m_runStatus != RanAtLeastOneSection && m_runStatus != EncounteredASection ) m_runStatus = RanToCompletionWithNoSections; + m_runStatus = RanToCompletionWithSections; + if( m_lastSectionToRun ) { + m_lastSectionToRun->ranToCompletion(); + m_changed = true; } } diff --git a/include/internal/catch_section_info.hpp b/include/internal/catch_section_info.hpp index e28f3147..7f09a943 100644 --- a/include/internal/catch_section_info.hpp +++ b/include/internal/catch_section_info.hpp @@ -22,7 +22,7 @@ namespace Catch { virtual const ISectionInfo* getParent() const = 0; }; - class SectionInfo : ISectionInfo { + class SectionInfo : public ISectionInfo { public: typedef std::vector<SectionInfo*> SubSections; @@ -98,11 +98,10 @@ namespace Catch { } bool ran() { - if( m_state < Branch ) { - m_state = TestedLeaf; - return true; - } - return false; + if( m_state >= Branch ) + return false; + m_state = TestedLeaf; + return true; } void ranToCompletion() {