3 extern mhashtable_t mlookup;
11 if (mhashCreate(10, 0.20) == 1) {
12 printf("mhashCreate error\n"); //creates hashtable
14 for (i = 1; i <= 7; i++) { // Checks the insert() and resize()
15 if (mhashInsert(10*i, &i) == 1)
16 printf("mhashInsert error\n");
19 i = mhashRemove(60);//Delete first element in the hashtable
21 printf("mhashRemove error ");
23 for (i = 1; i <=7; i++) { // Check if it can search for all oids in hash table
24 val = mhashSearch(10*i);
26 printf("mhashSearch error - val = %d\n", val);
28 printf("mhashSearch oid = %d val = %x\n",10*i, val);
33 printf("mhashRemove error ");
35 for (i = 1; i <= 7; i++) { //Prints all left over elements inside hash after deletion and prints error if element not found in hash
36 val = mhashSearch(10*i);
38 printf("mhashSearch error - val = %d\n", val);
40 printf("mhashSearch oid = %d val = %x\n",10*i, val);
43 printf("The total number of elements in table : %d\n", mlookup.numelements);