LCOV - code coverage report
Current view: top level - test - test-arphrd-list.c (source / functions) Hit Total Coverage
Test: main_coverage.info Lines: 10 10 100.0 %
Date: 2019-08-22 15:41:25 Functions: 1 1 100.0 %

          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           1 : int main(int argc, const char *argv[]) {
      17             : 
      18             :         unsigned i;
      19             : 
      20       65536 :         for (i = 1; i < ELEMENTSOF(arphrd_names); i++) {
      21       65535 :                 if (arphrd_names[i]) {
      22          65 :                         assert_se(streq(arphrd_to_name(i), arphrd_names[i]));
      23          65 :                         assert_se(arphrd_from_name(arphrd_names[i]) == (int) i);
      24             :                 }
      25             :         }
      26             : 
      27           1 :         assert_se(arphrd_to_name(arphrd_max()) == NULL);
      28           1 :         assert_se(arphrd_to_name(0) == NULL);
      29           1 :         assert_se(arphrd_from_name("huddlduddl") == -EINVAL);
      30           1 :         assert_se(arphrd_from_name("") == -EINVAL);
      31             : 
      32           1 :         return 0;
      33             : }

Generated by: LCOV version 1.14