Add tests back
This commit is contained in:
11
.github/workflows/ci.yml
vendored
11
.github/workflows/ci.yml
vendored
@@ -66,18 +66,9 @@ jobs:
|
|||||||
- name: cache
|
- name: cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: "**/cpm_modules"
|
path: "**/CPM_modules"
|
||||||
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
|
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
|
||||||
|
|
||||||
- name: setup dependencies
|
|
||||||
uses: aminya/setup-cpp@v1
|
|
||||||
with:
|
|
||||||
compiler: ${{ matrix.compiler }}
|
|
||||||
vcvarsall: ${{ contains(matrix.os, 'windows')}}
|
|
||||||
cmake: true
|
|
||||||
ccache: true
|
|
||||||
clangtidy: ${{ env.CLANG_TIDY_VERSION }}
|
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_configuration}}
|
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_configuration}}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED true)
|
|||||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
|
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
OPTION(ENABLE_TESTS "Enable Unit Tests" OFF)
|
OPTION(ENABLE_TESTS "Enable Unit Tests" ON)
|
||||||
OPTION(ENABLE_ALL_REASONABLE_WARNINGS "Enable all possible reasonable warnings" ON )
|
OPTION(ENABLE_ALL_REASONABLE_WARNINGS "Enable all possible reasonable warnings" ON )
|
||||||
OPTION(ENABLE_WARNINGS_AS_ERRORS "Warnings are treated as Errors" ON)
|
OPTION(ENABLE_WARNINGS_AS_ERRORS "Warnings are treated as Errors" ON)
|
||||||
OPTION(ENABLE_STATIC_ANALYSIS "Enable Static Analysis Tools" OFF)
|
OPTION(ENABLE_STATIC_ANALYSIS "Enable Static Analysis Tools" OFF)
|
||||||
@@ -18,5 +18,12 @@ set(CMAKE_SCRIPTS_DIR ${CMAKE_CURRENT_LIST_DIR}/cmake)
|
|||||||
include(${CMAKE_SCRIPTS_DIR}/compilerwarnings.cmake)
|
include(${CMAKE_SCRIPTS_DIR}/compilerwarnings.cmake)
|
||||||
include(${CMAKE_SCRIPTS_DIR}/sanitizers.cmake)
|
include(${CMAKE_SCRIPTS_DIR}/sanitizers.cmake)
|
||||||
include(${CMAKE_SCRIPTS_DIR}/staticanalysis.cmake)
|
include(${CMAKE_SCRIPTS_DIR}/staticanalysis.cmake)
|
||||||
|
include(${CMAKE_SCRIPTS_DIR}/cpm.cmake)
|
||||||
|
|
||||||
|
if (ENABLE_TESTS)
|
||||||
|
message("-- Unit Testing Enabled")
|
||||||
|
enable_testing()
|
||||||
|
add_subdirectory(test)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|||||||
15
test/CMakeLists.txt
Normal file
15
test/CMakeLists.txt
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
include(${CMAKE_SCRIPTS_DIR}/googletest.cmake)
|
||||||
|
set(current_target starter_window_test)
|
||||||
|
|
||||||
|
add_executable(
|
||||||
|
${current_target}
|
||||||
|
test_main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(
|
||||||
|
${current_target}
|
||||||
|
gtest_main
|
||||||
|
)
|
||||||
|
|
||||||
|
include(GoogleTest)
|
||||||
|
gtest_discover_tests(${current_target})
|
||||||
6
test/test_main.cpp
Normal file
6
test/test_main.cpp
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
TEST(testmain, example)
|
||||||
|
{
|
||||||
|
EXPECT_EQ(42, 7*6);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user