LCOV - code coverage report
Current view: top level - test - test-arphrd-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 <linux/if_arp.h>
       4                 :            : #include <string.h>
       5                 :            : 
       6                 :            : #include "macro.h"
       7                 :            : #include "string-util.h"
       8                 :            : 
       9                 :            : _unused_ \
      10                 :            : static const struct arphrd_name* lookup_arphrd(register const char *str, register GPERF_LEN_TYPE len);
      11                 :            : 
      12                 :            : #include "arphrd-from-name.h"
      13                 :            : #include "arphrd-list.h"
      14                 :            : #include "arphrd-to-name.h"
      15                 :            : 
      16                 :          4 : int main(int argc, const char *argv[]) {
      17                 :            : 
      18                 :            :         unsigned i;
      19                 :            : 
      20         [ +  + ]:     262144 :         for (i = 1; i < ELEMENTSOF(arphrd_names); i++) {
      21         [ +  + ]:     262140 :                 if (arphrd_names[i]) {
      22         [ -  + ]:        260 :                         assert_se(streq(arphrd_to_name(i), arphrd_names[i]));
      23         [ -  + ]:        260 :                         assert_se(arphrd_from_name(arphrd_names[i]) == (int) i);
      24                 :            :                 }
      25                 :            :         }
      26                 :            : 
      27         [ -  + ]:          4 :         assert_se(arphrd_to_name(arphrd_max()) == NULL);
      28         [ -  + ]:          4 :         assert_se(arphrd_to_name(0) == NULL);
      29         [ -  + ]:          4 :         assert_se(arphrd_from_name("huddlduddl") == -EINVAL);
      30         [ -  + ]:          4 :         assert_se(arphrd_from_name("") == -EINVAL);
      31                 :            : 
      32                 :          4 :         return 0;
      33                 :            : }

Generated by: LCOV version 1.14