Forgot some files.

This commit is contained in:
Marco 2023-03-03 18:17:14 +01:00
parent f8e09d656d
commit 18f2f4efcd
2 changed files with 62 additions and 0 deletions

5
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"files.associations": {
"time.h": "c"
}
}

57
test/test_timer_utils.c Normal file
View File

@ -0,0 +1,57 @@
#include <stdio.h>
#include <time.h>
#include "CUnit/Basic.h"
#include "timer_utils.h"
int init_suite1(void)
{
printf("init_suit1()");
return 0;
}
int clean_suite1(void)
{
printf("clean_suit1()");
return 0;
}
void test_tmr_add_ns_to_current_time(void)
{
struct itimerspec test_time = {
.it_value = {
.tv_nsec = 0,
.tv_sec = 0
}
};
tmr_add_ns_to_current_time(&test_time, 1);
CU_ASSERT(test_time.it_value.tv_nsec == 2);
}
int main()
{
CU_pSuite pSuite = NULL;
if (CUE_SUCCESS != CU_initialize_registry())
return CU_get_error();
pSuite = CU_add_suite("Suite_1", init_suite1, clean_suite1);
if (NULL == pSuite)
{
CU_cleanup_registry();
return CU_get_error();
}
if ((NULL == CU_add_test(pSuite, "test of fprintf()", test_tmr_add_ns_to_current_time)))
{
CU_cleanup_registry();
return CU_get_error();
}
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
CU_cleanup_registry();
return CU_get_error();
}