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
(re)Inlined isTrue()
- Commit
3b965aa50131998f179ade39a0b7df7111d1c88f- Author
- Phil Nash ·
- Parents
e54dcdac8bae
Changes
include/internal/catch_capture.hpp | 2 +- include/internal/catch_common.cpp | 1 - include/internal/catch_common.h | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 9f205465..595336d4 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -63,7 +63,7 @@ CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( Catch::isTrue( false && static_cast<bool>( !!(__VA_ARGS__) ) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look + } while( Catch::isTrue(false) && static_cast<bool>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&. /////////////////////////////////////////////////////////////////////////////// diff --git a/include/internal/catch_common.cpp b/include/internal/catch_common.cpp index 0f2f6eb4..470b7ea9 100644 --- a/include/internal/catch_common.cpp +++ b/include/internal/catch_common.cpp @@ -38,7 +38,6 @@ namespace Catch { return os; } - bool isTrue( bool value ){ return value; } bool alwaysTrue() { return true; } bool alwaysFalse() { return false; } diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h index 617a9343..026ac2bb 100644 --- a/include/internal/catch_common.h +++ b/include/internal/catch_common.h @@ -61,7 +61,7 @@ namespace Catch { std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); // This is just here to avoid compiler warnings with macro constants and boolean literals - bool isTrue( bool value ); + inline bool isTrue( bool value ){ return value; } bool alwaysTrue(); bool alwaysFalse();