Fix symbol export rules.
[gnutls.git] / tests / simple.c
blob5f1645494e0ed729d2590ceee4e4c45b05381434
1 /*
2 * Copyright (C) 2004, 2005, 2008, 2009 Free Software Foundation
4 * Author: Simon Josefsson
6 * This file is part of GNUTLS.
8 * GNUTLS is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * GNUTLS is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * 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 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 #ifdef HAVE_CONFIG_H
24 # include <config.h>
25 #endif
27 #include <stdio.h>
29 #include "utils.h"
31 void
32 doit (void)
34 printf ("GnuTLS header version %s.\n", GNUTLS_VERSION);
35 printf ("GnuTLS library version %s.\n", gnutls_check_version (NULL));
37 if (gnutls_check_version (GNUTLS_VERSION))
38 success ("gnutls_check_version OK\n");
39 else
40 fail ("gnutls_check_version ERROR\n");
43 const gnutls_pk_algorithm_t *algs;
44 size_t i;
45 int pk;
47 algs = gnutls_pk_list ();
48 if (!algs)
49 fail ("gnutls_pk_list return NULL\n");
51 for (i = 0; algs[i]; i++)
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])));
56 if (gnutls_pk_get_id (gnutls_pk_algorithm_get_name (algs[i]))
57 != algs[i])
58 fail ("gnutls_pk id's doesn't match\n");
61 pk = gnutls_pk_get_id ("foo");
62 if (pk != GNUTLS_PK_UNKNOWN)
63 fail ("gnutls_pk unknown test failed (%d)\n", pk);
65 success ("gnutls_pk_list ok\n");
69 const gnutls_sign_algorithm_t *algs;
70 size_t i;
71 int pk;
73 algs = gnutls_sign_list ();
74 if (!algs)
75 fail ("gnutls_sign_list return NULL\n");
77 for (i = 0; algs[i]; i++)
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 (gnutls_sign_get_id (gnutls_sign_algorithm_get_name (algs[i])) !=
84 algs[i])
85 fail ("gnutls_sign id's doesn't match\n");
88 pk = gnutls_sign_get_id ("foo");
89 if (pk != GNUTLS_PK_UNKNOWN)
90 fail ("gnutls_sign unknown test failed (%d)\n", pk);
92 success ("gnutls_sign_list ok\n");