From 075d17f8ada47e990fe94606c3d21df409223465 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Tue, 2 May 2023 10:01:47 +0200 Subject: moved source directories into `/src` (#264) * moved source directories into `/src` * updated bundle.lua for new `src` path * moved some docs, icon * removed old test trees --- src/zencore/testing.cpp | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/zencore/testing.cpp (limited to 'src/zencore/testing.cpp') diff --git a/src/zencore/testing.cpp b/src/zencore/testing.cpp new file mode 100644 index 000000000..1599e9d1f --- /dev/null +++ b/src/zencore/testing.cpp @@ -0,0 +1,54 @@ +// 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(); +} + +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 = 0; + + m_Impl->Session.run(); + + return Rv; +} + +} // namespace zen::testing + +#endif -- cgit v1.2.3