LCOV - code coverage report
Current view: top level - liboath/tests - tst_basic.c (source / functions) Hit Total Coverage
Test: oath-toolkit Lines: 9 19 47.4 %
Date: 2013-01-08 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 5 10 50.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * tst_basic.c - self-tests for liboath basic functions
       3                 :            :  * Copyright (C) 2009-2013 Simon Josefsson
       4                 :            :  *
       5                 :            :  * This library is free software; you can redistribute it and/or
       6                 :            :  * modify it under the terms of the GNU Lesser General Public License
       7                 :            :  * as published by the Free Software Foundation; either version 2.1 of
       8                 :            :  * the License, or (at your option) any later version.
       9                 :            :  *
      10                 :            :  * This library is distributed in the hope that it will be useful, but
      11                 :            :  * WITHOUT ANY WARRANTY; without even the implied warranty of
      12                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13                 :            :  * Lesser General Public License for more details.
      14                 :            :  *
      15                 :            :  * You should have received a copy of the GNU Lesser General Public
      16                 :            :  * License along with this library; if not, write to the Free Software
      17                 :            :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
      18                 :            :  * 02110-1301 USA
      19                 :            :  *
      20                 :            :  */
      21                 :            : 
      22                 :            : #include <config.h>
      23                 :            : 
      24                 :            : #include "oath.h"
      25                 :            : 
      26                 :            : #include <stdio.h>
      27                 :            : 
      28                 :            : int
      29                 :          1 : main (void)
      30                 :            : {
      31                 :            :   oath_rc rc;
      32                 :            : 
      33                 :            :   /* Check version. */
      34                 :            : 
      35         [ -  + ]:          1 :   if (!oath_check_version (OATH_VERSION))
      36                 :            :     {
      37                 :          0 :       printf ("oath_check_version (%s) failed [%s]\n", OATH_VERSION,
      38                 :            :               oath_check_version (NULL));
      39                 :          0 :       return 1;
      40                 :            :     }
      41                 :            : 
      42         [ -  + ]:          1 :   if (oath_check_version (NULL) == NULL)
      43                 :            :     {
      44                 :          0 :       printf ("oath_check_version (NULL) == NULL\n");
      45                 :          0 :       return 1;
      46                 :            :     }
      47                 :            : 
      48         [ -  + ]:          1 :   if (oath_check_version ("999.999"))
      49                 :            :     {
      50                 :          0 :       printf ("oath_check_version (999.999) succeeded?!\n");
      51                 :          0 :       return 1;
      52                 :            :     }
      53                 :            : 
      54                 :            :   /* Test initialization. */
      55                 :            : 
      56                 :          1 :   rc = oath_init ();
      57         [ -  + ]:          1 :   if (rc != OATH_OK)
      58                 :            :     {
      59                 :          0 :       printf ("oath_init: %d\n", rc);
      60                 :          0 :       return 1;
      61                 :            :     }
      62                 :            : 
      63                 :            :   /* Test deinitialization. */
      64                 :            : 
      65                 :          1 :   rc = oath_done ();
      66         [ -  + ]:          1 :   if (rc != OATH_OK)
      67                 :            :     {
      68                 :          0 :       printf ("oath_done: %d\n", rc);
      69                 :          0 :       return 1;
      70                 :            :     }
      71                 :            : 
      72                 :          1 :   return 0;
      73                 :            : }

Generated by: LCOV version 1.9