Add tests back

This commit is contained in:
McMassiveNZ
2023-05-31 21:23:24 +02:00
parent 799a0f6069
commit 9bcbe577a9
4 changed files with 30 additions and 11 deletions

View File

@@ -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}}

View File

@@ -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
View 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
View File

@@ -0,0 +1,6 @@
#include <gtest/gtest.h>
TEST(testmain, example)
{
EXPECT_EQ(42, 7*6);
}