From 99e9a6765a9a358987c062ec4a251f8254581933 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sun, 10 Apr 2022 01:42:32 +0100 Subject: Remove some more unused chibicc bits --- src/3p/chibicc/hashmap.c | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'src/3p/chibicc/hashmap.c') diff --git a/src/3p/chibicc/hashmap.c b/src/3p/chibicc/hashmap.c index 46539d9..47110c6 100644 --- a/src/3p/chibicc/hashmap.c +++ b/src/3p/chibicc/hashmap.c @@ -132,34 +132,3 @@ void hashmap_delete2(HashMap *map, char *key, int keylen) { if (ent) ent->key = TOMBSTONE; } - -void hashmap_test(void) { - HashMap *map = calloc(1, sizeof(HashMap)); - - for (int i = 0; i < 5000; i++) - hashmap_put(map, format("key %d", i), (void *)(size_t)i); - for (int i = 1000; i < 2000; i++) - hashmap_delete(map, format("key %d", i)); - for (int i = 1500; i < 1600; i++) - hashmap_put(map, format("key %d", i), (void *)(size_t)i); - for (int i = 6000; i < 7000; i++) - hashmap_put(map, format("key %d", i), (void *)(size_t)i); - - for (int i = 0; i < 1000; i++) - assert((size_t)hashmap_get(map, format("key %d", i)) == i); - for (int i = 1000; i < 1500; i++) - assert(hashmap_get(map, "no such key") == NULL); - for (int i = 1500; i < 1600; i++) - assert((size_t)hashmap_get(map, format("key %d", i)) == i); - for (int i = 1600; i < 2000; i++) - assert(hashmap_get(map, "no such key") == NULL); - for (int i = 2000; i < 5000; i++) - assert((size_t)hashmap_get(map, format("key %d", i)) == i); - for (int i = 5000; i < 6000; i++) - assert(hashmap_get(map, "no such key") == NULL); - for (int i = 6000; i < 7000; i++) - hashmap_put(map, format("key %d", i), (void *)(size_t)i); - - assert(hashmap_get(map, "no such key") == NULL); - printf("OK\n"); -} -- cgit v1.2.3