diff --git a/CMakeLists.txt b/CMakeLists.txt index 4009a5e0..4e7dd527 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,11 +8,8 @@ include (cmake/Flags.cmake) set(CMAKE_CXX_STANDARD 20) -if (NOT BUILD_TESTING STREQUAL OFF) - set(ENABLE_TESTING ON) - enable_testing() - find_package(GTest QUIET REQUIRED) -endif() +enable_testing() +find_package(GTest QUIET REQUIRED) if (DEFINED BUILD_COVERAGE) if (${BUILD_COVERAGE}) diff --git a/src/cache/CMakeLists.txt b/src/cache/CMakeLists.txt index 8c231055..614b48a8 100644 --- a/src/cache/CMakeLists.txt +++ b/src/cache/CMakeLists.txt @@ -8,30 +8,26 @@ target_link_libraries(sisl_cache PUBLIC sisl_buffer ) -if (DEFINED ENABLE_TESTING) - if (${ENABLE_TESTING}) - add_executable(test_range_hashmap) - target_sources(test_range_hashmap PRIVATE - tests/test_range_hashmap.cpp - ) - target_include_directories(test_range_hashmap BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries(test_range_hashmap sisl_cache GTest::gtest) - #add_test(NAME RangeHashMap COMMAND test_range_hashmap --num_iters 10000) +add_executable(test_range_hashmap) +target_sources(test_range_hashmap PRIVATE + tests/test_range_hashmap.cpp + ) +target_include_directories(test_range_hashmap BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(test_range_hashmap sisl_cache GTest::gtest) +#add_test(NAME RangeHashMap COMMAND test_range_hashmap --num_iters 10000) - add_executable(test_range_cache) - target_sources(test_range_cache PRIVATE - tests/test_range_cache.cpp - ) - target_include_directories(test_range_cache BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries(test_range_cache sisl_cache GTest::gtest) - #add_test(NAME RangeCache COMMAND test_range_cache --num_iters 1000) +add_executable(test_range_cache) +target_sources(test_range_cache PRIVATE + tests/test_range_cache.cpp + ) +target_include_directories(test_range_cache BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(test_range_cache sisl_cache GTest::gtest) +#add_test(NAME RangeCache COMMAND test_range_cache --num_iters 1000) - add_executable(test_simple_cache) - target_sources(test_simple_cache PRIVATE - tests/test_simple_cache.cpp - ) - target_include_directories(test_simple_cache BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries(test_simple_cache sisl_cache GTest::gtest) - add_test(NAME SimpleCache COMMAND test_simple_cache --num_iters 1000) - endif() -endif() +add_executable(test_simple_cache) +target_sources(test_simple_cache PRIVATE + tests/test_simple_cache.cpp + ) +target_include_directories(test_simple_cache BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(test_simple_cache sisl_cache GTest::gtest) +add_test(NAME SimpleCache COMMAND test_simple_cache --num_iters 1000) diff --git a/src/fds/CMakeLists.txt b/src/fds/CMakeLists.txt index 19105227..04ca1753 100644 --- a/src/fds/CMakeLists.txt +++ b/src/fds/CMakeLists.txt @@ -9,104 +9,100 @@ target_link_libraries(sisl_buffer PUBLIC folly::folly ) -if (DEFINED ENABLE_TESTING) - if (${ENABLE_TESTING}) - include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}) - add_executable(test_stream_tracker) - target_sources(test_stream_tracker PRIVATE - tests/test_stream_tracker.cpp - ) - target_link_libraries(test_stream_tracker sisl_buffer GTest::gtest) - add_test(NAME StreamTracker COMMAND test_stream_tracker) +add_executable(test_stream_tracker) +target_sources(test_stream_tracker PRIVATE + tests/test_stream_tracker.cpp + ) +target_link_libraries(test_stream_tracker sisl_buffer GTest::gtest) +add_test(NAME StreamTracker COMMAND test_stream_tracker) - add_executable(test_atomic_status_counter) - target_sources(test_atomic_status_counter PRIVATE - tests/test_atomic_status_counter.cpp - ) - target_link_libraries(test_atomic_status_counter sisl_logging GTest::gtest atomic) - add_test(NAME AtomicStatusCounter COMMAND test_atomic_status_counter) +add_executable(test_atomic_status_counter) +target_sources(test_atomic_status_counter PRIVATE + tests/test_atomic_status_counter.cpp + ) +target_link_libraries(test_atomic_status_counter sisl_logging GTest::gtest atomic) +add_test(NAME AtomicStatusCounter COMMAND test_atomic_status_counter) - add_executable(test_bitset) - target_sources(test_bitset PRIVATE - tests/test_bitset.cpp - ) - target_link_libraries(test_bitset sisl_buffer GTest::gtest) - add_test(NAME Bitset COMMAND test_bitset) +add_executable(test_bitset) +target_sources(test_bitset PRIVATE + tests/test_bitset.cpp + ) +target_link_libraries(test_bitset sisl_buffer GTest::gtest) +add_test(NAME Bitset COMMAND test_bitset) - add_executable(test_bitword) - target_sources(test_bitword PRIVATE - tests/test_bitword.cpp - ) - target_link_libraries(test_bitword sisl_logging GTest::gtest) - add_test(NAME Bitword COMMAND test_bitset) +add_executable(test_bitword) +target_sources(test_bitword PRIVATE + tests/test_bitword.cpp + ) +target_link_libraries(test_bitword sisl_logging GTest::gtest) +add_test(NAME Bitword COMMAND test_bitset) - add_executable(test_compact_bitset) - target_sources(test_compact_bitset PRIVATE - tests/test_compact_bitset.cpp - ) - target_link_libraries(test_compact_bitset sisl_buffer GTest::gtest) - add_test(NAME CompactBitset COMMAND test_compact_bitset) +add_executable(test_compact_bitset) +target_sources(test_compact_bitset PRIVATE + tests/test_compact_bitset.cpp + ) +target_link_libraries(test_compact_bitset sisl_buffer GTest::gtest) +add_test(NAME CompactBitset COMMAND test_compact_bitset) - add_executable(test_concurrent_insert_vector) - target_sources(test_concurrent_insert_vector PRIVATE - tests/test_concurrent_insert_vector.cpp - ) - target_link_libraries(test_concurrent_insert_vector sisl_buffer GTest::gtest) - add_test(NAME ConcurrentInsertVector COMMAND test_concurrent_insert_vector) +add_executable(test_concurrent_insert_vector) +target_sources(test_concurrent_insert_vector PRIVATE + tests/test_concurrent_insert_vector.cpp + ) +target_link_libraries(test_concurrent_insert_vector sisl_buffer GTest::gtest) +add_test(NAME ConcurrentInsertVector COMMAND test_concurrent_insert_vector) - add_executable(concurrent_insert_vector_bench) - target_sources(concurrent_insert_vector_bench PRIVATE - tests/concurrent_insert_vector_bench.cpp - ) - target_link_libraries(concurrent_insert_vector_bench sisl_buffer benchmark::benchmark) - add_test(NAME ConcurrentVectorBench COMMAND concurrent_insert_vector_bench) +add_executable(concurrent_insert_vector_bench) +target_sources(concurrent_insert_vector_bench PRIVATE + tests/concurrent_insert_vector_bench.cpp + ) +target_link_libraries(concurrent_insert_vector_bench sisl_buffer benchmark::benchmark) +add_test(NAME ConcurrentVectorBench COMMAND concurrent_insert_vector_bench) - add_executable(obj_allocator_benchmark) - target_sources(obj_allocator_benchmark PRIVATE - tests/obj_allocator_benchmark.cpp - ) - target_link_libraries(obj_allocator_benchmark sisl_buffer benchmark::benchmark) - add_test(NAME ObjAllocatorBenchmark COMMAND obj_allocator_benchmark) +add_executable(obj_allocator_benchmark) +target_sources(obj_allocator_benchmark PRIVATE + tests/obj_allocator_benchmark.cpp + ) +target_link_libraries(obj_allocator_benchmark sisl_buffer benchmark::benchmark) +add_test(NAME ObjAllocatorBenchmark COMMAND obj_allocator_benchmark) - add_executable(test_obj_allocator) - target_sources(test_obj_allocator PRIVATE - tests/test_obj_allocator.cpp - ) - target_link_libraries(test_obj_allocator sisl_buffer) - add_test(NAME ObjAlloc COMMAND test_obj_allocator) +add_executable(test_obj_allocator) +target_sources(test_obj_allocator PRIVATE + tests/test_obj_allocator.cpp + ) +target_link_libraries(test_obj_allocator sisl_buffer) +add_test(NAME ObjAlloc COMMAND test_obj_allocator) - add_executable(test_cb_mutex) - target_sources(test_cb_mutex PRIVATE - tests/test_cb_mutex.cpp - ) - target_link_libraries(test_cb_mutex sisl_logging folly::folly GTest::gtest) - #add_test(NAME TestCBMutex COMMAND test_cb_mutex) +add_executable(test_cb_mutex) +target_sources(test_cb_mutex PRIVATE + tests/test_cb_mutex.cpp + ) +target_link_libraries(test_cb_mutex sisl_logging folly::folly GTest::gtest) +#add_test(NAME TestCBMutex COMMAND test_cb_mutex) - add_executable(test_sg_list) - target_sources(test_sg_list PRIVATE - tests/test_sg_list.cpp - ) - target_link_libraries(test_sg_list sisl_buffer folly::folly GTest::gtest) - add_test(NAME SgList COMMAND test_sg_list) +add_executable(test_sg_list) +target_sources(test_sg_list PRIVATE + tests/test_sg_list.cpp + ) +target_link_libraries(test_sg_list sisl_buffer folly::folly GTest::gtest) +add_test(NAME SgList COMMAND test_sg_list) - if (DEFINED MALLOC_IMPL) - if (${MALLOC_IMPL} STREQUAL "jemalloc") - add_executable(test_jemalloc) - target_sources(test_jemalloc PRIVATE - tests/test_jemalloc_helper.cpp - ) - target_link_libraries(test_jemalloc sisl_buffer GTest::gtest jemalloc::jemalloc) - add_test(NAME TestJemalloc COMMAND test_jemalloc) - elseif (${MALLOC_IMPL} STREQUAL "tcmalloc") - add_executable(test_tcmalloc) - target_sources(test_tcmalloc PRIVATE - tests/test_tcmalloc_helper.cpp - ) - target_link_libraries(test_tcmalloc sisl_buffer GTest::gtest gperftools::gperftools) - add_test(NAME TestTcmalloc COMMAND test_tcmalloc) - endif() - endif() +if (DEFINED MALLOC_IMPL) + if (${MALLOC_IMPL} STREQUAL "jemalloc") + add_executable(test_jemalloc) + target_sources(test_jemalloc PRIVATE + tests/test_jemalloc_helper.cpp + ) + target_link_libraries(test_jemalloc sisl_buffer GTest::gtest jemalloc::jemalloc) + add_test(NAME TestJemalloc COMMAND test_jemalloc) + elseif (${MALLOC_IMPL} STREQUAL "tcmalloc") + add_executable(test_tcmalloc) + target_sources(test_tcmalloc PRIVATE + tests/test_tcmalloc_helper.cpp + ) + target_link_libraries(test_tcmalloc sisl_buffer GTest::gtest gperftools::gperftools) + add_test(NAME TestTcmalloc COMMAND test_tcmalloc) endif() endif() diff --git a/src/file_watcher/CMakeLists.txt b/src/file_watcher/CMakeLists.txt index 36dec85c..b22fdf8f 100644 --- a/src/file_watcher/CMakeLists.txt +++ b/src/file_watcher/CMakeLists.txt @@ -7,13 +7,9 @@ target_sources(sisl_file_watcher PRIVATE target_link_libraries(sisl_file_watcher PUBLIC sisl_logging) -if (DEFINED ENABLE_TESTING) - if (${ENABLE_TESTING}) - add_executable(test_file_watcher) - target_sources(test_file_watcher PRIVATE - file_watcher_test.cpp - ) - target_link_libraries(test_file_watcher sisl_file_watcher GTest::gtest GTest::gmock) - add_test(NAME FileWatcher COMMAND test_file_watcher) - endif() -endif() +add_executable(test_file_watcher) +target_sources(test_file_watcher PRIVATE + file_watcher_test.cpp + ) +target_link_libraries(test_file_watcher sisl_file_watcher GTest::gtest GTest::gmock) +add_test(NAME FileWatcher COMMAND test_file_watcher) diff --git a/src/flip/CMakeLists.txt b/src/flip/CMakeLists.txt index b5fa5f56..376ee792 100644 --- a/src/flip/CMakeLists.txt +++ b/src/flip/CMakeLists.txt @@ -19,26 +19,22 @@ target_link_libraries(flip PUBLIC nlohmann_json::nlohmann_json ) -if (DEFINED ENABLE_TESTING) - if (${ENABLE_TESTING}) - add_executable(test_flip) - target_sources(test_flip PRIVATE - lib/test_flip.cpp - ) - target_link_libraries(test_flip flip cxxopts::cxxopts) - add_test(NAME Flip COMMAND test_flip) +add_executable(test_flip) +target_sources(test_flip PRIVATE + lib/test_flip.cpp + ) +target_link_libraries(test_flip flip cxxopts::cxxopts) +add_test(NAME Flip COMMAND test_flip) - add_executable(test_flip_server) - target_sources(test_flip_server PRIVATE - lib/test_flip_server.cpp - ) - target_link_libraries(test_flip_server flip cxxopts::cxxopts) +add_executable(test_flip_server) +target_sources(test_flip_server PRIVATE + lib/test_flip_server.cpp + ) +target_link_libraries(test_flip_server flip cxxopts::cxxopts) - add_executable(test_flip_local_client) - target_sources(test_flip_local_client PRIVATE - client/local/test_flip_local_client.cpp - ) - target_link_libraries(test_flip_local_client flip cxxopts::cxxopts) - add_test(NAME FlipLocalClient COMMAND test_flip_local_client) - endif() -endif() +add_executable(test_flip_local_client) +target_sources(test_flip_local_client PRIVATE + client/local/test_flip_local_client.cpp + ) +target_link_libraries(test_flip_local_client flip cxxopts::cxxopts) +add_test(NAME FlipLocalClient COMMAND test_flip_local_client) diff --git a/src/grpc/CMakeLists.txt b/src/grpc/CMakeLists.txt index ee89d029..66032e82 100644 --- a/src/grpc/CMakeLists.txt +++ b/src/grpc/CMakeLists.txt @@ -13,8 +13,4 @@ target_link_libraries(sisl_grpc PUBLIC gRPC::grpc++ ) -if(DEFINED ENABLE_TESTING) - if(${ENABLE_TESTING}) - add_subdirectory(tests) - endif() -endif() +add_subdirectory(tests) diff --git a/src/logging/CMakeLists.txt b/src/logging/CMakeLists.txt index 1dc65130..0ea3db67 100644 --- a/src/logging/CMakeLists.txt +++ b/src/logging/CMakeLists.txt @@ -23,12 +23,8 @@ target_sources(sisl_logging PRIVATE ) target_link_libraries(sisl_logging PUBLIC ${LOGGING_DEPS} -rdynamic) -if (DEFINED ENABLE_TESTING) - if (${ENABLE_TESTING}) - add_executable(logging_example) - target_sources(logging_example PRIVATE - test/example.cpp - ) - target_link_libraries(logging_example sisl_logging) - endif() -endif() +add_executable(logging_example) +target_sources(logging_example PRIVATE + test/example.cpp + ) +target_link_libraries(logging_example sisl_logging) diff --git a/src/metrics/CMakeLists.txt b/src/metrics/CMakeLists.txt index e5dff95c..0779cc58 100644 --- a/src/metrics/CMakeLists.txt +++ b/src/metrics/CMakeLists.txt @@ -15,29 +15,25 @@ target_link_libraries(sisl_metrics PUBLIC userspace-rcu::userspace-rcu ) -if (DEFINED ENABLE_TESTING) - if (${ENABLE_TESTING}) - include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}) - add_executable(metrics_farm_test) - target_sources(metrics_farm_test PRIVATE - tests/farm_test.cpp - ) - target_link_libraries(metrics_farm_test sisl_metrics GTest::gtest) - add_test(NAME MetricsFarm COMMAND metrics_farm_test) +add_executable(metrics_farm_test) +target_sources(metrics_farm_test PRIVATE + tests/farm_test.cpp + ) +target_link_libraries(metrics_farm_test sisl_metrics GTest::gtest) +add_test(NAME MetricsFarm COMMAND metrics_farm_test) - add_executable(metrics_wrapper_test) - target_sources(metrics_wrapper_test PRIVATE - tests/wrapper_test.cpp - ) - target_link_libraries(metrics_wrapper_test sisl_metrics GTest::gtest) - add_test(NAME MetricsWrapper COMMAND metrics_wrapper_test) +add_executable(metrics_wrapper_test) +target_sources(metrics_wrapper_test PRIVATE + tests/wrapper_test.cpp + ) +target_link_libraries(metrics_wrapper_test sisl_metrics GTest::gtest) +add_test(NAME MetricsWrapper COMMAND metrics_wrapper_test) - add_executable(metrics_benchmark) - target_sources(metrics_benchmark PRIVATE - tests/metrics_benchmark.cpp - ) - target_link_libraries(metrics_benchmark sisl_metrics benchmark::benchmark) - add_test(NAME MetricsBenchmark COMMAND metrics_benchmark) - endif() -endif() +add_executable(metrics_benchmark) +target_sources(metrics_benchmark PRIVATE + tests/metrics_benchmark.cpp + ) +target_link_libraries(metrics_benchmark sisl_metrics benchmark::benchmark) +add_test(NAME MetricsBenchmark COMMAND metrics_benchmark) diff --git a/src/options/CMakeLists.txt b/src/options/CMakeLists.txt index 503fe90a..d242a724 100644 --- a/src/options/CMakeLists.txt +++ b/src/options/CMakeLists.txt @@ -9,13 +9,9 @@ target_link_libraries(sisl_options PUBLIC cxxopts::cxxopts ) -if (DEFINED ENABLE_TESTING) - if (${ENABLE_TESTING}) - add_executable(basic_test) - target_sources(basic_test PRIVATE - tests/basic.cpp - ) - target_link_libraries(basic_test sisl_options GTest::gtest) - add_test(NAME OptionsBasics COMMAND basic_test) - endif() -endif() +add_executable(basic_test) +target_sources(basic_test PRIVATE + tests/basic.cpp + ) +target_link_libraries(basic_test sisl_options GTest::gtest) +add_test(NAME OptionsBasics COMMAND basic_test) diff --git a/src/settings/CMakeLists.txt b/src/settings/CMakeLists.txt index 9097fc4f..2442339f 100644 --- a/src/settings/CMakeLists.txt +++ b/src/settings/CMakeLists.txt @@ -10,23 +10,19 @@ target_link_libraries(sisl_settings PUBLIC userspace-rcu::userspace-rcu ) -if (DEFINED ENABLE_TESTING) - if (${ENABLE_TESTING}) - add_executable(test_settings) - target_sources(test_settings PRIVATE - tests/test_settings.cpp - ) - settings_gen_cpp( - ${FLATBUFFERS_FLATC_EXECUTABLE} - ${CMAKE_CURRENT_BINARY_DIR}/generated/ - test_settings - tests/test_app_schema.fbs - ) - if(NOT ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) - target_include_directories(test_settings BEFORE PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) - endif() - target_include_directories(test_settings BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries(test_settings sisl_settings GTest::gtest) - add_test(NAME Settings COMMAND test_settings) - endif() +add_executable(test_settings) +target_sources(test_settings PRIVATE + tests/test_settings.cpp + ) +settings_gen_cpp( + ${FLATBUFFERS_FLATC_EXECUTABLE} + ${CMAKE_CURRENT_BINARY_DIR}/generated/ + test_settings + tests/test_app_schema.fbs + ) +if(NOT ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) + target_include_directories(test_settings BEFORE PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) endif() +target_include_directories(test_settings BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(test_settings sisl_settings GTest::gtest) +add_test(NAME Settings COMMAND test_settings) diff --git a/src/sobject/CMakeLists.txt b/src/sobject/CMakeLists.txt index de343e58..48bcaabb 100644 --- a/src/sobject/CMakeLists.txt +++ b/src/sobject/CMakeLists.txt @@ -9,13 +9,9 @@ target_link_libraries(sisl_sobject PUBLIC nlohmann_json::nlohmann_json ) -if (DEFINED ENABLE_TESTING) - if (${ENABLE_TESTING}) - add_executable(test_sobject) - target_sources(test_sobject PRIVATE - tests/test_sobject.cpp - ) - target_link_libraries(test_sobject sisl_sobject GTest::gtest) - add_test(NAME Sobject COMMAND test_sobject) - endif() -endif() +add_executable(test_sobject) +target_sources(test_sobject PRIVATE + tests/test_sobject.cpp + ) +target_link_libraries(test_sobject sisl_sobject GTest::gtest) +add_test(NAME Sobject COMMAND test_sobject) diff --git a/src/utility/CMakeLists.txt b/src/utility/CMakeLists.txt index 7c3d5462..8e445a56 100644 --- a/src/utility/CMakeLists.txt +++ b/src/utility/CMakeLists.txt @@ -1,45 +1,41 @@ cmake_minimum_required (VERSION 3.11) -if (DEFINED ENABLE_TESTING) - if (${ENABLE_TESTING}) - include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}) - add_executable(test_atomic_counter) - target_sources(test_atomic_counter PRIVATE - tests/test_atomic_counter.cpp - ) - target_link_libraries(test_atomic_counter sisl_logging GTest::gtest) - add_test(NAME AtomicCounter COMMAND test_atomic_counter) +include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}) +add_executable(test_atomic_counter) +target_sources(test_atomic_counter PRIVATE + tests/test_atomic_counter.cpp + ) +target_link_libraries(test_atomic_counter sisl_logging GTest::gtest) +add_test(NAME AtomicCounter COMMAND test_atomic_counter) - add_executable(test_thread_buffer) - target_sources(test_thread_buffer PRIVATE - tests/test_thread_buffer.cpp - ) - target_link_libraries(test_thread_buffer sisl_metrics GTest::gtest) - add_test(NAME ThreadBuffer COMMAND test_thread_buffer) +add_executable(test_thread_buffer) +target_sources(test_thread_buffer PRIVATE + tests/test_thread_buffer.cpp + ) +target_link_libraries(test_thread_buffer sisl_metrics GTest::gtest) +add_test(NAME ThreadBuffer COMMAND test_thread_buffer) - add_executable(test_status_factory) - target_sources(test_status_factory PRIVATE - tests/test_status_factory.cpp - ) - target_link_libraries(test_status_factory sisl_metrics benchmark::benchmark) - add_test(NAME StatusFactory COMMAND test_status_factory) +add_executable(test_status_factory) +target_sources(test_status_factory PRIVATE + tests/test_status_factory.cpp + ) +target_link_libraries(test_status_factory sisl_metrics benchmark::benchmark) +add_test(NAME StatusFactory COMMAND test_status_factory) - add_executable(test_enum) - target_sources(test_enum PRIVATE - tests/test_enum.cpp - ) - target_link_libraries(test_enum sisl_metrics GTest::gtest) - add_test(NAME Enum COMMAND test_enum) +add_executable(test_enum) +target_sources(test_enum PRIVATE + tests/test_enum.cpp + ) +target_link_libraries(test_enum sisl_metrics GTest::gtest) +add_test(NAME Enum COMMAND test_enum) - if (DEFINED ${_PRERELEASE}) - if (${_PRERELEASE}) - add_executable(test_objlife) - target_sources(test_objlife PRIVATE - tests/test_objlife_counter.cpp - ) - target_link_libraries(test_objlife sisl_metrics GTest::gtest) - add_test(NAME ObjLife COMMAND test_objlife) - endif () - endif() - endif() +if (DEFINED ${_PRERELEASE}) + if (${_PRERELEASE}) + add_executable(test_objlife) + target_sources(test_objlife PRIVATE + tests/test_objlife_counter.cpp + ) + target_link_libraries(test_objlife sisl_metrics GTest::gtest) + add_test(NAME ObjLife COMMAND test_objlife) + endif () endif() diff --git a/src/version/CMakeLists.txt b/src/version/CMakeLists.txt index 8fff0d0b..76913df2 100644 --- a/src/version/CMakeLists.txt +++ b/src/version/CMakeLists.txt @@ -9,13 +9,9 @@ target_link_libraries(sisl_version PUBLIC zmarok-semver::zmarok-semver ) -if (DEFINED ENABLE_TESTING) - if (${ENABLE_TESTING}) - add_executable(test_version) - target_sources(test_version PRIVATE - tests/test_version.cpp - ) - target_link_libraries(test_version sisl_version GTest::gtest) - add_test(NAME Version COMMAND test_version) - endif() -endif() +add_executable(test_version) +target_sources(test_version PRIVATE + tests/test_version.cpp + ) +target_link_libraries(test_version sisl_version GTest::gtest) +add_test(NAME Version COMMAND test_version) diff --git a/src/wisr/CMakeLists.txt b/src/wisr/CMakeLists.txt index 728d19ec..bbf159f7 100644 --- a/src/wisr/CMakeLists.txt +++ b/src/wisr/CMakeLists.txt @@ -1,37 +1,33 @@ cmake_minimum_required (VERSION 3.11) -if (DEFINED ENABLE_TESTING) - if(${ENABLE_TESTING}) - include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}) - add_executable(wisr_vector_test) - target_sources(wisr_vector_test PRIVATE - tests/test_wisr_vector.cpp - ) - target_link_libraries(wisr_vector_test sisl_metrics benchmark::benchmark GTest::gtest) - add_test(NAME WisrVector COMMAND wisr_vector_test) +include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}) +add_executable(wisr_vector_test) +target_sources(wisr_vector_test PRIVATE + tests/test_wisr_vector.cpp + ) +target_link_libraries(wisr_vector_test sisl_metrics benchmark::benchmark GTest::gtest) +add_test(NAME WisrVector COMMAND wisr_vector_test) - add_executable(wisr_vector_benchmark) - target_sources(wisr_vector_benchmark PRIVATE - tests/wisr_vector_benchmark.cpp - ) - target_link_libraries(wisr_vector_benchmark sisl_metrics benchmark::benchmark) +add_executable(wisr_vector_benchmark) +target_sources(wisr_vector_benchmark PRIVATE + tests/wisr_vector_benchmark.cpp + ) +target_link_libraries(wisr_vector_benchmark sisl_metrics benchmark::benchmark) - add_executable(wisr_list_benchmark) - target_sources(wisr_list_benchmark PRIVATE - tests/wisr_list_benchmark.cpp - ) - target_link_libraries(wisr_list_benchmark sisl_metrics benchmark::benchmark) +add_executable(wisr_list_benchmark) +target_sources(wisr_list_benchmark PRIVATE + tests/wisr_list_benchmark.cpp + ) +target_link_libraries(wisr_list_benchmark sisl_metrics benchmark::benchmark) - add_executable(wisr_deque_benchmark) - target_sources(wisr_deque_benchmark PRIVATE - tests/wisr_deque_benchmark.cpp - ) - target_link_libraries(wisr_deque_benchmark sisl_metrics benchmark::benchmark) +add_executable(wisr_deque_benchmark) +target_sources(wisr_deque_benchmark PRIVATE + tests/wisr_deque_benchmark.cpp + ) +target_link_libraries(wisr_deque_benchmark sisl_metrics benchmark::benchmark) - add_executable(wisr_intrusive_slist_benchmark) - target_sources(wisr_intrusive_slist_benchmark PRIVATE - tests/wisr_intrusive_slist_benchmark.cpp - ) - target_link_libraries(wisr_intrusive_slist_benchmark sisl_metrics benchmark::benchmark) - endif() -endif() +add_executable(wisr_intrusive_slist_benchmark) +target_sources(wisr_intrusive_slist_benchmark PRIVATE + tests/wisr_intrusive_slist_benchmark.cpp + ) +target_link_libraries(wisr_intrusive_slist_benchmark sisl_metrics benchmark::benchmark)