From 91ca6038d367d9e17952d4cc7f8cf9bdc31c9fb6 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Thu, 26 Aug 2021 19:24:35 +0200 Subject: [PATCH] Add more logging. --- src/Tester/TestRunner.hpp | 5 +++++ src/main.cpp | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Tester/TestRunner.hpp b/src/Tester/TestRunner.hpp index f321a65..fafc16c 100644 --- a/src/Tester/TestRunner.hpp +++ b/src/Tester/TestRunner.hpp @@ -19,6 +19,11 @@ public: auto meta = AngelscriptMetadata(m); if (meta.GetIdentifier() == "Test"_cnc) { auto name = meta.GetParameter("name"_cnc); + if (_tests.Has(name)) { + std::cout << termcolor::red << "Duplicate test name: '" << name << "'." << termcolor::reset + << std::endl; + continue; + } _tests.GetStdMap().insert({name, std::make_unique(name, func)}); } } diff --git a/src/main.cpp b/src/main.cpp index a72b3b4..14869b8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include "../extern/args.hpp" @@ -39,6 +40,7 @@ int main(int argc, char** argv) { chdir(std::filesystem::path(workingDirectory).c_str()); } + std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); std::function initialize = [](PkmnLib::Battling::ScriptResolver* resolver) { auto* scriptResolver = dynamic_cast(resolver); @@ -55,5 +57,10 @@ int main(int argc, char** argv) { auto* scriptResolver = dynamic_cast(Globals::Library.GetValue()->GetScriptResolver().get()); auto testRunner = TestRunner(scriptResolver); auto* engine = scriptResolver->GetBuilder().GetEngine(); - return testRunner.RunAll(engine); + auto v = testRunner.RunAll(engine); + std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); + std::cout << std::endl + << "Total Run time: " << std::chrono::duration_cast(end - begin).count() + << "ms" << std::endl; + return v; } \ No newline at end of file