LCOV - code coverage report
Current view: top level - tests - test_print.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 37 38 97.4 %
Date: 2017-03-13 16:41:56 Functions: 5 5 100.0 %

          Line data    Source code
       1             : #include "test.h"
       2             : 
       3           2 : TEST(print_info) {
       4             :         int                     st, fd[2];
       5             :         pid_t           pid;
       6             : 
       7           2 :         pipe(fd);
       8           2 :         if ((pid = fork()) == 0) {
       9           2 :                 DUP_ALL_OUTPUTS(fd);
      10           2 :                 m_info("Test");
      11           2 :                 exit(0);
      12             :         } else {
      13           2 :                 WAIT_AND_CLOSE(pid, st, fd);
      14             :         }
      15           2 :         return TEST_SUCCESS;
      16             : }
      17             : 
      18           2 : TEST(print_warning) {
      19             :         int                     st, fd[2];
      20             :         pid_t           pid;
      21             : 
      22           2 :         pipe(fd);
      23           2 :         if ((pid = fork()) == 0) {
      24           2 :                 DUP_ALL_OUTPUTS(fd);
      25           2 :                 m_warning("Test");
      26           2 :                 exit(0);
      27             :         } else {
      28           2 :                 WAIT_AND_CLOSE(pid, st, fd);
      29             :         }
      30           2 :         return TEST_SUCCESS;
      31             : }
      32             : 
      33           2 : TEST(print_error) {
      34             :         int                     st, fd[2];
      35             :         pid_t           pid;
      36             : 
      37           2 :         pipe(fd);
      38           2 :         if ((pid = fork()) == 0) {
      39           2 :                 DUP_ALL_OUTPUTS(fd);
      40           2 :                 m_error("Test");
      41           2 :                 exit(0);
      42             :         } else {
      43           2 :                 WAIT_AND_CLOSE(pid, st, fd);
      44             :         }
      45           2 :         return TEST_SUCCESS;
      46             : }
      47             : 
      48           2 : TEST(print_panic) {
      49             :         int                     st, fd[2];
      50             :         pid_t           pid;
      51             : 
      52           2 :         pipe(fd);
      53           2 :         if ((pid = fork()) == 0) {
      54           2 :                 DUP_ALL_OUTPUTS(fd);
      55           2 :                 m_panic("Test");
      56           0 :                 exit(0);
      57             :         } else {
      58           2 :                 WAIT_AND_CLOSE(pid, st, fd);
      59             :         }
      60           2 :         return TEST_SUCCESS;
      61             : }
      62             : 
      63           2 : void    register_print_tests(void) {
      64           2 :         reg_test("mprint", print_info);
      65           2 :         reg_test("mprint", print_warning);
      66           2 :         reg_test("mprint", print_error);
      67           2 :         reg_test("mprint", print_panic);
      68           2 : }

Generated by: LCOV version 1.11