mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-05-29 17:02:21 +00:00
Preparing sources and tests for CI
This commit is contained in:
+19
-3
@@ -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)
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
int HelloWorld(void)
|
||||
{
|
||||
std::cout << "Hello, World!" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
int HelloWorld(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return HelloWorld();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
#include <criterion/criterion.h>
|
||||
|
||||
int HelloWorld(void);
|
||||
|
||||
Test(HelloWorld, hello)
|
||||
{
|
||||
int result = HelloWorld();
|
||||
|
||||
cr_assert_eq(result, 0);
|
||||
}
|
||||
Reference in New Issue
Block a user