diff --git a/unittest/rebootLogic/CMakeLists.txt b/unittest/rebootLogic/CMakeLists.txt index 9377d45e..dbaf2f28 100644 --- a/unittest/rebootLogic/CMakeLists.txt +++ b/unittest/rebootLogic/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0.0) +cmake_minimum_required(VERSION 3.13.0) project(reboot-logic VERSION 0.1.0) include(CTest) @@ -19,16 +19,9 @@ endif() enable_testing() -add_executable(reboot-logic main.cpp) - -target_sources(reboot-logic PRIVATE - main.cpp - CoreController.cpp - SdCardManager.cpp - event.cpp - libxiphos.cpp -) +add_executable(reboot-logic) +add_subdirectory(src) target_link_libraries(reboot-logic PRIVATE Catch2::Catch2WithMain) target_include_directories(reboot-logic PRIVATE diff --git a/unittest/rebootLogic/README.md b/unittest/rebootLogic/README.md new file mode 100644 index 00000000..a51f0745 --- /dev/null +++ b/unittest/rebootLogic/README.md @@ -0,0 +1,16 @@ +Reboot Logic Unittest +======= + +These tests were written with Catch2 and VS code. +Install VS code with the C++ and CMake plugins and open this folder with VS code. +You should be able to run the tests directly. + +It is also recommended to [install Catch2](https://github.com/catchorg/Catch2/blob/devel/docs/cmake-integration.md): + +```sh +git clone https://github.com/catchorg/Catch2.git +cd Catch2 +git checkout v3.0.0-preview4 +cmake -Bbuild -H. -DBUILD_TESTING=OFF +sudo cmake --build build/ --target install +``` diff --git a/unittest/rebootLogic/src/CMakeLists.txt b/unittest/rebootLogic/src/CMakeLists.txt new file mode 100644 index 00000000..674c288a --- /dev/null +++ b/unittest/rebootLogic/src/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(reboot-logic PRIVATE + main.cpp + CoreController.cpp + SdCardManager.cpp + event.cpp + libxiphos.cpp +) diff --git a/unittest/rebootLogic/CoreController.cpp b/unittest/rebootLogic/src/CoreController.cpp similarity index 100% rename from unittest/rebootLogic/CoreController.cpp rename to unittest/rebootLogic/src/CoreController.cpp diff --git a/unittest/rebootLogic/CoreController.h b/unittest/rebootLogic/src/CoreController.h similarity index 100% rename from unittest/rebootLogic/CoreController.h rename to unittest/rebootLogic/src/CoreController.h diff --git a/unittest/rebootLogic/HasActionsIF.h b/unittest/rebootLogic/src/HasActionsIF.h similarity index 100% rename from unittest/rebootLogic/HasActionsIF.h rename to unittest/rebootLogic/src/HasActionsIF.h diff --git a/unittest/rebootLogic/SdCardManager.cpp b/unittest/rebootLogic/src/SdCardManager.cpp similarity index 100% rename from unittest/rebootLogic/SdCardManager.cpp rename to unittest/rebootLogic/src/SdCardManager.cpp diff --git a/unittest/rebootLogic/SdCardManager.h b/unittest/rebootLogic/src/SdCardManager.h similarity index 100% rename from unittest/rebootLogic/SdCardManager.h rename to unittest/rebootLogic/src/SdCardManager.h diff --git a/unittest/rebootLogic/conf.h b/unittest/rebootLogic/src/conf.h similarity index 100% rename from unittest/rebootLogic/conf.h rename to unittest/rebootLogic/src/conf.h diff --git a/unittest/rebootLogic/definitions.h b/unittest/rebootLogic/src/definitions.h similarity index 100% rename from unittest/rebootLogic/definitions.h rename to unittest/rebootLogic/src/definitions.h diff --git a/unittest/rebootLogic/event.cpp b/unittest/rebootLogic/src/event.cpp similarity index 100% rename from unittest/rebootLogic/event.cpp rename to unittest/rebootLogic/src/event.cpp diff --git a/unittest/rebootLogic/event.h b/unittest/rebootLogic/src/event.h similarity index 100% rename from unittest/rebootLogic/event.h rename to unittest/rebootLogic/src/event.h diff --git a/unittest/rebootLogic/libxiphos.cpp b/unittest/rebootLogic/src/libxiphos.cpp similarity index 100% rename from unittest/rebootLogic/libxiphos.cpp rename to unittest/rebootLogic/src/libxiphos.cpp diff --git a/unittest/rebootLogic/libxiphos.h b/unittest/rebootLogic/src/libxiphos.h similarity index 100% rename from unittest/rebootLogic/libxiphos.h rename to unittest/rebootLogic/src/libxiphos.h diff --git a/unittest/rebootLogic/main.cpp b/unittest/rebootLogic/src/main.cpp similarity index 100% rename from unittest/rebootLogic/main.cpp rename to unittest/rebootLogic/src/main.cpp