Blame tests/t-version.c

Packit Service 672cf4
/* t-version.c - Regression test.
Packit Service 6c01f9
   Copyright (C) 2001, 2004 g10 Code GmbH
Packit Service 6c01f9
Packit Service 6c01f9
   This file is part of GPGME.
Packit Service 6c01f9
Packit Service 6c01f9
   GPGME is free software; you can redistribute it and/or modify it
Packit Service 6c01f9
   under the terms of the GNU Lesser General Public License as
Packit Service 6c01f9
   published by the Free Software Foundation; either version 2.1 of
Packit Service 6c01f9
   the License, or (at your option) any later version.
Packit Service 6c01f9
Packit Service 6c01f9
   GPGME is distributed in the hope that it will be useful, but
Packit Service 6c01f9
   WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 6c01f9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 6c01f9
   Lesser General Public License for more details.
Packit Service 6c01f9
Packit Service 6c01f9
   You should have received a copy of the GNU Lesser General Public
Packit Service 6c01f9
   License along with this program; if not, write to the Free Software
Packit Service 6c01f9
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
Packit Service 6c01f9
   02111-1307, USA.  */
Packit Service 672cf4
Packit Service 672cf4
#ifdef HAVE_CONFIG_H
Packit Service 672cf4
#include <config.h>
Packit Service 672cf4
#endif
Packit Service 672cf4
Packit Service 672cf4
#include <stdio.h>
Packit Service 672cf4
#include <stdlib.h>
Packit Service 672cf4
#include <string.h>
Packit Service 672cf4
Packit Service 672cf4
#include <gpgme.h>
Packit Service 672cf4
Packit Service 672cf4
static int verbose;
Packit Service 672cf4
static int debug;
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
int
Packit Service 672cf4
main (int argc, char **argv)
Packit Service 672cf4
{
Packit Service 672cf4
  int ret;
Packit Service 672cf4
  const char *null_result;
Packit Service 672cf4
  const char *current_result;
Packit Service 672cf4
  const char *future_result;
Packit Service 672cf4
Packit Service 672cf4
  int last_argc = -1;
Packit Service 672cf4
Packit Service 672cf4
  if (argc)
Packit Service 672cf4
    {
Packit Service 672cf4
      argc--; argv++;
Packit Service 672cf4
    }
Packit Service 672cf4
  while (argc && last_argc != argc )
Packit Service 672cf4
    {
Packit Service 672cf4
      last_argc = argc;
Packit Service 672cf4
      if (!strcmp (*argv, "--help"))
Packit Service 672cf4
        {
Packit Service 672cf4
          puts ("usage: ./t-version [options]\n"
Packit Service 672cf4
                "\n"
Packit Service 672cf4
                "Options:\n"
Packit Service 672cf4
                "  --verbose      Show what is going on\n"
Packit Service 672cf4
                );
Packit Service 672cf4
          exit (0);
Packit Service 672cf4
        }
Packit Service 672cf4
      if (!strcmp (*argv, "--verbose"))
Packit Service 672cf4
        {
Packit Service 672cf4
          verbose = 1;
Packit Service 672cf4
          argc--; argv++;
Packit Service 672cf4
        }
Packit Service 672cf4
      else if (!strcmp (*argv, "--debug"))
Packit Service 672cf4
        {
Packit Service 672cf4
          verbose = debug = 1;
Packit Service 672cf4
          argc--; argv++;
Packit Service 672cf4
        }
Packit Service 672cf4
    }
Packit Service 672cf4
Packit Service 672cf4
  null_result = gpgme_check_version (NULL);
Packit Service 672cf4
  current_result = gpgme_check_version (VERSION);
Packit Service 672cf4
  future_result = gpgme_check_version (VERSION ".1");
Packit Service 672cf4
Packit Service 672cf4
  ret = !(null_result
Packit Service 672cf4
          && ! strcmp (null_result, VERSION)
Packit Service 672cf4
          && current_result
Packit Service 672cf4
          && ! strcmp (current_result, VERSION)
Packit Service 672cf4
          && ! future_result);
Packit Service 672cf4
Packit Service 672cf4
  if (verbose || ret)
Packit Service 672cf4
    {
Packit Service 672cf4
      printf ("Version from header: %s (0x%06x)\n",
Packit Service 672cf4
               GPGME_VERSION, GPGME_VERSION_NUMBER);
Packit Service 672cf4
      printf ("Version from binary: %s\n", gpgme_check_version (NULL));
Packit Service 672cf4
      printf ("Copyright blurb ...:%s\n", gpgme_check_version ("\x01\x01"));
Packit Service 672cf4
    }
Packit Service 672cf4
Packit Service 672cf4
  return ret;
Packit Service 672cf4
}