chore: remove unused hashtable and dead code

Remove hashtable module and tests (unused in runtime). Remove unused
variables mycolour, direction, output_scale_factor, and dead local p.
This commit is contained in:
2026-11-08 16:34:50 +01:00
parent f6fce3e9a5
commit d1d90dfb67
6 changed files with 0 additions and 406 deletions
-63
View File
@@ -1,63 +0,0 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <hashtable.h>
void test_hashtable(int size) {
hashtable h = hashtable_new(size);
void *value1 = "to jest jakaś tam wartość";
void *value2 = "I inna";
void *value3 = "trzecia";
void *value4 = "Czwarta";
void *value5 = "Piąta";
void *retval = hashtable_set(h, "jeden", value1);
assert(retval == NULL);
void *found = hashtable_lookup(h, "jeden");
assert(found != NULL && !strcmp(value1, found));
retval = hashtable_set(h, "dwa", value2);
assert(retval == NULL);
retval = hashtable_set(h, "trzy", value3);
assert(retval == NULL);
retval = hashtable_set(h, "cztery", value4);
assert(retval == NULL);
retval = hashtable_set(h, "jeden", value5);
assert(retval != NULL);
assert (retval == value1);
retval = hashtable_lookup(h, "niema");
assert(retval == NULL);
retval = hashtable_lookup(h, "jeden");
assert(retval == value5);
ht_iterator iter = hashtable_iter(h);
while (ht_iter_next(&iter)) {
printf("Key %s, value: %s\n", ht_iter_key(&iter), (const char*) ht_iter_value(&iter));
}
retval = hashtable_remove(h, "cztery");
assert (retval == value4);
retval = hashtable_remove(h, "trzy");
assert(retval == value3);
retval = hashtable_remove(h, "dwa");
assert(retval == value2);
retval = hashtable_remove(h, "jeden");
assert(retval == value5);
hashtable_destroy(h);
}
int main() {
test_hashtable(2);
test_hashtable(10);
}