From e4cc3b977a4428b7315ca3e4f97327a976e0e942 Mon Sep 17 00:00:00 2001 From: scawful Date: Sun, 19 Jan 2025 19:09:39 -0500 Subject: [PATCH] Move test dir to root --- CMakeLists.txt | 7 +++++ src/CMakeLists.txt | 3 -- {src/test => test}/CMakeLists.txt | 31 +++++++++++-------- {src/test => test}/core/testing.h | 0 {src/test => test}/emu/cpu_test.cc | 0 {src/test => test}/emu/ppu_test.cc | 0 {src/test => test}/emu/spc700_test.cc | 0 {src/test => test}/gfx/compression_test.cc | 0 {src/test => test}/gfx/snes_palette_test.cc | 0 {src/test => test}/integration/test_editor.cc | 0 {src/test => test}/integration/test_editor.h | 0 {src/test => test}/mocks/mock_memory.h | 0 {src/test => test}/rom_test.cc | 0 {src/test => test}/yaze_test.cc | 0 .../test => test}/zelda3/dungeon_room_test.cc | 0 {src/test => test}/zelda3/message_test.cc | 0 {src/test => test}/zelda3/overworld_test.cc | 0 .../zelda3/sprite_builder_test.cc | 0 18 files changed, 25 insertions(+), 16 deletions(-) rename {src/test => test}/CMakeLists.txt (73%) rename {src/test => test}/core/testing.h (100%) rename {src/test => test}/emu/cpu_test.cc (100%) rename {src/test => test}/emu/ppu_test.cc (100%) rename {src/test => test}/emu/spc700_test.cc (100%) rename {src/test => test}/gfx/compression_test.cc (100%) rename {src/test => test}/gfx/snes_palette_test.cc (100%) rename {src/test => test}/integration/test_editor.cc (100%) rename {src/test => test}/integration/test_editor.h (100%) rename {src/test => test}/mocks/mock_memory.h (100%) rename {src/test => test}/rom_test.cc (100%) rename {src/test => test}/yaze_test.cc (100%) rename {src/test => test}/zelda3/dungeon_room_test.cc (100%) rename {src/test => test}/zelda3/message_test.cc (100%) rename {src/test => test}/zelda3/overworld_test.cc (100%) rename {src/test => test}/zelda3/sprite_builder_test.cc (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index f61889b4..40460644 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,3 +56,10 @@ include(cmake/imgui.cmake) # Project Files add_subdirectory(src) + +# Tests +if (YAZE_BUILD_TESTS) +include(cmake/gtest.cmake) +add_subdirectory(test) +endif() + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8bba2238..05141abc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -53,9 +53,6 @@ endif() if (YAZE_BUILD_PYTHON) include(cli/python/yaze_py.cmake) endif() -if (YAZE_BUILD_TESTS) - include(test/CMakeLists.txt) -endif() if(MACOS) set(MACOSX_BUNDLE_ICON_FILE ${CMAKE_SOURCE_DIR}/win32/yaze.ico) diff --git a/src/test/CMakeLists.txt b/test/CMakeLists.txt similarity index 73% rename from src/test/CMakeLists.txt rename to test/CMakeLists.txt index 064e3285..18ab23a9 100644 --- a/src/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,26 +1,31 @@ -include(../cmake/gtest.cmake) -add_executable( - yaze_test - test/yaze_test.cc - test/rom_test.cc - test/gfx/compression_test.cc - test/gfx/snes_palette_test.cc - test/integration/test_editor.cc - test/zelda3/overworld_test.cc - test/zelda3/sprite_builder_test.cc +set(YAZE_SRC_FILES "") +foreach (file app/rom.cc app/core/common.cc - ${ASAR_STATIC_SRC} ${YAZE_APP_CORE_SRC} ${YAZE_APP_EMU_SRC} ${YAZE_APP_GFX_SRC} ${YAZE_APP_ZELDA3_SRC} ${YAZE_APP_EDITOR_SRC} ${YAZE_UTIL_SRC} - ${YAZE_GUI_SRC} + ${YAZE_GUI_SRC}) + list(APPEND YAZE_SRC_FILES ${CMAKE_SOURCE_DIR}/src/${file}) +endforeach() + +add_executable( + yaze_test + yaze_test.cc + rom_test.cc + gfx/compression_test.cc + gfx/snes_palette_test.cc + integration/test_editor.cc + zelda3/overworld_test.cc + zelda3/sprite_builder_test.cc + ${ASAR_STATIC_SRC} ${IMGUI_SRC} ${IMGUI_TEST_ENGINE_SOURCES} + ${YAZE_SRC_FILES} ) target_include_directories( @@ -28,7 +33,7 @@ target_include_directories( app/ lib/ ${CMAKE_SOURCE_DIR}/incl/ - ${CMAKE_SOURCE_DIR}/src/ + ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine ${ASAR_INCLUDE_DIR} ${SDL2_INCLUDE_DIR} diff --git a/src/test/core/testing.h b/test/core/testing.h similarity index 100% rename from src/test/core/testing.h rename to test/core/testing.h diff --git a/src/test/emu/cpu_test.cc b/test/emu/cpu_test.cc similarity index 100% rename from src/test/emu/cpu_test.cc rename to test/emu/cpu_test.cc diff --git a/src/test/emu/ppu_test.cc b/test/emu/ppu_test.cc similarity index 100% rename from src/test/emu/ppu_test.cc rename to test/emu/ppu_test.cc diff --git a/src/test/emu/spc700_test.cc b/test/emu/spc700_test.cc similarity index 100% rename from src/test/emu/spc700_test.cc rename to test/emu/spc700_test.cc diff --git a/src/test/gfx/compression_test.cc b/test/gfx/compression_test.cc similarity index 100% rename from src/test/gfx/compression_test.cc rename to test/gfx/compression_test.cc diff --git a/src/test/gfx/snes_palette_test.cc b/test/gfx/snes_palette_test.cc similarity index 100% rename from src/test/gfx/snes_palette_test.cc rename to test/gfx/snes_palette_test.cc diff --git a/src/test/integration/test_editor.cc b/test/integration/test_editor.cc similarity index 100% rename from src/test/integration/test_editor.cc rename to test/integration/test_editor.cc diff --git a/src/test/integration/test_editor.h b/test/integration/test_editor.h similarity index 100% rename from src/test/integration/test_editor.h rename to test/integration/test_editor.h diff --git a/src/test/mocks/mock_memory.h b/test/mocks/mock_memory.h similarity index 100% rename from src/test/mocks/mock_memory.h rename to test/mocks/mock_memory.h diff --git a/src/test/rom_test.cc b/test/rom_test.cc similarity index 100% rename from src/test/rom_test.cc rename to test/rom_test.cc diff --git a/src/test/yaze_test.cc b/test/yaze_test.cc similarity index 100% rename from src/test/yaze_test.cc rename to test/yaze_test.cc diff --git a/src/test/zelda3/dungeon_room_test.cc b/test/zelda3/dungeon_room_test.cc similarity index 100% rename from src/test/zelda3/dungeon_room_test.cc rename to test/zelda3/dungeon_room_test.cc diff --git a/src/test/zelda3/message_test.cc b/test/zelda3/message_test.cc similarity index 100% rename from src/test/zelda3/message_test.cc rename to test/zelda3/message_test.cc diff --git a/src/test/zelda3/overworld_test.cc b/test/zelda3/overworld_test.cc similarity index 100% rename from src/test/zelda3/overworld_test.cc rename to test/zelda3/overworld_test.cc diff --git a/src/test/zelda3/sprite_builder_test.cc b/test/zelda3/sprite_builder_test.cc similarity index 100% rename from src/test/zelda3/sprite_builder_test.cc rename to test/zelda3/sprite_builder_test.cc