summaryrefslogtreecommitdiff
path: root/tests/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hash.c')
-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;
}