Code

t/unit/: Create one test binary for each *_test.c file.
[sysdb.git] / t / unit / utils / dbi_test.c
index 8a0811bda72a71670a8aa921cf1c0bc7f3e33126..db467fdfdb0dbd08dae33b67337732ef3577bc8d 100644 (file)
@@ -29,7 +29,7 @@
 #      include "config.h"
 #endif /* HAVE_CONFIG_H */
 
-#include "libsysdb_test.h"
+#include "testutils.h"
 #include "utils/dbi.h"
 
 #include <check.h>
@@ -176,7 +176,7 @@ dbi_driver_open_r(const char *name, dbi_inst __attribute__((unused)) inst)
 {
        if (strcmp(name, "mockdriver"))
                return NULL;
-       return (dbi_driver)strdup(name);
+       return (dbi_driver)"mockdriver";
 } /* dbi_driver_open */
 
 dbi_driver
@@ -527,7 +527,7 @@ query_callback(sdb_dbi_client_t *c,
                        user_data, TEST_MAGIC);
 
        for (i = 0; i < n; ++i) {
-               int expected_type = DBI_TYPE_TO_SC(current_query->field_types[i]);
+               int expected_type = DBI_TYPE_TO_SDB(current_query->field_types[i]);
                mock_data_t expected_data;
 
                fail_unless((int)data[i].type == expected_type,
@@ -558,8 +558,8 @@ query_callback(sdb_dbi_client_t *c,
                        case SDB_TYPE_DATETIME:
                                fail_unless(data[i].data.datetime
                                                        == SECS_TO_SDB_TIME(expected_data.datetime),
-                                               "query callback received unexpected data "PRIscTIME
-                                               " for column %zu; expected: "PRIscTIME,
+                                               "query callback received unexpected data "PRIsdbTIME
+                                               " for column %zu; expected: "PRIsdbTIME,
                                                data[i].data.integer, i,
                                                SECS_TO_SDB_TIME(expected_data.integer));
                                break;
@@ -676,25 +676,16 @@ START_TEST(test_sdb_dbi_exec_query)
 }
 END_TEST
 
-/*
- * test API
- */
-
-Suite *
-util_dbi_suite(void)
+TEST_MAIN("utils::dbi")
 {
-       Suite *s = suite_create("utils::dbi");
-       TCase *tc;
-
-       tc = tcase_create("core");
+       TCase *tc = tcase_create("core");
        tcase_add_checked_fixture(tc, setup, teardown);
        tcase_add_test(tc, test_sdb_dbi_client_connect);
        tcase_add_test(tc, test_sdb_dbi_client_check_conn);
        tcase_add_test(tc, test_sdb_dbi_exec_query);
-       suite_add_tcase(s, tc);
-
-       return s;
-} /* util_llist_suite */
+       ADD_TCASE(tc);
+}
+TEST_MAIN_END
 
 /* vim: set tw=78 sw=4 ts=4 noexpandtab : */