Last active
June 11, 2022 07:01
-
-
Save matwey/3e18a59b7c3ff88582b994ed9a730180 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <check.h> | |
#include <stdlib.h> | |
START_TEST (test_check1) { | |
ck_assert_int_eq(0, 0); | |
} | |
END_TEST | |
Suite* the_suite(void) { | |
Suite *s; | |
TCase *tc_core; | |
s = suite_create("bit"); | |
tc_core = tcase_create("Core"); | |
tcase_add_test(tc_core, test_check1); | |
suite_add_tcase(s, tc_core); | |
return s; | |
} | |
int main(void) { | |
int number_failed; | |
Suite *s; | |
SRunner *sr; | |
s = the_suite(); | |
sr = srunner_create(s); | |
srunner_run_all(sr, CK_NORMAL); | |
number_failed = srunner_ntests_failed(sr); | |
srunner_free(sr); | |
return (number_failed == 0) ? 0 : 1; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required (VERSION 3.1) | |
project(checkcheck LANGUAGES C CXX VERSION 0.1.0) | |
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) | |
set(CMAKE_C_STANDARD 99) | |
include(CheckSymbolExists) | |
include(GNUInstallDirs) | |
include(GenerateExportHeader) | |
find_package(Check CONFIG NAMES Check check) | |
enable_testing() | |
file(GLOB_RECURSE TESTS check.c) | |
foreach(test_source IN ITEMS ${TESTS}) | |
string(REPLACE ${CMAKE_SOURCE_DIR}/ "" test_name ${test_source}) | |
string(REPLACE / _ test_name ${test_name}) | |
string(REPLACE .c "" test_name ${test_name}) | |
add_executable(${test_name} ${test_source}) | |
target_link_libraries(${test_name} Check::checkShared) | |
add_test(${test_name} ${test_name}) | |
endforeach(test_source) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment