Code

t/unit/: Create one test binary for each *_test.c file.
[sysdb.git] / t / unit / utils / dbi_test.c
index 1ad96d123f6b6431b87f8cfc3a83872ccc37fb1b..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>
@@ -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 : */