summaryrefslogtreecommitdiff
path: root/ccan/htable/test/run-copy.c
diff options
context:
space:
mode:
authorWilliam Casarin <jb55@jb55.com>2018-07-09 22:28:25 -0700
committerWilliam Casarin <jb55@jb55.com>2018-07-09 22:31:48 -0700
commit9593fc545950782ed75f12f53238b07885559b2b (patch)
tree9c7c2f7cbb427c54e9184cb61eedce737a6cbc6f /ccan/htable/test/run-copy.c
parentbd8c223756d2f912526ecef53bae0cc8e0c63442 (diff)
remove ccan for now
Diffstat (limited to 'ccan/htable/test/run-copy.c')
-rw-r--r--ccan/htable/test/run-copy.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/ccan/htable/test/run-copy.c b/ccan/htable/test/run-copy.c
deleted file mode 100644
index d111495..0000000
--- a/ccan/htable/test/run-copy.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#include <ccan/htable/htable.h>
-#include <ccan/htable/htable.c>
-#include <ccan/tap/tap.h>
-#include <stdbool.h>
-#include <string.h>
-
-#define NUM_VALS 512
-
-static size_t hash(const void *elem, void *unused UNNEEDED)
-{
- size_t h = *(uint64_t *)elem / 2;
- return h;
-}
-
-static bool cmp(const void *candidate, void *ptr)
-{
- return *(const uint64_t *)candidate == *(const uint64_t *)ptr;
-}
-
-int main(void)
-{
- struct htable ht, ht2;
- uint64_t val[NUM_VALS], i;
-
- plan_tests((NUM_VALS) * 3);
- for (i = 0; i < NUM_VALS; i++)
- val[i] = i;
-
- htable_init(&ht, hash, NULL);
- for (i = 0; i < NUM_VALS; i++) {
- ok1(ht.max >= i);
- ok1(ht.max <= i * 2);
- htable_add(&ht, hash(&val[i], NULL), &val[i]);
- }
-
- htable_copy(&ht2, &ht);
- htable_clear(&ht);
-
- for (i = 0; i < NUM_VALS; i++)
- ok1(htable_get(&ht2, hash(&i, NULL), cmp, &i) == &val[i]);
- htable_clear(&ht2);
-
- return exit_status();
-}