Progmasoft Git

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

Fix incorrectly clamped return value

Fixes #1215
Commit
dc3e7f9cf7628d4edf43ad04507a86ba81137c31
Author
Martin Hořeňovský ·
Parents
d14b7563c2f4

Files · Download .tar.gz

Changes

 include/internal/catch_session.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/internal/catch_session.cpp b/include/internal/catch_session.cpp
index 0581ac88..a5f8946e 100644
--- a/include/internal/catch_session.cpp
+++ b/include/internal/catch_session.cpp
@@ -277,7 +277,7 @@ namespace Catch {
             // Note that on unices only the lower 8 bits are usually used, clamping
             // the return value to 255 prevents false negative when some multiple
             // of 256 tests has failed
-            return (std::min)( { MaxExitCode, totals.error, static_cast<int>( totals.assertions.failed ) } );
+            return (std::min) (MaxExitCode, (std::max) (totals.error, static_cast<int>(totals.assertions.failed)));
         }
         catch( std::exception& ex ) {
             Catch::cerr() << ex.what() << std::endl;