/ externals / catch / src / catch2 / internal / catch_result_type.hpp
catch_result_type.hpp
 1  
 2  //              Copyright Catch2 Authors
 3  // Distributed under the Boost Software License, Version 1.0.
 4  //   (See accompanying file LICENSE.txt or copy at
 5  //        https://www.boost.org/LICENSE_1_0.txt)
 6  
 7  // SPDX-License-Identifier: BSL-1.0
 8  #ifndef CATCH_RESULT_TYPE_HPP_INCLUDED
 9  #define CATCH_RESULT_TYPE_HPP_INCLUDED
10  
11  namespace Catch {
12  
13      // ResultWas::OfType enum
14      struct ResultWas { enum OfType {
15          Unknown = -1,
16          Ok = 0,
17          Info = 1,
18          Warning = 2,
19          // TODO: Should explicit skip be considered "not OK" (cf. isOk)? I.e., should it have the failure bit?
20          ExplicitSkip = 4,
21  
22          FailureBit = 0x10,
23  
24          ExpressionFailed = FailureBit | 1,
25          ExplicitFailure = FailureBit | 2,
26  
27          Exception = 0x100 | FailureBit,
28  
29          ThrewException = Exception | 1,
30          DidntThrowException = Exception | 2,
31  
32          FatalErrorCondition = 0x200 | FailureBit
33  
34      }; };
35  
36      bool isOk( ResultWas::OfType resultType );
37      bool isJustInfo( int flags );
38  
39  
40      // ResultDisposition::Flags enum
41      struct ResultDisposition { enum Flags {
42          Normal = 0x01,
43  
44          ContinueOnFailure = 0x02,   // Failures fail test, but execution continues
45          FalseTest = 0x04,           // Prefix expression with !
46          SuppressFail = 0x08         // Failures are reported but do not fail the test
47      }; };
48  
49      ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs );
50  
51      bool shouldContinueOnFailure( int flags );
52      inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; }
53      bool shouldSuppressFailure( int flags );
54  
55  } // end namespace Catch
56  
57  #endif // CATCH_RESULT_TYPE_HPP_INCLUDED