richardphibel / rpms / librepo

Forked from rpms/librepo 2 years ago
Clone
936122
From 3738ee93ebcc3552774b6361fccea2b8ab80e101 Mon Sep 17 00:00:00 2001
936122
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
936122
Date: Tue, 22 Jun 2021 10:32:29 +0200
936122
Subject: [PATCH] `fail_if` and `fail_unless` are deprecated
936122
936122
https://libcheck.github.io/check/doc/check_html/check_4.html#Convenience-Test-Functions
936122
936122
It also fixes a couple of covscan warnings of the following type:
936122
```
936122
Error: COMPILER_WARNING (CWE-685):
936122
librepo-1.12.1/tests/fixtures.h:5: included_from: Included from here.
936122
librepo-1.12.1/tests/test_checksum.c:15: included_from: Included from here.
936122
librepo-1.12.1/tests/test_checksum.c: scope_hint: In function 'test_checksum'
936122
librepo-1.12.1/tests/test_checksum.c:58:9: warning[-Wformat-extra-args]: too many arguments for format
936122
\#   58 |         "Checksum is %s instead of %s", checksum, expected);
936122
\#      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
936122
\#   56|       fail_if(tmp_err);
936122
\#   57|       fail_if(strcmp(checksum, expected),
936122
\#   58|->         "Checksum is %s instead of %s", checksum, expected);
936122
\#   59|       lr_free(checksum);
936122
\#   60|       close(fd);
936122
```
936122
---
936122
 tests/test_checksum.c           |  88 +++----
936122
 tests/test_downloader.c         |  93 +++----
936122
 tests/test_gpg.c                |  32 +--
936122
 tests/test_handle.c             | 140 +++++-----
936122
 tests/test_lrmirrorlist.c       | 114 ++++-----
936122
 tests/test_metalink.c           | 438 ++++++++++++++++----------------
936122
 tests/test_mirrorlist.c         |  40 +--
936122
 tests/test_package_downloader.c |  48 ++--
936122
 tests/test_repo_zck.c           |  20 +-
936122
 tests/test_repoconf.c           |  24 +-
936122
 tests/test_repomd.c             |  38 +--
936122
 tests/test_url_substitution.c   |  50 ++--
936122
 tests/test_util.c               | 146 +++++------
936122
 tests/test_version.c            |  24 +-
936122
 14 files changed, 640 insertions(+), 655 deletions(-)
936122
936122
diff --git a/tests/test_checksum.c b/tests/test_checksum.c
936122
index d0aba365..cd28cd17 100644
936122
--- a/tests/test_checksum.c
936122
+++ b/tests/test_checksum.c
936122
@@ -38,8 +38,8 @@ build_test_file(const char *filename, const char *content)
936122
 {
936122
     FILE *fp = fopen(filename, "w");
936122
     size_t len = strlen(content);
936122
-    fail_if(fp == NULL);
936122
-    fail_unless(fwrite(content, 1, len, fp) == len);
936122
+    ck_assert_ptr_nonnull(fp);
936122
+    ck_assert(fwrite(content, 1, len, fp) == len);
936122
     fclose(fp);
936122
 }
936122
 
936122
@@ -51,11 +51,11 @@ test_checksum(const char *filename, LrChecksumType ch_type, char *expected)
936122
     GError *tmp_err = NULL;
936122
 
936122
     fd = open(filename, O_RDONLY);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     checksum = lr_checksum_fd(ch_type, fd, &tmp_err);
936122
-    fail_if(checksum == NULL);
936122
-    fail_if(tmp_err);
936122
-    fail_if(strcmp(checksum, expected),
936122
+    ck_assert_ptr_nonnull(checksum);
936122
+    ck_assert_ptr_null(tmp_err);
936122
+    ck_assert_msg(!strcmp(checksum, expected),
936122
         "Checksum is %s instead of %s", checksum, expected);
936122
     lr_free(checksum);
936122
     close(fd);
936122
@@ -85,7 +85,7 @@ START_TEST(test_checksum_fd)
936122
     test_checksum(file, LR_CHECKSUM_SHA384, CHKS_VAL_01_SHA384);
936122
     test_checksum(file, LR_CHECKSUM_SHA512, CHKS_VAL_01_SHA512);
936122
 
936122
-    fail_if(remove(file) != 0, "Cannot delete temporary test file");
936122
+    ck_assert_msg(remove(file) == 0, "Cannot delete temporary test file");
936122
     lr_free(file);
936122
 }
936122
 END_TEST
936122
@@ -107,28 +107,28 @@ START_TEST(test_cached_checksum_matches)
936122
 
936122
     filename = lr_pathconcat(test_globals.tmpdir, "/test_checksum_matches", NULL);
936122
     f = fopen(filename, "w");
936122
-    fail_if(f == NULL);
936122
+    ck_assert_ptr_nonnull(f);
936122
     fwrite("foo\nbar\n", 1, 8, f);
936122
     fclose(f);
936122
 
936122
     // Assert no cached checksum exists
936122
     attr_ret = GETXATTR(filename, timestamp_key, &buf, sizeof(buf)-1);
936122
-    fail_if(attr_ret != -1);  // Cached timestamp should not exists
936122
+    ck_assert(attr_ret == -1);  // Cached timestamp should not exists
936122
     attr_ret = GETXATTR(filename, checksum_key, &buf, sizeof(buf)-1);
936122
-    fail_if(attr_ret != -1);  // Cached checksum should not exists
936122
+    ck_assert(attr_ret == -1);  // Cached checksum should not exists
936122
 
936122
     // Calculate checksum
936122
     fd = open(filename, O_RDONLY);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     checksum_ret = lr_checksum_fd_cmp(LR_CHECKSUM_SHA256,
936122
                                       fd,
936122
                                       expected,
936122
                                       1,
936122
                                       &matches,
936122
                                       &tmp_err);
936122
-    fail_if(tmp_err);
936122
-    fail_if(!checksum_ret);
936122
-    fail_if(!matches);
936122
+    ck_assert_ptr_null(tmp_err);
936122
+    ck_assert(checksum_ret);
936122
+    ck_assert(matches);
936122
     close(fd);
936122
 
936122
     // Assert cached checksum exists
936122
@@ -141,33 +141,33 @@ START_TEST(test_cached_checksum_matches)
936122
             goto exit_label;
936122
         }
936122
         // Any other errno means fail
936122
-        fail_if(attr_ret == -1);
936122
+        ck_assert(attr_ret != -1);
936122
     } else {
936122
         buf[attr_ret] = 0;
936122
-        fail_if(strcmp(buf, expected));
936122
+        ck_assert_str_eq(buf, expected);
936122
     }
936122
 
936122
     // stored timestamp matches the file mtime
936122
     ret = stat(filename, &st);
936122
-    fail_if(ret != 0);
936122
+    ck_assert_int_eq(ret, 0);
936122
     mtime_str = g_strdup_printf("%lli", (long long) st.st_mtime);
936122
     attr_ret = GETXATTR(filename, timestamp_key, &buf, sizeof(buf)-1);
936122
-    fail_if(attr_ret == -1);
936122
+    ck_assert(attr_ret != -1);
936122
     buf[attr_ret] = 0;
936122
-    fail_if(strcmp(buf, mtime_str));
936122
+    ck_assert_str_eq(buf, mtime_str);
936122
 
936122
     // Calculate checksum again (cached shoud be used this time)
936122
     fd = open(filename, O_RDONLY);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     checksum_ret = lr_checksum_fd_cmp(LR_CHECKSUM_SHA256,
936122
                                       fd,
936122
                                       expected,
936122
                                       1,
936122
                                       &matches,
936122
                                       &tmp_err);
936122
-    fail_if(tmp_err);
936122
-    fail_if(!checksum_ret);
936122
-    fail_if(!matches);
936122
+    ck_assert_ptr_null(tmp_err);
936122
+    ck_assert(checksum_ret);
936122
+    ck_assert(matches);
936122
     close(fd);
936122
 
936122
 exit_label:
936122
@@ -195,19 +195,19 @@ START_TEST(test_cached_checksum_value)
936122
 
936122
     filename = lr_pathconcat(test_globals.tmpdir, "/test_checksum_value", NULL);
936122
     f = fopen(filename, "w");
936122
-    fail_if(f == NULL);
936122
+    ck_assert_ptr_nonnull(f);
936122
     fwrite("foo\nbar\n", 1, 8, f);
936122
     fclose(f);
936122
 
936122
     // Assert no cached checksum exists
936122
     attr_ret = GETXATTR(filename, timestamp_key, &buf, sizeof(buf)-1);
936122
-    fail_if(attr_ret != -1);  // Cached timestamp should not exists
936122
+    ck_assert(attr_ret == -1);  // Cached timestamp should not exists
936122
     attr_ret = GETXATTR(filename, checksum_key, &buf, sizeof(buf)-1);
936122
-    fail_if(attr_ret != -1);  // Cached checksum should not exists
936122
+    ck_assert(attr_ret == -1);  // Cached checksum should not exists
936122
 
936122
     // Calculate checksum
936122
     fd = open(filename, O_RDONLY);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     checksum_ret = lr_checksum_fd_compare(LR_CHECKSUM_SHA256,
936122
                                       fd,
936122
                                       "",
936122
@@ -215,20 +215,20 @@ START_TEST(test_cached_checksum_value)
936122
                                       &matches,
936122
                                       &calculated,
936122
                                       &tmp_err);
936122
-    fail_if(tmp_err);
936122
-    fail_if(!checksum_ret);
936122
+    ck_assert_ptr_null(tmp_err);
936122
+    ck_assert(checksum_ret);
936122
     // We pass in an empty string for expected, so we must not match.
936122
-    fail_if(matches);
936122
+    ck_assert(!matches);
936122
     close(fd);
936122
-    fail_if(strcmp(calculated, expected));
936122
+    ck_assert_str_eq(calculated, expected);
936122
 
936122
     // Assert no cached checksum exists
936122
     // This assumes issue #235 is unresolved. Once it is, this code
936122
     // should fail and the test will need updated.
936122
     attr_ret = GETXATTR(filename, timestamp_key, &buf, sizeof(buf)-1);
936122
-    fail_if(attr_ret != -1);  // Cached timestamp should not exists
936122
+    ck_assert(attr_ret == -1);  // Cached timestamp should not exists
936122
     attr_ret = GETXATTR(filename, checksum_key, &buf, sizeof(buf)-1);
936122
-    fail_if(attr_ret != -1);  // Cached checksum should not exists
936122
+    ck_assert(attr_ret == -1);  // Cached checksum should not exists
936122
 
936122
     lr_free(calculated);
936122
     lr_free(filename);
936122
@@ -252,42 +252,42 @@ START_TEST(test_cached_checksum_clear)
936122
 
936122
     filename = lr_pathconcat(test_globals.tmpdir, "/test_checksum_clear", NULL);
936122
     f = fopen(filename, "w");
936122
-    fail_if(f == NULL);
936122
+    ck_assert_ptr_nonnull(f);
936122
     fclose(f);
936122
 
936122
     // set extended attributes
936122
     fd = open(filename, O_RDONLY);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     attr_ret = FSETXATTR(fd, timestamp_key, value, strlen(value), 0);
936122
     if (attr_ret == -1) {
936122
         if (errno == ENOTSUP) {
936122
             goto cleanup;
936122
         }
936122
-        fail_if(attr_ret == -1);
936122
+        ck_assert(attr_ret != -1);
936122
     }
936122
     attr_ret = FSETXATTR(fd, checksum_key, value, strlen(value), 0);
936122
-    fail_if(attr_ret == -1);
936122
+    ck_assert(attr_ret != -1);
936122
     attr_ret = FSETXATTR(fd, other_key, value, strlen(value), 0);
936122
-    fail_if(attr_ret == -1);
936122
+    ck_assert(attr_ret != -1);
936122
 
936122
     // verify that xattrs are set
936122
     attr_ret = GETXATTR(filename, timestamp_key, &buf, sizeof(buf));
936122
-    fail_if(attr_ret == -1);
936122
+    ck_assert(attr_ret != -1);
936122
     attr_ret = GETXATTR(filename, checksum_key, &buf, sizeof(buf));
936122
-    fail_if(attr_ret == -1);
936122
+    ck_assert(attr_ret != -1);
936122
     attr_ret = GETXATTR(filename, other_key, &buf, sizeof(buf));
936122
-    fail_if(attr_ret == -1);
936122
+    ck_assert(attr_ret != -1);
936122
 
936122
     lr_checksum_clear_cache(fd);
936122
 
936122
     // verify that checksum xattrs are removed
936122
     attr_ret = GETXATTR(filename, timestamp_key, &buf, sizeof(buf));
936122
-    fail_if(attr_ret != -1);
936122
+    ck_assert(attr_ret == -1);
936122
     attr_ret = GETXATTR(filename, checksum_key, &buf, sizeof(buf));
936122
-    fail_if(attr_ret != -1);
936122
+    ck_assert(attr_ret == -1);
936122
     // other then checksum related attributes are not removed
936122
     attr_ret = GETXATTR(filename, other_key, &buf, sizeof(buf));
936122
-    fail_if(attr_ret == -1);
936122
+    ck_assert(attr_ret != -1);
936122
 cleanup:
936122
     close(fd);
936122
     lr_free(filename);
936122
diff --git a/tests/test_downloader.c b/tests/test_downloader.c
936122
index e6155105..34958ab1 100644
936122
--- a/tests/test_downloader.c
936122
+++ b/tests/test_downloader.c
936122
@@ -20,18 +20,14 @@
936122
 
936122
 START_TEST(test_downloader_no_list)
936122
 {
936122
-    int ret;
936122
     GError *err = NULL;
936122
-
936122
-    ret = lr_download(NULL, FALSE, &err;;
936122
-    fail_if(!ret);
936122
-    fail_if(err);
936122
+    ck_assert(lr_download(NULL, FALSE, &err));
936122
+    ck_assert_ptr_null(err);
936122
 }
936122
 END_TEST
936122
 
936122
 START_TEST(test_downloader_single_file)
936122
 {
936122
-    int ret;
936122
     LrHandle *handle;
936122
     GSList *list = NULL;
936122
     GError *err = NULL;
936122
@@ -43,12 +39,12 @@ START_TEST(test_downloader_single_file)
936122
     // Prepare handle
936122
 
936122
     handle = lr_handle_init();
936122
-    fail_if(handle == NULL);
936122
+    ck_assert_ptr_nonnull(handle);
936122
 
936122
     char *urls[] = {"http://www.google.com", NULL};
936122
-    fail_if(!lr_handle_setopt(handle, NULL, LRO_URLS, urls));
936122
+    ck_assert(lr_handle_setopt(handle, NULL, LRO_URLS, urls));
936122
     lr_handle_prepare_internal_mirrorlist(handle, FALSE, &tmp_err);
936122
-    fail_if(tmp_err);
936122
+    ck_assert_ptr_null(tmp_err);
936122
 
936122
 
936122
     // Prepare list of download targets
936122
@@ -57,20 +53,19 @@ START_TEST(test_downloader_single_file)
936122
 
936122
     fd1 = mkstemp(tmpfn1);
936122
     lr_free(tmpfn1);
936122
-    fail_if(fd1 < 0);
936122
+    ck_assert_int_ge(fd1, 0);
936122
 
936122
     t1 = lr_downloadtarget_new(handle, "index.html", NULL, fd1, NULL, NULL,
936122
                                0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL,
936122
                                FALSE, FALSE);
936122
-    fail_if(!t1);
936122
+    ck_assert_ptr_nonnull(t1);
936122
 
936122
     list = g_slist_append(list, t1);
936122
 
936122
     // Download
936122
 
936122
-    ret = lr_download(list, FALSE, &err;;
936122
-    fail_if(!ret);
936122
-    fail_if(err);
936122
+    ck_assert(lr_download(list, FALSE, &err));
936122
+    ck_assert_ptr_null(err);
936122
 
936122
     lr_handle_free(handle);
936122
 
936122
@@ -91,7 +86,6 @@ END_TEST
936122
 
936122
 START_TEST(test_downloader_single_file_2)
936122
 {
936122
-    int ret;
936122
     GSList *list = NULL;
936122
     GError *err = NULL;
936122
     int fd1;
936122
@@ -104,20 +98,19 @@ START_TEST(test_downloader_single_file_2)
936122
 
936122
     fd1 = mkstemp(tmpfn1);
936122
     lr_free(tmpfn1);
936122
-    fail_if(fd1 < 0);
936122
+    ck_assert_int_ge(fd1, 0);
936122
 
936122
     t1 = lr_downloadtarget_new(NULL, "http://seznam.cz/index.html", NULL,
936122
                                fd1, NULL, NULL, 0, 0, NULL, NULL, NULL,
936122
                                NULL, NULL, 0, 0, NULL, FALSE, FALSE);
936122
-    fail_if(!t1);
936122
+    ck_assert_ptr_nonnull(t1);
936122
 
936122
     list = g_slist_append(list, t1);
936122
 
936122
     // Download
936122
 
936122
-    ret = lr_download(list, FALSE, &err;;
936122
-    fail_if(!ret);
936122
-    fail_if(err);
936122
+    ck_assert(lr_download(list, FALSE, &err));
936122
+    ck_assert_ptr_null(err);
936122
 
936122
     // Check results
936122
 
936122
@@ -136,7 +129,6 @@ END_TEST
936122
 
936122
 START_TEST(test_downloader_two_files)
936122
 {
936122
-    int ret;
936122
     LrHandle *handle;
936122
     GSList *list = NULL;
936122
     GError *err = NULL;
936122
@@ -148,12 +140,12 @@ START_TEST(test_downloader_two_files)
936122
     // Prepare handle
936122
 
936122
     handle = lr_handle_init();
936122
-    fail_if(handle == NULL);
936122
+    ck_assert_ptr_nonnull(handle);
936122
 
936122
     char *urls[] = {"http://www.google.com", NULL};
936122
-    fail_if(!lr_handle_setopt(handle, NULL, LRO_URLS, urls));
936122
+    ck_assert(lr_handle_setopt(handle, NULL, LRO_URLS, urls));
936122
     lr_handle_prepare_internal_mirrorlist(handle, FALSE, &tmp_err);
936122
-    fail_if(tmp_err);
936122
+    ck_assert_ptr_null(tmp_err);
936122
 
936122
     // Prepare list of download targets
936122
 
936122
@@ -164,26 +156,25 @@ START_TEST(test_downloader_two_files)
936122
     fd2 = mkstemp(tmpfn2);
936122
     lr_free(tmpfn1);
936122
     lr_free(tmpfn2);
936122
-    fail_if(fd1 < 0);
936122
-    fail_if(fd2 < 0);
936122
+    ck_assert_int_ge(fd1, 0);
936122
+    ck_assert_int_ge(fd2, 0);
936122
 
936122
     t1 = lr_downloadtarget_new(handle, "index.html", NULL, fd1, NULL,
936122
                                NULL, 0, 0, NULL, NULL, NULL,
936122
                                NULL, NULL, 0, 0, NULL, FALSE, FALSE);
936122
-    fail_if(!t1);
936122
+    ck_assert_ptr_nonnull(t1);
936122
     t2 = lr_downloadtarget_new(handle, "index.html", "http://seznam.cz", fd2,
936122
                                NULL, NULL, 0, 0, NULL, NULL, NULL,
936122
                                NULL, NULL, 0, 0, NULL, FALSE, FALSE);
936122
-    fail_if(!t2);
936122
+    ck_assert_ptr_nonnull(t2);
936122
 
936122
     list = g_slist_append(list, t1);
936122
     list = g_slist_append(list, t2);
936122
 
936122
     // Download
936122
 
936122
-    ret = lr_download(list, FALSE, &err;;
936122
-    fail_if(!ret);
936122
-    fail_if(err);
936122
+    ck_assert(lr_download(list, FALSE, &err));
936122
+    ck_assert_ptr_null(err);
936122
 
936122
     lr_handle_free(handle);
936122
 
936122
@@ -205,7 +196,6 @@ END_TEST
936122
 
936122
 START_TEST(test_downloader_three_files_with_error)
936122
 {
936122
-    int ret;
936122
     LrHandle *handle;
936122
     GSList *list = NULL;
936122
     GError *err = NULL;
936122
@@ -217,12 +207,12 @@ START_TEST(test_downloader_three_files_with_error)
936122
     // Prepare handle
936122
 
936122
     handle = lr_handle_init();
936122
-    fail_if(handle == NULL);
936122
+    ck_assert_ptr_nonnull(handle);
936122
 
936122
     char *urls[] = {"http://www.google.com", NULL};
936122
-    fail_if(!lr_handle_setopt(handle, NULL, LRO_URLS, urls));
936122
+    ck_assert(lr_handle_setopt(handle, NULL, LRO_URLS, urls));
936122
     lr_handle_prepare_internal_mirrorlist(handle, FALSE, &tmp_err);
936122
-    fail_if(tmp_err);
936122
+    ck_assert_ptr_null(tmp_err);
936122
 
936122
     // Prepare list of download targets
936122
 
936122
@@ -236,25 +226,25 @@ START_TEST(test_downloader_three_files_with_error)
936122
     lr_free(tmpfn1);
936122
     lr_free(tmpfn2);
936122
     lr_free(tmpfn3);
936122
-    fail_if(fd1 < 0);
936122
-    fail_if(fd2 < 0);
936122
-    fail_if(fd3 < 0);
936122
+    ck_assert_int_ge(fd1, 0);
936122
+    ck_assert_int_ge(fd2, 0);
936122
+    ck_assert_int_ge(fd3, 0);
936122
 
936122
     t1 = lr_downloadtarget_new(handle, "index.html", NULL, fd1, NULL, NULL,
936122
                                0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL,
936122
                                FALSE, FALSE);
936122
-    fail_if(!t1);
936122
+    ck_assert_ptr_nonnull(t1);
936122
 
936122
     t2 = lr_downloadtarget_new(handle, "index.html", "http://seznam.cz", fd2,
936122
                                NULL, NULL, 0, 0, NULL, NULL, NULL, NULL,
936122
                                NULL, 0, 0, NULL, FALSE, FALSE);
936122
-    fail_if(!t2);
936122
+    ck_assert_ptr_nonnull(t2);
936122
 
936122
     t3 = lr_downloadtarget_new(handle, "i_hope_this_page_doesnt_exists.html",
936122
                                "http://google.com", fd3, NULL, NULL,
936122
                                0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL,
936122
                                FALSE, FALSE);
936122
-    fail_if(!t3);
936122
+    ck_assert_ptr_nonnull(t3);
936122
 
936122
     list = g_slist_append(list, t1);
936122
     list = g_slist_append(list, t2);
936122
@@ -262,9 +252,8 @@ START_TEST(test_downloader_three_files_with_error)
936122
 
936122
     // Download
936122
 
936122
-    ret = lr_download(list, FALSE, &err;;
936122
-    fail_if(!ret);
936122
-    fail_if(err);
936122
+    ck_assert(lr_download(list, FALSE, &err));
936122
+    ck_assert_ptr_null(err);
936122
 
936122
     lr_handle_free(handle);
936122
 
936122
@@ -314,7 +303,6 @@ START_TEST(test_downloader_checksum)
936122
     int i;
936122
 
936122
     for (i = 0; tests[i].sha512; i++) {
936122
-        int ret;
936122
         LrHandle *handle;
936122
         GSList *list = NULL;
936122
         GError *err = NULL;
936122
@@ -328,12 +316,12 @@ START_TEST(test_downloader_checksum)
936122
         // Prepare handle
936122
 
936122
         handle = lr_handle_init();
936122
-        fail_if(handle == NULL);
936122
+        ck_assert_ptr_nonnull(handle);
936122
 
936122
         char *urls[] = {"file:///", NULL};
936122
-        fail_if(!lr_handle_setopt(handle, NULL, LRO_URLS, urls));
936122
+        ck_assert(lr_handle_setopt(handle, NULL, LRO_URLS, urls));
936122
         lr_handle_prepare_internal_mirrorlist(handle, FALSE, &tmp_err);
936122
-        fail_if(tmp_err);
936122
+        ck_assert_ptr_null(tmp_err);
936122
 
936122
 
936122
         // Prepare list of download targets
936122
@@ -342,7 +330,7 @@ START_TEST(test_downloader_checksum)
936122
 
936122
         fd1 = mkstemp(tmpfn1);
936122
         lr_free(tmpfn1);
936122
-        fail_if(fd1 < 0);
936122
+        ck_assert_int_ge(fd1, 0);
936122
 
936122
         checksum = lr_downloadtargetchecksum_new(LR_CHECKSUM_SHA512,
936122
                                                  tests[i].sha512);
936122
@@ -351,15 +339,14 @@ START_TEST(test_downloader_checksum)
936122
         t1 = lr_downloadtarget_new(handle, "dev/null", NULL, fd1, NULL, checksums,
936122
                                    0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL,
936122
                                    FALSE, FALSE);
936122
-        fail_if(!t1);
936122
+        ck_assert_ptr_nonnull(t1);
936122
 
936122
         list = g_slist_append(list, t1);
936122
 
936122
         // Download
936122
 
936122
-        ret = lr_download(list, FALSE, &err;;
936122
-        fail_if(!ret);
936122
-        fail_if(err);
936122
+        ck_assert(lr_download(list, FALSE, &err));
936122
+        ck_assert_ptr_null(err);
936122
 
936122
         lr_handle_free(handle);
936122
 
936122
diff --git a/tests/test_gpg.c b/tests/test_gpg.c
936122
index 1f956d8b..fd322e38 100644
936122
--- a/tests/test_gpg.c
936122
+++ b/tests/test_gpg.c
936122
@@ -39,24 +39,24 @@ START_TEST(test_gpg_check_signature)
936122
                              "repo_yum_01/repodata/repomd.xml_bad.asc", NULL);
936122
 
936122
     ret = lr_gpg_import_key(key_path, tmp_home_path, &tmp_err);
936122
-    fail_if(!ret);
936122
-    fail_if(tmp_err);
936122
+    ck_assert(ret);
936122
+    ck_assert_ptr_null(tmp_err);
936122
 
936122
     // Valid key and data
936122
     ret = lr_gpg_check_signature(signature_path,
936122
                                  data_path,
936122
                                  tmp_home_path,
936122
                                  &tmp_err);
936122
-    fail_if(!ret);
936122
-    fail_if(tmp_err);
936122
+    ck_assert(ret);
936122
+    ck_assert_ptr_null(tmp_err);
936122
 
936122
     // Bad signature signed with unknown key
936122
     ret = lr_gpg_check_signature(_signature_path,
936122
                                  data_path,
936122
                                  tmp_home_path,
936122
                                  &tmp_err);
936122
-    fail_if(ret);
936122
-    fail_if(!tmp_err);
936122
+    ck_assert(!ret);
936122
+    ck_assert_ptr_nonnull(tmp_err);
936122
     g_error_free(tmp_err);
936122
     tmp_err = NULL;
936122
 
936122
@@ -65,31 +65,31 @@ START_TEST(test_gpg_check_signature)
936122
                                  _data_path,
936122
                                  tmp_home_path,
936122
                                  &tmp_err);
936122
-    fail_if(ret);
936122
-    fail_if(!tmp_err);
936122
+    ck_assert(!ret);
936122
+    ck_assert_ptr_nonnull(tmp_err);
936122
     g_error_free(tmp_err);
936122
     tmp_err = NULL;
936122
 
936122
     // Import the 2nd key
936122
     ret = lr_gpg_import_key(_key_path, tmp_home_path, &tmp_err);
936122
-    fail_if(!ret);
936122
-    fail_if(tmp_err);
936122
+    ck_assert(ret);
936122
+    ck_assert_ptr_null(tmp_err);
936122
 
936122
     // Valid key and data
936122
     ret = lr_gpg_check_signature(_signature_path,
936122
                                  _data_path,
936122
                                  tmp_home_path,
936122
                                  &tmp_err);
936122
-    fail_if(!ret);
936122
-    fail_if(tmp_err);
936122
+    ck_assert(ret);
936122
+    ck_assert_ptr_null(tmp_err);
936122
 
936122
     // Bad signature signed with known key
936122
     ret = lr_gpg_check_signature(_signature_path,
936122
                                  data_path,
936122
                                  tmp_home_path,
936122
                                  &tmp_err);
936122
-    fail_if(ret);
936122
-    fail_if(!tmp_err);
936122
+    ck_assert(!ret);
936122
+    ck_assert_ptr_nonnull(tmp_err);
936122
     g_error_free(tmp_err);
936122
     tmp_err = NULL;
936122
 
936122
@@ -98,8 +98,8 @@ START_TEST(test_gpg_check_signature)
936122
                                  data_path,
936122
                                  tmp_home_path,
936122
                                  &tmp_err);
936122
-    fail_if(ret);
936122
-    fail_if(!tmp_err);
936122
+    ck_assert(!ret);
936122
+    ck_assert_ptr_nonnull(tmp_err);
936122
     g_error_free(tmp_err);
936122
     tmp_err = NULL;
936122
 
936122
diff --git a/tests/test_handle.c b/tests/test_handle.c
936122
index d8b3c3fe..a80df4eb 100644
936122
--- a/tests/test_handle.c
936122
+++ b/tests/test_handle.c
936122
@@ -22,42 +22,42 @@ START_TEST(test_handle)
936122
     GError *tmp_err = NULL;
936122
 
936122
     h = lr_handle_init();
936122
-    fail_if(h == NULL);
936122
+    ck_assert_ptr_nonnull(h);
936122
     lr_handle_free(h);
936122
     h = NULL;
936122
 
936122
     /* This test is meant to check memory leaks. (Use valgrind) */
936122
     h = lr_handle_init();
936122
     char *urls[] = {"foo", NULL};
936122
-    fail_if(!lr_handle_setopt(h, &tmp_err, LRO_URLS, urls));
936122
-    fail_if(tmp_err);
936122
-    fail_if(!lr_handle_setopt(h, &tmp_err, LRO_URLS, urls));
936122
-    fail_if(tmp_err);
936122
-    fail_if(!lr_handle_setopt(h, &tmp_err, LRO_MIRRORLIST, "foo"));
936122
-    fail_if(tmp_err);
936122
-    fail_if(!lr_handle_setopt(h, &tmp_err, LRO_MIRRORLIST, "bar"));
936122
-    fail_if(tmp_err);
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_USERPWD, "user:pwd"));
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_PROXY, "proxy"));
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_PROXYUSERPWD, "proxyuser:pwd"));
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_DESTDIR, "foodir"));
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_USERAGENT, "librepo/0.0"));
936122
+    ck_assert(lr_handle_setopt(h, &tmp_err, LRO_URLS, urls));
936122
+    ck_assert_ptr_null(tmp_err);
936122
+    ck_assert(lr_handle_setopt(h, &tmp_err, LRO_URLS, urls));
936122
+    ck_assert_ptr_null(tmp_err);
936122
+    ck_assert(lr_handle_setopt(h, &tmp_err, LRO_MIRRORLIST, "foo"));
936122
+    ck_assert_ptr_null(tmp_err);
936122
+    ck_assert(lr_handle_setopt(h, &tmp_err, LRO_MIRRORLIST, "bar"));
936122
+    ck_assert_ptr_null(tmp_err);
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_USERPWD, "user:pwd"));
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_PROXY, "proxy"));
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_PROXYUSERPWD, "proxyuser:pwd"));
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_DESTDIR, "foodir"));
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_USERAGENT, "librepo/0.0"));
936122
     char *dlist[] = {"primary", "filelists", NULL};
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_YUMDLIST, dlist));
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_YUMBLIST, dlist));
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_YUMDLIST, dlist));
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_YUMBLIST, dlist));
936122
     LrUrlVars *vars = NULL;
936122
     vars = lr_urlvars_set(vars, "foo", "bar");
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_VARSUB, vars));
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_FASTESTMIRRORCACHE,
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_VARSUB, vars));
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_FASTESTMIRRORCACHE,
936122
                               "/var/cache/fastestmirror.librepo"));
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_SSLCLIENTCERT, "/etc/cert.pem"));
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_SSLCLIENTKEY, "/etc/cert.key"));
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_SSLCACERT, "/etc/ca.pem"));
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_PROXY_SSLCLIENTCERT, "/etc/proxy_cert.pem"));
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_PROXY_SSLCLIENTKEY, "/etc/proxy_cert.key"));
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_PROXY_SSLCACERT, "/etc/proxy_ca.pem"));
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_HTTPAUTHMETHODS, LR_AUTH_NTLM));
936122
-    fail_if(!lr_handle_setopt(h, NULL, LRO_PROXYAUTHMETHODS, LR_AUTH_DIGEST));
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_SSLCLIENTCERT, "/etc/cert.pem"));
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_SSLCLIENTKEY, "/etc/cert.key"));
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_SSLCACERT, "/etc/ca.pem"));
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_PROXY_SSLCLIENTCERT, "/etc/proxy_cert.pem"));
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_PROXY_SSLCLIENTKEY, "/etc/proxy_cert.key"));
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_PROXY_SSLCACERT, "/etc/proxy_ca.pem"));
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_HTTPAUTHMETHODS, LR_AUTH_NTLM));
936122
+    ck_assert(lr_handle_setopt(h, NULL, LRO_PROXYAUTHMETHODS, LR_AUTH_DIGEST));
936122
     lr_handle_free(h);
936122
 }
936122
 END_TEST
936122
@@ -73,90 +73,90 @@ START_TEST(test_handle_getinfo)
936122
     h = lr_handle_init();
936122
 
936122
     num = -1;
936122
-    fail_if(!lr_handle_getinfo(h, &tmp_err, LRI_UPDATE, &num);;
936122
-    fail_if(num != 0);
936122
-    fail_if(tmp_err);
936122
+    ck_assert(lr_handle_getinfo(h, &tmp_err, LRI_UPDATE, &num);;
936122
+    ck_assert(num == 0);
936122
+    ck_assert_ptr_null(tmp_err);
936122
 
936122
     strlist = NULL;
936122
-    fail_if(!lr_handle_getinfo(h, &tmp_err, LRI_URLS, &strlist));
936122
-    fail_if(strlist != NULL);
936122
-    fail_if(tmp_err);
936122
+    ck_assert(lr_handle_getinfo(h, &tmp_err, LRI_URLS, &strlist));
936122
+    ck_assert_ptr_null(strlist);
936122
+    ck_assert_ptr_null(tmp_err);
936122
 
936122
     str = NULL;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_MIRRORLIST, &str);;
936122
-    fail_if(str != NULL);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_MIRRORLIST, &str);;
936122
+    ck_assert_ptr_null(str);
936122
 
936122
     num = -1;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_LOCAL, &num);;
936122
-    fail_if(num != 0);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_LOCAL, &num);;
936122
+    ck_assert(num == 0);
936122
 
936122
     str = NULL;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_DESTDIR, &str);;
936122
-    fail_if(str != NULL);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_DESTDIR, &str);;
936122
+    ck_assert_ptr_null(str);
936122
 
936122
     num = -1;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_REPOTYPE, &num);;
936122
-    fail_if(num != 0);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_REPOTYPE, &num);;
936122
+    ck_assert(num == 0);
936122
 
936122
     str = NULL;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_USERAGENT, &str);;
936122
-    fail_if(str != NULL);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_USERAGENT, &str);;
936122
+    ck_assert_ptr_null(str);
936122
 
936122
     strlist = NULL;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_YUMDLIST, &strlist));
936122
-    fail_if(strlist != NULL);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_YUMDLIST, &strlist));
936122
+    ck_assert_ptr_null(strlist);
936122
 
936122
     strlist = NULL;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_YUMBLIST, &strlist));
936122
-    fail_if(strlist != NULL);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_YUMBLIST, &strlist));
936122
+    ck_assert_ptr_null(strlist);
936122
 
936122
     num = -1;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_MAXMIRRORTRIES, &num);;
936122
-    fail_if(num != 0);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_MAXMIRRORTRIES, &num);;
936122
+    ck_assert(num == 0);
936122
 
936122
     LrUrlVars *vars = NULL;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_VARSUB, &vars);;
936122
-    fail_if(strlist != NULL);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_VARSUB, &vars);;
936122
+    ck_assert_ptr_null(strlist);
936122
 
936122
     str = NULL;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_FASTESTMIRRORCACHE, &str);;
936122
-    fail_if(str != NULL);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_FASTESTMIRRORCACHE, &str);;
936122
+    ck_assert_ptr_null(str);
936122
 
936122
     num = -1;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_FASTESTMIRRORMAXAGE, &num);;
936122
-    fail_if(num != LRO_FASTESTMIRRORMAXAGE_DEFAULT);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_FASTESTMIRRORMAXAGE, &num);;
936122
+    ck_assert(num == LRO_FASTESTMIRRORMAXAGE_DEFAULT);
936122
 
936122
     str = NULL;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_SSLCLIENTCERT, &str);;
936122
-    fail_if(str != NULL);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_SSLCLIENTCERT, &str);;
936122
+    ck_assert_ptr_null(str);
936122
 
936122
     str = NULL;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_SSLCLIENTKEY, &str);;
936122
-    fail_if(str != NULL);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_SSLCLIENTKEY, &str);;
936122
+    ck_assert_ptr_null(str);
936122
 
936122
     str = NULL;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_SSLCACERT, &str);;
936122
-    fail_if(str != NULL);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_SSLCACERT, &str);;
936122
+    ck_assert_ptr_null(str);
936122
 
936122
     str = NULL;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_PROXY_SSLCLIENTCERT, &str);;
936122
-    fail_if(str != NULL);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_PROXY_SSLCLIENTCERT, &str);;
936122
+    ck_assert_ptr_null(str);
936122
 
936122
     str = NULL;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_PROXY_SSLCLIENTKEY, &str);;
936122
-    fail_if(str != NULL);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_PROXY_SSLCLIENTKEY, &str);;
936122
+    ck_assert_ptr_null(str);
936122
 
936122
     str = NULL;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_PROXY_SSLCACERT, &str);;
936122
-    fail_if(str != NULL);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_PROXY_SSLCACERT, &str);;
936122
+    ck_assert_ptr_null(str);
936122
 
936122
     LrAuth auth = LR_AUTH_NONE;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_HTTPAUTHMETHODS, &auth));
936122
-    fail_if(auth != LR_AUTH_BASIC);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_HTTPAUTHMETHODS, &auth));
936122
+    ck_assert(auth == LR_AUTH_BASIC);
936122
 
936122
     auth = LR_AUTH_NONE;
936122
-    fail_if(!lr_handle_getinfo(h, NULL, LRI_PROXYAUTHMETHODS, &auth));
936122
-    fail_if(auth != LR_AUTH_BASIC);
936122
+    ck_assert(lr_handle_getinfo(h, NULL, LRI_PROXYAUTHMETHODS, &auth));
936122
+    ck_assert(auth == LR_AUTH_BASIC);
936122
 
936122
     lr_handle_free(h);
936122
 }
936122
diff --git a/tests/test_lrmirrorlist.c b/tests/test_lrmirrorlist.c
936122
index 9c908026..70c73b2c 100644
936122
--- a/tests/test_lrmirrorlist.c
936122
+++ b/tests/test_lrmirrorlist.c
936122
@@ -29,16 +29,16 @@ START_TEST(test_lrmirrorlist_append_url)
936122
     lr_urlvars_free(vars);
936122
 
936122
     mirror = lr_lrmirrorlist_nth(iml, 0);
936122
-    fail_if(!mirror);
936122
-    fail_if(strcmp(mirror->url, "ftp://bar"));
936122
+    ck_assert_ptr_nonnull(mirror);
936122
+    ck_assert_str_eq(mirror->url, "ftp://bar");
936122
 
936122
     mirror = lr_lrmirrorlist_nth(iml, 1);
936122
-    fail_if(!mirror);
936122
-    fail_if(strcmp(mirror->url, "http://foo"));
936122
+    ck_assert_ptr_nonnull(mirror);
936122
+    ck_assert_str_eq(mirror->url, "http://foo");
936122
 
936122
     mirror = lr_lrmirrorlist_nth(iml, 2);
936122
-    fail_if(!mirror);
936122
-    fail_if(strcmp(mirror->url, "http://xyz/i386/"));
936122
+    ck_assert_ptr_nonnull(mirror);
936122
+    ck_assert_str_eq(mirror->url, "http://xyz/i386/");
936122
 
936122
     lr_lrmirrorlist_free(iml);
936122
 }
936122
@@ -56,30 +56,30 @@ START_TEST(test_lrmirrorlist_append_mirrorlist)
936122
     ml.urls = g_slist_prepend(ml.urls, "ftp://bar");
936122
     ml.urls = g_slist_prepend(ml.urls, "http://foo");
936122
 
936122
-    fail_if(g_slist_length(iml) != 0);
936122
+    ck_assert(g_slist_length(iml) == 0);
936122
     iml = lr_lrmirrorlist_append_mirrorlist(iml, NULL, NULL);
936122
-    fail_if(g_slist_length(iml) != 0);
936122
+    ck_assert(g_slist_length(iml) == 0);
936122
 
936122
     iml = lr_lrmirrorlist_append_mirrorlist(iml, &ml, NULL);
936122
-    fail_if(g_slist_length(iml) != 2);
936122
+    ck_assert(g_slist_length(iml) == 2);
936122
     mirror = lr_lrmirrorlist_nth(iml, 0);
936122
-    fail_if(!mirror);
936122
-    fail_if(strcmp(mirror->url, "http://foo"));
936122
-    fail_if(mirror->preference != 100);
936122
-    fail_if(mirror->protocol != LR_PROTOCOL_HTTP);
936122
+    ck_assert_ptr_nonnull(mirror);
936122
+    ck_assert_str_eq(mirror->url, "http://foo");
936122
+    ck_assert(mirror->preference == 100);
936122
+    ck_assert(mirror->protocol == LR_PROTOCOL_HTTP);
936122
     mirror = lr_lrmirrorlist_nth(iml, 1);
936122
-    fail_if(!mirror);
936122
-    fail_if(strcmp(mirror->url, "ftp://bar"));
936122
-    fail_if(mirror->preference != 100);
936122
-    fail_if(mirror->protocol != LR_PROTOCOL_FTP);
936122
+    ck_assert_ptr_nonnull(mirror);
936122
+    ck_assert_str_eq(mirror->url, "ftp://bar");
936122
+    ck_assert(mirror->preference == 100);
936122
+    ck_assert(mirror->protocol == LR_PROTOCOL_FTP);
936122
 
936122
-    fail_if(g_slist_length(iml) != 2);
936122
+    ck_assert(g_slist_length(iml) == 2);
936122
 
936122
     url = lr_lrmirrorlist_nth_url(iml, 0);
936122
-    fail_if(strcmp(url, "http://foo"));
936122
+    ck_assert_str_eq(url, "http://foo");
936122
 
936122
     url = lr_lrmirrorlist_nth_url(iml, 1);
936122
-    fail_if(strcmp(url, "ftp://bar"));
936122
+    ck_assert_str_eq(url, "ftp://bar");
936122
 
936122
     lr_lrmirrorlist_free(iml);
936122
     g_slist_free(ml.urls);
936122
@@ -132,46 +132,46 @@ START_TEST(test_lrmirrorlist_append_metalink)
936122
     ml.urls = g_slist_prepend(ml.urls, &url2);
936122
     ml.urls = g_slist_prepend(ml.urls, &url1);
936122
 
936122
-    fail_if(g_slist_length(iml) != 0);
936122
+    ck_assert(g_slist_length(iml) == 0);
936122
     iml = lr_lrmirrorlist_append_metalink(iml, NULL, NULL, NULL);
936122
-    fail_if(g_slist_length(iml) != 0);
936122
+    ck_assert(g_slist_length(iml) == 0);
936122
 
936122
     iml = lr_lrmirrorlist_append_metalink(iml, &ml, "/repodata/repomd.xml", NULL);
936122
-    fail_if(g_slist_length(iml) != 2);  // 2 because element with empty url shoud be skipped
936122
+    ck_assert(g_slist_length(iml) == 2);  // 2 because element with empty url shoud be skipped
936122
 
936122
     mirror = lr_lrmirrorlist_nth(iml, 0);
936122
-    fail_if(strcmp(mirror->url, "http://foo"));
936122
-    fail_if(mirror->preference != 100);
936122
-    fail_if(mirror->protocol != LR_PROTOCOL_HTTP);
936122
+    ck_assert_str_eq(mirror->url, "http://foo");
936122
+    ck_assert(mirror->preference == 100);
936122
+    ck_assert(mirror->protocol == LR_PROTOCOL_HTTP);
936122
 
936122
     mirror = lr_lrmirrorlist_nth(iml, 1);
936122
-    fail_if(strcmp(mirror->url, "ftp://bar"));
936122
-    fail_if(mirror->preference != 95);
936122
-    fail_if(mirror->protocol != LR_PROTOCOL_FTP);
936122
+    ck_assert_str_eq(mirror->url, "ftp://bar");
936122
+    ck_assert(mirror->preference == 95);
936122
+    ck_assert(mirror->protocol == LR_PROTOCOL_FTP);
936122
 
936122
-    fail_if(g_slist_length(iml) != 2);
936122
+    ck_assert(g_slist_length(iml) == 2);
936122
 
936122
     url = lr_lrmirrorlist_nth_url(iml, 0);
936122
-    fail_if(strcmp(url, "http://foo"));
936122
+    ck_assert_str_eq(url, "http://foo");
936122
 
936122
     url = lr_lrmirrorlist_nth_url(iml, 1);
936122
-    fail_if(strcmp(url, "ftp://bar"));
936122
+    ck_assert_str_eq(url, "ftp://bar");
936122
 
936122
     lr_lrmirrorlist_free(iml);
936122
 
936122
     // Try append on list with existing element
936122
     iml = NULL;
936122
-    fail_if(g_slist_length(iml) != 0);
936122
+    ck_assert(g_slist_length(iml) == 0);
936122
     iml = lr_lrmirrorlist_append_url(iml, "http://abc", NULL);
936122
-    fail_if(g_slist_length(iml) != 1);
936122
+    ck_assert(g_slist_length(iml) == 1);
936122
     iml = lr_lrmirrorlist_append_metalink(iml, &ml, "/repodata/repomd.xml", NULL);
936122
-    fail_if(g_slist_length(iml) != 3);
936122
+    ck_assert(g_slist_length(iml) == 3);
936122
     url = lr_lrmirrorlist_nth_url(iml, 0);
936122
-    fail_if(strcmp(url, "http://abc"));
936122
+    ck_assert_str_eq(url, "http://abc");
936122
     url = lr_lrmirrorlist_nth_url(iml, 1);
936122
-    fail_if(strcmp(url, "http://foo"));
936122
+    ck_assert_str_eq(url, "http://foo");
936122
     url = lr_lrmirrorlist_nth_url(iml, 2);
936122
-    fail_if(strcmp(url, "ftp://bar"));
936122
+    ck_assert_str_eq(url, "ftp://bar");
936122
 
936122
     lr_lrmirrorlist_free(iml);
936122
     g_slist_free(ml.urls);
936122
@@ -189,48 +189,48 @@ START_TEST(test_lrmirrorlist_append_lrmirrorlist)
936122
     iml_2 = lr_lrmirrorlist_append_url(iml_2, NULL, NULL);
936122
     iml_2 = lr_lrmirrorlist_append_url(iml_2, "ftp://bar", NULL);
936122
 
936122
-    fail_if(g_slist_length(iml_2) != 2);
936122
+    ck_assert(g_slist_length(iml_2) == 2);
936122
 
936122
-    fail_if(g_slist_length(iml) != 0);
936122
+    ck_assert(g_slist_length(iml) == 0);
936122
     iml = lr_lrmirrorlist_append_lrmirrorlist(iml, NULL);
936122
-    fail_if(g_slist_length(iml) != 0);
936122
+    ck_assert(g_slist_length(iml) == 0);
936122
 
936122
     iml = lr_lrmirrorlist_append_lrmirrorlist(iml, iml_2);
936122
-    fail_if(g_slist_length(iml) != 2);  // 2 because element with empty url shoud be skipped
936122
+    ck_assert(g_slist_length(iml) == 2);  // 2 because element with empty url shoud be skipped
936122
 
936122
     mirror = lr_lrmirrorlist_nth(iml, 0);
936122
-    fail_if(strcmp(mirror->url, "http://foo"));
936122
-    fail_if(mirror->preference != 100);
936122
-    fail_if(mirror->protocol != LR_PROTOCOL_HTTP);
936122
+    ck_assert_str_eq(mirror->url, "http://foo");
936122
+    ck_assert(mirror->preference == 100);
936122
+    ck_assert(mirror->protocol == LR_PROTOCOL_HTTP);
936122
 
936122
     mirror = lr_lrmirrorlist_nth(iml, 1);
936122
-    fail_if(strcmp(mirror->url, "ftp://bar"));
936122
-    fail_if(mirror->preference != 100);
936122
-    fail_if(mirror->protocol != LR_PROTOCOL_FTP);
936122
+    ck_assert_str_eq(mirror->url, "ftp://bar");
936122
+    ck_assert(mirror->preference == 100);
936122
+    ck_assert(mirror->protocol == LR_PROTOCOL_FTP);
936122
 
936122
-    fail_if(g_slist_length(iml) != 2);
936122
+    ck_assert(g_slist_length(iml) == 2);
936122
 
936122
     url = lr_lrmirrorlist_nth_url(iml, 0);
936122
-    fail_if(strcmp(url, "http://foo"));
936122
+    ck_assert_str_eq(url, "http://foo");
936122
 
936122
     url = lr_lrmirrorlist_nth_url(iml, 1);
936122
-    fail_if(strcmp(url, "ftp://bar"));
936122
+    ck_assert_str_eq(url, "ftp://bar");
936122
 
936122
     lr_lrmirrorlist_free(iml);
936122
 
936122
     // Try append on list with existing element
936122
     iml = NULL;
936122
-    fail_if(g_slist_length(iml) != 0);
936122
+    ck_assert(g_slist_length(iml) == 0);
936122
     iml = lr_lrmirrorlist_append_url(iml, "http://abc", NULL);
936122
-    fail_if(g_slist_length(iml) != 1);
936122
+    ck_assert(g_slist_length(iml) == 1);
936122
     iml = lr_lrmirrorlist_append_lrmirrorlist(iml, iml_2);
936122
-    fail_if(g_slist_length(iml) != 3);
936122
+    ck_assert(g_slist_length(iml) == 3);
936122
     url = lr_lrmirrorlist_nth_url(iml, 0);
936122
-    fail_if(strcmp(url, "http://abc"));
936122
+    ck_assert_str_eq(url, "http://abc");
936122
     url = lr_lrmirrorlist_nth_url(iml, 1);
936122
-    fail_if(strcmp(url, "http://foo"));
936122
+    ck_assert_str_eq(url, "http://foo");
936122
     url = lr_lrmirrorlist_nth_url(iml, 2);
936122
-    fail_if(strcmp(url, "ftp://bar"));
936122
+    ck_assert_str_eq(url, "ftp://bar");
936122
     lr_lrmirrorlist_free(iml);
936122
     lr_lrmirrorlist_free(iml_2);
936122
 }
936122
diff --git a/tests/test_metalink.c b/tests/test_metalink.c
936122
index 69ebc236..e425742c 100644
936122
--- a/tests/test_metalink.c
936122
+++ b/tests/test_metalink.c
936122
@@ -29,7 +29,7 @@ START_TEST(test_metalink_init)
936122
     LrMetalink *ml = NULL;
936122
 
936122
     ml = lr_metalink_init();
936122
-    fail_if(ml == NULL);
936122
+    ck_assert_ptr_nonnull(ml);
936122
     lr_metalink_free(ml);
936122
 }
936122
 END_TEST
936122
@@ -49,101 +49,101 @@ START_TEST(test_metalink_good_01)
936122
                          "metalink_good_01", NULL);
936122
     fd = open(path, O_RDONLY);
936122
     lr_free(path);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     ml = lr_metalink_init();
936122
-    fail_if(ml == NULL);
936122
+    ck_assert_ptr_nonnull(ml);
936122
     ret = lr_metalink_parse_file(ml, fd, REPOMD, NULL, NULL, &tmp_err);
936122
-    fail_if(!ret);
936122
-    fail_if(tmp_err);
936122
+    ck_assert(ret);
936122
+    ck_assert_ptr_null(tmp_err);
936122
     close(fd);
936122
 
936122
-    fail_if(ml->filename == NULL);
936122
-    fail_if(strcmp(ml->filename, "repomd.xml"));
936122
-    fail_if(ml->timestamp != 1337942396);
936122
-    fail_if(ml->size != 4309);
936122
-    fail_if(g_slist_length(ml->hashes) != 4);
936122
-    fail_if(g_slist_length(ml->urls) != 106);
936122
+    ck_assert_ptr_nonnull(ml->filename);
936122
+    ck_assert_str_eq(ml->filename, "repomd.xml");
936122
+    ck_assert(ml->timestamp == 1337942396);
936122
+    ck_assert(ml->size == 4309);
936122
+    ck_assert(g_slist_length(ml->hashes) == 4);
936122
+    ck_assert(g_slist_length(ml->urls) == 106);
936122
 
936122
     elem = g_slist_nth(ml->hashes, 0);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     mlhash = elem->data;
936122
-    fail_if(!mlhash);
936122
-    fail_if(mlhash->type == NULL);
936122
-    fail_if(strcmp(mlhash->type, "md5"));
936122
-    fail_if(mlhash->value == NULL);
936122
-    fail_if(strcmp(mlhash->value, "20b6d77930574ae541108e8e7987ad3f"));
936122
+    ck_assert_ptr_nonnull(mlhash);
936122
+    ck_assert_ptr_nonnull(mlhash->type);
936122
+    ck_assert_str_eq(mlhash->type, "md5");
936122
+    ck_assert_ptr_nonnull(mlhash->value);
936122
+    ck_assert_str_eq(mlhash->value, "20b6d77930574ae541108e8e7987ad3f");
936122
 
936122
     elem = g_slist_nth(ml->hashes, 1);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     mlhash = elem->data;
936122
-    fail_if(!mlhash);
936122
-    fail_if(mlhash->type == NULL);
936122
-    fail_if(strcmp(mlhash->type, "sha1"));
936122
-    fail_if(mlhash->value == NULL);
936122
-    fail_if(strcmp(mlhash->value, "4a5ae1831a567b58e2e0f0de1529ca199d1d8319"));
936122
+    ck_assert_ptr_nonnull(mlhash);
936122
+    ck_assert_ptr_nonnull(mlhash->type);
936122
+    ck_assert_str_eq(mlhash->type, "sha1");
936122
+    ck_assert_ptr_nonnull(mlhash->value);
936122
+    ck_assert_str_eq(mlhash->value, "4a5ae1831a567b58e2e0f0de1529ca199d1d8319");
936122
 
936122
     elem = g_slist_nth(ml->hashes, 2);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     mlhash = elem->data;
936122
-    fail_if(!mlhash);
936122
-    fail_if(mlhash->type == NULL);
936122
-    fail_if(strcmp(mlhash->type, "sha256"));
936122
-    fail_if(mlhash->value == NULL);
936122
-    fail_if(strcmp(mlhash->value, "0076c44aabd352da878d5c4d794901ac87f66afac869488f6a4ef166de018cdf"));
936122
+    ck_assert_ptr_nonnull(mlhash);
936122
+    ck_assert_ptr_nonnull(mlhash->type);
936122
+    ck_assert_str_eq(mlhash->type, "sha256");
936122
+    ck_assert_ptr_nonnull(mlhash->value);
936122
+    ck_assert_str_eq(mlhash->value, "0076c44aabd352da878d5c4d794901ac87f66afac869488f6a4ef166de018cdf");
936122
 
936122
     elem = g_slist_nth(ml->hashes, 3);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     mlhash = elem->data;
936122
-    fail_if(!mlhash);
936122
-    fail_if(mlhash->type == NULL);
936122
-    fail_if(strcmp(mlhash->type, "sha512"));
936122
-    fail_if(mlhash->value == NULL);
936122
-    fail_if(strcmp(mlhash->value, "884dc465da67fee8fe3f11dab321a99d9a13b22ce97f84ceff210e82b6b1a8c635ccd196add1dd738807686714c3a0a048897e2d0650bc05302b3ee26de521fd"));
936122
+    ck_assert_ptr_nonnull(mlhash);
936122
+    ck_assert_ptr_nonnull(mlhash->type);
936122
+    ck_assert_str_eq(mlhash->type, "sha512");
936122
+    ck_assert_ptr_nonnull(mlhash->value);
936122
+    ck_assert_str_eq(mlhash->value, "884dc465da67fee8fe3f11dab321a99d9a13b22ce97f84ceff210e82b6b1a8c635ccd196add1dd738807686714c3a0a048897e2d0650bc05302b3ee26de521fd");
936122
 
936122
     elem = g_slist_nth(ml->urls, 0);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     mlurl = elem->data;
936122
-    fail_if(!mlurl);
936122
-    fail_if(mlurl->protocol == NULL);
936122
-    fail_if(strcmp(mlurl->protocol, "http"));
936122
-    fail_if(mlurl->type == NULL);
936122
-    fail_if(strcmp(mlurl->type, "http"));
936122
-    fail_if(mlurl->location == NULL);
936122
-    fail_if(strcmp(mlurl->location, "US"));
936122
-    fail_if(mlurl->preference != 99);
936122
-    fail_if(mlurl->url == NULL);
936122
-    fail_if(strcmp(mlurl->url,
936122
-                   "http://mirror.pnl.gov/fedora/linux/releases/17/Everything/x86_64/os/repodata/repomd.xml"));
936122
+    ck_assert_ptr_nonnull(mlurl);
936122
+    ck_assert_ptr_nonnull(mlurl->protocol);
936122
+    ck_assert_str_eq(mlurl->protocol, "http");
936122
+    ck_assert_ptr_nonnull(mlurl->type);
936122
+    ck_assert_str_eq(mlurl->type, "http");
936122
+    ck_assert_ptr_nonnull(mlurl->location);
936122
+    ck_assert_str_eq(mlurl->location, "US");
936122
+    ck_assert(mlurl->preference == 99);
936122
+    ck_assert_ptr_nonnull(mlurl->url);
936122
+    ck_assert_str_eq(mlurl->url,
936122
+                   "http://mirror.pnl.gov/fedora/linux/releases/17/Everything/x86_64/os/repodata/repomd.xml");
936122
 
936122
     elem = g_slist_nth(ml->urls, 2);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     mlurl = elem->data;
936122
-    fail_if(!mlurl);
936122
-    fail_if(mlurl->protocol == NULL);
936122
-    fail_if(strcmp(mlurl->protocol, "ftp"));
936122
-    fail_if(mlurl->type == NULL);
936122
-    fail_if(strcmp(mlurl->type, "ftp"));
936122
-    fail_if(mlurl->location == NULL);
936122
-    fail_if(strcmp(mlurl->location, "US"));
936122
-    fail_if(mlurl->preference != 98);
936122
-    fail_if(mlurl->url == NULL);
936122
-    fail_if(strcmp(mlurl->url,
936122
-                   "ftp://mirrors.syringanetworks.net/fedora/releases/17/Everything/x86_64/os/repodata/repomd.xml"));
936122
+    ck_assert_ptr_nonnull(mlurl);
936122
+    ck_assert_ptr_nonnull(mlurl->protocol);
936122
+    ck_assert_str_eq(mlurl->protocol, "ftp");
936122
+    ck_assert_ptr_nonnull(mlurl->type);
936122
+    ck_assert_str_eq(mlurl->type, "ftp");
936122
+    ck_assert_ptr_nonnull(mlurl->location);
936122
+    ck_assert_str_eq(mlurl->location, "US");
936122
+    ck_assert(mlurl->preference == 98);
936122
+    ck_assert_ptr_nonnull(mlurl->url);
936122
+    ck_assert_str_eq(mlurl->url,
936122
+                   "ftp://mirrors.syringanetworks.net/fedora/releases/17/Everything/x86_64/os/repodata/repomd.xml");
936122
 
936122
     elem = g_slist_nth(ml->urls, 104);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     mlurl = elem->data;
936122
-    fail_if(!mlurl);
936122
-    fail_if(mlurl->protocol == NULL);
936122
-    fail_if(strcmp(mlurl->protocol, "rsync"));
936122
-    fail_if(mlurl->type == NULL);
936122
-    fail_if(strcmp(mlurl->type, "rsync"));
936122
-    fail_if(mlurl->location == NULL);
936122
-    fail_if(strcmp(mlurl->location, "CA"));
936122
-    fail_if(mlurl->preference != 48);
936122
-    fail_if(mlurl->url == NULL);
936122
-    fail_if(strcmp(mlurl->url,
936122
-                   "rsync://mirror.csclub.uwaterloo.ca/fedora-enchilada/linux/releases/17/Everything/x86_64/os/repodata/repomd.xml"));
936122
+    ck_assert_ptr_nonnull(mlurl);
936122
+    ck_assert_ptr_nonnull(mlurl->protocol);
936122
+    ck_assert_str_eq(mlurl->protocol, "rsync");
936122
+    ck_assert_ptr_nonnull(mlurl->type);
936122
+    ck_assert_str_eq(mlurl->type, "rsync");
936122
+    ck_assert_ptr_nonnull(mlurl->location);
936122
+    ck_assert_str_eq(mlurl->location, "CA");
936122
+    ck_assert(mlurl->preference == 48);
936122
+    ck_assert_ptr_nonnull(mlurl->url);
936122
+    ck_assert_str_eq(mlurl->url,
936122
+                   "rsync://mirror.csclub.uwaterloo.ca/fedora-enchilada/linux/releases/17/Everything/x86_64/os/repodata/repomd.xml");
936122
 
936122
     lr_metalink_free(ml);
936122
 }
936122
@@ -161,35 +161,35 @@ START_TEST(test_metalink_good_02)
936122
                          "metalink_good_02", NULL);
936122
     fd = open(path, O_RDONLY);
936122
     lr_free(path);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     ml = lr_metalink_init();
936122
-    fail_if(ml == NULL);
936122
+    ck_assert_ptr_nonnull(ml);
936122
     ret = lr_metalink_parse_file(ml, fd, REPOMD, NULL, NULL, &tmp_err);
936122
-    fail_if(!ret);
936122
-    fail_if(tmp_err);
936122
+    ck_assert(ret);
936122
+    ck_assert_ptr_null(tmp_err);
936122
     close(fd);
936122
 
936122
-    fail_if(ml->filename == NULL);
936122
-    fail_if(strcmp(ml->filename, "repomd.xml"));
936122
-    fail_if(ml->timestamp != 0);
936122
-    fail_if(ml->size != 0);
936122
-    fail_if(g_slist_length(ml->hashes) != 0);
936122
-    fail_if(g_slist_length(ml->urls) != 3);
936122
+    ck_assert_ptr_nonnull(ml->filename);
936122
+    ck_assert_str_eq(ml->filename, "repomd.xml");
936122
+    ck_assert(ml->timestamp == 0);
936122
+    ck_assert(ml->size == 0);
936122
+    ck_assert(g_slist_length(ml->hashes) == 0);
936122
+    ck_assert(g_slist_length(ml->urls) == 3);
936122
 
936122
     GSList *list = g_slist_nth(ml->urls, 0);
936122
-    fail_if(!list);
936122
+    ck_assert_ptr_nonnull(list);
936122
     LrMetalinkUrl *mlurl = list->data;
936122
-    fail_if(!mlurl);
936122
-    fail_if(mlurl->protocol == NULL);
936122
-    fail_if(strcmp(mlurl->protocol, "http"));
936122
-    fail_if(mlurl->type == NULL);
936122
-    fail_if(strcmp(mlurl->type, "http"));
936122
-    fail_if(mlurl->location == NULL);
936122
-    fail_if(strcmp(mlurl->location, "US"));
936122
-    fail_if(mlurl->preference != 97);
936122
-    fail_if(mlurl->url == NULL);
936122
-    fail_if(strcmp(mlurl->url,
936122
-                   "http://mirror.pnl.gov/fedora/linux/releases/17/Everything/x86_64/os/repodata/repomd.xml"));
936122
+    ck_assert_ptr_nonnull(mlurl);
936122
+    ck_assert_ptr_nonnull(mlurl->protocol);
936122
+    ck_assert_str_eq(mlurl->protocol, "http");
936122
+    ck_assert_ptr_nonnull(mlurl->type);
936122
+    ck_assert_str_eq(mlurl->type, "http");
936122
+    ck_assert_ptr_nonnull(mlurl->location);
936122
+    ck_assert_str_eq(mlurl->location, "US");
936122
+    ck_assert(mlurl->preference == 97);
936122
+    ck_assert_ptr_nonnull(mlurl->url);
936122
+    ck_assert_str_eq(mlurl->url,
936122
+                   "http://mirror.pnl.gov/fedora/linux/releases/17/Everything/x86_64/os/repodata/repomd.xml");
936122
 
936122
     lr_metalink_free(ml);
936122
 }
936122
@@ -207,20 +207,20 @@ START_TEST(test_metalink_good_03)
936122
                          "metalink_good_03", NULL);
936122
     fd = open(path, O_RDONLY);
936122
     lr_free(path);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     ml = lr_metalink_init();
936122
-    fail_if(ml == NULL);
936122
+    ck_assert_ptr_nonnull(ml);
936122
     ret = lr_metalink_parse_file(ml, fd, REPOMD, NULL, NULL, &tmp_err);
936122
-    fail_if(!ret);
936122
-    fail_if(tmp_err);
936122
+    ck_assert(ret);
936122
+    ck_assert_ptr_null(tmp_err);
936122
     close(fd);
936122
 
936122
-    fail_if(ml->filename == NULL);
936122
-    fail_if(strcmp(ml->filename, "repomd.xml"));
936122
-    fail_if(ml->timestamp != 0);
936122
-    fail_if(ml->size != 0);
936122
-    fail_if(g_slist_length(ml->hashes) != 0);
936122
-    fail_if(g_slist_length(ml->urls) != 0);
936122
+    ck_assert_ptr_nonnull(ml->filename);
936122
+    ck_assert_str_eq(ml->filename, "repomd.xml");
936122
+    ck_assert(ml->timestamp == 0);
936122
+    ck_assert(ml->size == 0);
936122
+    ck_assert(g_slist_length(ml->hashes) == 0);
936122
+    ck_assert(g_slist_length(ml->urls) == 0);
936122
 
936122
     lr_metalink_free(ml);
936122
 }
936122
@@ -251,112 +251,110 @@ START_TEST(test_metalink_bad_01)
936122
                          "metalink_bad_01", NULL);
936122
     fd = open(path, O_RDONLY);
936122
     lr_free(path);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     ml = lr_metalink_init();
936122
-    fail_if(ml == NULL);
936122
+    ck_assert_ptr_nonnull(ml);
936122
     int call_counter = 0;
936122
     ret = lr_metalink_parse_file(ml, fd, REPOMD, warning_cb, &call_counter, &tmp_err);
936122
-    fail_if(!ret);
936122
-    fail_if(tmp_err);
936122
-    fail_if(call_counter <= 0);
936122
+    ck_assert(ret);
936122
+    ck_assert_ptr_null(tmp_err);
936122
+    ck_assert_int_gt(call_counter, 0);
936122
     close(fd);
936122
 
936122
-    fail_if(ml->filename == NULL);
936122
-    fail_if(strcmp(ml->filename, "repomd.xml"));
936122
-    fail_if(ml->timestamp != 0);
936122
-    fail_if(ml->size != 0);
936122
-    fail_if(g_slist_length(ml->hashes) != 4);
936122
-    fail_if(g_slist_length(ml->urls) != 4);
936122
-    fail_if(g_slist_length(ml->alternates) != 0);
936122
+    ck_assert_ptr_nonnull(ml->filename);
936122
+    ck_assert_str_eq(ml->filename, "repomd.xml");
936122
+    ck_assert(ml->timestamp == 0);
936122
+    ck_assert(ml->size == 0);
936122
+    ck_assert(g_slist_length(ml->hashes) == 4);
936122
+    ck_assert(g_slist_length(ml->urls) == 4);
936122
+    ck_assert(g_slist_length(ml->alternates) == 0);
936122
 
936122
     elem = g_slist_nth(ml->hashes, 0);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     mlhash = elem->data;
936122
-    fail_if(!mlhash);
936122
-    fail_if(mlhash->type == NULL);
936122
-    fail_if(strcmp(mlhash->type, "md5"));
936122
-    fail_if(mlhash->value == NULL);
936122
-    fail_if(strcmp(mlhash->value,
936122
-                    "20b6d77930574ae541108e8e7987ad3f"));
936122
+    ck_assert_ptr_nonnull(mlhash);
936122
+    ck_assert_ptr_nonnull(mlhash->type);
936122
+    ck_assert_str_eq(mlhash->type, "md5");
936122
+    ck_assert_ptr_nonnull(mlhash->value);
936122
+    ck_assert_str_eq(mlhash->value, "20b6d77930574ae541108e8e7987ad3f");
936122
 
936122
     elem = g_slist_nth(ml->hashes, 1);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     mlhash = elem->data;
936122
-    fail_if(!mlhash);
936122
-    fail_if(mlhash->type == NULL);
936122
-    fail_if(strcmp(mlhash->type, "foo"));
936122
-    fail_if(mlhash->value == NULL);
936122
-    fail_if(strcmp(mlhash->value, ""));
936122
+    ck_assert_ptr_nonnull(mlhash);
936122
+    ck_assert_ptr_nonnull(mlhash->type);
936122
+    ck_assert_str_eq(mlhash->type, "foo");
936122
+    ck_assert_ptr_nonnull(mlhash->value);
936122
+    ck_assert_str_eq(mlhash->value, "");
936122
 
936122
     elem = g_slist_nth(ml->hashes, 2);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     mlhash = elem->data;
936122
-    fail_if(!mlhash);
936122
-    fail_if(mlhash->type == NULL);
936122
-    fail_if(strcmp(mlhash->type, "sha256"));
936122
-    fail_if(mlhash->value == NULL);
936122
-    fail_if(strcmp(mlhash->value,
936122
-                    "0076c44aabd352da878d5c4d794901ac87f66afac869488f6a4ef166de018cdf"));
936122
+    ck_assert_ptr_nonnull(mlhash);
936122
+    ck_assert_ptr_nonnull(mlhash->type);
936122
+    ck_assert_str_eq(mlhash->type, "sha256");
936122
+    ck_assert_ptr_nonnull(mlhash->value);
936122
+    ck_assert_str_eq(mlhash->value, "0076c44aabd352da878d5c4d794901ac87f66afac869488f6a4ef166de018cdf");
936122
 
936122
     elem = g_slist_nth(ml->hashes, 3);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     mlhash = elem->data;
936122
-    fail_if(!mlhash);
936122
-    fail_if(mlhash->type == NULL);
936122
-    fail_if(strcmp(mlhash->type, "sha512"));
936122
-    fail_if(mlhash->value == NULL);
936122
-    fail_if(strcmp(mlhash->value,
936122
-                    "884dc465da67fee8fe3f11dab321a99d9a13b22ce97f84ceff210e82b6b1a8c635ccd196add1dd738807686714c3a0a048897e2d0650bc05302b3ee26de521fd"));
936122
+    ck_assert_ptr_nonnull(mlhash);
936122
+    ck_assert_ptr_nonnull(mlhash->type);
936122
+    ck_assert_str_eq(mlhash->type, "sha512");
936122
+    ck_assert_ptr_nonnull(mlhash->value);
936122
+    ck_assert_str_eq(mlhash->value,
936122
+                    "884dc465da67fee8fe3f11dab321a99d9a13b22ce97f84ceff210e82b6b1a8c635ccd196add1dd738807686714c3a0a048897e2d0650bc05302b3ee26de521fd");
936122
 
936122
     elem = g_slist_nth(ml->urls, 0);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     mlurl = elem->data;
936122
-    fail_if(!mlurl);
936122
-    fail_if(mlurl->protocol == NULL);
936122
-    fail_if(strcmp(mlurl->protocol, "http"));
936122
-    fail_if(mlurl->type == NULL);
936122
-    fail_if(strcmp(mlurl->type, "http"));
936122
-    fail_if(mlurl->location == NULL);
936122
-    fail_if(strcmp(mlurl->location, "US"));
936122
-    fail_if(mlurl->preference != 0);
936122
-    fail_if(mlurl->url == NULL);
936122
-    fail_if(strcmp(mlurl->url,
936122
-                   "http://mirror.pnl.gov/fedora/linux/releases/17/Everything/x86_64/os/repodata/repomd.xml"));
936122
+    ck_assert_ptr_nonnull(mlurl);
936122
+    ck_assert_ptr_nonnull(mlurl->protocol);
936122
+    ck_assert_str_eq(mlurl->protocol, "http");
936122
+    ck_assert_ptr_nonnull(mlurl->type);
936122
+    ck_assert_str_eq(mlurl->type, "http");
936122
+    ck_assert_ptr_nonnull(mlurl->location);
936122
+    ck_assert_str_eq(mlurl->location, "US");
936122
+    ck_assert(mlurl->preference == 0);
936122
+    ck_assert_ptr_nonnull(mlurl->url);
936122
+    ck_assert_str_eq(mlurl->url,
936122
+                   "http://mirror.pnl.gov/fedora/linux/releases/17/Everything/x86_64/os/repodata/repomd.xml");
936122
 
936122
     elem = g_slist_nth(ml->urls, 1);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     mlurl = elem->data;
936122
-    fail_if(!mlurl);
936122
-    fail_if(mlurl->protocol != NULL);
936122
-    fail_if(mlurl->type != NULL);
936122
-    fail_if(mlurl->location != NULL);
936122
-    fail_if(mlurl->preference < 0 || mlurl->preference > 100);
936122
-    fail_if(mlurl->url == NULL);
936122
-    fail_if(strcmp(mlurl->url,
936122
-                   "ftp://mirrors.syringanetworks.net/fedora/releases/17/Everything/x86_64/os/repodata/repomd.xml"));
936122
+    ck_assert_ptr_nonnull(mlurl);
936122
+    ck_assert_ptr_null(mlurl->protocol);
936122
+    ck_assert_ptr_null(mlurl->type);
936122
+    ck_assert_ptr_null(mlurl->location);
936122
+    ck_assert(mlurl->preference >= 0 && mlurl->preference <= 100);
936122
+    ck_assert_ptr_nonnull(mlurl->url);
936122
+    ck_assert_str_eq(mlurl->url,
936122
+                   "ftp://mirrors.syringanetworks.net/fedora/releases/17/Everything/x86_64/os/repodata/repomd.xml");
936122
 
936122
     elem = g_slist_nth(ml->urls, 2);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     mlurl = elem->data;
936122
-    fail_if(!mlurl);
936122
-    fail_if(mlurl->protocol != NULL);
936122
-    fail_if(mlurl->type != NULL);
936122
-    fail_if(mlurl->location != NULL);
936122
-    fail_if(mlurl->preference != 0);
936122
-    fail_if(mlurl->url == NULL);
936122
-    fail_if(strcmp(mlurl->url,
936122
-                   "rsync://mirrors.syringanetworks.net/fedora/releases/17/Everything/x86_64/os/repodata/repomd.xml"));
936122
+    ck_assert_ptr_nonnull(mlurl);
936122
+    ck_assert_ptr_null(mlurl->protocol);
936122
+    ck_assert_ptr_null(mlurl->type);
936122
+    ck_assert_ptr_null(mlurl->location);
936122
+    ck_assert(mlurl->preference == 0);
936122
+    ck_assert_ptr_nonnull(mlurl->url);
936122
+    ck_assert_str_eq(mlurl->url,
936122
+                   "rsync://mirrors.syringanetworks.net/fedora/releases/17/Everything/x86_64/os/repodata/repomd.xml");
936122
 
936122
     elem = g_slist_nth(ml->urls, 3);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     mlurl = elem->data;
936122
-    fail_if(!mlurl);
936122
-    fail_if(mlurl->protocol != NULL);
936122
-    fail_if(mlurl->type != NULL);
936122
-    fail_if(mlurl->location != NULL);
936122
-    fail_if(mlurl->preference != 0);
936122
-    fail_if(mlurl->url == NULL);
936122
-    fail_if(strcmp(mlurl->url, ""));
936122
+    ck_assert_ptr_nonnull(mlurl);
936122
+    ck_assert_ptr_null(mlurl->protocol);
936122
+    ck_assert_ptr_null(mlurl->type);
936122
+    ck_assert_ptr_null(mlurl->location);
936122
+    ck_assert(mlurl->preference == 0);
936122
+    ck_assert_ptr_nonnull(mlurl->url);
936122
+    ck_assert_str_eq(mlurl->url, "");
936122
 
936122
     lr_metalink_free(ml);
936122
 }
936122
@@ -374,14 +372,14 @@ START_TEST(test_metalink_bad_02)
936122
                          "metalink_bad_02", NULL);
936122
     fd = open(path, O_RDONLY);
936122
     lr_free(path);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     ml = lr_metalink_init();
936122
-    fail_if(ml == NULL);
936122
+    ck_assert_ptr_nonnull(ml);
936122
     ret = lr_metalink_parse_file(ml, fd, REPOMD, NULL, NULL, &tmp_err);
936122
-    fail_if(!ret);
936122
-    fail_if(tmp_err);
936122
+    ck_assert(ret);
936122
+    ck_assert_ptr_null(tmp_err);
936122
     close(fd);
936122
-    fail_if(g_slist_length(ml->urls) != 0);
936122
+    ck_assert(g_slist_length(ml->urls) == 0);
936122
     lr_metalink_free(ml);
936122
 }
936122
 END_TEST
936122
@@ -398,12 +396,12 @@ START_TEST(test_metalink_really_bad_01)
936122
                          "metalink_really_bad_01", NULL);
936122
     fd = open(path, O_RDONLY);
936122
     lr_free(path);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     ml = lr_metalink_init();
936122
-    fail_if(ml == NULL);
936122
+    ck_assert_ptr_nonnull(ml);
936122
     ret = lr_metalink_parse_file(ml, fd, REPOMD, NULL, NULL, &tmp_err);
936122
-    fail_if(ret);
936122
-    fail_if(!tmp_err);
936122
+    ck_assert(!ret);
936122
+    ck_assert_ptr_nonnull(tmp_err);
936122
     g_error_free(tmp_err);
936122
     close(fd);
936122
     lr_metalink_free(ml);
936122
@@ -422,12 +420,12 @@ START_TEST(test_metalink_really_bad_02)
936122
                          "metalink_really_bad_02", NULL);
936122
     fd = open(path, O_RDONLY);
936122
     lr_free(path);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     ml = lr_metalink_init();
936122
-    fail_if(ml == NULL);
936122
+    ck_assert_ptr_nonnull(ml);
936122
     ret = lr_metalink_parse_file(ml, fd, REPOMD, NULL, NULL, &tmp_err);
936122
-    fail_if(ret);
936122
-    fail_if(!tmp_err);
936122
+    ck_assert(!ret);
936122
+    ck_assert_ptr_nonnull(tmp_err);
936122
     g_error_free(tmp_err);
936122
     close(fd);
936122
     lr_metalink_free(ml);
936122
@@ -446,12 +444,12 @@ START_TEST(test_metalink_really_bad_03)
936122
                          "metalink_really_bad_03", NULL);
936122
     fd = open(path, O_RDONLY);
936122
     lr_free(path);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     ml = lr_metalink_init();
936122
-    fail_if(ml == NULL);
936122
+    ck_assert_ptr_nonnull(ml);
936122
     ret = lr_metalink_parse_file(ml, fd, REPOMD, NULL, NULL, &tmp_err);
936122
-    fail_if(ret);
936122
-    fail_if(!tmp_err);
936122
+    ck_assert(!ret);
936122
+    ck_assert_ptr_nonnull(tmp_err);
936122
     g_error_free(tmp_err);
936122
     close(fd);
936122
     lr_metalink_free(ml);
936122
@@ -473,41 +471,41 @@ START_TEST(test_metalink_with_alternates)
936122
                          "metalink_with_alternates", NULL);
936122
     fd = open(path, O_RDONLY);
936122
     lr_free(path);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     ml = lr_metalink_init();
936122
-    fail_if(ml == NULL);
936122
+    ck_assert_ptr_nonnull(ml);
936122
     ret = lr_metalink_parse_file(ml, fd, REPOMD, NULL, NULL, &tmp_err);
936122
-    fail_if(!ret);
936122
-    fail_if(tmp_err);
936122
+    ck_assert(ret);
936122
+    ck_assert_ptr_null(tmp_err);
936122
     close(fd);
936122
 
936122
-    fail_if(ml->filename == NULL);
936122
-    fail_if(strcmp(ml->filename, "repomd.xml"));
936122
-    fail_if(g_slist_length(ml->hashes) != 4);
936122
-    fail_if(g_slist_length(ml->alternates) != 1);
936122
+    ck_assert_ptr_nonnull(ml->filename);
936122
+    ck_assert_str_eq(ml->filename, "repomd.xml");
936122
+    ck_assert(g_slist_length(ml->hashes) == 4);
936122
+    ck_assert(g_slist_length(ml->alternates) == 1);
936122
 
936122
     elem = g_slist_nth(ml->hashes, 0);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     mlhash = elem->data;
936122
-    fail_if(!mlhash);
936122
-    fail_if(mlhash->type == NULL);
936122
-    fail_if(strcmp(mlhash->type, "md5"));
936122
-    fail_if(mlhash->value == NULL);
936122
-    fail_if(strcmp(mlhash->value, "0ffcd7798421c9a6760f3e4202cc4675"));
936122
+    ck_assert_ptr_nonnull(mlhash);
936122
+    ck_assert_ptr_nonnull(mlhash->type);
936122
+    ck_assert_str_eq(mlhash->type, "md5");
936122
+    ck_assert_ptr_nonnull(mlhash->value);
936122
+    ck_assert_str_eq(mlhash->value, "0ffcd7798421c9a6760f3e4202cc4675");
936122
 
936122
     elem = g_slist_nth(ml->alternates, 0);
936122
-    fail_if(!elem);
936122
+    ck_assert_ptr_nonnull(elem);
936122
     malternate = elem->data;
936122
-    fail_if(malternate->timestamp != 1381706941);
936122
-    fail_if(malternate->size != 4761);
936122
-    fail_if(g_slist_length(malternate->hashes) != 4);
936122
+    ck_assert(malternate->timestamp == 1381706941);
936122
+    ck_assert(malternate->size == 4761);
936122
+    ck_assert(g_slist_length(malternate->hashes) == 4);
936122
     elem = g_slist_nth(malternate->hashes, 0);
936122
     mlhash = elem->data;
936122
-    fail_if(!mlhash);
936122
-    fail_if(mlhash->type == NULL);
936122
-    fail_if(strcmp(mlhash->type, "md5"));
936122
-    fail_if(mlhash->value == NULL);
936122
-    fail_if(strcmp(mlhash->value, "0c5b64d395d5364633df7c8e97a07fd6"));
936122
+    ck_assert_ptr_nonnull(mlhash);
936122
+    ck_assert_ptr_nonnull(mlhash->type);
936122
+    ck_assert_str_eq(mlhash->type, "md5");
936122
+    ck_assert_ptr_nonnull(mlhash->value);
936122
+    ck_assert_str_eq(mlhash->value, "0c5b64d395d5364633df7c8e97a07fd6");
936122
 
936122
     lr_metalink_free(ml);
936122
 }
936122
diff --git a/tests/test_mirrorlist.c b/tests/test_mirrorlist.c
936122
index 6ccf2537..cc00b7fc 100644
936122
--- a/tests/test_mirrorlist.c
936122
+++ b/tests/test_mirrorlist.c
936122
@@ -18,7 +18,7 @@ START_TEST(test_mirrorlist_init)
936122
     LrMirrorlist *ml = NULL;
936122
 
936122
     ml = lr_mirrorlist_init();
936122
-    fail_if(ml == NULL);
936122
+    ck_assert_ptr_nonnull(ml);
936122
     lr_mirrorlist_free(ml);
936122
 }
936122
 END_TEST
936122
@@ -36,23 +36,23 @@ START_TEST(test_mirrorlist_01)
936122
                          "mirrorlist_01", NULL);
936122
     fd = open(path, O_RDONLY);
936122
     lr_free(path);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     ml = lr_mirrorlist_init();
936122
-    fail_if(ml == NULL);
936122
+    ck_assert_ptr_nonnull(ml);
936122
     ret = lr_mirrorlist_parse_file(ml, fd, &tmp_err);
936122
     close(fd);
936122
-    fail_if(!ret);
936122
-    fail_if(tmp_err);
936122
+    ck_assert(ret);
936122
+    ck_assert_ptr_null(tmp_err);
936122
 
936122
-    fail_if(g_slist_length(ml->urls) != 2);
936122
+    ck_assert(g_slist_length(ml->urls) == 2);
936122
 
936122
     elem = g_slist_nth(ml->urls, 0);
936122
-    fail_if(!elem);
936122
-    fail_if(g_strcmp0(elem->data, "http://foo.bar/fedora/linux/"));
936122
+    ck_assert_ptr_nonnull(elem);
936122
+    ck_assert_str_eq(elem->data, "http://foo.bar/fedora/linux/");
936122
 
936122
     elem = g_slist_nth(ml->urls, 1);
936122
-    fail_if(!elem);
936122
-    fail_if(g_strcmp0(elem->data, "ftp://ftp.bar.foo/Fedora/17/"));
936122
+    ck_assert_ptr_nonnull(elem);
936122
+    ck_assert_str_eq(elem->data, "ftp://ftp.bar.foo/Fedora/17/");
936122
     lr_mirrorlist_free(ml);
936122
 }
936122
 END_TEST
936122
@@ -69,14 +69,14 @@ START_TEST(test_mirrorlist_02)
936122
                          "mirrorlist_02", NULL);
936122
     fd = open(path, O_RDONLY);
936122
     lr_free(path);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     ml = lr_mirrorlist_init();
936122
-    fail_if(ml == NULL);
936122
+    ck_assert_ptr_nonnull(ml);
936122
     ret = lr_mirrorlist_parse_file(ml, fd, &tmp_err);
936122
     close(fd);
936122
-    fail_if(!ret);
936122
-    fail_if(tmp_err);
936122
-    fail_if(g_slist_length(ml->urls) != 0);
936122
+    ck_assert(ret);
936122
+    ck_assert_ptr_null(tmp_err);
936122
+    ck_assert(g_slist_length(ml->urls) == 0);
936122
     lr_mirrorlist_free(ml);
936122
 }
936122
 END_TEST
936122
@@ -93,14 +93,14 @@ START_TEST(test_mirrorlist_03)
936122
                          "mirrorlist_03", NULL);
936122
     fd = open(path, O_RDONLY);
936122
     lr_free(path);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     ml = lr_mirrorlist_init();
936122
-    fail_if(ml == NULL);
936122
+    ck_assert_ptr_nonnull(ml);
936122
     ret = lr_mirrorlist_parse_file(ml, fd, &tmp_err);
936122
     close(fd);
936122
-    fail_if(!ret);
936122
-    fail_if(tmp_err);
936122
-    fail_if(g_slist_length(ml->urls) != 0);
936122
+    ck_assert(ret);
936122
+    ck_assert_ptr_null(tmp_err);
936122
+    ck_assert(g_slist_length(ml->urls) == 0);
936122
     lr_mirrorlist_free(ml);
936122
 }
936122
 END_TEST
936122
diff --git a/tests/test_package_downloader.c b/tests/test_package_downloader.c
936122
index b384bef8..3263ba02 100644
936122
--- a/tests/test_package_downloader.c
936122
+++ b/tests/test_package_downloader.c
936122
@@ -25,19 +25,19 @@ START_TEST(test_package_downloader_new_and_free)
936122
 
936122
     target = lr_packagetarget_new(NULL, "url", NULL, 0, NULL, 0, NULL, FALSE,
936122
                                   NULL, NULL, &err;;
936122
-    fail_if(!target);
936122
-    fail_if(err);
936122
+    ck_assert_ptr_nonnull(target);
936122
+    ck_assert_ptr_null(err);
936122
 
936122
-    fail_if(strcmp(target->relative_url, "url"));
936122
-    fail_if(target->dest);
936122
-    fail_if(target->base_url);
936122
-    fail_if(target->checksum_type != 0);
936122
-    fail_if(target->checksum);
936122
-    fail_if(target->resume != FALSE);
936122
-    fail_if(target->progresscb);
936122
-    fail_if(target->cbdata);
936122
-    fail_if(target->local_path);
936122
-    fail_if(target->err);
936122
+    ck_assert_str_eq(target->relative_url, "url");
936122
+    ck_assert_ptr_null(target->dest);
936122
+    ck_assert_ptr_null(target->base_url);
936122
+    ck_assert(target->checksum_type == 0);
936122
+    ck_assert_ptr_null(target->checksum);
936122
+    ck_assert(target->resume == FALSE);
936122
+    ck_assert(!target->progresscb);
936122
+    ck_assert_ptr_null(target->cbdata);
936122
+    ck_assert_ptr_null(target->local_path);
936122
+    ck_assert_ptr_null(target->err);
936122
 
936122
     lr_packagetarget_free(target);
936122
     target = NULL;
936122
@@ -47,19 +47,19 @@ START_TEST(test_package_downloader_new_and_free)
936122
     target = lr_packagetarget_new(NULL, "url", "dest", LR_CHECKSUM_SHA384,
936122
                                   "xxx", 0, "baseurl", TRUE, (LrProgressCb) 22,
936122
                                   (void *) 33, &err;;
936122
-    fail_if(!target);
936122
-    fail_if(err);
936122
+    ck_assert_ptr_nonnull(target);
936122
+    ck_assert_ptr_null(err);
936122
 
936122
-    fail_if(strcmp(target->relative_url, "url"));
936122
-    fail_if(strcmp(target->dest, "dest"));
936122
-    fail_if(strcmp(target->base_url, "baseurl"));
936122
-    fail_if(target->checksum_type != LR_CHECKSUM_SHA384);
936122
-    fail_if(strcmp(target->checksum, "xxx"));
936122
-    fail_if(target->resume != TRUE);
936122
-    fail_if(target->progresscb != (LrProgressCb) 22);
936122
-    fail_if(target->cbdata != (void *) 33);
936122
-    fail_if(target->local_path);
936122
-    fail_if(target->err);
936122
+    ck_assert_str_eq(target->relative_url, "url");
936122
+    ck_assert_str_eq(target->dest, "dest");
936122
+    ck_assert_str_eq(target->base_url, "baseurl");
936122
+    ck_assert(target->checksum_type == LR_CHECKSUM_SHA384);
936122
+    ck_assert_str_eq(target->checksum, "xxx");
936122
+    ck_assert(target->resume == TRUE);
936122
+    ck_assert(target->progresscb == (LrProgressCb) 22);
936122
+    ck_assert_ptr_eq(target->cbdata, (void *) 33);
936122
+    ck_assert_ptr_null(target->local_path);
936122
+    ck_assert_ptr_null(target->err);
936122
 
936122
     lr_packagetarget_free(target);
936122
     target = NULL;
936122
diff --git a/tests/test_repo_zck.c b/tests/test_repo_zck.c
936122
index a2299a8d..e68b1442 100644
936122
--- a/tests/test_repo_zck.c
936122
+++ b/tests/test_repo_zck.c
936122
@@ -23,22 +23,22 @@ START_TEST(test_repo_zck_parsing)
936122
                                 "repo_yum_03/repodata/repomd.xml",
936122
                                 NULL);
936122
     repomd = lr_yum_repomd_init();
936122
-    fail_if(!repomd);
936122
+    ck_assert_ptr_nonnull(repomd);
936122
     fd = open(repomd_path, O_RDONLY);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
 
936122
     ret = lr_yum_repomd_parse_file(repomd, fd, NULL, NULL, &tmp_err);
936122
     close(fd);
936122
 
936122
-    fail_if(!ret);
936122
-    fail_if(tmp_err);
936122
-    fail_if(g_slist_length(repomd->records) != 12);
936122
-    fail_if(!lr_yum_repomd_get_record(repomd, "primary"));
936122
-    fail_if(!lr_yum_repomd_get_record(repomd, "filelists"));
936122
-    fail_if(!lr_yum_repomd_get_record(repomd, "other"));
936122
+    ck_assert(ret);
936122
+    ck_assert_ptr_null(tmp_err);
936122
+    ck_assert(g_slist_length(repomd->records) == 12);
936122
+    ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "primary"));
936122
+    ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "filelists"));
936122
+    ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "other"));
936122
 
936122
-    fail_if(lr_yum_repomd_get_record(repomd, "foo"));
936122
-    fail_if(lr_yum_repomd_get_record(repomd, "bar"));
936122
+    ck_assert_ptr_null(lr_yum_repomd_get_record(repomd, "foo"));
936122
+    ck_assert_ptr_null(lr_yum_repomd_get_record(repomd, "bar"));
936122
 
936122
     lr_yum_repomd_free(repomd);
936122
     lr_free(repomd_path);
936122
diff --git a/tests/test_repoconf.c b/tests/test_repoconf.c
936122
index 5c85047e..0036b500 100644
936122
--- a/tests/test_repoconf.c
936122
+++ b/tests/test_repoconf.c
936122
@@ -304,19 +304,19 @@ START_TEST(test_parse_repoconf_minimal)
936122
     path = lr_pathconcat(test_globals.testdata_dir, "repo-minimal.repo", NULL);
936122
 
936122
     confs = lr_yum_repoconfs_init();
936122
-    fail_if(!confs);
936122
+    ck_assert_ptr_nonnull(confs);
936122
 
936122
     ret = lr_yum_repoconfs_parse(confs, path, &tmp_err);
936122
-    fail_if(!ret);
936122
+    ck_assert(ret);
936122
 
936122
     list = lr_yum_repoconfs_get_list(confs, &tmp_err);
936122
-    fail_if(!list);
936122
-    fail_if(g_slist_length(list) != 2);
936122
+    ck_assert_ptr_nonnull(list);
936122
+    ck_assert(g_slist_length(list) == 2);
936122
 
936122
     // Test content of first repo config
936122
 
936122
     conf = g_slist_nth_data(list, 0);
936122
-    fail_if(!conf);
936122
+    ck_assert_ptr_nonnull(conf);
936122
 
936122
     conf_assert_str_eq(LR_YRC_ID, "minimal-repo-1");
936122
     conf_assert_str_eq(LR_YRC_NAME, "Minimal repo 1 - $basearch");
936122
@@ -363,7 +363,7 @@ START_TEST(test_parse_repoconf_minimal)
936122
     // Test content of second repo config
936122
 
936122
     conf = g_slist_nth_data(list, 1);
936122
-    fail_if(!conf);
936122
+    ck_assert_ptr_nonnull(conf);
936122
 
936122
     conf_assert_str_eq(LR_YRC_ID, "minimal-repo-2");
936122
     conf_assert_str_eq(LR_YRC_NAME, "Minimal repo 2 - $basearch");
936122
@@ -423,17 +423,17 @@ START_TEST(test_parse_repoconf_big)
936122
     path = lr_pathconcat(test_globals.testdata_dir, "repo-big.repo", NULL);
936122
 
936122
     confs = lr_yum_repoconfs_init();
936122
-    fail_if(!confs);
936122
+    ck_assert_ptr_nonnull(confs);
936122
 
936122
     ret = lr_yum_repoconfs_parse(confs, path, &tmp_err);
936122
-    fail_if(!ret);
936122
+    ck_assert(ret);
936122
 
936122
     list = lr_yum_repoconfs_get_list(confs, &tmp_err);
936122
-    fail_if(!list);
936122
-    fail_if(g_slist_length(list) != 1);
936122
+    ck_assert_ptr_nonnull(list);
936122
+    ck_assert(g_slist_length(list) == 1);
936122
 
936122
     conf = g_slist_nth_data(list, 0);
936122
-    fail_if(!conf);
936122
+    ck_assert_ptr_nonnull(conf);
936122
 
936122
     conf_assert_str_eq(LR_YRC_ID, "big-repo");
936122
     conf_assert_str_eq(LR_YRC_NAME, "Maxi repo - $basearch");
936122
@@ -504,7 +504,7 @@ START_TEST(test_write_repoconf)
936122
 
936122
     // Create a temporary file
936122
     fd = mkstemp(tmpfn);
936122
-    fail_if(fd == -1);
936122
+    ck_assert_int_ne(fd, -1);
936122
 
936122
     // Create reconfs with one repoconf with one id (one section)
936122
     confs = lr_yum_repoconfs_init();
936122
diff --git a/tests/test_repomd.c b/tests/test_repomd.c
936122
index 3dda8337..4c9300d6 100644
936122
--- a/tests/test_repomd.c
936122
+++ b/tests/test_repomd.c
936122
@@ -23,31 +23,31 @@ START_TEST(test_repomd_parsing)
936122
                                 "repo_yum_02/repodata/repomd.xml",
936122
                                 NULL);
936122
     repomd = lr_yum_repomd_init();
936122
-    fail_if(!repomd);
936122
+    ck_assert_ptr_nonnull(repomd);
936122
     fd = open(repomd_path, O_RDONLY);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
 
936122
     ret = lr_yum_repomd_parse_file(repomd, fd, NULL, NULL, &tmp_err);
936122
     close(fd);
936122
 
936122
-    fail_if(!ret);
936122
-    fail_if(tmp_err);
936122
-    fail_if(g_slist_length(repomd->records) != 12);
936122
-    fail_if(!lr_yum_repomd_get_record(repomd, "primary"));
936122
-    fail_if(!lr_yum_repomd_get_record(repomd, "filelists"));
936122
-    fail_if(!lr_yum_repomd_get_record(repomd, "other"));
936122
-    fail_if(!lr_yum_repomd_get_record(repomd, "primary_db"));
936122
-    fail_if(!lr_yum_repomd_get_record(repomd, "filelists_db"));
936122
-    fail_if(!lr_yum_repomd_get_record(repomd, "other_db"));
936122
-    fail_if(!lr_yum_repomd_get_record(repomd, "group"));
936122
-    fail_if(!lr_yum_repomd_get_record(repomd, "group_gz"));
936122
-    fail_if(!lr_yum_repomd_get_record(repomd, "updateinfo"));
936122
-    fail_if(!lr_yum_repomd_get_record(repomd, "origin"));
936122
-    fail_if(!lr_yum_repomd_get_record(repomd, "prestodelta"));
936122
-    fail_if(!lr_yum_repomd_get_record(repomd, "deltainfo"));
936122
+    ck_assert(ret);
936122
+    ck_assert_ptr_null(tmp_err);
936122
+    ck_assert(g_slist_length(repomd->records) == 12);
936122
+    ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "primary"));
936122
+    ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "filelists"));
936122
+    ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "other"));
936122
+    ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "primary_db"));
936122
+    ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "filelists_db"));
936122
+    ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "other_db"));
936122
+    ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "group"));
936122
+    ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "group_gz"));
936122
+    ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "updateinfo"));
936122
+    ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "origin"));
936122
+    ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "prestodelta"));
936122
+    ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "deltainfo"));
936122
 
936122
-    fail_if(lr_yum_repomd_get_record(repomd, "foo"));
936122
-    fail_if(lr_yum_repomd_get_record(repomd, "bar"));
936122
+    ck_assert_ptr_null(lr_yum_repomd_get_record(repomd, "foo"));
936122
+    ck_assert_ptr_null(lr_yum_repomd_get_record(repomd, "bar"));
936122
 
936122
     lr_yum_repomd_free(repomd);
936122
     lr_free(repomd_path);
936122
diff --git a/tests/test_url_substitution.c b/tests/test_url_substitution.c
936122
index e3d53a79..b0086a8c 100644
936122
--- a/tests/test_url_substitution.c
936122
+++ b/tests/test_url_substitution.c
936122
@@ -20,22 +20,22 @@ START_TEST(test_urlvars_set)
936122
     LrUrlVars *urlvars = NULL;
936122
 
936122
     urlvars = lr_urlvars_set(urlvars, "foo", "bar");
936122
-    fail_if(urlvars == NULL);
936122
-    fail_if(strcmp(((LrVar *)urlvars->data)->var, "foo") != 0);
936122
+    ck_assert_ptr_nonnull(urlvars);
936122
+    ck_assert_str_eq(((LrVar *)urlvars->data)->var, "foo");
936122
 
936122
     urlvars = lr_urlvars_set(urlvars, "foo1", "bar1");
936122
-    fail_if(urlvars == NULL);
936122
+    ck_assert_ptr_nonnull(urlvars);
936122
 
936122
     urlvars = lr_urlvars_set(urlvars, "foo", NULL);
936122
-    fail_if(urlvars == NULL);
936122
-    fail_if(strcmp(((LrVar *)urlvars->data)->var, "foo1") != 0);
936122
+    ck_assert_ptr_nonnull(urlvars);
936122
+    ck_assert_str_eq(((LrVar *)urlvars->data)->var, "foo1");
936122
 
936122
     urlvars = lr_urlvars_set(urlvars, "foo1", NULL);
936122
-    fail_if(urlvars != NULL);
936122
+    ck_assert_ptr_null(urlvars);
936122
 
936122
     urlvars = lr_urlvars_set(urlvars, "bar", "foo");
936122
-    fail_if(urlvars == NULL);
936122
-    fail_if(strcmp(((LrVar *)urlvars->data)->var, "bar") != 0);
936122
+    ck_assert_ptr_nonnull(urlvars);
936122
+    ck_assert_str_eq(((LrVar *)urlvars->data)->var, "bar");
936122
 
936122
     lr_urlvars_free(urlvars);
936122
 }
936122
@@ -49,19 +49,19 @@ START_TEST(test_url_substitute_without_urlvars)
936122
     urlvars = lr_urlvars_set(urlvars, "foo", "bar");
936122
 
936122
     url = lr_url_substitute("", urlvars);
936122
-    fail_if(strcmp(url, ""));
936122
+    ck_assert_str_eq(url, "");
936122
     lr_free(url);
936122
 
936122
     url = lr_url_substitute("http://foo", urlvars);
936122
-    fail_if(strcmp(url, "http://foo"));
936122
+    ck_assert_str_eq(url, "http://foo");
936122
     lr_free(url);
936122
 
936122
     url = lr_url_substitute("http://foo?id=$bar", urlvars);
936122
-    fail_if(strcmp(url, "http://foo?id=$bar"));
936122
+    ck_assert_str_eq(url, "http://foo?id=$bar");
936122
     lr_free(url);
936122
 
936122
     url = lr_url_substitute("http://foo?id=$foox", urlvars);
936122
-    fail_if(strcmp(url, "http://foo?id=$foox"));
936122
+    ck_assert_str_eq(url, "http://foo?id=$foox");
936122
     lr_free(url);
936122
 
936122
     lr_urlvars_free(urlvars);
936122
@@ -78,31 +78,31 @@ START_TEST(test_url_substitute)
936122
     urlvars = lr_urlvars_set(urlvars, "bar", "repo");
936122
 
936122
     url = lr_url_substitute("", urlvars);
936122
-    fail_if(strcmp(url, ""));
936122
+    ck_assert_str_eq(url, "");
936122
     lr_free(url);
936122
 
936122
     url = lr_url_substitute("http://foo", urlvars);
936122
-    fail_if(strcmp(url, "http://foo"));
936122
+    ck_assert_str_eq(url, "http://foo");
936122
     lr_free(url);
936122
 
936122
     url = lr_url_substitute("http://foo?id=$bar", urlvars);
936122
-    fail_if(strcmp(url, "http://foo?id=repo"));
936122
+    ck_assert_str_eq(url, "http://foo?id=repo");
936122
     lr_free(url);
936122
 
936122
     url = lr_url_substitute("http://$foo?id=$bar", urlvars);
936122
-    fail_if(strcmp(url, "http://version?id=repo"));
936122
+    ck_assert_str_eq(url, "http://version?id=repo");
936122
     lr_free(url);
936122
 
936122
     url = lr_url_substitute("http://$fo?id=$bar", urlvars);
936122
-    fail_if(strcmp(url, "http://ver?id=repo"));
936122
+    ck_assert_str_eq(url, "http://ver?id=repo");
936122
     lr_free(url);
936122
 
936122
     url = lr_url_substitute("http://$foo$bar", urlvars);
936122
-    fail_if(strcmp(url, "http://versionrepo"));
936122
+    ck_assert_str_eq(url, "http://versionrepo");
936122
     lr_free(url);
936122
 
936122
     url = lr_url_substitute("http://$foo$bar/", urlvars);
936122
-    fail_if(strcmp(url, "http://versionrepo/"));
936122
+    ck_assert_str_eq(url, "http://versionrepo/");
936122
     lr_free(url);
936122
 
936122
     lr_urlvars_free(urlvars);
936122
@@ -119,27 +119,27 @@ START_TEST(test_url_substitute_braces)
936122
     urlvars = lr_urlvars_set(urlvars, "bar", "repo");
936122
 
936122
     url = lr_url_substitute("http://foo?id=${bar}", urlvars);
936122
-    fail_if(strcmp(url, "http://foo?id=repo"));
936122
+    ck_assert_str_eq(url, "http://foo?id=repo");
936122
     lr_free(url);
936122
 
936122
     url = lr_url_substitute("http://${foo}?id=${bar}", urlvars);
936122
-    fail_if(strcmp(url, "http://version?id=repo"));
936122
+    ck_assert_str_eq(url, "http://version?id=repo");
936122
     lr_free(url);
936122
 
936122
     url = lr_url_substitute("http://${fo}?id=$bar", urlvars);
936122
-    fail_if(strcmp(url, "http://ver?id=repo"));
936122
+    ck_assert_str_eq(url, "http://ver?id=repo");
936122
     lr_free(url);
936122
 
936122
     url = lr_url_substitute("http://${fo?id=$bar", urlvars);
936122
-    fail_if(strcmp(url, "http://${fo?id=repo"));
936122
+    ck_assert_str_eq(url, "http://${fo?id=repo");
936122
     lr_free(url);
936122
 
936122
     url = lr_url_substitute("http://${foo${bar}", urlvars);
936122
-    fail_if(strcmp(url, "http://${foorepo"));
936122
+    ck_assert_str_eq(url, "http://${foorepo");
936122
     lr_free(url);
936122
 
936122
     url = lr_url_substitute("http://${foo}${bar}/", urlvars);
936122
-    fail_if(strcmp(url, "http://versionrepo/"));
936122
+    ck_assert_str_eq(url, "http://versionrepo/");
936122
     lr_free(url);
936122
 
936122
     lr_urlvars_free(urlvars);
936122
diff --git a/tests/test_util.c b/tests/test_util.c
936122
index b3b2b6dd..595b0fef 100644
936122
--- a/tests/test_util.c
936122
+++ b/tests/test_util.c
936122
@@ -18,7 +18,7 @@ START_TEST(test_malloc)
936122
 {
936122
     long long *num = NULL;
936122
     num = lr_malloc0(sizeof(long long));
936122
-    fail_if(num == NULL);
936122
+    ck_assert_ptr_nonnull(num);
936122
     lr_free(num);
936122
 }
936122
 END_TEST
936122
@@ -27,8 +27,8 @@ START_TEST(test_malloc0)
936122
 {
936122
     long long *num = NULL;
936122
     num = lr_malloc0(sizeof(long long));
936122
-    fail_if(num == NULL);
936122
-    fail_if(*num != 0LL);
936122
+    ck_assert_ptr_nonnull(num);
936122
+    ck_assert(*num == 0LL);
936122
     lr_free(num);
936122
 }
936122
 END_TEST
936122
@@ -44,7 +44,7 @@ START_TEST(test_gettmpfile)
936122
 {
936122
     int fd = 0;
936122
     fd = lr_gettmpfile();
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     close(fd);
936122
 }
936122
 END_TEST
936122
@@ -52,8 +52,8 @@ END_TEST
936122
 START_TEST(test_gettmpdir)
936122
 {
936122
     char *tmp_dir = lr_gettmpdir();
936122
-    fail_if(tmp_dir == NULL);
936122
-    fail_if(rmdir(tmp_dir) != 0);
936122
+    ck_assert_ptr_nonnull(tmp_dir);
936122
+    ck_assert_int_eq(rmdir(tmp_dir), 0);
936122
     lr_free(tmp_dir);
936122
 }
936122
 END_TEST
936122
@@ -63,47 +63,47 @@ START_TEST(test_pathconcat)
936122
     char *path = NULL;
936122
 
936122
     path = lr_pathconcat(NULL, NULL);
936122
-    fail_if(path != NULL);
936122
+    ck_assert_ptr_null(path);
936122
 
936122
     path = lr_pathconcat("", NULL);
936122
-    fail_if(path == NULL);
936122
-    fail_if(strcmp(path, ""));
936122
+    ck_assert_ptr_nonnull(path);
936122
+    ck_assert_str_eq(path, "");
936122
     lr_free(path);
936122
     path = NULL;
936122
 
936122
     path = lr_pathconcat("/tmp", "foo///", "bar", NULL);
936122
-    fail_if(path == NULL);
936122
-    fail_if(strcmp(path, "/tmp/foo/bar"));
936122
+    ck_assert_ptr_nonnull(path);
936122
+    ck_assert_str_eq(path, "/tmp/foo/bar");
936122
     lr_free(path);
936122
     path = NULL;
936122
 
936122
     path = lr_pathconcat("foo", "bar/", NULL);
936122
-    fail_if(path == NULL);
936122
-    fail_if(strcmp(path, "foo/bar"));
936122
+    ck_assert_ptr_nonnull(path);
936122
+    ck_assert_str_eq(path, "foo/bar");
936122
     lr_free(path);
936122
     path = NULL;
936122
 
936122
     path = lr_pathconcat("foo", "/bar/", NULL);
936122
-    fail_if(path == NULL);
936122
-    fail_if(strcmp(path, "foo/bar"));
936122
+    ck_assert_ptr_nonnull(path);
936122
+    ck_assert_str_eq(path, "foo/bar");
936122
     lr_free(path);
936122
     path = NULL;
936122
 
936122
     path = lr_pathconcat("foo", "bar", "", NULL);
936122
-    fail_if(path == NULL);
936122
-    fail_if(strcmp(path, "foo/bar/"));
936122
+    ck_assert_ptr_nonnull(path);
936122
+    ck_assert_str_eq(path, "foo/bar/");
936122
     lr_free(path);
936122
     path = NULL;
936122
 
936122
     path = lr_pathconcat("http://host.net", "path/to/somewhere", NULL);
936122
-    fail_if(path == NULL);
936122
-    fail_if(strcmp(path, "http://host.net/path/to/somewhere"));
936122
+    ck_assert_ptr_nonnull(path);
936122
+    ck_assert_str_eq(path, "http://host.net/path/to/somewhere");
936122
     lr_free(path);
936122
     path = NULL;
936122
 
936122
     path = lr_pathconcat("http://host.net?hello=1", "path/to/", "somewhere", NULL);
936122
-    fail_if(path == NULL);
936122
-    fail_if(strcmp(path, "http://host.net/path/to/somewhere?hello=1"));
936122
+    ck_assert_ptr_nonnull(path);
936122
+    ck_assert_str_eq(path, "http://host.net/path/to/somewhere?hello=1");
936122
     lr_free(path);
936122
     path = NULL;
936122
 }
936122
@@ -116,16 +116,16 @@ START_TEST(test_remove_dir)
936122
     int fd, rc;
936122
 
936122
     tmp_dir = lr_gettmpdir();
936122
-    fail_if(tmp_dir == NULL);
936122
+    ck_assert_ptr_nonnull(tmp_dir);
936122
     tmp_file = lr_pathconcat(tmp_dir, "file_a", NULL);
936122
     fd = open(tmp_file, O_CREAT|O_TRUNC|O_RDWR, 0660);
936122
-    fail_if(fd < 0);
936122
+    ck_assert_int_ge(fd, 0);
936122
     close(fd);
936122
 
936122
     rc = lr_remove_dir(tmp_dir);
936122
-    fail_if(rc != 0);
936122
-    fail_if(unlink(tmp_file) == 0);
936122
-    fail_if(rmdir(tmp_dir) == 0);
936122
+    ck_assert_int_eq(rc, 0);
936122
+    ck_assert_int_ne(unlink(tmp_file), 0);
936122
+    ck_assert_int_ne(rmdir(tmp_dir), 0);
936122
     lr_free(tmp_dir);
936122
     lr_free(tmp_file);
936122
 }
936122
@@ -136,65 +136,65 @@ START_TEST(test_url_without_path)
936122
     char *new_url = NULL;
936122
 
936122
     new_url = lr_url_without_path(NULL);
936122
-    fail_if(new_url != NULL);
936122
+    ck_assert_ptr_null(new_url);
936122
 
936122
     new_url = lr_url_without_path("");
936122
-    fail_if(new_url == NULL);
936122
-    fail_if(strcmp(new_url, ""));
936122
+    ck_assert_ptr_nonnull(new_url);
936122
+    ck_assert_str_eq(new_url, "");
936122
     lr_free(new_url);
936122
     new_url = NULL;
936122
 
936122
     new_url = lr_url_without_path("hostname");
936122
-    fail_if(new_url == NULL);
936122
-    fail_if(strcmp(new_url, "hostname"));
936122
+    ck_assert_ptr_nonnull(new_url);
936122
+    ck_assert_str_eq(new_url, "hostname");
936122
     lr_free(new_url);
936122
     new_url = NULL;
936122
 
936122
     new_url = lr_url_without_path("hostname/foo/bar/");
936122
-    fail_if(new_url == NULL);
936122
-    fail_if(strcmp(new_url, "hostname"));
936122
+    ck_assert_ptr_nonnull(new_url);
936122
+    ck_assert_str_eq(new_url, "hostname");
936122
     lr_free(new_url);
936122
     new_url = NULL;
936122
 
936122
     new_url = lr_url_without_path("hostname:80");
936122
-    fail_if(new_url == NULL);
936122
-    fail_if(strcmp(new_url, "hostname:80"));
936122
+    ck_assert_ptr_nonnull(new_url);
936122
+    ck_assert_str_eq(new_url, "hostname:80");
936122
     lr_free(new_url);
936122
     new_url = NULL;
936122
 
936122
     new_url = lr_url_without_path("hostname:80/foo/bar");
936122
-    fail_if(new_url == NULL);
936122
-    fail_if(strcmp(new_url, "hostname:80"));
936122
+    ck_assert_ptr_nonnull(new_url);
936122
+    ck_assert_str_eq(new_url, "hostname:80");
936122
     lr_free(new_url);
936122
     new_url = NULL;
936122
 
936122
     new_url = lr_url_without_path("http://hostname:80/");
936122
-    fail_if(new_url == NULL);
936122
-    fail_if(strcmp(new_url, "http://hostname:80"));
936122
+    ck_assert_ptr_nonnull(new_url);
936122
+    ck_assert_str_eq(new_url, "http://hostname:80");
936122
     lr_free(new_url);
936122
     new_url = NULL;
936122
 
936122
     new_url = lr_url_without_path("http://hostname:80/foo/bar");
936122
-    fail_if(new_url == NULL);
936122
-    fail_if(strcmp(new_url, "http://hostname:80"));
936122
+    ck_assert_ptr_nonnull(new_url);
936122
+    ck_assert_str_eq(new_url, "http://hostname:80");
936122
     lr_free(new_url);
936122
     new_url = NULL;
936122
 
936122
     new_url = lr_url_without_path("ftp://foo.hostname:80/foo/bar");
936122
-    fail_if(new_url == NULL);
936122
-    fail_if(strcmp(new_url, "ftp://foo.hostname:80"));
936122
+    ck_assert_ptr_nonnull(new_url);
936122
+    ck_assert_str_eq(new_url, "ftp://foo.hostname:80");
936122
     lr_free(new_url);
936122
     new_url = NULL;
936122
 
936122
     new_url = lr_url_without_path("file:///home/foobar");
936122
-    fail_if(new_url == NULL);
936122
-    fail_if(strcmp(new_url, "file://"));
936122
+    ck_assert_ptr_nonnull(new_url);
936122
+    ck_assert_str_eq(new_url, "file://");
936122
     lr_free(new_url);
936122
     new_url = NULL;
936122
 
936122
     new_url = lr_url_without_path("file:/home/foobar");
936122
-    fail_if(new_url == NULL);
936122
-    fail_if(strcmp(new_url, "file://"));
936122
+    ck_assert_ptr_nonnull(new_url);
936122
+    ck_assert_str_eq(new_url, "file://");
936122
     lr_free(new_url);
936122
     new_url = NULL;
936122
 }
936122
@@ -209,39 +209,39 @@ START_TEST(test_strv_dup)
936122
     gchar **copy = NULL;
936122
 
936122
     copy = lr_strv_dup(in0);
936122
-    fail_if(copy != NULL);
936122
+    ck_assert_ptr_null(copy);
936122
 
936122
     copy = lr_strv_dup(in1);
936122
-    fail_if(!copy);
936122
-    fail_if(copy == in1);
936122
-    fail_if(copy[0] != NULL);
936122
+    ck_assert(copy);
936122
+    ck_assert_ptr_ne(copy, in1);
936122
+    ck_assert_ptr_null(copy[0]);
936122
     g_strfreev(copy);
936122
 
936122
     copy = lr_strv_dup(in2);
936122
-    fail_if(!copy);
936122
-    fail_if(copy == in2);
936122
-    fail_if(g_strcmp0(copy[0], "foo"));
936122
-    fail_if(copy[0] == in2[0]);
936122
-    fail_if(copy[1] != NULL);
936122
+    ck_assert(copy);
936122
+    ck_assert_ptr_ne(copy, in2);
936122
+    ck_assert_str_eq(copy[0], "foo");
936122
+    ck_assert_ptr_ne(copy[0], in2[0]);
936122
+    ck_assert_ptr_null(copy[1]);
936122
     g_strfreev(copy);
936122
 }
936122
 END_TEST
936122
 
936122
 START_TEST(test_is_local_path)
936122
 {
936122
-    fail_if(!lr_is_local_path("/tmp"));
936122
-    fail_if(!lr_is_local_path("foo/bar"));
936122
-    fail_if(!lr_is_local_path("bar"));
936122
-    fail_if(!lr_is_local_path("/"));
936122
-    fail_if(!lr_is_local_path("file:///tmp"));
936122
-    fail_if(!lr_is_local_path("file:/tmp"));
936122
-
936122
-    fail_if(lr_is_local_path(NULL));
936122
-    fail_if(lr_is_local_path(""));
936122
-    fail_if(lr_is_local_path("http://foo.bar"));
936122
-    fail_if(lr_is_local_path("https://foo.bar/x"));
936122
-    fail_if(lr_is_local_path("ftp://foo.bar/foobar"));
936122
-    fail_if(lr_is_local_path("rsync://xyz"));
936122
+    ck_assert(lr_is_local_path("/tmp"));
936122
+    ck_assert(lr_is_local_path("foo/bar"));
936122
+    ck_assert(lr_is_local_path("bar"));
936122
+    ck_assert(lr_is_local_path("/"));
936122
+    ck_assert(lr_is_local_path("file:///tmp"));
936122
+    ck_assert(lr_is_local_path("file:/tmp"));
936122
+
936122
+    ck_assert(!lr_is_local_path(NULL));
936122
+    ck_assert(!lr_is_local_path(""));
936122
+    ck_assert(!lr_is_local_path("http://foo.bar"));
936122
+    ck_assert(!lr_is_local_path("https://foo.bar/x"));
936122
+    ck_assert(!lr_is_local_path("ftp://foo.bar/foobar"));
936122
+    ck_assert(!lr_is_local_path("rsync://xyz"));
936122
 }
936122
 END_TEST
936122
 
936122
@@ -250,19 +250,19 @@ START_TEST(test_prepend_url_protocol)
936122
     gchar *url = NULL;
936122
 
936122
     url = lr_prepend_url_protocol("/tmp");
936122
-    fail_if(g_strcmp0(url, "file:///tmp"));
936122
+    ck_assert_str_eq(url, "file:///tmp");
936122
     g_free(url);
936122
 
936122
     url = lr_prepend_url_protocol("file:///tmp");
936122
-    fail_if(g_strcmp0(url, "file:///tmp"));
936122
+    ck_assert_str_eq(url, "file:///tmp");
936122
     g_free(url);
936122
 
936122
     url = lr_prepend_url_protocol("http://tmp");
936122
-    fail_if(g_strcmp0(url, "http://tmp"));
936122
+    ck_assert_str_eq(url, "http://tmp");
936122
     g_free(url);
936122
 
936122
     url = lr_prepend_url_protocol("file:/tmp");
936122
-    fail_if(g_strcmp0(url, "file:/tmp"));
936122
+    ck_assert_str_eq(url, "file:/tmp");
936122
     g_free(url);
936122
 }
936122
 END_TEST
936122
diff --git a/tests/test_version.c b/tests/test_version.c
936122
index 235b4c6e..96e6ec69 100644
936122
--- a/tests/test_version.c
936122
+++ b/tests/test_version.c
936122
@@ -10,23 +10,23 @@
936122
 
936122
 START_TEST(test_version_check_macro)
936122
 {
936122
-    fail_if(!(LR_VERSION_CHECK(LR_VERSION_MAJOR,
936122
+    ck_assert(LR_VERSION_CHECK(LR_VERSION_MAJOR,
936122
                                LR_VERSION_MINOR,
936122
-                               LR_VERSION_PATCH)));
936122
+                               LR_VERSION_PATCH));
936122
 
936122
-    fail_if(!(LR_VERSION_CHECK(0, 0, 0)));
936122
+    ck_assert(LR_VERSION_CHECK(0, 0, 0));
936122
 
936122
-    fail_if(LR_VERSION_CHECK(LR_VERSION_MAJOR,
936122
-                             LR_VERSION_MINOR,
936122
-                             LR_VERSION_PATCH+1));
936122
+    ck_assert(!(LR_VERSION_CHECK(LR_VERSION_MAJOR,
936122
+                                 LR_VERSION_MINOR,
936122
+                                 LR_VERSION_PATCH+1)));
936122
 
936122
-    fail_if(LR_VERSION_CHECK(LR_VERSION_MAJOR,
936122
-                             LR_VERSION_MINOR+1,
936122
-                             LR_VERSION_PATCH));
936122
+    ck_assert(!(LR_VERSION_CHECK(LR_VERSION_MAJOR,
936122
+                                 LR_VERSION_MINOR+1,
936122
+                                 LR_VERSION_PATCH)));
936122
 
936122
-    fail_if(LR_VERSION_CHECK(LR_VERSION_MAJOR+1,
936122
-                             LR_VERSION_MINOR,
936122
-                             LR_VERSION_PATCH));
936122
+    ck_assert(!(LR_VERSION_CHECK(LR_VERSION_MAJOR+1,
936122
+                                 LR_VERSION_MINOR,
936122
+                                 LR_VERSION_PATCH)));
936122
 }
936122
 END_TEST
936122