37 lines
754 B
C
37 lines
754 B
C
#include <stdlib.h>
|
|
#include <check.h>
|
|
#include "check_check.h"
|
|
#include "../src/calibrate.h"
|
|
#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);
|
|
}
|
|
|
|
Suite*
|
|
calibrate_suite(void)
|
|
{
|
|
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;
|
|
}
|