1 /**
2 * @file
3 * Test code for the kyotocabinet store
4 *
5 * @authors
6 * Copyright (C) 2020 Richard Russon <rich@flatcap.org>
7 *
8 * @copyright
9 * This program is free software: you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License as published by the Free Software
11 * Foundation, either version 2 of the License, or (at your option) any later
12 * version.
13 *
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License along with
20 * this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23 #define TEST_NO_MAIN
24 #include "config.h"
25 #include "acutest.h"
26 #include <limits.h>
27 #include "mutt/lib.h"
28 #include "store/lib.h"
29 #include "common.h"
30
31 #define DB_NAME "kyotocabinet"
32
test_store_kc(void)33 void test_store_kc(void)
34 {
35 char path[PATH_MAX];
36
37 const struct StoreOps *sops = store_get_backend_ops(DB_NAME);
38 TEST_CHECK(sops != NULL);
39
40 TEST_CHECK(test_store_degenerate(sops, DB_NAME) == true);
41
42 TEST_CHECK(test_store_setup(path, sizeof(path)) == true);
43
44 mutt_str_cat(path, sizeof(path), "/");
45 mutt_str_cat(path, sizeof(path), DB_NAME);
46
47 void *db = sops->open(path);
48 TEST_CHECK(db != NULL);
49
50 TEST_CHECK(test_store_db(sops, db) == true);
51
52 sops->close(&db);
53 }
54