From 0985cd62d2e1bccb7ac31be4ffb3565ebf57361a Mon Sep 17 00:00:00 2001 From: Dawid Drozd Date: Thu, 12 Mar 2020 09:40:26 +0100 Subject: [PATCH] Move test into new file layout No code changes only moving stuff --- test/CMakeLists.txt | 59 +------------------ test/unit/CMakeLists.txt | 58 ++++++++++++++++++ .../eventbus/test/SuiteConcurrentEventBus.cpp | 0 .../dexode/eventbus/test/SuiteEventBus.cpp | 0 .../src/dexode/eventbus/test/SuiteEventID.cpp | 0 .../dexode/eventbus/test/SuiteListener.cpp | 0 .../src/dexode/eventbus/test/event.hpp | 0 test/{ => unit}/src/main.cpp | 0 8 files changed, 59 insertions(+), 58 deletions(-) create mode 100644 test/unit/CMakeLists.txt rename test/{ => unit}/src/dexode/eventbus/test/SuiteConcurrentEventBus.cpp (100%) rename test/{ => unit}/src/dexode/eventbus/test/SuiteEventBus.cpp (100%) rename test/{ => unit}/src/dexode/eventbus/test/SuiteEventID.cpp (100%) rename test/{ => unit}/src/dexode/eventbus/test/SuiteListener.cpp (100%) rename test/{ => unit}/src/dexode/eventbus/test/event.hpp (100%) rename test/{ => unit}/src/main.cpp (100%) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4bca3fb..269aea0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,58 +1 @@ -cmake_minimum_required(VERSION 3.11 FATAL_ERROR) - -# http://www.levelofindirection.com/journal/2010/12/28/unit-testing-in-c-and-objective-c-just-got-easier.html -# Thanks for CATCH! - -project(EventBusTest) - -# Dependencies -enable_testing() -if(NOT TARGET Dexode::EventBus) - find_package(EventBus CONFIG REQUIRED) -endif() - -find_package(Catch2 2.10 REQUIRED) -find_package(Threads REQUIRED) - -# Target definition -add_executable(EventBusTest - src/dexode/eventbus/test/event.hpp - src/dexode/eventbus/test/SuiteConcurrentEventBus.cpp - src/dexode/eventbus/test/SuiteEventBus.cpp - src/dexode/eventbus/test/SuiteEventID.cpp - src/dexode/eventbus/test/SuiteListener.cpp - src/main.cpp - ) -target_include_directories(EventBusTest PRIVATE src/) - -target_compile_options(EventBusTest PUBLIC - -Wall -pedantic - -Wno-unused-private-field - -Wnon-virtual-dtor - -Wno-gnu - -Werror - ) - -# Don't do such thing: -# if(CMAKE_BUILD_TYPE STREQUAL DEBUG) -# .... -# else() -# ... -# endif() -# -# Instead do this way: (It will work for Visual Studio) -# target_compile_definitions(foo PRIVATE "VERBOSITY=$,30,10>") - - -set(EVENTBUS_DEBUG_FLAGS - -O0 -fno-inline - -DDEBUG - #-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC - ) - -target_compile_options(EventBusTest PUBLIC "$<$:${EVENTBUS_DEBUG_FLAGS}>") - -target_link_libraries(EventBusTest PUBLIC Catch2::Catch2 Dexode::EventBus Threads::Threads) - - -add_test(NAME EventBus.UnitTests COMMAND EventBusTest) +add_subdirectory(unit) diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt new file mode 100644 index 0000000..4bca3fb --- /dev/null +++ b/test/unit/CMakeLists.txt @@ -0,0 +1,58 @@ +cmake_minimum_required(VERSION 3.11 FATAL_ERROR) + +# http://www.levelofindirection.com/journal/2010/12/28/unit-testing-in-c-and-objective-c-just-got-easier.html +# Thanks for CATCH! + +project(EventBusTest) + +# Dependencies +enable_testing() +if(NOT TARGET Dexode::EventBus) + find_package(EventBus CONFIG REQUIRED) +endif() + +find_package(Catch2 2.10 REQUIRED) +find_package(Threads REQUIRED) + +# Target definition +add_executable(EventBusTest + src/dexode/eventbus/test/event.hpp + src/dexode/eventbus/test/SuiteConcurrentEventBus.cpp + src/dexode/eventbus/test/SuiteEventBus.cpp + src/dexode/eventbus/test/SuiteEventID.cpp + src/dexode/eventbus/test/SuiteListener.cpp + src/main.cpp + ) +target_include_directories(EventBusTest PRIVATE src/) + +target_compile_options(EventBusTest PUBLIC + -Wall -pedantic + -Wno-unused-private-field + -Wnon-virtual-dtor + -Wno-gnu + -Werror + ) + +# Don't do such thing: +# if(CMAKE_BUILD_TYPE STREQUAL DEBUG) +# .... +# else() +# ... +# endif() +# +# Instead do this way: (It will work for Visual Studio) +# target_compile_definitions(foo PRIVATE "VERBOSITY=$,30,10>") + + +set(EVENTBUS_DEBUG_FLAGS + -O0 -fno-inline + -DDEBUG + #-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC + ) + +target_compile_options(EventBusTest PUBLIC "$<$:${EVENTBUS_DEBUG_FLAGS}>") + +target_link_libraries(EventBusTest PUBLIC Catch2::Catch2 Dexode::EventBus Threads::Threads) + + +add_test(NAME EventBus.UnitTests COMMAND EventBusTest) diff --git a/test/src/dexode/eventbus/test/SuiteConcurrentEventBus.cpp b/test/unit/src/dexode/eventbus/test/SuiteConcurrentEventBus.cpp similarity index 100% rename from test/src/dexode/eventbus/test/SuiteConcurrentEventBus.cpp rename to test/unit/src/dexode/eventbus/test/SuiteConcurrentEventBus.cpp diff --git a/test/src/dexode/eventbus/test/SuiteEventBus.cpp b/test/unit/src/dexode/eventbus/test/SuiteEventBus.cpp similarity index 100% rename from test/src/dexode/eventbus/test/SuiteEventBus.cpp rename to test/unit/src/dexode/eventbus/test/SuiteEventBus.cpp diff --git a/test/src/dexode/eventbus/test/SuiteEventID.cpp b/test/unit/src/dexode/eventbus/test/SuiteEventID.cpp similarity index 100% rename from test/src/dexode/eventbus/test/SuiteEventID.cpp rename to test/unit/src/dexode/eventbus/test/SuiteEventID.cpp diff --git a/test/src/dexode/eventbus/test/SuiteListener.cpp b/test/unit/src/dexode/eventbus/test/SuiteListener.cpp similarity index 100% rename from test/src/dexode/eventbus/test/SuiteListener.cpp rename to test/unit/src/dexode/eventbus/test/SuiteListener.cpp diff --git a/test/src/dexode/eventbus/test/event.hpp b/test/unit/src/dexode/eventbus/test/event.hpp similarity index 100% rename from test/src/dexode/eventbus/test/event.hpp rename to test/unit/src/dexode/eventbus/test/event.hpp diff --git a/test/src/main.cpp b/test/unit/src/main.cpp similarity index 100% rename from test/src/main.cpp rename to test/unit/src/main.cpp