add google test

This commit is contained in:
kai
2025-03-29 14:12:18 +01:00
parent a0c67066bb
commit 40ac1a76a6
2 changed files with 28 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.14)
# Projektname
project(fib)
@@ -6,8 +6,28 @@ project(fib)
# C++-Standard setzen
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
# add includes
include_directories(include)
# Quellverzeichnis angeben
add_executable(MyProject src/main.cpp)
enable_testing()
add_executable(
test_stuff
src/test_stuff.cc
)
target_link_libraries(
test_stuff
GTest::gtest_main
)
include(GoogleTest)
gtest_discover_tests(test_stuff)

View File

@@ -0,0 +1,6 @@
#include <gtest/gtest.h>
TEST(first, test) {
EXPECT_STRNE("hello", "world");
EXPECT_EQ(7*6, 42);
}