Add unit testes

This commit is contained in:
2026-04-05 14:30:43 +10:00
parent fed40b0c90
commit f57ed78763
12 changed files with 1013 additions and 216 deletions

31
tests/CMakeLists.txt Normal file
View File

@@ -0,0 +1,31 @@
project(ANSCustomModels_Tests LANGUAGES CXX)
# ---------- Google Test (fetched once, shared by all sub-projects) ----------
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.14.0
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
enable_testing()
# ---------- Common paths (propagated to sub-projects via variables) ----------
set(ANSLIB_INCLUDE_DIR "C:/Projects/ANLS/ANSLIB/ANSLIB" CACHE PATH "")
set(OPENCV_INCLUDE_DIR "C:/ANSLibs/opencv/include" CACHE PATH "")
set(ANSLIB_LIB_DIR "C:/ProgramData/ANSCENTER/Shared" CACHE PATH "")
set(OPENCV_LIB_DIR "C:/ANSLibs/opencv/x64/vc17/lib" CACHE PATH "")
set(OPENCV_BIN_DIR "C:/ProgramData/ANSCENTER/Shared" CACHE PATH "")
set(TEST_COMMON_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH "")
# ---------- Place all test .exe files alongside the DLLs they need ----------
# This ensures custom model DLLs (built by sibling projects) land in the same
# directory as the test executables so Windows can find them at runtime.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" CACHE PATH "" FORCE)
# ---------- Sub-project test executables ----------
add_subdirectory(FireNSmokeDetection)
add_subdirectory(HelmetDetection)
add_subdirectory(WeaponDetection)