summaryrefslogtreecommitdiff
path: root/tests/hash.c
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-01-12 00:14:03 -0300
committerEuAndreh <eu@euandre.org>2025-01-12 14:27:57 -0300
commit44d56f5311f98a8955c67638e7520963dbd4d845 (patch)
treefbb2c58c79f1730ff62c83cef116fb5c0e035dfe /tests/hash.c
parentReplace src/config.h with <s.h>; incorporate changes from other projects (diff)
downloadpindaiba-44d56f5311f98a8955c67638e7520963dbd4d845.tar.gz
pindaiba-44d56f5311f98a8955c67638e7520963dbd4d845.tar.xz
Revamp lib, simplify it a bit and address some FIXMEs
Diffstat (limited to '')
-rw-r--r--tests/hash.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/tests/hash.c b/tests/hash.c
index ebb39a0..b3c2aad 100644
--- a/tests/hash.c
+++ b/tests/hash.c
@@ -13,30 +13,28 @@ test_HASH_OUTPUT_LENGTH(void) {
{
testing("Enforce we're always consistent with SipHash");
- assert(HASH_OUTPUT_LENGTH == SIPHASHBS_OUTPUT_LENGTH);
+ assert((int)HASH_OUTPUT_LENGTH == (int)SIPHASH_OUTPUT_LENGTH);
test_ok();
}
}
static int
-test_hash_init(void) {
+test_hash_setup(void) {
int rc = -1;
- test_start("hash_init()");
+ test_start("hash_setup()");
{
- testing("INITIALIZED changes after calling hash_init()");
+ testing("SEED_INITIALIZED changes after calling hash_setup()");
- assert(INITIALIZED == false);
+ assert(SEED_INITIALIZED == false);
- if (hash_init()) {
- logerr("hash_init()");
+ if (hash_setup()) {
+ logerr("hash_setup()");
goto out;
}
- rc = 0; goto out;
-
- assert(INITIALIZED == true);
+ assert(SEED_INITIALIZED == true);
test_ok();
}
@@ -50,14 +48,25 @@ int
main(void) {
int rc = EXIT_FAILURE;
+ if (random_init()) {
+ logerr("random_init()");
+ goto out;
+ }
+
test_HASH_OUTPUT_LENGTH();
- if (test_hash_init()) {
- logerr("test_hash_init()");
+ if (test_hash_setup()) {
+ logerr("test_hash_setup()");
goto out;
}
rc = EXIT_SUCCESS;
out:
+ if (random_end()) {
+ if (rc == EXIT_SUCCESS) {
+ rc = EXIT_FAILURE;
+ }
+ }
+
return rc;
}