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,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) {