~ubuntu-branches/ubuntu/quantal/gnutls26/quantal

« back to all changes in this revision

Viewing changes to tests/simple.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2011-05-20 13:07:18 UTC
  • mfrom: (12.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20110520130718-db41dybbanzfvlji
Tags: 2.10.5-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Fix build failure with --no-add-needed.
  - Build for multiarch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2004, 2005, 2008, 2009 Free Software Foundation
 
2
 * Copyright (C) 2004, 2005, 2008, 2009, 2010 Free Software Foundation,
 
3
 * Inc.
3
4
 *
4
5
 * Author: Simon Josefsson
5
6
 *
6
 
 * This file is part of GNUTLS.
 
7
 * This file is part of GnuTLS.
7
8
 *
8
 
 * GNUTLS is free software; you can redistribute it and/or modify it
 
9
 * GnuTLS is free software; you can redistribute it and/or modify it
9
10
 * under the terms of the GNU General Public License as published by
10
11
 * the Free Software Foundation; either version 3 of the License, or
11
12
 * (at your option) any later version.
12
13
 *
13
 
 * GNUTLS is distributed in the hope that it will be useful, but
 
14
 * GnuTLS is distributed in the hope that it will be useful, but
14
15
 * WITHOUT ANY WARRANTY; without even the implied warranty of
15
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
17
 * General Public License for more details.
17
18
 *
18
19
 * You should have received a copy of the GNU General Public License
19
 
 * along with GNUTLS; if not, write to the Free Software Foundation,
 
20
 * along with GnuTLS; if not, write to the Free Software Foundation,
20
21
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21
22
 */
22
23
 
31
32
void
32
33
doit (void)
33
34
{
34
 
  printf ("GnuTLS header version %s.\n", GNUTLS_VERSION);
35
 
  printf ("GnuTLS library version %s.\n", gnutls_check_version (NULL));
 
35
  if (debug)
 
36
    {
 
37
      printf ("GnuTLS header version %s.\n", GNUTLS_VERSION);
 
38
      printf ("GnuTLS library version %s.\n", gnutls_check_version (NULL));
 
39
    }
36
40
 
37
 
  if (gnutls_check_version (GNUTLS_VERSION))
38
 
    success ("gnutls_check_version OK\n");
39
 
  else
 
41
  if (!gnutls_check_version (GNUTLS_VERSION))
40
42
    fail ("gnutls_check_version ERROR\n");
41
43
 
42
44
  {
50
52
 
51
53
    for (i = 0; algs[i]; i++)
52
54
      {
53
 
        printf ("pk_list[%d] = %d = %s = %d\n", i, algs[i],
54
 
                gnutls_pk_algorithm_get_name (algs[i]),
55
 
                gnutls_pk_get_id (gnutls_pk_algorithm_get_name (algs[i])));
 
55
        if (debug)
 
56
          printf ("pk_list[%d] = %d = %s = %d\n", (int) i, algs[i],
 
57
                  gnutls_pk_algorithm_get_name (algs[i]),
 
58
                  gnutls_pk_get_id (gnutls_pk_algorithm_get_name (algs[i])));
56
59
        if (gnutls_pk_get_id (gnutls_pk_algorithm_get_name (algs[i]))
57
60
            != algs[i])
58
61
          fail ("gnutls_pk id's doesn't match\n");
62
65
    if (pk != GNUTLS_PK_UNKNOWN)
63
66
      fail ("gnutls_pk unknown test failed (%d)\n", pk);
64
67
 
65
 
    success ("gnutls_pk_list ok\n");
 
68
    if (debug)
 
69
      success ("gnutls_pk_list ok\n");
66
70
  }
67
71
 
68
72
  {
76
80
 
77
81
    for (i = 0; algs[i]; i++)
78
82
      {
79
 
        printf ("sign_list[%d] = %d = %s = %d\n", i, algs[i],
80
 
                gnutls_sign_algorithm_get_name (algs[i]),
81
 
                gnutls_sign_get_id (gnutls_sign_algorithm_get_name
82
 
                                    (algs[i])));
 
83
        if (debug)
 
84
          printf ("sign_list[%d] = %d = %s = %d\n", (int) i, algs[i],
 
85
                  gnutls_sign_algorithm_get_name (algs[i]),
 
86
                  gnutls_sign_get_id (gnutls_sign_algorithm_get_name
 
87
                                      (algs[i])));
83
88
        if (gnutls_sign_get_id (gnutls_sign_algorithm_get_name (algs[i])) !=
84
89
            algs[i])
85
90
          fail ("gnutls_sign id's doesn't match\n");
89
94
    if (pk != GNUTLS_PK_UNKNOWN)
90
95
      fail ("gnutls_sign unknown test failed (%d)\n", pk);
91
96
 
92
 
    success ("gnutls_sign_list ok\n");
 
97
    if (debug)
 
98
      success ("gnutls_sign_list ok\n");
93
99
  }
94
100
}