Code

t/: Use ck_assert() instead of assert() in all tests.
authorSebastian Harl <sh@tokkee.org>
Wed, 20 May 2015 20:04:54 +0000 (22:04 +0200)
committerSebastian Harl <sh@tokkee.org>
Wed, 20 May 2015 20:04:54 +0000 (22:04 +0200)
t/unit/core/data_test.c
t/unit/core/store_json_test.c
t/unit/core/store_lookup_test.c
t/unit/frontend/connection_test.c

index 1955528e919a8c753b1c1c99842a15296890b716..d421e64df3dd90136776a9b84925ccccf689ffab 100644 (file)
@@ -32,7 +32,6 @@
 #include "core/data.h"
 #include "testutils.h"
 
-#include <assert.h>
 #include <check.h>
 
 static regex_t empty_re;
@@ -171,7 +170,7 @@ START_TEST(test_data)
        check = sdb_data_parse(".", SDB_TYPE_REGEX, &d2);
        fail_unless(check == 0,
                        "INTERNAL ERROR: Failed to parse regex '.'");
-       assert(d2.type == SDB_TYPE_REGEX);
+       ck_assert(d2.type == SDB_TYPE_REGEX);
        check = sdb_data_copy(&d1, &d2);
        fail_unless(!check, "sdb_data_copy() = %i; expected: 0", check);
        fail_unless(d1.type == d2.type,
index 704ad067fc52d9fba04a8ea5bbe901a3013583c6..b69573c45fde0afd0b90ab5db4402f225eb9ac00 100644 (file)
@@ -32,8 +32,6 @@
 #include "core/store.h"
 #include "testutils.h"
 
-#include <assert.h>
-
 #include <check.h>
 #include <stdlib.h>
 
@@ -466,7 +464,7 @@ START_TEST(test_store_tojson)
        sdb_strbuf_clear(buf);
        f = sdb_store_json_formatter(buf,
                        store_tojson_data[_i].type, SDB_WANT_ARRAY);
-       assert(f);
+       ck_assert(f != NULL);
 
        status = sdb_store_scan(store_tojson_data[_i].type,
                        /* m = */ NULL, filter, store_tojson_data[_i].f, f);
index 33fd1d24ec4d55e257cd9ab49bbd6b76fcbbe840..b4c6015b7bfb0dcfe2d338eb05af51555491efca 100644 (file)
@@ -34,8 +34,6 @@
 #include "parser/parser.h"
 #include "testutils.h"
 
-#include <assert.h>
-
 #include <check.h>
 #include <string.h>
 
@@ -265,7 +263,7 @@ START_TEST(test_cmp_attr)
        };
 
        const char *op_str[] = { "<", "<=", "=", ">=", ">" };
-       assert(SDB_STATIC_ARRAY_LEN(tests) == SDB_STATIC_ARRAY_LEN(op_str));
+       ck_assert(SDB_STATIC_ARRAY_LEN(tests) == SDB_STATIC_ARRAY_LEN(op_str));
 
        host = sdb_store_get_host("a");
        fail_unless(host != NULL,
@@ -373,7 +371,7 @@ START_TEST(test_cmp_obj)
        };
        char *op_str[] = { "<", "<=", "=", ">=", ">" };
 
-       assert(SDB_STATIC_ARRAY_LEN(tests) == SDB_STATIC_ARRAY_LEN(op_str));
+       ck_assert(SDB_STATIC_ARRAY_LEN(tests) == SDB_STATIC_ARRAY_LEN(op_str));
 
        host = sdb_store_get_host(cmp_obj_data[_i].host);
        fail_unless(host != NULL,
index b4cc1878555198425a44e7b3bb4abe9acd691de5..11a93a24fbafeb8b495549a9a89b4c56c7aecc2e 100644 (file)
@@ -36,7 +36,6 @@
 
 #include "utils/strbuf.h"
 
-#include <assert.h>
 #include <check.h>
 
 #include <stdlib.h>
@@ -72,13 +71,13 @@ mock_conn_destroy(sdb_conn_t *conn)
 static ssize_t
 mock_conn_read(sdb_conn_t *conn, size_t len)
 {
-       return sdb_strbuf_read(conn->buf, conn->fd, len);
+       return sdb_strbuf_read(conn->buf, conn->fd, len);
 } /* conn_read */
 
 static ssize_t
 mock_conn_write(sdb_conn_t *conn, const void *buf, size_t len)
 {
-       return sdb_write(conn->fd, len, buf);
+       return sdb_write(conn->fd, len, buf);
 } /* conn_write */
 
 static sdb_conn_t *
@@ -118,7 +117,7 @@ mock_conn_create(void)
        conn->write = mock_conn_write;
 
        conn->username = strdup(username);
-       assert(conn->username);
+       ck_assert(conn->username != NULL);
 
        conn->cmd = SDB_CONNECTION_IDLE;
        conn->cmd_len = 0;
@@ -441,7 +440,6 @@ TEST_MAIN("frontend::connection")
        TCase *tc;
 
        char *tmp = sdb_get_current_user();
-       assert(tmp);
        strcpy(username, tmp);
        free(tmp);