LCOV - code coverage report
Current view: top level - src/plugins/cpptemplate - testmod_cpptemplate.cpp (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 16 16 100.0 %
Date: 2019-09-12 12:28:41 Functions: 4 5 80.0 %

          Line data    Source code
       1             : /**
       2             :  * @file
       3             :  *
       4             :  * @brief Tests for cpptemplate plugin
       5             :  *
       6             :  * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
       7             :  *
       8             :  */
       9             : 
      10             : #include "cpptemplate.hpp"
      11             : 
      12             : #include <kdbmodule.h>
      13             : #include <kdbprivate.h>
      14             : 
      15             : #include <tests.hpp>
      16             : 
      17             : using CppKeySet = kdb::KeySet;
      18             : using CppKey = kdb::Key;
      19             : 
      20          20 : TEST (cpptemplate, basics)
      21             : {
      22           4 :         CppKeySet modules{ 0, KS_END };
      23           4 :         CppKeySet config{ 0, KS_END };
      24           4 :         CppKeySet keys{ 0, KS_END };
      25           2 :         elektraModulesInit (modules.getKeySet (), 0);
      26             : 
      27           4 :         CppKey parent{ "system/elektra/modules/cpptemplate", KEY_END };
      28           6 :         Plugin * plugin = elektraPluginOpen ("cpptemplate", modules.getKeySet (), config.getKeySet (), *parent);
      29           6 :         exit_if_fail (plugin != NULL, "Could not open cpptemplate plugin"); //! OCLint (empty if, too few branches switch)
      30             : 
      31          10 :         succeed_if_same (plugin->kdbGet (plugin, keys.getKeySet (), *parent), ELEKTRA_PLUGIN_STATUS_SUCCESS, "Call of `kdbGet` failed");
      32             : 
      33          10 :         succeed_if_same (plugin->kdbSet (plugin, keys.getKeySet (), *parent), ELEKTRA_PLUGIN_STATUS_NO_UPDATE, "Call of `kdbSet` failed");
      34             : 
      35          10 :         succeed_if_same (plugin->kdbError (plugin, keys.getKeySet (), *parent), ELEKTRA_PLUGIN_STATUS_SUCCESS, "Call of `kdbError` failed");
      36             : 
      37           2 :         elektraPluginClose (plugin, 0);
      38           2 :         elektraModulesClose (modules.getKeySet (), 0);
      39             : 
      40           2 :         ksDel (modules.release ());
      41           2 :         config.release ();
      42           6 : }

Generated by: LCOV version 1.13