Skip to content

Commit

Permalink
[test-libc] refs fibercrypto#5 Init suite test util.datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Mar 27, 2020
1 parent 3cf8907 commit 8fc2289
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
32 changes: 32 additions & 0 deletions lib/cgo/tests/check_util.datetime.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <stdio.h>
#include <stdlib.h>

#include <check.h>
#include <string.h>
#include <time.h>

#include "fcassert.h"
#include "fcerrors.h"
#include "fcstring.h"
#include "fctest.h"
#include "libfibercrypto.h"

START_TEST(TestParseDate)
{
printf("Load TestParseDate \n");
GoUint64_ some_date = 1577665665;
time_t datetime = time(some_date);
printf("The value is %d\n", datetime);
}
END_TEST

Suite *check_util_datetime(void)
{
Suite *s = suite_create("Load check_util_datetime");
TCase *tc;
tc = tcase_create("check_util_datetime");
tcase_add_checked_fixture(tc, setup, teardown);
tcase_add_test(tc, TestParseDate);
suite_add_tcase(s, tc);
return s;
}
4 changes: 3 additions & 1 deletion lib/cgo/tests/test_main.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include "test_main.h"
#include <check.h>
// run suite
int main(void) {
int main(void)
{
int number_failed = 0;
SRunner *sr = srunner_create(check_util_cipher());
srunner_add_suite(sr, check_util_datetime());
srunner_set_fork_status(sr, CK_NOFORK);
srunner_run_all(sr, CK_VERBOSE);
number_failed = srunner_ntests_failed(sr);
Expand Down
1 change: 1 addition & 0 deletions lib/cgo/tests/test_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
#include <string.h>

Suite *check_util_cipher(void);
Suite *check_util_datetime(void);

#endif

0 comments on commit 8fc2289

Please sign in to comment.