test(rom): add role-based ROM selection
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
#include "app/editor/message/message_data.h"
|
||||
#include "app/editor/message/message_editor.h"
|
||||
#include "test/test_utils.h"
|
||||
#include "testing.h"
|
||||
|
||||
namespace yaze {
|
||||
@@ -12,17 +13,8 @@ namespace test {
|
||||
class MessageRomTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
// Skip tests if ROM is not available
|
||||
if (getenv("YAZE_SKIP_ROM_TESTS")) {
|
||||
GTEST_SKIP() << "ROM tests disabled";
|
||||
}
|
||||
|
||||
// Check if ROM file exists
|
||||
std::string rom_path = "zelda3.sfc";
|
||||
if (!std::filesystem::exists(rom_path)) {
|
||||
GTEST_SKIP() << "Test ROM not found: " << rom_path;
|
||||
}
|
||||
|
||||
TestRomManager::SkipIfRomMissing(RomRole::kVanilla, "MessageRomTest");
|
||||
const std::string rom_path = TestRomManager::GetRomPath(RomRole::kVanilla);
|
||||
EXPECT_OK(rom_.LoadFromFile(rom_path));
|
||||
dictionary_ = editor::BuildDictionaryEntries(&rom_);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,11 @@
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "app/emu/emulator.h"
|
||||
#include "rom/rom.h"
|
||||
#include "test/test_utils.h"
|
||||
#include "zelda3/music/music_bank.h"
|
||||
#include "zelda3/music/song_data.h"
|
||||
#include "zelda3/music/spc_parser.h"
|
||||
@@ -25,12 +28,10 @@ class MusicIntegrationTest : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
rom_ = std::make_unique<Rom>();
|
||||
|
||||
// Check if ROM file exists
|
||||
const char* rom_path = std::getenv("YAZE_TEST_ROM_PATH");
|
||||
if (!rom_path) {
|
||||
rom_path = "zelda3.sfc";
|
||||
}
|
||||
|
||||
yaze::test::TestRomManager::SkipIfRomMissing(
|
||||
yaze::test::RomRole::kVanilla, "MusicIntegrationTest");
|
||||
const std::string rom_path =
|
||||
yaze::test::TestRomManager::GetRomPath(yaze::test::RomRole::kVanilla);
|
||||
auto status = rom_->LoadFromFile(rom_path);
|
||||
if (!status.ok()) {
|
||||
GTEST_SKIP() << "ROM file not available: " << status.message();
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "rom/rom.h"
|
||||
#include "test/test_utils.h"
|
||||
#include "zelda3/overworld/overworld.h"
|
||||
#include "zelda3/overworld/overworld_map.h"
|
||||
|
||||
@@ -15,19 +16,13 @@ namespace zelda3 {
|
||||
class SpritePositionTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
// Try to load a vanilla ROM for testing
|
||||
rom_ = std::make_unique<Rom>();
|
||||
std::string rom_path = "bin/zelda3.sfc";
|
||||
|
||||
// Check if ROM exists in build directory
|
||||
std::ifstream rom_file(rom_path);
|
||||
if (rom_file.good()) {
|
||||
ASSERT_TRUE(rom_->LoadFromFile(rom_path).ok())
|
||||
<< "Failed to load ROM from " << rom_path;
|
||||
} else {
|
||||
// Skip test if ROM not found
|
||||
GTEST_SKIP() << "ROM file not found at " << rom_path;
|
||||
}
|
||||
yaze::test::TestRomManager::SkipIfRomMissing(
|
||||
yaze::test::RomRole::kVanilla, "SpritePositionTest");
|
||||
const std::string rom_path =
|
||||
yaze::test::TestRomManager::GetRomPath(yaze::test::RomRole::kVanilla);
|
||||
ASSERT_TRUE(rom_->LoadFromFile(rom_path).ok())
|
||||
<< "Failed to load ROM from " << rom_path;
|
||||
|
||||
overworld_ = std::make_unique<Overworld>(rom_.get());
|
||||
ASSERT_TRUE(overworld_->Load(rom_.get()).ok())
|
||||
|
||||
Reference in New Issue
Block a user