1 /*
2  *  Created by Phil on 07/01/2011.
3  *  Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
4  *
5  *  Distributed under the Boost Software License, Version 1.0. (See accompanying
6  *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7  */
8 #ifndef TWOBLUECUBES_CATCH_RESULT_TYPE_H_INCLUDED
9 #define TWOBLUECUBES_CATCH_RESULT_TYPE_H_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 
20         FailureBit = 0x10,
21 
22         ExpressionFailed = FailureBit | 1,
23         ExplicitFailure = FailureBit | 2,
24 
25         Exception = 0x100 | FailureBit,
26 
27         ThrewException = Exception | 1,
28         DidntThrowException = Exception | 2,
29 
30         FatalErrorCondition = 0x200 | FailureBit
31 
32     }; };
33 
34     bool isOk( ResultWas::OfType resultType );
35     bool isJustInfo( int flags );
36 
37 
38     // ResultDisposition::Flags enum
39     struct ResultDisposition { enum Flags {
40         Normal = 0x01,
41 
42         ContinueOnFailure = 0x02,   // Failures fail test, but execution continues
43         FalseTest = 0x04,           // Prefix expression with !
44         SuppressFail = 0x08         // Failures are reported but do not fail the test
45     }; };
46 
47     ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs );
48 
49     bool shouldContinueOnFailure( int flags );
isFalseTest(int flags)50     inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; }
51     bool shouldSuppressFailure( int flags );
52 
53 } // end namespace Catch
54 
55 #endif // TWOBLUECUBES_CATCH_RESULT_TYPE_H_INCLUDED
56