forked from ElektraInitiative/libelektra
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestmod_cpptemplate.cpp
More file actions
46 lines (35 loc) · 1.5 KB
/
testmod_cpptemplate.cpp
File metadata and controls
46 lines (35 loc) · 1.5 KB
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
/**
* @file
*
* @brief Tests for cpptemplate plugin
*
* @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
*
*/
#include "cpptemplate.hpp"
#include <kdbmodule.h>
#include <kdbprivate.h>
#include <tests.hpp>
using CppKeySet = kdb::KeySet;
using CppKey = kdb::Key;
TEST (cpptemplate, basics) //! OCLint (avoid private static members)
#ifdef __llvm__
__attribute__ ((annotate ("oclint:suppress[empty if statement]"), annotate ("oclint:suppress[high ncss method]"),
annotate ("oclint:suppress[too few branches in switch statement]")))
#endif
{
CppKeySet modules{ 0, KS_END };
CppKeySet config{ 0, KS_END };
CppKeySet keys{ 0, KS_END };
elektraModulesInit (modules.getKeySet (), 0);
CppKey parent{ "system:/elektra/modules/cpptemplate", KEY_END };
Plugin * plugin = elektraPluginOpen ("cpptemplate", modules.getKeySet (), config.getKeySet (), *parent);
exit_if_fail (plugin != NULL, "Could not open cpptemplate plugin"); //! OCLint (empty if, too few branches switch)
succeed_if_same (plugin->kdbGet (plugin, keys.getKeySet (), *parent), ELEKTRA_PLUGIN_STATUS_SUCCESS, "Call of `kdbGet` failed");
succeed_if_same (plugin->kdbSet (plugin, keys.getKeySet (), *parent), ELEKTRA_PLUGIN_STATUS_NO_UPDATE, "Call of `kdbSet` failed");
succeed_if_same (plugin->kdbError (plugin, keys.getKeySet (), *parent), ELEKTRA_PLUGIN_STATUS_SUCCESS, "Call of `kdbError` failed");
elektraPluginClose (plugin, 0);
elektraModulesClose (modules.getKeySet (), 0);
ksDel (modules.release ());
config.release ();
}