From ca501272d839a41c1f6a8d298941905fb99a0877 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 8 May 2022 02:11:57 +0200 Subject: [PATCH] some refactoring --- CMakeLists.txt | 1 - config/commonConfig.h.in | 4 +++- example/test/CMakeLists.txt | 8 +++++++- example/test/FsfwTestTask.cpp | 9 ++++++++- {test => example/test}/testFmt.cpp | 0 {test => example/test}/testFmt.h | 0 test/CMakeLists.txt | 5 ----- 7 files changed, 18 insertions(+), 9 deletions(-) rename {test => example/test}/testFmt.cpp (100%) rename {test => example/test}/testFmt.h (100%) delete mode 100644 test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 27ee34e..27b456d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,5 @@ add_subdirectory(config) add_subdirectory(example) -add_subdirectory(test) target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/config/commonConfig.h.in b/config/commonConfig.h.in index 24dc62a..a0449da 100644 --- a/config/commonConfig.h.in +++ b/config/commonConfig.h.in @@ -4,7 +4,9 @@ #ifndef COMMON_COMMONCONFIG_H_ #define COMMON_COMMONCONFIG_H_ -#include +#include + +#cmakedefine01 FSFW_ADD_FMT_TESTS //! Specify the debug output verbose level #define OBSW_VERBOSE_LEVEL 1 diff --git a/example/test/CMakeLists.txt b/example/test/CMakeLists.txt index e689c9b..3b93a30 100644 --- a/example/test/CMakeLists.txt +++ b/example/test/CMakeLists.txt @@ -3,4 +3,10 @@ target_sources(${TARGET_NAME} PRIVATE FsfwExampleTask.cpp MutexExample.cpp FsfwTestTask.cpp -) \ No newline at end of file +) + +if(FSFW_ADD_FMT_TESTS) + target_sources(${TARGET_NAME} PRIVATE + testFmt.cpp + ) +endif() diff --git a/example/test/FsfwTestTask.cpp b/example/test/FsfwTestTask.cpp index ac180ba..71a2dcf 100644 --- a/example/test/FsfwTestTask.cpp +++ b/example/test/FsfwTestTask.cpp @@ -1,9 +1,16 @@ #include "FsfwTestTask.h" -#include "../test/testFmt.h" + +#include + +#if FSFW_ADD_FMT_TESTS == 1 +#include "testFmt.h" +#endif FsfwTestTask::FsfwTestTask(object_id_t objectId, bool periodicEvent) : TestTask(objectId), periodicEvent(periodicEvent) { +#if FSFW_ADD_FMT_TESTS == 1 fmtTests(); +#endif } ReturnValue_t FsfwTestTask::performPeriodicAction() { diff --git a/test/testFmt.cpp b/example/test/testFmt.cpp similarity index 100% rename from test/testFmt.cpp rename to example/test/testFmt.cpp diff --git a/test/testFmt.h b/example/test/testFmt.h similarity index 100% rename from test/testFmt.h rename to example/test/testFmt.h diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index b6a94e6..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -if(FSFW_ADD_FMT_TESTS) - target_sources(${TARGET_NAME} PRIVATE - testFmt.cpp - ) -endif()