nextcloud-desktop/tests/csync_tests/check_csync_create.c

50 lines
1,013 B
C
Raw Normal View History

#include <stdlib.h>
#include <stdio.h>
2008-05-09 11:54:08 +04:00
#include "torture.h"
2008-05-09 11:54:08 +04:00
#include "csync_private.h"
static void check_csync_destroy_null(void **state)
2008-05-09 11:54:08 +04:00
{
int rc;
2008-05-09 11:54:08 +04:00
(void) state; /* unused */
2008-05-09 11:54:08 +04:00
rc = csync_destroy(NULL);
assert_int_equal(rc, -1);
2008-05-09 11:54:08 +04:00
}
static void check_csync_create(void **state)
{
CSYNC *csync;
char confdir[1024] = {0};
int rc;
2008-05-09 11:54:08 +04:00
(void) state; /* unused */
2008-05-09 11:54:08 +04:00
rc = csync_create(&csync, "/tmp/csync1", "/tmp/csync2");
assert_int_equal(rc, 0);
2008-05-09 11:54:08 +04:00
assert_int_equal(csync->options.max_depth, MAX_DEPTH);
assert_int_equal(csync->options.max_time_difference, MAX_TIME_DIFFERENCE);
2008-05-09 11:54:08 +04:00
snprintf(confdir, sizeof(confdir), "%s/%s", getenv("HOME"), CSYNC_CONF_DIR);
assert_string_equal(csync->options.config_dir, confdir);
2008-05-09 11:54:08 +04:00
rc = csync_destroy(csync);
assert_int_equal(rc, 0);
}
2008-05-09 11:54:08 +04:00
int torture_run_tests(void)
{
const UnitTest tests[] = {
unit_test(check_csync_destroy_null),
unit_test(check_csync_create),
};
2008-05-09 11:54:08 +04:00
return run_tests(tests);
2008-05-09 11:54:08 +04:00
}