LCOV - code coverage report
Current view: top level - src/plugins/yamlsmith - testmod_yamlsmith.c (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 12 12 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 yamlsmith plugin
       5             :  *
       6             :  * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
       7             :  *
       8             :  */
       9             : 
      10             : // -- Imports ------------------------------------------------------------------------------------------------------------------------------
      11             : 
      12             : #include <tests_plugin.h>
      13             : 
      14             : // -- Macros -------------------------------------------------------------------------------------------------------------------------------
      15             : 
      16             : #define INIT_PLUGIN(parent, errorMessage)                                                                                                  \
      17             :         Key * parentKey = keyNew (parent, KEY_END);                                                                                        \
      18             :         KeySet * conf = ksNew (0, KS_END);                                                                                                 \
      19             :         PLUGIN_OPEN ("yamlsmith")                                                                                                          \
      20             :         KeySet * keySet = ksNew (0, KS_END);                                                                                               \
      21             :         succeed_if (plugin->kdbGet (plugin, keySet, parentKey) == ELEKTRA_PLUGIN_STATUS_SUCCESS, errorMessage)
      22             : 
      23             : #define CLOSE_PLUGIN()                                                                                                                     \
      24             :         keyDel (parentKey);                                                                                                                \
      25             :         ksDel (keySet);                                                                                                                    \
      26             :         PLUGIN_CLOSE ()
      27             : 
      28             : // -- Functions  ---------------------------------------------------------------------------------------------------------------------------
      29             : 
      30           2 : static void test_contract (void)
      31             : #ifdef __llvm__
      32             :         __attribute__ ((annotate ("oclint:suppress[high ncss method]")))
      33             : #endif
      34             : {
      35           2 :         printf ("• Retrieve plugin contract\n");
      36             : 
      37           2 :         INIT_PLUGIN ("system/elektra/modules/yamlsmith", "Could not retrieve plugin contract");
      38           2 :         CLOSE_PLUGIN ();
      39           2 : }
      40             : 
      41             : // -- Main ---------------------------------------------------------------------------------------------------------------------------------
      42             : 
      43           2 : int main (int argc, char ** argv)
      44             : {
      45           2 :         printf ("⚒ YAMLSMITH     TESTS\n");
      46           2 :         printf ("=======================\n\n");
      47             : 
      48           2 :         init (argc, argv);
      49             : 
      50           2 :         test_contract ();
      51             : 
      52           2 :         print_result ("testmod_yamlsmith");
      53             : 
      54           2 :         return nbError;
      55             : }

Generated by: LCOV version 1.13