LCOV - code coverage report
Current view: top level - tests - t-version.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 14 27 51.9 %
Date: 2017-03-02 17:11:10 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /* t-version.c - Regression test.
       2             :    Copyright (C) 2001, 2004 g10 Code GmbH
       3             : 
       4             :    This file is part of GPGME.
       5             : 
       6             :    GPGME is free software; you can redistribute it and/or modify it
       7             :    under the terms of the GNU Lesser General Public License as
       8             :    published by the Free Software Foundation; either version 2.1 of
       9             :    the License, or (at your option) any later version.
      10             : 
      11             :    GPGME is distributed in the hope that it will be useful, but
      12             :    WITHOUT ANY WARRANTY; without even the implied warranty of
      13             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      14             :    Lesser General Public License for more details.
      15             : 
      16             :    You should have received a copy of the GNU Lesser General Public
      17             :    License along with this program; if not, write to the Free Software
      18             :    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
      19             :    02111-1307, USA.  */
      20             : 
      21             : #ifdef HAVE_CONFIG_H
      22             : #include <config.h>
      23             : #endif
      24             : 
      25             : #include <stdio.h>
      26             : #include <stdlib.h>
      27             : #include <string.h>
      28             : 
      29             : #include <gpgme.h>
      30             : 
      31             : static int verbose;
      32             : static int debug;
      33             : 
      34             : 
      35             : int
      36           1 : main (int argc, char **argv)
      37             : {
      38             :   int ret;
      39             :   const char *null_result;
      40             :   const char *current_result;
      41             :   const char *future_result;
      42             : 
      43           1 :   int last_argc = -1;
      44             : 
      45           1 :   if (argc)
      46             :     {
      47           1 :       argc--; argv++;
      48             :     }
      49           2 :   while (argc && last_argc != argc )
      50             :     {
      51           0 :       last_argc = argc;
      52           0 :       if (!strcmp (*argv, "--help"))
      53             :         {
      54           0 :           puts ("usage: ./t-version [options]\n"
      55             :                 "\n"
      56             :                 "Options:\n"
      57             :                 "  --verbose      Show what is going on\n"
      58             :                 );
      59           0 :           exit (0);
      60             :         }
      61           0 :       if (!strcmp (*argv, "--verbose"))
      62             :         {
      63           0 :           verbose = 1;
      64           0 :           argc--; argv++;
      65             :         }
      66           0 :       else if (!strcmp (*argv, "--debug"))
      67             :         {
      68           0 :           verbose = debug = 1;
      69           0 :           argc--; argv++;
      70             :         }
      71             :     }
      72             : 
      73           1 :   null_result = gpgme_check_version (NULL);
      74           1 :   current_result = gpgme_check_version (VERSION);
      75           1 :   future_result = gpgme_check_version (VERSION ".1");
      76             : 
      77           2 :   ret = !(null_result
      78           1 :           && ! strcmp (null_result, VERSION)
      79           1 :           && current_result
      80           1 :           && ! strcmp (current_result, VERSION)
      81             :           && ! future_result);
      82             : 
      83           1 :   if (verbose || ret)
      84             :     {
      85           0 :       printf ("Version from header: %s (0x%06x)\n",
      86             :                GPGME_VERSION, GPGME_VERSION_NUMBER);
      87           0 :       printf ("Version from binary: %s\n", gpgme_check_version (NULL));
      88           0 :       printf ("Copyright blurb ...:%s\n", gpgme_check_version ("\x01\x01"));
      89             :     }
      90             : 
      91           1 :   return ret;
      92             : }

Generated by: LCOV version 1.13