From 1d297d52283b9de850400503f28451e8d09d377c Mon Sep 17 00:00:00 2001 From: scawful Date: Mon, 22 Dec 2025 14:56:31 -0500 Subject: [PATCH] test(overworld): align integration expectations --- .../zelda3/overworld_integration_test.cc | 22 +++++++++---------- test/unit/zelda3/overworld_regression_test.cc | 4 ++++ test/unit/zelda3/overworld_test.cc | 10 ++++----- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/test/integration/zelda3/overworld_integration_test.cc b/test/integration/zelda3/overworld_integration_test.cc index 0ffe5a91..b9e38a14 100644 --- a/test/integration/zelda3/overworld_integration_test.cc +++ b/test/integration/zelda3/overworld_integration_test.cc @@ -1,11 +1,11 @@ #include -#include #include #include #include #include "rom/rom.h" +#include "test/test_utils.h" #include "testing.h" #include "zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld_map.h" @@ -32,17 +32,16 @@ class OverworldIntegrationTest : public ::testing::Test { #endif // Check if we should use real ROM or mock data - const char* rom_path_env = getenv("YAZE_TEST_ROM_PATH"); - const char* skip_rom_tests = getenv("YAZE_SKIP_ROM_TESTS"); - - if (skip_rom_tests) { + if (std::getenv("YAZE_SKIP_ROM_TESTS")) { GTEST_SKIP() << "ROM tests disabled"; } - if (rom_path_env && std::filesystem::exists(rom_path_env)) { + const std::string rom_path = + yaze::test::TestRomManager::GetRomPath(yaze::test::RomRole::kVanilla); + if (!rom_path.empty()) { // Use real ROM for testing rom_ = std::make_unique(); - auto status = rom_->LoadFromFile(rom_path_env); + auto status = rom_->LoadFromFile(rom_path); if (status.ok()) { use_real_rom_ = true; overworld_ = std::make_unique(rom_.get()); @@ -181,7 +180,7 @@ TEST_F(OverworldIntegrationTest, DISABLED_EntranceCoordinateCalculation) { // Test exit loading matches ZScream data structure TEST_F(OverworldIntegrationTest, ExitDataLoading) { auto status = overworld_->Load(rom_.get()); - ASSERT_TRUE(status.ok()); + ASSERT_TRUE(status.ok()) << status.ToString(); const auto& exits = overworld_->exits(); EXPECT_EQ(exits->size(), 0x4F); @@ -298,8 +297,9 @@ TEST_F(OverworldIntegrationTest, RomDependentTestSuiteCompatibility) { // Test that sprite data is accessible (matches RomDependentTestSuite // expectations) - const auto& sprites = overworld_->sprites(0); - EXPECT_EQ(sprites.size(), 3); // Three game states + const auto all_sprites = overworld_->all_sprites(); + EXPECT_EQ(all_sprites.size(), 3); // Three game states + EXPECT_GT(all_sprites[0].size(), 0); // Test that item data is accessible const auto& items = overworld_->all_items(); @@ -420,4 +420,4 @@ TEST_F(OverworldIntegrationTest, ZScreamCoordinateCompatibility) { } } // namespace zelda3 -} // namespace yaze \ No newline at end of file +} // namespace yaze diff --git a/test/unit/zelda3/overworld_regression_test.cc b/test/unit/zelda3/overworld_regression_test.cc index 10372830..37d099b2 100644 --- a/test/unit/zelda3/overworld_regression_test.cc +++ b/test/unit/zelda3/overworld_regression_test.cc @@ -39,6 +39,10 @@ class OverworldRegressionTest : public ::testing::Test { for (int i = 0; i < 160; i++) { mock_rom_data[0x1788D + i] = 0x01; } + // Parent table - identity for LW so DW mirrors correctly (+0x40) + for (int i = 0; i < 64; i++) { + mock_rom_data[0x125EC + i] = static_cast(i); + } // Sprite sets/palettes for (int i = 0; i < 160; i++) { mock_rom_data[0x7A41 + i] = 0x00; diff --git a/test/unit/zelda3/overworld_test.cc b/test/unit/zelda3/overworld_test.cc index 50b9d174..736bb0a6 100644 --- a/test/unit/zelda3/overworld_test.cc +++ b/test/unit/zelda3/overworld_test.cc @@ -249,12 +249,12 @@ TEST_F(OverworldTest, OverworldMapDestroy) { map.set_main_palette(5); map.SetAreaSize(AreaSizeEnum::LargeArea); - // Destroy and verify reset + // Destroy and verify identity fields are preserved for rebuild map.Destroy(); - EXPECT_EQ(map.area_graphics(), 0); - EXPECT_EQ(map.main_palette(), 0); - EXPECT_EQ(map.area_size(), AreaSizeEnum::SmallArea); + EXPECT_EQ(map.area_graphics(), 10); + EXPECT_EQ(map.main_palette(), 5); + EXPECT_EQ(map.area_size(), AreaSizeEnum::LargeArea); EXPECT_FALSE(map.is_initialized()); } @@ -296,4 +296,4 @@ TEST_F(OverworldTest, WorldBasedSpriteFiltering) { } } // namespace zelda3 -} // namespace yaze \ No newline at end of file +} // namespace yaze