From: Sebastian Harl Date: Wed, 20 May 2015 20:04:54 +0000 (+0200) Subject: t/: Use ck_assert() instead of assert() in all tests. X-Git-Tag: sysdb-0.8.0~72 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9097c9c3259b2943dc0088b250ec871172025303;p=sysdb.git t/: Use ck_assert() instead of assert() in all tests. --- diff --git a/t/unit/core/data_test.c b/t/unit/core/data_test.c index 1955528..d421e64 100644 --- a/t/unit/core/data_test.c +++ b/t/unit/core/data_test.c @@ -32,7 +32,6 @@ #include "core/data.h" #include "testutils.h" -#include #include 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, diff --git a/t/unit/core/store_json_test.c b/t/unit/core/store_json_test.c index 704ad06..b69573c 100644 --- a/t/unit/core/store_json_test.c +++ b/t/unit/core/store_json_test.c @@ -32,8 +32,6 @@ #include "core/store.h" #include "testutils.h" -#include - #include #include @@ -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); diff --git a/t/unit/core/store_lookup_test.c b/t/unit/core/store_lookup_test.c index 33fd1d2..b4c6015 100644 --- a/t/unit/core/store_lookup_test.c +++ b/t/unit/core/store_lookup_test.c @@ -34,8 +34,6 @@ #include "parser/parser.h" #include "testutils.h" -#include - #include #include @@ -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, diff --git a/t/unit/frontend/connection_test.c b/t/unit/frontend/connection_test.c index b4cc187..11a93a2 100644 --- a/t/unit/frontend/connection_test.c +++ b/t/unit/frontend/connection_test.c @@ -36,7 +36,6 @@ #include "utils/strbuf.h" -#include #include #include @@ -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);