File indexing completed on 2025-10-14 08:48:17
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef CATCH_RESULT_TYPE_HPP_INCLUDED
0009 #define CATCH_RESULT_TYPE_HPP_INCLUDED
0010
0011 namespace Catch {
0012
0013
0014 struct ResultWas { enum OfType {
0015 Unknown = -1,
0016 Ok = 0,
0017 Info = 1,
0018 Warning = 2,
0019
0020 ExplicitSkip = 4,
0021
0022 FailureBit = 0x10,
0023
0024 ExpressionFailed = FailureBit | 1,
0025 ExplicitFailure = FailureBit | 2,
0026
0027 Exception = 0x100 | FailureBit,
0028
0029 ThrewException = Exception | 1,
0030 DidntThrowException = Exception | 2,
0031
0032 FatalErrorCondition = 0x200 | FailureBit
0033
0034 }; };
0035
0036 constexpr bool isOk( ResultWas::OfType resultType ) {
0037 return ( resultType & ResultWas::FailureBit ) == 0;
0038 }
0039 constexpr bool isJustInfo( int flags ) { return flags == ResultWas::Info; }
0040
0041
0042
0043 struct ResultDisposition { enum Flags {
0044 Normal = 0x01,
0045
0046 ContinueOnFailure = 0x02,
0047 FalseTest = 0x04,
0048 SuppressFail = 0x08
0049 }; };
0050
0051 constexpr ResultDisposition::Flags operator|( ResultDisposition::Flags lhs,
0052 ResultDisposition::Flags rhs ) {
0053 return static_cast<ResultDisposition::Flags>( static_cast<int>( lhs ) |
0054 static_cast<int>( rhs ) );
0055 }
0056
0057 constexpr bool isFalseTest( int flags ) {
0058 return ( flags & ResultDisposition::FalseTest ) != 0;
0059 }
0060 constexpr bool shouldSuppressFailure( int flags ) {
0061 return ( flags & ResultDisposition::SuppressFail ) != 0;
0062 }
0063
0064 }
0065
0066 #endif