This repository has been archived on 2021-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
modetw/tests/check_file_t.c

43 lines
830 B
C

#include "check_check.h"
#include "../src/file_t.h"
START_TEST(test_file_init)
{
file_t *f;
exception_t *e = NULL;
f = file_init ("samples/1.txt", FILEPATH_RELATIVE, e);
ck_assert_ptr_nonnull (f);
ck_assert_ptr_null (e);
file_close (f);
}
END_TEST
START_TEST(test_file_md5)
{
file_t *f;
exception_t *e = NULL;
f = file_init("samples/1.txt", FILEPATH_RELATIVE, e);
file_md5_gen (f, e);
ck_assert_ptr_null (e);
file_md5_str (f, e);
ck_assert_ptr_null (e);
ck_assert_str_eq (f->hash_str, "492ff087b26577237c576e7ad409064e");
file_close (f);
}
Suite*
file_t_suite(void)
{
Suite *s;
TCase *tc_core;
s = suite_create ("file_t");
tc_core = tcase_create ("core");
tcase_add_test(tc_core, test_file_init);
tcase_add_test(tc_core, test_file_md5);
suite_add_tcase(s, tc_core);
return s;
}