| 1099 | |
| 1100 | METHOD sanity_check() { |
| 1101 | Hash *hash = (Hash*)PMC_struct_val(SELF); |
| 1102 | UINTVAL i, j; |
| 1103 | |
| 1104 | for (i = 0; i <= hash->mask; i++) { |
| 1105 | HashBucket * const b = hash->bs + i; |
| 1106 | void * const key = b->key; |
| 1107 | void * const val = b->value; |
| 1108 | |
| 1109 | for (j = 0; j <= hash->mask; j++) |
| 1110 | if (b == hash->bi[j]) |
| 1111 | printf("index #%d maps to bucket #%d\n", j, i); |
| 1112 | |
| 1113 | if (key) |
| 1114 | printf("hash->bs+%d: '%s' => ", i, ((STRING*)key)->strstart); |
| 1115 | if (val) |
| 1116 | printf("'%s'\n", VTABLE_get_string(INTERP, (PMC*)val)->strstart ); |
| 1117 | if (key && !val) |
| 1118 | printf(" (null)\n"); |
| 1119 | if (!key && !val) |
| 1120 | printf("hash->bs+%d: key and value are null\n", i); |
| 1121 | } |
| 1122 | } |