yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
main_test.cc
Go to the documentation of this file.
4#include "util/log.h"
5
6#include "absl/flags/parse.h"
7
8#include "imgui.h"
9
10#if YAZE_ENABLE_EXPERIMENTAL_APP_TEST_SUITES
14#endif
15
16int main(int argc, char** argv) {
17 absl::ParseCommandLine(argc, argv);
18
19 // Initialize ImGui context for tests
20 IMGUI_CHECKVERSION();
21 ImGui::CreateContext();
22 ImGuiIO& io = ImGui::GetIO();
23 io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
24
25 // Configure minimal logging
27 yaze::util::LogLevel::INFO, "", {"Test", "Error"});
28
29 LOG_INFO("Test", "Registering test suites...");
31
32 // Register our new agent tools test suite
34
35#if YAZE_ENABLE_EXPERIMENTAL_APP_TEST_SUITES
36 // Optional WIP suites. Off by default so they don't block baseline builds.
38 std::make_unique<yaze::test::DungeonEditorTestSuite>());
40 std::make_unique<yaze::test::OverworldEditorTestSuite>());
42 std::make_unique<yaze::test::GraphicsEditorTestSuite>());
43#endif
44
45 LOG_INFO("Test", "Running all tests...");
47
48 // Cleanup
49 ImGui::DestroyContext();
50
51 if (status.ok()) {
52 const auto& results = yaze::test::TestManager::Get().GetLastResults();
53 LOG_INFO("Test", "Tests passed: %zu/%zu", results.passed_tests,
54 results.total_tests);
55
56 if (results.failed_tests > 0) {
57 LOG_ERROR("Test", "--- FAILED TESTS ---");
58 for (const auto& result : results.individual_results) {
59 if (result.status == yaze::test::TestStatus::kFailed) {
60 LOG_ERROR("Test", "[FAILED] %s::%s - %s",
61 result.suite_name.c_str(), result.name.c_str(),
62 result.error_message.c_str());
63 }
64 }
65 LOG_ERROR("Test", "--------------------");
66 }
67
68 return (results.failed_tests == 0) ? 0 : 1;
69 } else {
70 LOG_ERROR("Test", "Test execution failed: %s", status.ToString().c_str());
71 return 1;
72 }
73}
const TestResults & GetLastResults() const
void RegisterTestSuite(std::unique_ptr< TestSuite > suite)
absl::Status RunAllTests()
static TestManager & Get()
static LogManager & instance()
Definition log.cc:32
void configure(LogLevel level, const std::string &file_path, const std::set< std::string > &categories)
Configures the logging system.
Definition log.cc:46
#define LOG_ERROR(category, format,...)
Definition log.h:109
#define LOG_INFO(category, format,...)
Definition log.h:105
int main(int argc, char **argv)
Definition main_test.cc:16
void RegisterAgentToolsTestSuite()
void RegisterZ3edTestSuites()