Update check_file_t to correctly check exception

This commit is contained in:
Pradana Aumars 2021-06-02 12:05:00 +02:00
parent 72f71d4e2b
commit 0794691f5a

View File

@ -4,25 +4,27 @@
START_TEST(test_file_init) START_TEST(test_file_init)
{ {
file_t *f; file_t *f;
exception_t *e = NULL; exception_t *e = exception_init();
f = file_init ("samples/1.txt", FILEPATH_RELATIVE, e); f = file_init ("samples/1.txt", FILEPATH_RELATIVE, e);
ck_assert_ptr_nonnull (f); ck_assert_ptr_nonnull (f);
ck_assert_ptr_null (e); ck_assert (exception_null(e));
file_close (f); file_close (f);
exception_free(e);
} }
END_TEST END_TEST
START_TEST(test_file_md5) START_TEST(test_file_md5)
{ {
file_t *f; file_t *f;
exception_t *e = NULL; exception_t *e = exception_init();
f = file_init("samples/1.txt", FILEPATH_RELATIVE, e); f = file_init("samples/1.txt", FILEPATH_RELATIVE, e);
file_md5_gen (f, e); file_md5_gen (f, e);
ck_assert_ptr_null (e); ck_assert (exception_null(e));
file_md5_str (f, e); file_md5_str (f, e);
ck_assert_ptr_null (e); ck_assert (exception_null(e));
ck_assert_str_eq (f->hash_str, "492ff087b26577237c576e7ad409064e"); ck_assert_str_eq (f->hash_str, "492ff087b26577237c576e7ad409064e");
file_close (f); file_close (f);
exception_free(e);
} }
Suite* Suite*