From 85363e0db16029b8e5fca596a20ad12ab73de53e Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Thu, 4 May 2017 23:03:53 +0100 Subject: [PATCH] Add an empty unit test. --- .gitmodules | 3 +++ CMakeLists.txt | 7 +++++++ lib/Catch | 1 + lib/incredis | 2 +- test/unit/CMakeLists.txt | 18 ++++++++++++++++++ test/unit/check.cpp | 19 +++++++++++++++++++ 6 files changed, 49 insertions(+), 1 deletion(-) create mode 160000 lib/Catch create mode 100644 test/unit/CMakeLists.txt create mode 100644 test/unit/check.cpp diff --git a/.gitmodules b/.gitmodules index 948076f..e694a21 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "lib/spdlog"] path = lib/spdlog url = https://github.com/gabime/spdlog.git +[submodule "lib/Catch"] + path = lib/Catch + url = https://github.com/philsquared/Catch.git diff --git a/CMakeLists.txt b/CMakeLists.txt index a661204..7c2519c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR) list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) project(tawashi_top VERSION 0.1.3 LANGUAGES NONE) +include(CTest) + +set(INCREDIS_FORCE_DISABLE_TESTS ON) set(TAWASHI_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}") set(TAWASHI_GEN_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include") set(TAWASHI_CONFIG_PATH "etc" CACHE STRING "Path where config file will be located, absolute or relative to the install prefix") @@ -19,3 +22,7 @@ add_subdirectory(src/tawashi_implem) add_subdirectory(src/tawashi) install(DIRECTORY html DESTINATION .) + +if (BUILD_TESTING) + add_subdirectory(test/unit) +endif() diff --git a/lib/Catch b/lib/Catch new file mode 160000 index 0000000..5604ec7 --- /dev/null +++ b/lib/Catch @@ -0,0 +1 @@ +Subproject commit 5604ec7266e54fc38dbbe3bca1b50beef3d39fc2 diff --git a/lib/incredis b/lib/incredis index f798a69..69221f8 160000 --- a/lib/incredis +++ b/lib/incredis @@ -1 +1 @@ -Subproject commit f798a6999b0d6c9967a274727ec12bd9a3efdfb4 +Subproject commit 69221f811cbc02b8c5c55460f2c8cd0a72f9f8ac diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt new file mode 100644 index 0000000..57d74fb --- /dev/null +++ b/test/unit/CMakeLists.txt @@ -0,0 +1,18 @@ +project(tawashi_unittest CXX) + +add_executable(${PROJECT_NAME} + check.cpp +) + +target_include_directories(${PROJECT_NAME} + PRIVATE ${TAWASHI_SOURCE_ROOT}/lib/Catch/single_include +) +target_link_libraries(${PROJECT_NAME} + PRIVATE tawashi_implem +) + +add_test( + NAME TawashiUnitTest + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PROJECT_NAME} +) diff --git a/test/unit/check.cpp b/test/unit/check.cpp new file mode 100644 index 0000000..2925a6b --- /dev/null +++ b/test/unit/check.cpp @@ -0,0 +1,19 @@ +/* Copyright 2017, Michele Santullo + * This file is part of "tawashi". + * + * "tawashi" is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * "tawashi" is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with "tawashi". If not, see . + */ + +#define CATCH_CONFIG_MAIN +#include "catch.hpp"