Add unit testing 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
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: "**/cpm_modules"
|
||||
path: "**/CPM_modules"
|
||||
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
|
||||
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_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_WARNINGS_AS_ERRORS "Warnings are treated as Errors" ON)
|
||||
OPTION(ENABLE_STATIC_ANALYSIS "Enable Static Analysis Tools" OFF)
|
||||
@@ -20,4 +20,10 @@ include(${CMAKE_SCRIPTS_DIR}/sanitizers.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)
|
||||
|
||||
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 opengl-starter-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