#include #include "../ht.h" int main(int UNUSED argc, char ** UNUSED argv) { ht *htp = new_ht(HT_INIT_CAP); NUM *temp = MYALLOC(NUM, 1), key = 1023; *temp = 12345; if (ht_insert(htp, key, temp)) { fleprintf0("Fail to insert\n"); free(temp); destroy_ht(htp, 1); return 1; } if ((temp = ht_find(htp, key))) { fleprintf("We found value %ld for key %ld\n", *temp, key); } else fleprintf("We found no value for key %ld\n", key); if (ht_delete(htp, key, 1)) { fleprintf("Fail to delete key %ld\n", key); destroy_ht(htp, 1); return 1; } fleprintf0("After the deletion, "); if ((temp = ht_find(htp, key))) { eprintf("We found value %ld for key %ld\n", *temp, key); destroy_ht(htp, 1); return 1; } else { eprintf("We found no value for key %ld\n", key); } destroy_ht(htp, 1); return 0; }