aboutsummaryrefslogtreecommitdiff
path: root/test/core.c
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2019-01-06 16:21:58 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2019-01-06 16:21:58 +0100
commit90a4bf2ab7a2a78ee0ce7e61926a1aa0ac1b9820 (patch)
treeda3652491496bdaa6e57144b1857b75b7153213e /test/core.c
parent980c763c84bdbf1588eb1e8757bb09346570a6e7 (diff)
downloadd2tk-90a4bf2ab7a2a78ee0ce7e61926a1aa0ac1b9820.tar.xz
hash: update to mum 2, impl. multi-value hashing.
Diffstat (limited to 'test/core.c')
-rw-r--r--test/core.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/core.c b/test/core.c
index 39b169a..62b63c3 100644
--- a/test/core.c
+++ b/test/core.c
@@ -6,6 +6,7 @@
#include <assert.h>
#include <d2tk/core.h>
+#include <d2tk/hash.h>
#include "src/core_internal.h"
typedef void (*d2tk_check_t)(const d2tk_com_t *com, const d2tk_clip_t *clip);
@@ -175,6 +176,33 @@ const d2tk_core_driver_t d2tk_mock_driver_triple = {
};
static void
+_test_hash()
+{
+ const char *foo = "barbarbarbar";
+
+ const uint64_t hash1 = d2tk_hash(foo, -1);
+ const uint64_t hash2 = d2tk_hash(foo, strlen(foo));
+
+ assert(hash1 == hash2);
+}
+
+static void
+_test_hash_foreach()
+{
+ const char *foo = "barbarbarbar";
+ const char *bar = "foofoofoofoo";
+
+ const uint64_t hash1 = d2tk_hash_foreach(foo, -1,
+ bar, -1,
+ NULL);
+ const uint64_t hash2 = d2tk_hash_foreach(foo, strlen(foo),
+ bar, strlen(bar),
+ NULL);
+
+ assert(hash1 == hash2);
+}
+
+static void
_test_rect_shrink()
{
d2tk_rect_t dst;
@@ -1383,6 +1411,8 @@ _test_triple()
int
main(int argc __attribute__((unused)), char **argv __attribute__((unused)))
{
+ _test_hash();
+ _test_hash_foreach();
_test_rect_shrink();
_test_point();
_test_dimensions();