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 1955528..d421e64 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 704ad06..b69573c 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 33fd1d2..b4c6015 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 b4cc187..11a93a2 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);