test housekeeping

This commit is contained in:
scawful
2025-08-21 19:01:40 -04:00
parent 9cbae49cb0
commit 7f60ddcd42
5 changed files with 19 additions and 21 deletions

View File

@@ -7,7 +7,6 @@
namespace yaze {
namespace test {
using yaze::emu::MockClock;
using yaze::emu::MockMemory;
using yaze::emu::BackgroundMode;
using yaze::emu::PpuInterface;
@@ -35,7 +34,6 @@ class MockPpu : public PpuInterface {
class PpuTest : public ::testing::Test {
protected:
MockMemory mock_memory;
MockClock mock_clock;
MockPpu mock_ppu;
PpuTest() {}

View File

@@ -3,7 +3,7 @@
#include <SDL.h>
#include "app/core/controller.h"
#include "app/core/platform/renderer.h"
#include "app/core/window.h"
#include "app/gui/style.h"
#include "imgui/backends/imgui_impl_sdl2.h"
#include "imgui/backends/imgui_impl_sdlrenderer2.h"
@@ -42,14 +42,11 @@ void TestEditor::RegisterTests(ImGuiTestEngine* engine) {
};
}
// TODO: Fix the window/controller management
int RunIntegrationTest() {
yaze::core::Controller controller;
if (!controller.CreateWindow().ok()) {
return EXIT_FAILURE;
}
if (!controller.CreateRenderer().ok()) {
return EXIT_FAILURE;
}
yaze::core::Window window;
yaze::core::CreateWindow(&window);
IMGUI_CHECKVERSION();
ImGui::CreateContext();

View File

@@ -7,26 +7,27 @@
namespace yaze {
namespace test {
class DungeonRoomTest : public ::testing::Test, public SharedRom {
class DungeonRoomTest : public ::testing::Test {
protected:
void SetUp() override {
// Skip tests on Linux for automated github builds
#if defined(__linux__)
GTEST_SKIP();
#else
if (!rom()->LoadFromFile("./zelda3.sfc").ok()) {
if (!rom_.LoadFromFile("./zelda3.sfc").ok()) {
GTEST_SKIP_("Failed to load test ROM");
}
#endif
}
void TearDown() override {}
Rom rom_;
};
TEST_F(DungeonRoomTest, SingleRoomLoadOk) {
zelda3::Room test_room(/*room_id=*/0);
test_room.LoadHeader();
// Do some assertions based on the output in ZS
test_room.LoadRoomFromROM();
zelda3::Room test_room(/*room_id=*/0, &rom_);
test_room = zelda3::LoadRoomFromRom(&rom_, /*room_id=*/0);
}
} // namespace test

View File

@@ -7,17 +7,18 @@
namespace yaze {
namespace test {
class MessageTest : public ::testing::Test, public SharedRom {
class MessageTest : public ::testing::Test {
protected:
void SetUp() override {
#if defined(__linux__)
GTEST_SKIP();
#endif
EXPECT_OK(rom()->LoadFromFile("zelda3.sfc"));
dictionary_ = editor::BuildDictionaryEntries(rom());
EXPECT_OK(rom_.LoadFromFile("zelda3.sfc"));
dictionary_ = editor::BuildDictionaryEntries(&rom_);
}
void TearDown() override {}
Rom rom_;
editor::MessageEditor message_editor_;
std::vector<editor::DictionaryEntry> dictionary_;
};
@@ -193,7 +194,7 @@ TEST_F(MessageTest, FindMatchingElement_InvalidCommand) {
}
TEST_F(MessageTest, BuildDictionaryEntries_CorrectSize) {
auto result = editor::BuildDictionaryEntries(rom());
auto result = editor::BuildDictionaryEntries(&rom_);
EXPECT_EQ(result.size(), editor::kNumDictionaryEntries);
EXPECT_FALSE(result.empty());
}

View File

@@ -10,7 +10,7 @@
namespace yaze {
namespace test {
class OverworldTest : public ::testing::Test, public SharedRom {
class OverworldTest : public ::testing::Test {
protected:
void SetUp() override {
// Skip tests on Linux for automated github builds
@@ -20,7 +20,8 @@ class OverworldTest : public ::testing::Test, public SharedRom {
}
void TearDown() override {}
zelda3::Overworld overworld_{rom()};
Rom rom_;
zelda3::Overworld overworld_{&rom_};
};
TEST_F(OverworldTest, OverworldLoadNoRomDataError) {