LCOV - code coverage report
Current view: top level - src/plugins/haskell - testmod_haskell.c (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 23 23 100.0 %
Date: 2019-09-12 12:28:41 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /**
       2             :  * @file
       3             :  *
       4             :  * @brief Tests for haskell 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/haskell", KEY_END);
      22           2 :         KeySet * conf = ksNew (0, KS_END);
      23           2 :         PLUGIN_OPEN ("haskell");
      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->kdbError (plugin, ks, parentKey) == ELEKTRA_PLUGIN_STATUS_SUCCESS, "call to kdbError was not successful");
      34             : 
      35           2 :         succeed_if (plugin->kdbClose (plugin, parentKey) == ELEKTRA_PLUGIN_STATUS_SUCCESS, "call to kdbClose was not successful");
      36             : 
      37           2 :         keyDel (parentKey);
      38           2 :         ksDel (ks);
      39           2 :         PLUGIN_CLOSE ();
      40           2 : }
      41             : 
      42             : 
      43           1 : int main (int argc, char ** argv)
      44             : {
      45           1 :         printf ("HASKELL      TESTS\n");
      46           1 :         printf ("==================\n\n");
      47             : 
      48           1 :         init (argc, argv);
      49             : 
      50           1 :         test_basics ();
      51             :         // Test again to check loading/unloading the haskell plugin works
      52           1 :         test_basics ();
      53             : 
      54           1 :         print_result ("testmod_haskell");
      55             : 
      56           1 :         return nbError;
      57             : }

Generated by: LCOV version 1.13