summaryrefslogtreecommitdiff
path: root/tests/simple.c
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2008-09-01 16:35:41 +0200
committerSimon Josefsson <simon@josefsson.org>2008-09-01 16:35:41 +0200
commitf3ff8f068bb32f6fa1869419c764a59974ffff34 (patch)
treedcf70af11499b23b0029bc259f9e9ac13c40a903 /tests/simple.c
parent3ee5aaef35653dee0d6584fea229bc98760601c8 (diff)
downloadgnutls-f3ff8f068bb32f6fa1869419c764a59974ffff34.tar.gz
Add more tests.
Diffstat (limited to 'tests/simple.c')
-rw-r--r--tests/simple.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/tests/simple.c b/tests/simple.c
index eeb83687c8..66e0d428ed 100644
--- a/tests/simple.c
+++ b/tests/simple.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2005 Free Software Foundation
+ * Copyright (C) 2004, 2005, 2008 Free Software Foundation
*
* Author: Simon Josefsson
*
@@ -31,14 +31,37 @@
void
doit (void)
{
- if (debug)
- {
- printf ("GNUTLS header version %s.\n", LIBGNUTLS_VERSION);
- printf ("GNUTLS library version %s.\n", gnutls_check_version (NULL));
- }
+ printf ("GNUTLS header version %s.\n", LIBGNUTLS_VERSION);
+ printf ("GNUTLS library version %s.\n", gnutls_check_version (NULL));
if (gnutls_check_version (LIBGNUTLS_VERSION))
success ("gnutls_check_version OK\n");
else
fail ("gnutls_check_version ERROR\n");
+
+ {
+ const gnutls_pk_algorithm_t *algs;
+ size_t i;
+ int pk;
+
+ algs = gnutls_pk_list ();
+ if (!algs)
+ fail ("gnutls_pk_list return NULL\n");
+
+ for (i = 0; algs[i]; i++)
+ {
+ printf ("pk_list[%d] = %d = %s = %d\n", i, algs[i],
+ gnutls_pk_algorithm_get_name (algs[i]),
+ gnutls_pk_get_id (gnutls_pk_algorithm_get_name (algs[i])));
+ if (gnutls_pk_get_id (gnutls_pk_algorithm_get_name (algs[i]))
+ != algs[i])
+ fail ("gnutls_pk id's doesn't match\n");
+ }
+
+ pk = gnutls_pk_get_id ("foo");
+ if (pk != GNUTLS_PK_UNKNOWN)
+ fail ("gnutls_pk unknown test failed (%d)\n", pk);
+
+ success ("gnutls_pk_list ok\n");
+ }
}