LCOV - code coverage report
Current view: top level - src/bindings/io/uv - testio_uv.c (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 16 16 100.0 %
Date: 2019-09-12 12:28:41 Functions: 4 4 100.0 %

          Line data    Source code
       1             : /**
       2             :  * @file
       3             :  *
       4             :  * @brief Tests for I/O UV binding.
       5             :  *
       6             :  * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
       7             :  *
       8             :  */
       9             : 
      10             : #include <stdio.h>
      11             : #include <stdlib.h>
      12             : 
      13             : #include <kdbio.h>
      14             : #include <kdbiotest.h>
      15             : #include <tests.h>
      16             : 
      17             : #include <uv.h>
      18             : 
      19             : #include <kdbio/uv.h>
      20             : 
      21          38 : static ElektraIoInterface * createBinding (void)
      22             : {
      23          38 :         return elektraIoUvNew (uv_default_loop ());
      24             : }
      25             : 
      26          30 : static void startLoop (void)
      27             : {
      28          30 :         uv_run (uv_default_loop (), UV_RUN_DEFAULT);
      29          30 : }
      30             : 
      31          30 : static void stopLoop (void)
      32             : {
      33          30 :         uv_stop (uv_default_loop ());
      34          30 : }
      35             : 
      36           2 : int main (int argc, char ** argv)
      37             : {
      38           2 :         init (argc, argv);
      39             : 
      40           2 :         elektraIoTestSuite (createBinding, startLoop, stopLoop);
      41             : 
      42             :         // Run loop once to fire handle closed callbacks and free memory
      43             :         // see http://docs.libuv.org/en/v1.x/handle.html#c.uv_close
      44           2 :         uv_loop_t * loop = uv_default_loop ();
      45           2 :         uv_run (loop, UV_RUN_ONCE);
      46             : #ifdef HAVE_LIBUV1
      47           2 :         uv_loop_close (loop);
      48             : #elif HAVE_LIBUV0
      49             :         uv_loop_delete (loop);
      50             : #endif
      51             : 
      52           2 :         print_result ("iowrapper_uv");
      53             : 
      54           2 :         return nbError;
      55             : }

Generated by: LCOV version 1.13