summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Fridrich <zfridric@redhat.com>2022-09-24 10:54:38 +0200
committerNiels Möller <nisse@lysator.liu.se>2022-09-24 10:54:38 +0200
commit75722a2b8975dfc52c43bc12a6388b4eb8ec6ef6 (patch)
tree5fbfc9e4f67a796386ec3b126672ad182569fdff
parentf281a95547600bcc7a7069c84a6abc9b9dc3997d (diff)
downloadnettle-75722a2b8975dfc52c43bc12a6388b4eb8ec6ef6.tar.gz
Delete fail variable in tests
-rw-r--r--testsuite/balloon-test.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/testsuite/balloon-test.c b/testsuite/balloon-test.c
index 1b4cb41d..ad63c7a0 100644
--- a/testsuite/balloon-test.c
+++ b/testsuite/balloon-test.c
@@ -1,6 +1,7 @@
/* balloon-test.c
Copyright (C) 2022 Zoltan Fridrich
+ Copyright (C) 2022 Red Hat, Inc.
This file is part of GNU Nettle.
@@ -39,7 +40,6 @@ test_balloon(const struct nettle_hash *alg,
unsigned s_cost, unsigned t_cost,
const struct tstring *expected)
{
- int fail = 0;
void *ctx = xalloc(alg->context_size);
uint8_t *buf = xalloc(balloon_itch(alg->digest_size, s_cost));
@@ -56,14 +56,11 @@ test_balloon(const struct nettle_hash *alg,
fprintf(stderr, "\nExpected:");
tstring_print_hex(expected);
fprintf(stderr, "\n");
- fail = 1;
+ FAIL();
}
free(ctx);
free(buf);
-
- if (fail)
- FAIL();
}
static void
@@ -73,7 +70,6 @@ test_balloon_sha(const struct nettle_hash *alg,
unsigned s_cost, unsigned t_cost,
const struct tstring *expected)
{
- int fail = 0;
uint8_t *buf = xalloc(balloon_itch(alg->digest_size, s_cost));
if (alg == &nettle_sha1)
@@ -91,10 +87,10 @@ test_balloon_sha(const struct nettle_hash *alg,
else
{
fprintf(stderr, "test_balloon_sha: bad test\n");
- fail = 1;
+ FAIL();
}
- if (!fail && !MEMEQ(alg->digest_size, buf, expected->data))
+ if (!MEMEQ(alg->digest_size, buf, expected->data))
{
fprintf(stderr, "test_balloon_sha: result doesn't match the expectation:");
fprintf(stderr, "\nOutput: ");
@@ -102,13 +98,10 @@ test_balloon_sha(const struct nettle_hash *alg,
fprintf(stderr, "\nExpected:");
tstring_print_hex(expected);
fprintf(stderr, "\n");
- fail = 1;
+ FAIL();
}
free(buf);
-
- if (fail)
- FAIL();
}
/* Test vectors are taken from: