LCOV - code coverage report
Current view: top level - test - test-af-list.c (source / functions) Hit Total Coverage
Test: systemd_full.info Lines: 10 10 100.0 %
Date: 2019-08-23 13:36:53 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 10 16 62.5 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: LGPL-2.1+ */
       2                 :            : 
       3                 :            : #include <string.h>
       4                 :            : #include <sys/socket.h>
       5                 :            : 
       6                 :            : #include "macro.h"
       7                 :            : #include "string-util.h"
       8                 :            : #include "util.h"
       9                 :            : 
      10                 :            : _unused_
      11                 :            : static const struct af_name* lookup_af(register const char *str, register GPERF_LEN_TYPE len);
      12                 :            : 
      13                 :            : #include "af-from-name.h"
      14                 :            : #include "af-list.h"
      15                 :            : #include "af-to-name.h"
      16                 :            : 
      17                 :          4 : int main(int argc, const char *argv[]) {
      18                 :            : 
      19                 :            :         unsigned i;
      20                 :            : 
      21         [ +  + ]:        184 :         for (i = 0; i < ELEMENTSOF(af_names); i++) {
      22         [ +  + ]:        180 :                 if (af_names[i]) {
      23         [ -  + ]:        176 :                         assert_se(streq(af_to_name(i), af_names[i]));
      24         [ -  + ]:        176 :                         assert_se(af_from_name(af_names[i]) == (int) i);
      25                 :            :                 }
      26                 :            :         }
      27                 :            : 
      28         [ -  + ]:          4 :         assert_se(af_to_name(af_max()) == NULL);
      29         [ -  + ]:          4 :         assert_se(af_to_name(-1) == NULL);
      30         [ -  + ]:          4 :         assert_se(af_from_name("huddlduddl") == -EINVAL);
      31         [ -  + ]:          4 :         assert_se(af_from_name("") == -EINVAL);
      32                 :            : 
      33                 :          4 :         return 0;
      34                 :            : }

Generated by: LCOV version 1.14