3 extern lhashtable_t llookup;
9 if (lhashCreate(10, 0.20) == 1) {
10 printf("lhashCreate error\n"); //creates hashtable
12 for (i = 1; i <= 7; i++) { // Checks the insert() and resize()
13 if (lhashInsert(10*i, i) == 1)
14 printf("lhashInsert error\n");
17 i = lhashRemove(10);//Delete first element in the hashtable
19 printf("lhashRemove error ");
21 for (i = 1; i <=7; i++) { // Check if it can search for all oids in hash table
22 mid = lhashSearch(10*i);
24 printf("lhashSearch error - mid = %d\n", mid);
26 printf("lhashSearch oid = %d mid = %d\n",10*i, mid);
31 printf("lhashRemove error ");
33 for (i = 1; i <= 7; i++) { //Prints all left over elements inside hash after deletion and prints error if element not found in hash
34 mid = lhashSearch(10*i);
36 printf("lhashSearch error - mid = %d\n", mid);
38 printf("lhashSearch oid = %d mid = %d\n",10*i, mid);
41 printf(" The total number of elements in table : %d\n", llookup.numelements);