LCOV - code coverage report
Current view: top level - tests - errors.c (source / functions) Hit Total Coverage
Test: GNU SASL Lines: 11 13 84.6 %
Date: 2012-05-28 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 8 75.0 %

           Branch data     Line data    Source code
       1                 :            : /* errors.c --- Test the gsasl_strerror and gsasl_strerror_name functions.
       2                 :            :  * Copyright (C) 2002-2012 Simon Josefsson
       3                 :            :  *
       4                 :            :  * This file is part of GNU SASL.
       5                 :            :  *
       6                 :            :  * This program is free software: you can redistribute it and/or modify
       7                 :            :  * it under the terms of the GNU General Public License as published by
       8                 :            :  * the Free Software Foundation, either version 3 of the License, or
       9                 :            :  * (at your option) any later version.
      10                 :            :  *
      11                 :            :  * This program is distributed in the hope that it will be useful,
      12                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14                 :            :  * GNU General Public License for more details.
      15                 :            :  *
      16                 :            :  * You should have received a copy of the GNU General Public License
      17                 :            :  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
      18                 :            :  *
      19                 :            :  */
      20                 :            : 
      21                 :            : #ifdef HAVE_CONFIG_H
      22                 :            : #include "config.h"
      23                 :            : #endif
      24                 :            : 
      25                 :            : #include <stdio.h>
      26                 :            : #include <stdarg.h>
      27                 :            : #include <stdlib.h>
      28                 :            : #include <string.h>
      29                 :            : 
      30                 :            : #include <gsasl.h>
      31                 :            : 
      32                 :            : int
      33                 :          1 : main (void)
      34                 :            : {
      35                 :          1 :   const char *this = NULL, *last = NULL;
      36                 :            :   const char *name;
      37                 :          1 :   int i = 0;
      38                 :            : 
      39                 :            :   do
      40                 :            :     {
      41                 :         71 :       last = this;
      42                 :            : 
      43                 :         71 :       this = gsasl_strerror (i);
      44                 :         71 :       name = gsasl_strerror_name (i);
      45                 :            : 
      46         [ +  + ]:         71 :       printf ("%s (%d)\n\t%s\n", name ? name : "NULL", i, this);
      47                 :            : 
      48         [ -  + ]:         71 :       if (this == NULL)
      49                 :            :         {
      50                 :          0 :           printf ("Null error string?!\n");
      51                 :          0 :           return EXIT_FAILURE;
      52                 :            :         }
      53                 :            : 
      54                 :         71 :       i++;
      55                 :            :     }
      56 [ +  + ][ +  - ]:         71 :   while (this != last && this != NULL);
      57                 :            : 
      58                 :          1 :   return EXIT_SUCCESS;
      59                 :            : }

Generated by: LCOV version 1.9