From 4575594bbfde89e698770333fe9e1d53ba3206ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Fri, 12 Jan 2018 11:49:48 +0100 Subject: [PATCH] Comment why the return code is clamped --- include/internal/catch_session.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/internal/catch_session.cpp b/include/internal/catch_session.cpp index b1c00d05..1d3ce06e 100644 --- a/include/internal/catch_session.cpp +++ b/include/internal/catch_session.cpp @@ -259,6 +259,9 @@ namespace Catch { if( Option listed = list( config() ) ) return static_cast( *listed ); + // 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, static_cast( runTests( m_config ).assertions.failed ) ); } catch( std::exception& ex ) {