summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-06-22 20:12:17 -0400
committerDavid Robillard <d@drobilla.net>2024-06-22 20:17:06 -0400
commit503e58d36cd467ce83a7312f55bb8beb4e5e370b (patch)
treedda8210a6b71665f46c9ed37cf3de72a869407ea /test
parentd8204ca7482a9a5184cdd99f16f9d47b0cbe1c22 (diff)
downloadzix-503e58d36cd467ce83a7312f55bb8beb4e5e370b.tar.gz
zix-503e58d36cd467ce83a7312f55bb8beb4e5e370b.tar.bz2
zix-503e58d36cd467ce83a7312f55bb8beb4e5e370b.zip
Clean up whitespace and clang-format configuration
Diffstat (limited to 'test')
-rw-r--r--test/test_digest.c3
-rw-r--r--test/test_hash.c27
2 files changed, 20 insertions, 10 deletions
diff --git a/test/test_digest.c b/test/test_digest.c
index 7e7e77a..7228f86 100644
--- a/test/test_digest.c
+++ b/test/test_digest.c
@@ -116,7 +116,8 @@ test_digest_aligned(void)
}
}
-ZIX_PURE_FUNC int
+ZIX_PURE_FUNC
+int
main(void)
{
test_digest32();
diff --git a/test/test_hash.c b/test/test_hash.c
index d257924..3d3ca95 100644
--- a/test/test_hash.c
+++ b/test/test_hash.c
@@ -47,21 +47,24 @@ test_fail(TestState* const state, const char* fmt, ...)
return EXIT_FAILURE;
}
-ZIX_PURE_FUNC static const char*
+ZIX_PURE_FUNC
+static const char*
identity(const char* record)
{
return record;
}
/// Decent hash function using zix_digest (murmur2)
-ZIX_PURE_FUNC static size_t
+ZIX_PURE_FUNC
+static size_t
decent_string_hash(const char* const str)
{
return zix_digest(0U, str, strlen(str));
}
/// Terrible hash function from K&R first edition
-ZIX_PURE_FUNC static size_t
+ZIX_PURE_FUNC
+static size_t
terrible_string_hash(const char* str)
{
size_t hash = 0U;
@@ -74,7 +77,8 @@ terrible_string_hash(const char* str)
return hash;
}
-ZIX_PURE_FUNC static size_t
+ZIX_PURE_FUNC
+static size_t
string_hash_aligned(const char* const str)
{
size_t length = strlen(str);
@@ -83,19 +87,22 @@ string_hash_aligned(const char* const str)
return zix_digest_aligned(0U, str, length);
}
-ZIX_PURE_FUNC static size_t
+ZIX_PURE_FUNC
+static size_t
string_hash32(const char* const str)
{
return (size_t)zix_digest32(0U, str, strlen(str));
}
-ZIX_PURE_FUNC static size_t
+ZIX_PURE_FUNC
+static size_t
string_hash64(const char* const str)
{
return (size_t)zix_digest64(0U, str, strlen(str));
}
-ZIX_PURE_FUNC static size_t
+ZIX_PURE_FUNC
+static size_t
string_hash32_aligned(const char* const str)
{
size_t length = strlen(str);
@@ -106,7 +113,8 @@ string_hash32_aligned(const char* const str)
#if UINTPTR_MAX >= UINT64_MAX
-ZIX_PURE_FUNC static size_t
+ZIX_PURE_FUNC
+static size_t
string_hash64_aligned(const char* const str)
{
size_t length = strlen(str);
@@ -290,7 +298,8 @@ stress(ZixAllocator* const allocator, const size_t n_elems)
}
/// Identity hash function for numeric strings for explicitly hitting cases
-ZIX_PURE_FUNC static size_t
+ZIX_PURE_FUNC
+static size_t
identity_index_hash(const char* const str)
{
return strtoul(str, NULL, 10);