feat: Organize and enhance test structure with new tools and integration tests
- Added a new `tools` directory to house various utility tools, including the `overworld_golden_data_extractor`, `extract_vanilla_values`, and `rom_patch_utility`. - Introduced comprehensive integration tests for dungeon and overworld functionalities, ensuring compatibility with existing ROM data. - Refactored existing test files to improve organization and maintainability, moving deprecated tests to a dedicated directory. - Updated CMake configuration to include new tools and tests, enhancing the build process for development and CI environments. - Improved test coverage for dungeon object rendering and room integration, validating core functionalities against expected behaviors.
This commit is contained in:
@@ -271,6 +271,9 @@ file(COPY ${AGENT_FILES} DESTINATION "${CMAKE_BINARY_DIR}/assets/agent/")
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
# Tools
|
||||
add_subdirectory(tools)
|
||||
|
||||
# Tests
|
||||
if (YAZE_BUILD_TESTS)
|
||||
add_subdirectory(test)
|
||||
|
||||
@@ -43,7 +43,7 @@ if(YAZE_BUILD_TESTS AND NOT YAZE_BUILD_TESTS STREQUAL "OFF")
|
||||
unit/zelda3/test_dungeon_objects.cc
|
||||
unit/zelda3/dungeon_component_unit_test.cc
|
||||
zelda3/dungeon/room_object_encoding_test.cc
|
||||
zelda3/dungeon/room_integration_test.cc
|
||||
integration/zelda3/room_integration_test.cc
|
||||
zelda3/dungeon/room_manipulation_test.cc
|
||||
|
||||
# CLI Services (for catalog serialization tests)
|
||||
@@ -62,12 +62,17 @@ if(YAZE_BUILD_TESTS AND NOT YAZE_BUILD_TESTS STREQUAL "OFF")
|
||||
e2e/rom_dependent/e2e_rom_test.cc
|
||||
e2e/zscustomoverworld/zscustomoverworld_upgrade_test.cc
|
||||
|
||||
# Legacy Integration Tests (to be migrated)
|
||||
unit/zelda3/comprehensive_integration_test.cc
|
||||
unit/zelda3/overworld_integration_test.cc
|
||||
unit/zelda3/dungeon_integration_test.cc
|
||||
unit/zelda3/dungeon_editor_system_integration_test.cc
|
||||
unit/zelda3/dungeon_object_renderer_integration_test.cc
|
||||
# Deprecated Tests (formerly legacy)
|
||||
deprecated/comprehensive_integration_test.cc
|
||||
deprecated/dungeon_integration_test.cc
|
||||
|
||||
# Integration Tests (Zelda3)
|
||||
integration/zelda3/overworld_integration_test.cc
|
||||
integration/zelda3/dungeon_editor_system_integration_test.cc
|
||||
integration/zelda3/dungeon_object_renderer_integration_test.cc
|
||||
integration/zelda3/room_integration_test.cc
|
||||
|
||||
# Mock/Unit Tests for Zelda3
|
||||
unit/zelda3/dungeon_object_renderer_mock_test.cc
|
||||
unit/zelda3/dungeon_object_rendering_tests.cc
|
||||
unit/zelda3/dungeon_room_test.cc
|
||||
@@ -100,7 +105,6 @@ if(YAZE_BUILD_TESTS AND NOT YAZE_BUILD_TESTS STREQUAL "OFF")
|
||||
unit/zelda3/test_dungeon_objects.cc
|
||||
unit/zelda3/dungeon_component_unit_test.cc
|
||||
zelda3/dungeon/room_object_encoding_test.cc
|
||||
zelda3/dungeon/room_integration_test.cc
|
||||
zelda3/dungeon/room_manipulation_test.cc
|
||||
|
||||
# CLI Services (for catalog serialization tests)
|
||||
@@ -121,110 +125,27 @@ if(YAZE_BUILD_TESTS AND NOT YAZE_BUILD_TESTS STREQUAL "OFF")
|
||||
e2e/rom_dependent/e2e_rom_test.cc
|
||||
e2e/zscustomoverworld/zscustomoverworld_upgrade_test.cc
|
||||
|
||||
# Legacy Integration Tests (to be migrated)
|
||||
unit/zelda3/comprehensive_integration_test.cc
|
||||
unit/zelda3/overworld_integration_test.cc
|
||||
unit/zelda3/dungeon_integration_test.cc
|
||||
unit/zelda3/dungeon_editor_system_integration_test.cc
|
||||
unit/zelda3/dungeon_object_renderer_integration_test.cc
|
||||
# Deprecated Tests (formerly legacy)
|
||||
deprecated/comprehensive_integration_test.cc
|
||||
deprecated/dungeon_integration_test.cc
|
||||
|
||||
# Integration Tests (Zelda3)
|
||||
integration/zelda3/overworld_integration_test.cc
|
||||
integration/zelda3/dungeon_editor_system_integration_test.cc
|
||||
integration/zelda3/dungeon_object_renderer_integration_test.cc
|
||||
integration/zelda3/room_integration_test.cc
|
||||
|
||||
# Mock/Unit Tests for Zelda3
|
||||
unit/zelda3/dungeon_object_renderer_mock_test.cc
|
||||
unit/zelda3/dungeon_object_rendering_tests.cc
|
||||
unit/zelda3/dungeon_room_test.cc
|
||||
|
||||
# Benchmarks
|
||||
benchmarks/gfx_optimization_benchmarks.cc
|
||||
)
|
||||
endif()
|
||||
|
||||
# Add vanilla value extraction utility (only for local development with ROM access)
|
||||
# IMPORTANT: Do not build in CI/release - this is a development-only utility
|
||||
if(NOT YAZE_MINIMAL_BUILD AND YAZE_ENABLE_ROM_TESTS AND NOT DEFINED ENV{GITHUB_ACTIONS})
|
||||
add_executable(
|
||||
extract_vanilla_values
|
||||
unit/zelda3/extract_vanilla_values.cc
|
||||
${YAZE_SRC_FILES}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
extract_vanilla_values PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src/app/
|
||||
${CMAKE_SOURCE_DIR}/src/lib/
|
||||
${CMAKE_SOURCE_DIR}/incl/
|
||||
${CMAKE_SOURCE_DIR}/src/
|
||||
${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar-dll-bindings/c
|
||||
${SDL2_INCLUDE_DIR}
|
||||
${PNG_INCLUDE_DIRS}
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
extract_vanilla_values
|
||||
yaze_core
|
||||
${SDL_TARGETS}
|
||||
asar-static
|
||||
${ABSL_TARGETS}
|
||||
${PNG_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
${CMAKE_DL_LIBS}
|
||||
ImGui
|
||||
)
|
||||
|
||||
# Windows stack size configuration for extract_vanilla_values
|
||||
if(WIN32)
|
||||
if(MSVC)
|
||||
target_link_options(extract_vanilla_values PRIVATE /STACK:16777216)
|
||||
elseif(MINGW OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_link_options(extract_vanilla_values PRIVATE -Wl,--stack,16777216)
|
||||
else()
|
||||
target_link_options(extract_vanilla_values PRIVATE -Wl,--stack,16777216)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Add rom_patch_utility as a separate executable
|
||||
add_executable(
|
||||
rom_patch_utility
|
||||
unit/zelda3/rom_patch_utility.cc
|
||||
${YAZE_SRC_FILES}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
rom_patch_utility PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src/app/
|
||||
${CMAKE_SOURCE_DIR}/src/lib/
|
||||
${CMAKE_SOURCE_DIR}/incl/
|
||||
${CMAKE_SOURCE_DIR}/src/
|
||||
${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar-dll-bindings/c
|
||||
${SDL2_INCLUDE_DIR}
|
||||
${PNG_INCLUDE_DIRS}
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
rom_patch_utility
|
||||
yaze_core
|
||||
${SDL_TARGETS}
|
||||
asar-static
|
||||
${ABSL_TARGETS}
|
||||
${PNG_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
${CMAKE_DL_LIBS}
|
||||
ImGui
|
||||
)
|
||||
|
||||
# Windows stack size configuration for rom_patch_utility
|
||||
if(WIN32)
|
||||
if(MSVC)
|
||||
target_link_options(rom_patch_utility PRIVATE /STACK:16777216)
|
||||
elseif(MINGW OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_link_options(rom_patch_utility PRIVATE -Wl,--stack,16777216)
|
||||
else()
|
||||
target_link_options(rom_patch_utility PRIVATE -Wl,--stack,16777216)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Configure test executable only when tests are enabled
|
||||
target_include_directories(
|
||||
@@ -386,60 +307,81 @@ source_group("Tests\\Framework" FILES
|
||||
testing.h
|
||||
yaze_test.cc
|
||||
yaze_test_ci.cc
|
||||
test_editor.cc
|
||||
test_editor.h
|
||||
)
|
||||
|
||||
# Unit Tests
|
||||
source_group("Tests\\Unit" FILES
|
||||
unit/test_asar_wrapper.cc
|
||||
unit/test_rom_loading.cc
|
||||
unit/test_snes_tiles.cc
|
||||
unit/test_palettes.cc
|
||||
unit/test_hex_utils.cc
|
||||
unit/test_flag_utils.cc
|
||||
unit/test_bps_utils.cc
|
||||
unit/test_color_conversion.cc
|
||||
unit/test_tile_compression.cc
|
||||
unit/test_memory_management.cc
|
||||
unit/test_project_structure.cc
|
||||
unit/test_editor_basic.cc
|
||||
unit/test_dungeon_data.cc
|
||||
unit/test_overworld_data.cc
|
||||
unit/test_sprite_data.cc
|
||||
unit/test_music_data.cc
|
||||
unit/test_graphics_rendering.cc
|
||||
unit/test_gui_components.cc
|
||||
unit/test_emulator_core.cc
|
||||
unit/test_cpu_instructions.cc
|
||||
unit/test_ppu_rendering.cc
|
||||
unit/test_audio_processing.cc
|
||||
unit/test_compression_algorithms.cc
|
||||
unit/test_hex_editor.cc
|
||||
unit/core/asar_wrapper_test.cc
|
||||
unit/core/hex_test.cc
|
||||
unit/cli/resource_catalog_test.cc
|
||||
unit/rom/rom_test.cc
|
||||
unit/gfx/snes_tile_test.cc
|
||||
unit/gfx/compression_test.cc
|
||||
unit/gfx/snes_palette_test.cc
|
||||
unit/zelda3/message_test.cc
|
||||
unit/zelda3/overworld_test.cc
|
||||
unit/zelda3/object_parser_test.cc
|
||||
unit/zelda3/object_parser_structs_test.cc
|
||||
unit/zelda3/sprite_builder_test.cc
|
||||
unit/zelda3/sprite_position_test.cc
|
||||
unit/zelda3/test_dungeon_objects.cc
|
||||
unit/zelda3/dungeon_component_unit_test.cc
|
||||
zelda3/dungeon/room_object_encoding_test.cc
|
||||
zelda3/dungeon/room_manipulation_test.cc
|
||||
unit/zelda3/dungeon_object_renderer_mock_test.cc
|
||||
unit/zelda3/dungeon_object_rendering_tests.cc
|
||||
unit/zelda3/dungeon_room_test.cc
|
||||
)
|
||||
|
||||
# Integration Tests
|
||||
source_group("Tests\\Integration" FILES
|
||||
integration/test_editor_integration.cc
|
||||
integration/test_rom_integration.cc
|
||||
integration/test_project_workflow.cc
|
||||
integration/test_asar_integration.cc
|
||||
integration/test_graphics_pipeline.cc
|
||||
integration/test_emulator_integration.cc
|
||||
integration/asar_integration_test.cc
|
||||
integration/asar_rom_test.cc
|
||||
integration/dungeon_editor_test.cc
|
||||
integration/dungeon_editor_test.h
|
||||
integration/editor/tile16_editor_test.cc
|
||||
integration/editor/editor_integration_test.cc
|
||||
integration/editor/editor_integration_test.h
|
||||
)
|
||||
|
||||
# Integration Tests (Zelda3)
|
||||
source_group("Tests\\Integration\\Zelda3" FILES
|
||||
integration/zelda3/overworld_integration_test.cc
|
||||
integration/zelda3/dungeon_editor_system_integration_test.cc
|
||||
integration/zelda3/dungeon_object_renderer_integration_test.cc
|
||||
integration/zelda3/room_integration_test.cc
|
||||
)
|
||||
|
||||
# End-to-End Tests
|
||||
source_group("Tests\\E2E" FILES
|
||||
e2e/test_full_workflow.cc
|
||||
e2e/test_user_scenarios.cc
|
||||
e2e/canvas_selection_test.cc
|
||||
e2e/framework_smoke_test.cc
|
||||
e2e/rom_dependent/e2e_rom_test.cc
|
||||
e2e/zscustomoverworld/zscustomoverworld_upgrade_test.cc
|
||||
)
|
||||
|
||||
# Deprecated Tests
|
||||
source_group("Tests\\Deprecated" FILES
|
||||
deprecated/comprehensive_integration_test.cc
|
||||
deprecated/dungeon_integration_test.cc
|
||||
)
|
||||
|
||||
# Benchmarks
|
||||
source_group("Tests\\Benchmarks" FILES
|
||||
benchmarks/gfx_optimization_benchmarks.cc
|
||||
)
|
||||
|
||||
# Test Utilities and Mocks
|
||||
source_group("Tests\\Utilities" FILES
|
||||
test_utils.h
|
||||
test_utils.cc
|
||||
mocks/mock_rom.h
|
||||
mocks/mock_editor.h
|
||||
mocks/mock_memory.h
|
||||
)
|
||||
|
||||
# Test Assets
|
||||
source_group("Tests\\Assets" FILES
|
||||
assets/test_rom.asm
|
||||
assets/test_patch.asm
|
||||
)
|
||||
1102
test/e2e/dungeon_object_rendering_e2e_tests.cc
Normal file
1102
test/e2e/dungeon_object_rendering_e2e_tests.cc
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,24 +0,0 @@
|
||||
# Add golden data extractor tool
|
||||
add_executable(overworld_golden_data_extractor
|
||||
overworld_golden_data_extractor.cc
|
||||
)
|
||||
|
||||
target_link_libraries(overworld_golden_data_extractor
|
||||
yaze_core
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
|
||||
# Add vanilla values extractor tool
|
||||
add_executable(extract_vanilla_values
|
||||
extract_vanilla_values.cc
|
||||
)
|
||||
|
||||
target_link_libraries(extract_vanilla_values
|
||||
yaze_core
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
|
||||
# Install tools to bin directory
|
||||
install(TARGETS overworld_golden_data_extractor extract_vanilla_values
|
||||
DESTINATION bin
|
||||
)
|
||||
2
tools/CMakeLists.txt
Normal file
2
tools/CMakeLists.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
# Process the test helpers subdirectory
|
||||
add_subdirectory(test_helpers)
|
||||
53
tools/test_helpers/CMakeLists.txt
Normal file
53
tools/test_helpers/CMakeLists.txt
Normal file
@@ -0,0 +1,53 @@
|
||||
# Add golden data extractor tool
|
||||
add_executable(overworld_golden_data_extractor
|
||||
overworld_golden_data_extractor.cc
|
||||
)
|
||||
|
||||
target_link_libraries(overworld_golden_data_extractor
|
||||
yaze_core
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
|
||||
# Add vanilla values extractor tool
|
||||
add_executable(extract_vanilla_values
|
||||
extract_vanilla_values.cc
|
||||
)
|
||||
|
||||
target_link_libraries(extract_vanilla_values
|
||||
yaze_core
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
|
||||
# Add rom_patch_utility tool
|
||||
add_executable(rom_patch_utility
|
||||
rom_patch_utility.cc
|
||||
)
|
||||
|
||||
target_link_libraries(rom_patch_utility
|
||||
yaze_core
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
|
||||
# Windows stack size configuration for helper tools
|
||||
set(HELPER_TOOLS
|
||||
overworld_golden_data_extractor
|
||||
extract_vanilla_values
|
||||
rom_patch_utility
|
||||
)
|
||||
|
||||
foreach(TOOL ${HELPER_TOOLS})
|
||||
if(WIN32)
|
||||
if(MSVC)
|
||||
target_link_options(${TOOL} PRIVATE /STACK:16777216)
|
||||
elseif(MINGW OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_link_options(${TOOL} PRIVATE -Wl,--stack,16777216)
|
||||
else()
|
||||
target_link_options(${TOOL} PRIVATE -Wl,--stack,16777216)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Install tools to bin directory
|
||||
install(TARGETS overworld_golden_data_extractor extract_vanilla_values rom_patch_utility
|
||||
DESTINATION bin
|
||||
)
|
||||
Reference in New Issue
Block a user