initial commit

This commit is contained in:
2019-11-20 20:15:27 +07:00
commit d1cf05f3cf
22 changed files with 334 additions and 0 deletions

50
untests/CMakeLists.txt Normal file
View File

@@ -0,0 +1,50 @@
# 3.11 version is required for `FetchContent`
cmake_minimum_required(VERSION 3.11 FATAL_ERROR)
project(enum.hpp.untests)
#
# coverage
#
option(BUILD_WITH_COVERAGE "Build with coverage" OFF)
if(BUILD_WITH_COVERAGE AND (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang"))
set(COVERAGE_FLAGS "--coverage")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COVERAGE_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COVERAGE_FLAGS}")
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} ${COVERAGE_FLAGS}")
endif()
#
# executable
#
file(GLOB UNTESTS_SOURCES "*.cpp" "*.hpp")
add_executable(${PROJECT_NAME} ${UNTESTS_SOURCES})
target_link_libraries(${PROJECT_NAME} enum.hpp)
target_compile_options(${PROJECT_NAME}
PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:
/W4>
PRIVATE
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:
-Wall -Wextra -Wpedantic>)
add_test(${PROJECT_NAME} ${PROJECT_NAME})
#
# catchorg/catch2
#
include(FetchContent)
FetchContent_Declare(
catchorg_catch2
GIT_REPOSITORY https://github.com/catchorg/catch2)
FetchContent_GetProperties(catchorg_catch2)
if(NOT catchorg_catch2_POPULATED)
FetchContent_Populate(catchorg_catch2)
target_include_directories(${PROJECT_NAME}
PRIVATE ${catchorg_catch2_SOURCE_DIR}/single_include)
endif()

9
untests/catch_main.cpp Normal file
View File

@@ -0,0 +1,9 @@
/*******************************************************************************
* This file is part of the "https://github.com/blackmatov/enum.hpp"
* For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2019 Matvey Cherevko
******************************************************************************/
#define CATCH_CONFIG_MAIN
#define CATCH_CONFIG_FAST_COMPILE
#include <catch2/catch.hpp>

13
untests/enum_tests.cpp Normal file
View File

@@ -0,0 +1,13 @@
/*******************************************************************************
* This file is part of the "https://github.com/blackmatov/enum.hpp"
* For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2019, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/
#define CATCH_CONFIG_FAST_COMPILE
#include <catch2/catch.hpp>
#include <enum.hpp/enum.hpp>
TEST_CASE("enum") {
}