Preparing sources and tests for CI

This commit is contained in:
Melefo
2020-01-20 21:26:15 +01:00
parent ecc7d428be
commit 033ce127e6
4 changed files with 38 additions and 5 deletions
+19 -3
View File
@@ -1,6 +1,22 @@
cmake_minimum_required(VERSION 3.15)
project(Hillnes)
set(CMAKE_CXX_STANDARD 20)
add_executable(Hillnes main.cpp)
# set the project name
project(ComSquare)
# show compilation warnings
add_compile_options(-W -Wall -Wextra -Wshadow)
if (TEST)
# make unit tests
add_executable(unit_tests sources/hello.cpp tests/test_test.cpp)
# include criterion & coverage
target_link_libraries(unit_tests criterion -lgcov)
target_compile_options(unit_tests PUBLIC -fprofile-arcs -ftest-coverage -g -O0)
else (TEST)
# make app
add_executable(ComSquare sources/main.cpp sources/hello.cpp)
endif (TEST)
+3 -2
View File
@@ -1,6 +1,7 @@
#include <iostream>
int main() {
int HelloWorld(void)
{
std::cout << "Hello, World!" << std::endl;
return 0;
}
}
+6
View File
@@ -0,0 +1,6 @@
int HelloWorld(void);
int main(void)
{
return HelloWorld();
}
+10
View File
@@ -0,0 +1,10 @@
#include <criterion/criterion.h>
int HelloWorld(void);
Test(HelloWorld, hello)
{
int result = HelloWorld();
cr_assert_eq(result, 0);
}