summaryrefslogtreecommitdiffhomepage
path: root/src/3p/chibicc/hashmap.c
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2022-04-10 01:42:32 +0100
committerMichael Smith <mikesmiffy128@gmail.com>2022-04-14 21:04:55 +0100
commit99e9a6765a9a358987c062ec4a251f8254581933 (patch)
tree8b545ff0e0d52fdda30e0aeb0c340c7de5d54481 /src/3p/chibicc/hashmap.c
parentd823e5f524403e5c278d3c863e93bac4b1d8d2ce (diff)
Remove some more unused chibicc bits
Diffstat (limited to 'src/3p/chibicc/hashmap.c')
-rw-r--r--src/3p/chibicc/hashmap.c31
1 files changed, 0 insertions, 31 deletions
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");
-}