summaryrefslogtreecommitdiff
path: root/tests/simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/simple.c')
-rw-r--r--tests/simple.c88
1 files changed, 45 insertions, 43 deletions
diff --git a/tests/simple.c b/tests/simple.c
index 626d8714c5..98423f0272 100644
--- a/tests/simple.c
+++ b/tests/simple.c
@@ -20,7 +20,7 @@
*/
#ifdef HAVE_CONFIG_H
-# include <config.h>
+#include <config.h>
#endif
#include <stdio.h>
@@ -28,18 +28,20 @@
#include "utils.h"
-#define CHECK_OK(x,y,z) \
- if (x >= 0 && y >= 0 && z >= 0) { \
- if (!gnutls_check_version_numeric(x, y, z)) { \
- fail("error in gnutls_check_version_numeric %d.%d.%d: %d\n", x, y, z, __LINE__); \
- exit(1); \
- } \
+#define CHECK_OK(x, y, z) \
+ if (x >= 0 && y >= 0 && z >= 0) { \
+ if (!gnutls_check_version_numeric(x, y, z)) { \
+ fail("error in gnutls_check_version_numeric %d.%d.%d: %d\n", \
+ x, y, z, __LINE__); \
+ exit(1); \
+ } \
}
-#define CHECK_FAIL(x,y,z) \
- if (gnutls_check_version_numeric(x, y, z)) { \
- fail("error in neg gnutls_check_version_numeric %d.%d.%d: %d\n", x, y, z, __LINE__); \
- exit(1); \
+#define CHECK_FAIL(x, y, z) \
+ if (gnutls_check_version_numeric(x, y, z)) { \
+ fail("error in neg gnutls_check_version_numeric %d.%d.%d: %d\n", \
+ x, y, z, __LINE__); \
+ exit(1); \
}
void doit(void)
@@ -50,20 +52,20 @@ void doit(void)
gnutls_check_version(NULL));
}
- if (!gnutls_check_version_numeric
- (GNUTLS_VERSION_MAJOR, GNUTLS_VERSION_MINOR,
- GNUTLS_VERSION_PATCH)) {
+ if (!gnutls_check_version_numeric(GNUTLS_VERSION_MAJOR,
+ GNUTLS_VERSION_MINOR,
+ GNUTLS_VERSION_PATCH)) {
fail("error in gnutls_check_version_numeric 1\n");
exit(1);
}
CHECK_FAIL(99, 9, 9)
- CHECK_FAIL(90, 1, 0)
- CHECK_FAIL(90, 0, 0)
- CHECK_OK(2, 0, 0)
- CHECK_OK(2, 99, 99)
- CHECK_OK(3, 0, 0)
- if (!gnutls_check_version(GNUTLS_VERSION))
+ CHECK_FAIL(90, 1, 0)
+ CHECK_FAIL(90, 0, 0)
+ CHECK_OK(2, 0, 0)
+ CHECK_OK(2, 99, 99)
+ CHECK_OK(3, 0, 0)
+ if (!gnutls_check_version(GNUTLS_VERSION))
fail("gnutls_check_version ERROR\n");
{
@@ -77,15 +79,14 @@ void doit(void)
for (i = 0; algs[i]; i++) {
if (debug)
- printf("pk_list[%d] = %d = %s = %d\n",
- (int)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])
+ printf("pk_list[%d] = %d = %s = %d\n", (int)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 doesn't match\n");
}
@@ -110,16 +111,14 @@ void doit(void)
gnutls_digest_algorithm_t hash;
if (debug)
- printf("sign_list[%d] = %d = %s = %d\n",
- (int)i, algs[i],
- gnutls_sign_algorithm_get_name(algs
- [i]),
- gnutls_sign_get_id
- (gnutls_sign_algorithm_get_name
- (algs[i])));
- if (gnutls_sign_get_id
- (gnutls_sign_algorithm_get_name(algs[i])) !=
- algs[i])
+ printf("sign_list[%d] = %d = %s = %d\n", (int)i,
+ algs[i],
+ gnutls_sign_algorithm_get_name(algs[i]),
+ gnutls_sign_get_id(
+ gnutls_sign_algorithm_get_name(
+ algs[i])));
+ if (gnutls_sign_get_id(gnutls_sign_algorithm_get_name(
+ algs[i])) != algs[i])
fail("gnutls_sign id for %s doesn't match\n",
gnutls_sign_algorithm_get_name(algs[i]));
@@ -127,14 +126,17 @@ void doit(void)
if (hash != GNUTLS_DIG_UNKNOWN) {
const char *name = gnutls_digest_get_name(hash);
gnutls_digest_algorithm_t hash2 =
- gnutls_digest_get_id(name);
+ gnutls_digest_get_id(name);
/* gnutls_digest_get_id returns
* GNUTLS_DIG_UNKNOWN if the algorithm is not
* compiled in.
*/
- if (hash2 != GNUTLS_DIG_UNKNOWN
- && hash2 != hash)
- fail("gnutls_digest id for %s doesn't match %s\n", gnutls_sign_algorithm_get_name(algs[i]), name);
+ if (hash2 != GNUTLS_DIG_UNKNOWN &&
+ hash2 != hash)
+ fail("gnutls_digest id for %s doesn't match %s\n",
+ gnutls_sign_algorithm_get_name(
+ algs[i]),
+ name);
}
}