LCOV - code coverage report
Current view: top level - test - test-af-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 <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           1 : int main(int argc, const char *argv[]) {
      18             : 
      19             :         unsigned i;
      20             : 
      21          46 :         for (i = 0; i < ELEMENTSOF(af_names); i++) {
      22          45 :                 if (af_names[i]) {
      23          44 :                         assert_se(streq(af_to_name(i), af_names[i]));
      24          44 :                         assert_se(af_from_name(af_names[i]) == (int) i);
      25             :                 }
      26             :         }
      27             : 
      28           1 :         assert_se(af_to_name(af_max()) == NULL);
      29           1 :         assert_se(af_to_name(-1) == NULL);
      30           1 :         assert_se(af_from_name("huddlduddl") == -EINVAL);
      31           1 :         assert_se(af_from_name("") == -EINVAL);
      32             : 
      33           1 :         return 0;
      34             : }

Generated by: LCOV version 1.14