Add more logging.

This commit is contained in:
Deukhoofd 2021-08-26 19:24:35 +02:00
parent d11722efdd
commit 91ca6038d3
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 13 additions and 1 deletions

View File

@ -19,6 +19,11 @@ public:
auto meta = AngelscriptMetadata(m); auto meta = AngelscriptMetadata(m);
if (meta.GetIdentifier() == "Test"_cnc) { if (meta.GetIdentifier() == "Test"_cnc) {
auto name = meta.GetParameter("name"_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<Test>(name, func)}); _tests.GetStdMap().insert({name, std::make_unique<Test>(name, func)});
} }
} }

View File

@ -1,4 +1,5 @@
#include <PkmnLib/ScriptResolving/AngelScript/AngelScriptResolver.hpp> #include <PkmnLib/ScriptResolving/AngelScript/AngelScriptResolver.hpp>
#include <chrono>
#include <filesystem> #include <filesystem>
#include <iostream> #include <iostream>
#include "../extern/args.hpp" #include "../extern/args.hpp"
@ -39,6 +40,7 @@ int main(int argc, char** argv) {
chdir(std::filesystem::path(workingDirectory).c_str()); chdir(std::filesystem::path(workingDirectory).c_str());
} }
std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
std::function<void(PkmnLib::Battling::ScriptResolver*)> initialize = std::function<void(PkmnLib::Battling::ScriptResolver*)> initialize =
[](PkmnLib::Battling::ScriptResolver* resolver) { [](PkmnLib::Battling::ScriptResolver* resolver) {
auto* scriptResolver = dynamic_cast<AngelScriptResolver*>(resolver); auto* scriptResolver = dynamic_cast<AngelScriptResolver*>(resolver);
@ -55,5 +57,10 @@ int main(int argc, char** argv) {
auto* scriptResolver = dynamic_cast<AngelScriptResolver*>(Globals::Library.GetValue()->GetScriptResolver().get()); auto* scriptResolver = dynamic_cast<AngelScriptResolver*>(Globals::Library.GetValue()->GetScriptResolver().get());
auto testRunner = TestRunner(scriptResolver); auto testRunner = TestRunner(scriptResolver);
auto* engine = scriptResolver->GetBuilder().GetEngine(); 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<std::chrono::milliseconds>(end - begin).count()
<< "ms" << std::endl;
return v;
} }