Files
Catch2/src/catch2/internal/catch_context.cpp

42 lines
1.2 KiB
C++
Raw Normal View History

// Copyright Catch2 Authors
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
// SPDX-License-Identifier: BSL-1.0
#include <catch2/internal/catch_context.hpp>
#include <catch2/internal/catch_noncopyable.hpp>
#include <catch2/internal/catch_random_number_generator.hpp>
2012-05-16 08:02:20 +01:00
namespace Catch {
2023-03-16 10:04:03 +01:00
Context* Context::currentContext = nullptr;
2023-03-16 10:04:03 +01:00
void cleanUpContext() {
delete Context::currentContext;
Context::currentContext = nullptr;
}
void Context::createContext() {
currentContext = new Context();
}
2023-03-16 10:04:03 +01:00
Context& getCurrentMutableContext() {
if ( !Context::currentContext ) { Context::createContext(); }
// NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn)
return *Context::currentContext;
}
void Context::setResultCapture( IResultCapture* resultCapture ) {
m_resultCapture = resultCapture;
2011-01-26 23:23:33 +00:00
}
2023-03-16 10:04:03 +01:00
void Context::setConfig( IConfig const* config ) { m_config = config; }
2022-05-17 15:37:14 +02:00
SimplePcg32& sharedRng() {
static SimplePcg32 s_rng;
return s_rng;
}
}