check_csync_create.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * libcsync -- a library to sync a directory with another
  3. *
  4. * Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include <stdlib.h>
  21. #include <stdio.h>
  22. #include "torture.h"
  23. #include "csync_private.h"
  24. static void check_csync_destroy_null(void **state)
  25. {
  26. int rc;
  27. (void) state; /* unused */
  28. rc = csync_destroy(NULL);
  29. assert_int_equal(rc, -1);
  30. }
  31. static void check_csync_create(void **state)
  32. {
  33. CSYNC *csync;
  34. int rc;
  35. (void) state; /* unused */
  36. csync_create(&csync, "/tmp/csync1");
  37. rc = csync_destroy(csync);
  38. assert_int_equal(rc, 0);
  39. }
  40. int torture_run_tests(void)
  41. {
  42. const struct CMUnitTest tests[] = {
  43. cmocka_unit_test(check_csync_destroy_null),
  44. cmocka_unit_test(check_csync_create),
  45. };
  46. return cmocka_run_group_tests(tests, NULL, NULL);
  47. }