From 4841b3ff17288b7131c570fc493123b02d1fdb5f Mon Sep 17 00:00:00 2001 From: Christina Sander Date: Thu, 20 Oct 2022 14:02:48 +0200 Subject: [PATCH] ADD: Adds files for initial build of the library. --- .gitignore | 1 + CMakeLists.txt | 41 +++++++++++++++++++++++++++++++++++++ include/WHISPER/whisper.hpp | 19 +++++++++++++++++ tests/test_test.cpp | 40 ++++++++++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+) create mode 100644 .gitignore create mode 100755 CMakeLists.txt create mode 100644 include/WHISPER/whisper.hpp create mode 100644 tests/test_test.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..b0de671 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,41 @@ +cmake_minimum_required (VERSION 3.1 FATAL_ERROR) +project (whisper-com VERSION 0.1.0 LANGUAGES CXX C) +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules) +include(defaultOptions) + +IF(NOT TARGET Catch2) + add_subdirectory(libs/Catch2 EXCLUDE_FROM_ALL) + include(libs/Catch2/contrib/Catch.cmake) +ENDIF() + +add_compile_definitions(LOGURU_WITH_STREAMS SQLITE_THREADSAFE=2) +IF(NOT TARGET loguru) + add_subdirectory(libs/loguru EXCLUDE_FROM_ALL) +ENDIF() + +add_library(whisper-com STATIC + include/WHISPER/whisper.hpp + +) + +target_link_libraries(whisper-com + loguru +) + +target_include_directories(whisper-com PUBLIC + $ + $ + src) + +# +# Everything TEST related +# +option(TEST_WHISPER_COMMUNICATION_LIBRARY "Turn running of application template specific tests off" ON) + +IF (${TEST_WHISPER_COMMUNICATION_LIBRARY}) + + add_executable(test_test tests/test_test.cpp) + target_link_libraries(test_test Catch2::Catch2 whisper-com loguru) + catch_discover_tests(test_test) + +ENDIF() diff --git a/include/WHISPER/whisper.hpp b/include/WHISPER/whisper.hpp new file mode 100644 index 0000000..37f2aeb --- /dev/null +++ b/include/WHISPER/whisper.hpp @@ -0,0 +1,19 @@ +#pragma once +/* +* This Source Code Form is subject to the terms of the Mozilla Public +* License, v. 2.0. If a copy of the MPL was not distributed with this +* file, You can obtain one at https://mozilla.org/MPL/2.0/. +*/ + +/** +* @file +* @copyright 2022 MPLv2 +*/ + +/** + * @brief namespace for all whisper-com related components + */ +namespace WHISPER +{ + // Add datatypes here +} // namespace WHISPER \ No newline at end of file diff --git a/tests/test_test.cpp b/tests/test_test.cpp new file mode 100644 index 0000000..ecd9d13 --- /dev/null +++ b/tests/test_test.cpp @@ -0,0 +1,40 @@ +/* +* This Source Code Form is subject to the terms of the Mozilla Public +* License, v. 2.0. If a copy of the MPL was not distributed with this +* file, You can obtain one at https://mozilla.org/MPL/2.0/. +*/ + +/** +* @file +* @copyright 2022 MPLv2 +*/ + +/** +* @defgroup tests +*/ + + +#define CATCH_CONFIG_MAIN + +#include + +/** +* @brief brief test description +* @ingroup group +*/ +SCENARIO("A test scenario","[keywords]") +{ + GIVEN("Preliminaries") + { + int i = 40; + WHEN("doing something") + { + i = i + 2; + + THEN("expecting something to happen") + { + REQUIRE(i == 42 ); + } // THEN + } // WHEN + } // GIVEN +} // SCENARIO