Add Catch for unit testing.
This commit is contained in:
parent
8e1c19df47
commit
5a8c3fcac0
5 changed files with 60 additions and 0 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -4,3 +4,6 @@
|
|||
[submodule "lib/DeathHandler"]
|
||||
path = lib/DeathHandler
|
||||
url = https://github.com/vmarkovtsev/DeathHandler.git
|
||||
[submodule "lib/Catch"]
|
||||
path = lib/Catch
|
||||
url = https://github.com/philsquared/Catch.git
|
||||
|
|
|
@ -5,6 +5,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/include")
|
|||
|
||||
include(TargetArch)
|
||||
include(FindPkgConfig)
|
||||
include(CTest)
|
||||
|
||||
set(common_gcc_flags "-Wall -Wextra -pedantic -Wconversion")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${common_gcc_flags} -O0")
|
||||
|
@ -119,3 +120,9 @@ target_compile_definitions(${PROJECT_NAME}
|
|||
)
|
||||
|
||||
configure_file(src/${PROJECT_NAME}Config.h.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.h)
|
||||
|
||||
if (BUILD_TESTING)
|
||||
set(CATCH_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/Catch")
|
||||
set(MYCURRY_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
||||
add_subdirectory(test/unit)
|
||||
endif()
|
||||
|
|
1
lib/Catch
Submodule
1
lib/Catch
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 4d0cd602e37197f1502a419142d8f0167d4a063a
|
28
test/unit/CMakeLists.txt
Normal file
28
test/unit/CMakeLists.txt
Normal file
|
@ -0,0 +1,28 @@
|
|||
project(mycurry_unit_test CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
main.cpp
|
||||
)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME}
|
||||
PRIVATE VWR_WITH_IMPLICIT_CONVERSIONS=1
|
||||
PRIVATE VWR_EXTRA_ACCESSORS
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PRIVATE ${CATCH_SOURCE_DIR}/single_include
|
||||
PRIVATE ${MYCURRY_SOURCE_DIR}
|
||||
PRIVATE ${CMAKE_SOURCE_DIR}/lib/vectorwrapper/include
|
||||
PRIVATE ${CMAKE_SOURCE_DIR}/lib/tree-2.81/src
|
||||
)
|
||||
|
||||
add_test(
|
||||
NAME CloonelJumpTest
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMAND ${PROJECT_NAME}
|
||||
)
|
||||
|
||||
|
21
test/unit/main.cpp
Normal file
21
test/unit/main.cpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
Copyright 2016, 2017 Michele "King_DuckZ" Santullo
|
||||
|
||||
This file is part of MyCurry.
|
||||
|
||||
MyCurry 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.
|
||||
|
||||
MyCurry 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 MyCurry. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
Loading…
Reference in a new issue