aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/testing.cpp
blob: 5531aa7383524e6f9b6cb27102146a7d23a41311 (plain) (blame)
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
// Copyright Epic Games, Inc. All Rights Reserved.

#include "zencore/testing.h"
#include "zencore/logging.h"

#if ZEN_WITH_TESTS

namespace zen::testing {

using namespace std::literals;

struct TestRunner::Impl
{
	doctest::Context Session;
};

TestRunner::TestRunner()
{
	m_Impl = std::make_unique<Impl>();
}

TestRunner::~TestRunner()
{
}

int
TestRunner::ApplyCommandLine(int argc, char const* const* argv)
{
	m_Impl->Session.applyCommandLine(argc, argv);

	for (int i = 1; i < argc; ++i)
	{
		if (argv[i] == "--debug"sv)
		{
			spdlog::set_level(spdlog::level::debug);
		}
	}

	return 0;
}

int
TestRunner::Run()
{
	int Rv = m_Impl->Session.run();

	return Rv;
}

}  // namespace zen::testing

#endif