mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Add tests for the csync_util functions.
This commit is contained in:
parent
be57b79d6c
commit
9f887635b2
@ -34,6 +34,7 @@ macro_add_check_test(check_csync_config csync_tests/check_csync_config.c ${TEST_
|
||||
macro_add_check_test(check_csync_exclude csync_tests/check_csync_exclude.c ${TEST_TARGET_LIBRARIES})
|
||||
macro_add_check_test(check_csync_journal csync_tests/check_csync_journal.c ${TEST_TARGET_LIBRARIES})
|
||||
macro_add_check_test(check_csync_time csync_tests/check_csync_time.c ${TEST_TARGET_LIBRARIES})
|
||||
macro_add_check_test(check_csync_util csync_tests/check_csync_util.c ${TEST_TARGET_LIBRARIES})
|
||||
|
||||
# vio
|
||||
macro_add_check_test(check_vio_handle vio_tests/check_vio_handle.c ${TEST_TARGET_LIBRARIES})
|
||||
|
||||
55
tests/csync_tests/check_csync_util.c
Normal file
55
tests/csync_tests/check_csync_util.c
Normal file
@ -0,0 +1,55 @@
|
||||
#include "support.h"
|
||||
|
||||
#include "csync_util.h"
|
||||
|
||||
START_TEST (check_csync_instruction_str)
|
||||
{
|
||||
const char *str = NULL;
|
||||
|
||||
str = csync_instruction_str(CSYNC_INSTRUCTION_ERROR);
|
||||
fail_unless(strcmp(str, "CSYNC_INSTRUCTION_ERROR") == 0, NULL);
|
||||
|
||||
str = csync_instruction_str(0xFFFF);
|
||||
fail_unless(strcmp(str, "ERROR!") == 0, NULL);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (check_csync_memstat)
|
||||
{
|
||||
csync_memstat_check();
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
||||
static Suite *make_csync_suite(void) {
|
||||
Suite *s = suite_create("csync_lock");
|
||||
|
||||
create_case(s, "check_csync_instruction_str", check_csync_instruction_str);
|
||||
create_case(s, "check_csync_memstat", check_csync_memstat);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
Suite *s = NULL;
|
||||
SRunner *sr = NULL;
|
||||
struct argument_s arguments;
|
||||
int nf;
|
||||
|
||||
ZERO_STRUCT(arguments);
|
||||
|
||||
cmdline_parse(argc, argv, &arguments);
|
||||
|
||||
s = make_csync_suite();
|
||||
|
||||
sr = srunner_create(s);
|
||||
if (arguments.nofork) {
|
||||
srunner_set_fork_status(sr, CK_NOFORK);
|
||||
}
|
||||
srunner_run_all(sr, CK_VERBOSE);
|
||||
nf = srunner_ntests_failed(sr);
|
||||
srunner_free(sr);
|
||||
|
||||
return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user