line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
// Copyright Catch2 Authors |
3
|
|
|
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. |
4
|
|
|
|
|
|
|
// (See accompanying file LICENSE_1_0.txt or copy at |
5
|
|
|
|
|
|
|
// https://www.boost.org/LICENSE_1_0.txt) |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
// SPDX-License-Identifier: BSL-1.0 |
8
|
|
|
|
|
|
|
#ifndef CATCH_CONTEXT_HPP_INCLUDED |
9
|
|
|
|
|
|
|
#define CATCH_CONTEXT_HPP_INCLUDED |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
namespace Catch { |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
struct IResultCapture; |
14
|
|
|
|
|
|
|
struct IConfig; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
struct IContext |
17
|
|
|
|
|
|
|
{ |
18
|
|
|
|
|
|
|
virtual ~IContext(); // = default |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
virtual IResultCapture* getResultCapture() = 0; |
21
|
|
|
|
|
|
|
virtual IConfig const* getConfig() const = 0; |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
struct IMutableContext : IContext |
25
|
|
|
|
|
|
|
{ |
26
|
|
|
|
|
|
|
virtual ~IMutableContext(); // = default |
27
|
|
|
|
|
|
|
virtual void setResultCapture( IResultCapture* resultCapture ) = 0; |
28
|
|
|
|
|
|
|
virtual void setConfig( IConfig const* config ) = 0; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
private: |
31
|
|
|
|
|
|
|
static IMutableContext *currentContext; |
32
|
|
|
|
|
|
|
friend IMutableContext& getCurrentMutableContext(); |
33
|
|
|
|
|
|
|
friend void cleanUpContext(); |
34
|
|
|
|
|
|
|
static void createContext(); |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
inline IMutableContext& getCurrentMutableContext() |
38
|
|
|
|
|
|
|
{ |
39
|
0
|
0
|
|
|
|
|
if( !IMutableContext::currentContext ) |
40
|
0
|
|
|
|
|
|
IMutableContext::createContext(); |
41
|
|
|
|
|
|
|
// NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn) |
42
|
0
|
|
|
|
|
|
return *IMutableContext::currentContext; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
inline IContext& getCurrentContext() |
46
|
|
|
|
|
|
|
{ |
47
|
0
|
|
|
|
|
|
return getCurrentMutableContext(); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
void cleanUpContext(); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
class SimplePcg32; |
53
|
|
|
|
|
|
|
SimplePcg32& rng(); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
#endif // CATCH_CONTEXT_HPP_INCLUDED |