Skip to content
Snippets Groups Projects
Commit 6fd67bf9 authored by Armin Co's avatar Armin Co
Browse files

Added Gtest and Jenkinsfile.

parent d7427642
No related branches found
No related tags found
No related merge requests found
[submodule "libs/googletest"]
path = libs/googletest
url = https://github.com/google/googletest.git
......@@ -4,15 +4,25 @@ project(QuantumPong)
cmake_minimum_required(VERSION 3.2)
## Options
option(test "Build all tests." OFF)
option(release_type "Set the type of the releas (Debug/Release)." Release)
## Use modern C++!
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_BUILD_TYPE ${release_type})
find_package(PkgConfig REQUIRED)
message(" - Build type is set to ${CMAKE_BUILD_TYPE}")
add_subdirectory(
src
)
## Add folders with app and tests
##
add_subdirectory(src)
if (test)
add_subdirectory(libs/googletest)
add_subdirectory(tests)
endif()
Subproject commit 8b4817e3df3746a20502a84580f661ac448821be
enable_testing()
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
add_executable(runUnitTests test_qpong.cpp)
target_link_libraries(runUnitTests gtest gtest_main)
target_link_libraries(runUnitTests qpong)
add_test(NAME a-test COMMAND runUnitTests)
#include <iostream>
#include "gtest/gtest.h"
/// @brief A simple function to test
///
int addInts(int a, int b)
{
return a + b;
}
TEST(addInts, addNumbers)
{
int a{ 1 };
int b{ 3 };
EXPECT_EQ(4, addInts(a,b));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment