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

          Line data    Source code
       1             : /* Inception BWAAAAAAH */
       2             : 
       3             : #include "test.h"
       4             : 
       5           2 : TEST(test_all_empty) {
       6             :         int                     st, fd[2];
       7             :         pid_t           pid;
       8             : 
       9           2 :         pipe(fd);
      10           2 :         if ((pid = fork()) == 0) {
      11           2 :                 DUP_ALL_OUTPUTS(fd);
      12           2 :                 test_free();
      13           2 :                 test_all();
      14           2 :                 exit(0);
      15             :         } else {
      16           2 :                 WAIT_AND_CLOSE(pid, st, fd);
      17             :         }
      18           2 :         return TEST_SUCCESS;
      19             : 
      20             : }
      21             : 
      22           2 : TEST(test_group_unknown) {
      23             :         int                     st, fd[2];
      24             :         pid_t           pid;
      25             : 
      26           2 :         pipe(fd);
      27           2 :         if ((pid = fork()) == 0) {
      28           2 :                 DUP_ALL_OUTPUTS(fd);
      29           2 :                 test_group("Unknown");
      30           2 :                 exit(0);
      31             :         } else {
      32           2 :                 WAIT_AND_CLOSE(pid, st, fd);
      33             :         }
      34           2 :         return TEST_SUCCESS;
      35             : }
      36             : 
      37           2 : TEST(test_result) {
      38             :         int                     st, fd[2];
      39             :         pid_t           pid;
      40             : 
      41           2 :         pipe(fd);
      42           2 :         if ((pid = fork()) == 0) {
      43           2 :                 DUP_ALL_OUTPUTS(fd);
      44           2 :                 print_result("Test", 10, 0);
      45           2 :                 print_result("Test", 9, 1);
      46           2 :                 print_result("Test", 0, 10);
      47           2 :                 exit(0);
      48             :         } else {
      49           2 :                 WAIT_AND_CLOSE(pid, st, fd);
      50             :         }
      51           2 :         return TEST_SUCCESS;
      52             : }
      53             : 
      54           2 : TEST(test_false) {
      55           2 :         TEST_ASSERT(false, "Nope.");
      56             :         return TEST_SUCCESS;
      57             : }
      58             : 
      59           2 : TEST(test_group_fail) {
      60             :         int                     st, fd[2];
      61             :         pid_t           pid;
      62             : 
      63           2 :         pipe(fd);
      64           2 :         if ((pid = fork()) == 0) {
      65           2 :                 DUP_ALL_OUTPUTS(fd);
      66           2 :                 reg_test("group_fail", test_false);
      67           2 :                 test_all();
      68           2 :                 test_free();
      69           2 :                 exit(0);
      70             :         } else {
      71           2 :                 WAIT_AND_CLOSE(pid, st, fd);
      72             :         }
      73           2 :         return TEST_SUCCESS;
      74             : }
      75             : 
      76           2 : void    register_tests_tests(void) {
      77           2 :         test_test_all_empty();
      78           2 :         test_test_group_unknown();
      79           2 :         test_test_result();
      80           2 :         test_test_group_fail();
      81           2 : }

Generated by: LCOV version 1.11