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