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_calibrate.c

37 lines
754 B
C
Raw Permalink Normal View History

2021-06-03 00:34:12 +02:00
#include <stdlib.h>
2021-05-15 19:18:42 +02:00
#include <check.h>
2021-06-03 00:34:12 +02:00
#include "check_check.h"
2021-05-15 19:18:42 +02:00
#include "../src/calibrate.h"
2021-06-03 00:34:12 +02:00
#include "../src/file_t.h"
START_TEST(test_replace_text)
{
exception_t *e;
file_t *f;
e = exception_init();
f = file_init("samples/1.txt", FILEPATH_RELATIVE, e);
char *path = file_abs(f);
ck_assert(replace_text(path, "ABC", "123", "ASCII", e));
ck_assert(exception_null(e));
ck_assert(replace_text(path, "123", "ABC", "ASCII", e));
ck_assert(exception_null(e));
file_close(f);
exception_free(e);
free(path);
}
2021-05-15 19:18:42 +02:00
2021-06-03 00:34:12 +02:00
Suite*
calibrate_suite(void)
2021-05-15 19:18:42 +02:00
{
2021-06-03 00:34:12 +02:00
Suite *s;
TCase *tc_core;
s = suite_create ("calibrate");
tc_core = tcase_create ("core");
tcase_add_test(tc_core, test_replace_text);
suite_add_tcase(s, tc_core);
return s;
2021-05-15 19:18:42 +02:00
}