mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-06 23:03:52 +00:00
* Add new SKIP macro for skipping tests at runtime This adds a new `SKIP` macro for dynamically skipping tests at runtime. The "skipped" status of a test case is treated as a first-class citizen, like "succeeded" or "failed", and is reported with a new color on the console. * Don't show "skipped assertions" in console/compact reporters Also extend skip tests to cover a few more use cases. * Return exit code 4 if all test cases are skipped * Use LightGrey for the skip colour This isn't great, but is better than the deep blue that was borderline invisible on dark backgrounds. The fix is to redo the colouring a bit, including introducing light-blue that is actually visible. * Add support for explicit skips in all reporters * --allow-running-no-tests also allows all tests to be skipped * Add docs for SKIP macro, deprecate IEventListener::skipTest Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
66 lines
1.9 KiB
C++
66 lines
1.9 KiB
C++
|
|
// Copyright Catch2 Authors
|
|
// Distributed under the Boost Software License, Version 1.0.
|
|
// (See accompanying file LICENSE.txt or copy at
|
|
// https://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
#include <catch2/catch_totals.hpp>
|
|
|
|
namespace Catch {
|
|
|
|
Counts Counts::operator - ( Counts const& other ) const {
|
|
Counts diff;
|
|
diff.passed = passed - other.passed;
|
|
diff.failed = failed - other.failed;
|
|
diff.failedButOk = failedButOk - other.failedButOk;
|
|
diff.skipped = skipped - other.skipped;
|
|
return diff;
|
|
}
|
|
|
|
Counts& Counts::operator += ( Counts const& other ) {
|
|
passed += other.passed;
|
|
failed += other.failed;
|
|
failedButOk += other.failedButOk;
|
|
skipped += other.skipped;
|
|
return *this;
|
|
}
|
|
|
|
std::uint64_t Counts::total() const {
|
|
return passed + failed + failedButOk + skipped;
|
|
}
|
|
bool Counts::allPassed() const {
|
|
return failed == 0 && failedButOk == 0 && skipped == 0;
|
|
}
|
|
bool Counts::allOk() const {
|
|
return failed == 0;
|
|
}
|
|
|
|
Totals Totals::operator - ( Totals const& other ) const {
|
|
Totals diff;
|
|
diff.assertions = assertions - other.assertions;
|
|
diff.testCases = testCases - other.testCases;
|
|
return diff;
|
|
}
|
|
|
|
Totals& Totals::operator += ( Totals const& other ) {
|
|
assertions += other.assertions;
|
|
testCases += other.testCases;
|
|
return *this;
|
|
}
|
|
|
|
Totals Totals::delta( Totals const& prevTotals ) const {
|
|
Totals diff = *this - prevTotals;
|
|
if( diff.assertions.failed > 0 )
|
|
++diff.testCases.failed;
|
|
else if( diff.assertions.failedButOk > 0 )
|
|
++diff.testCases.failedButOk;
|
|
else if ( diff.assertions.skipped > 0 )
|
|
++ diff.testCases.skipped;
|
|
else
|
|
++diff.testCases.passed;
|
|
return diff;
|
|
}
|
|
|
|
}
|