aboutsummaryrefslogtreecommitdiff
path: root/dbfp_check.c
diff options
context:
space:
mode:
Diffstat (limited to 'dbfp_check.c')
-rw-r--r--dbfp_check.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/dbfp_check.c b/dbfp_check.c
new file mode 100644
index 0000000..35daaef
--- /dev/null
+++ b/dbfp_check.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2016 Robin Krahl <robin.krahl@ireas.org>
+ *
+ * dbfp_check.c
+ */
+
+#include <check.h>
+#include <stdlib.h>
+
+#include "dbfp.h"
+
+START_TEST(test_dbfp_create)
+{
+ struct dbfp dbfp;
+ int err;
+
+ err = dbfp_init(&dbfp, "test-key");
+ ck_assert_int_eq(err, 0);
+ ck_assert_str_eq(dbfp.key, "test-key");
+ dbfp_close(&dbfp);
+}
+END_TEST
+
+int main(int argc, char **argv)
+{
+ int num_failed = 0;
+ Suite *s;
+ SRunner *sr;
+ TCase *tc_basic;
+
+ s = suite_create("dbfp");
+ sr = srunner_create(s);
+
+ tc_basic = tcase_create("basic");
+ tcase_add_test(tc_basic, test_dbfp_create);
+ suite_add_tcase(s, tc_basic);
+
+ srunner_run_all(sr, CK_ENV);
+ num_failed = srunner_ntests_failed(sr);
+ srunner_free(sr);
+
+ return (num_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}