forked from ElektraInitiative/libelektra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestmod_xfconf.c
62 lines (44 loc) · 1.53 KB
/
testmod_xfconf.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* @file
*
* @brief Tests for xfconf plugin
*
* @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
*
*/
#include "xfconf.h"
#include <stdlib.h>
#include <tests_plugin.h>
static void test_basics (void)
{
Key * parentKey = keyNew ("user:/tests/xfconf", KEY_END);
KeySet * conf = ksNew (0, KS_END);
int statusCode = elektraXfconfInit (parentKey, 1, 1);
printf ("xfconf dry open returned: %d\n", statusCode);
if (statusCode != 1)
{
printf ("WARNING: dry open xfconf failed, is dbus running? skipping tests\n");
return;
}
printf ("test basics\n");
PLUGIN_OPEN ("xfconf");
KeySet * ks = ksNew (0, KS_END);
printf ("begin with tests...\n");
succeed_if (plugin->kdbOpen (plugin, parentKey) == ELEKTRA_PLUGIN_STATUS_SUCCESS, "call to kdbOpen was not successful");
succeed_if (plugin->kdbOpen (plugin, parentKey) == ELEKTRA_PLUGIN_STATUS_SUCCESS, "call to kdbOpen was not successful");
succeed_if (plugin->kdbGet (plugin, ks, parentKey) == ELEKTRA_PLUGIN_STATUS_NO_UPDATE, "call to kdbGet was not successful");
succeed_if (plugin->kdbSet (plugin, ks, parentKey) == ELEKTRA_PLUGIN_STATUS_NO_UPDATE, "call to kdbSet was not successful");
succeed_if (plugin->kdbClose (plugin, parentKey) == ELEKTRA_PLUGIN_STATUS_SUCCESS, "call to kdbClose was not successful");
keyDel (parentKey);
ksDel (ks);
PLUGIN_CLOSE ();
}
int main (int argc, char ** argv)
{
printf ("XFCONF TESTS\n");
printf ("==================\n\n");
init (argc, argv);
test_basics ();
print_result ("testmod_xfconf");
return nbError;
}