From d5252704437ddf2e169742198e3e3233fbda9698 Mon Sep 17 00:00:00 2001 From: Timerix22 Date: Fri, 3 Jun 2022 20:51:57 +0300 Subject: [PATCH] test_hash_functions --- tests/main.cpp | 16 +++++++------- tests/{test_hash.c => test_hash_functions.c} | 22 ++++++++++---------- tests/tests.h | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) rename tests/{test_hash.c => test_hash_functions.c} (50%) diff --git a/tests/main.cpp b/tests/main.cpp index eeef74d..d2bafc2 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,14 +1,14 @@ #include "tests.h" void test_all(){ - // test_autoarr(); - // test_string(); - // test_safethrow(); - // test_searchtree(); - // test_hashtable(); - // test_dtsod(); - // test_autoarr2(); - test_hash_collisions(); + test_autoarr(); + test_string(); + test_safethrow(); + test_searchtree(); + test_hashtable(); + test_dtsod(); + test_autoarr2(); + test_hash_functions(); printf("\e[96m---------------------------------------\e[0m\n"); } diff --git a/tests/test_hash.c b/tests/test_hash_functions.c similarity index 50% rename from tests/test_hash.c rename to tests/test_hash_functions.c index 1cbb360..b1ec0b7 100644 --- a/tests/test_hash.c +++ b/tests/test_hash_functions.c @@ -4,9 +4,12 @@ #define AMOUNT_OF_TESTS 400000 -#define test_hashf(hasht, hashf, tests_n)\ +char __buf[]="iojihiojopijiugbjmoihftytryfdrh"; + +#define test_hashfunc(hasht, hashf, tests_n)\ optime(#hashf,1,({\ - printf("\e[94mfunction: " #hashf "\n");\ + printf("\e[94mfunction: \e[92m" #hashf "\n");\ + printf("\e[94mhash of \"%s\": \e[92m%x\n",__buf, hashf(__buf,cptr_length(__buf)));\ Autoarr(hasht)* hashes=Autoarr_create(hasht,512,32768);\ uint32 collisions=0;\ for(uint32 i=0;i