Skip to content

Commit

Permalink
Streamlined the test configuration as we're only building one executa…
Browse files Browse the repository at this point in the history
…ble.
  • Loading branch information
LTLA committed Sep 2, 2024
1 parent b06046e commit b78bd3f
Showing 1 changed file with 19 additions and 29 deletions.
48 changes: 19 additions & 29 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,27 @@ FetchContent_MakeAvailable(scran_tests)

enable_testing()

add_executable(
libtest
src/normalize_counts.cpp
src/sanitize_size_factors.cpp
src/center_size_factors.cpp
src/choose_pseudo_count.cpp
)

target_link_libraries(
libtest
scran_norm
scran_tests
)

target_compile_options(libtest PRIVATE -Wall -Werror -Wpedantic -Wextra)

option(CODE_COVERAGE "Enable coverage testing" OFF)
set(DO_CODE_COVERAGE OFF)
if(CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(DO_CODE_COVERAGE ON)
target_compile_options(libtest PRIVATE -O0 -g --coverage)
target_link_options(libtest PRIVATE --coverage)
endif()

include(GoogleTest)

macro(create_test name)
add_executable(
${name}
src/normalize_counts.cpp
src/sanitize_size_factors.cpp
src/center_size_factors.cpp
src/choose_pseudo_count.cpp
)

target_link_libraries(
${name}
scran_norm
scran_tests
)

target_compile_options(${name} PRIVATE -Wall -Werror -Wpedantic -Wextra)

if(DO_CODE_COVERAGE)
target_compile_options(${name} PRIVATE -O0 -g --coverage)
target_link_options(${name} PRIVATE --coverage)
endif()

gtest_discover_tests(${name})
endmacro()

create_test(libtest)
gtest_discover_tests(libtest)

0 comments on commit b78bd3f

Please sign in to comment.