Line data Source code
1 : /**
2 : * @file
3 : *
4 : * @brief Tests for template plugin
5 : *
6 : * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
7 : *
8 : */
9 :
10 : #include <stdlib.h>
11 : #include <string.h>
12 :
13 : #include <kdbconfig.h>
14 :
15 : #include <tests_plugin.h>
16 :
17 2 : static void test_basics (void)
18 : {
19 2 : printf ("test basics\n");
20 :
21 2 : Key * parentKey = keyNew ("user/tests/template", KEY_END);
22 2 : KeySet * conf = ksNew (0, KS_END);
23 2 : PLUGIN_OPEN ("template");
24 :
25 2 : KeySet * ks = ksNew (0, KS_END);
26 :
27 2 : succeed_if (plugin->kdbOpen (plugin, parentKey) == ELEKTRA_PLUGIN_STATUS_SUCCESS, "call to kdbOpen was not successful");
28 :
29 2 : succeed_if (plugin->kdbGet (plugin, ks, parentKey) == ELEKTRA_PLUGIN_STATUS_NO_UPDATE, "call to kdbGet was not successful");
30 :
31 2 : succeed_if (plugin->kdbSet (plugin, ks, parentKey) == ELEKTRA_PLUGIN_STATUS_NO_UPDATE, "call to kdbSet was not successful");
32 :
33 2 : succeed_if (plugin->kdbCommit (plugin, ks, parentKey) == ELEKTRA_PLUGIN_STATUS_SUCCESS, "call to kdbCommit was not successful");
34 :
35 2 : succeed_if (plugin->kdbError (plugin, ks, parentKey) == ELEKTRA_PLUGIN_STATUS_SUCCESS, "call to kdbError was not successful");
36 :
37 2 : succeed_if (plugin->kdbClose (plugin, parentKey) == ELEKTRA_PLUGIN_STATUS_SUCCESS, "call to kdbClose was not successful");
38 :
39 2 : keyDel (parentKey);
40 2 : ksDel (ks);
41 2 : PLUGIN_CLOSE ();
42 2 : }
43 :
44 :
45 2 : int main (int argc, char ** argv)
46 : {
47 2 : printf ("TEMPLATE TESTS\n");
48 2 : printf ("==================\n\n");
49 :
50 2 : init (argc, argv);
51 :
52 2 : test_basics ();
53 :
54 2 : print_result ("testmod_template");
55 :
56 2 : return nbError;
57 : }
|