add google test
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
6
lab02/fib/src/test_stuff.cc
Normal file
6
lab02/fib/src/test_stuff.cc
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(first, test) {
|
||||
EXPECT_STRNE("hello", "world");
|
||||
EXPECT_EQ(7*6, 42);
|
||||
}
|
||||
Reference in New Issue
Block a user