Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:06

0001 
0002 //              Copyright Catch2 Authors
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //   (See accompanying file LICENSE.txt or copy at
0005 //        https://www.boost.org/LICENSE_1_0.txt)
0006 
0007 // SPDX-License-Identifier: BSL-1.0
0008 #ifndef CATCH_RESULT_TYPE_HPP_INCLUDED
0009 #define CATCH_RESULT_TYPE_HPP_INCLUDED
0010 
0011 namespace Catch {
0012 
0013     // ResultWas::OfType enum
0014     struct ResultWas { enum OfType {
0015         Unknown = -1,
0016         Ok = 0,
0017         Info = 1,
0018         Warning = 2,
0019         // TODO: Should explicit skip be considered "not OK" (cf. isOk)? I.e., should it have the failure bit?
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     bool isOk( ResultWas::OfType resultType );
0037     bool isJustInfo( int flags );
0038 
0039 
0040     // ResultDisposition::Flags enum
0041     struct ResultDisposition { enum Flags {
0042         Normal = 0x01,
0043 
0044         ContinueOnFailure = 0x02,   // Failures fail test, but execution continues
0045         FalseTest = 0x04,           // Prefix expression with !
0046         SuppressFail = 0x08         // Failures are reported but do not fail the test
0047     }; };
0048 
0049     ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs );
0050 
0051     bool shouldContinueOnFailure( int flags );
0052     inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; }
0053     bool shouldSuppressFailure( int flags );
0054 
0055 } // end namespace Catch
0056 
0057 #endif // CATCH_RESULT_TYPE_HPP_INCLUDED