int main(void) { ulong n = 256; HHash *T = hhashnew(n); ulong m = fill(T); test(m == T->m); test(m == count(T)); hhashfree(T); return 0; }
int main(void) { uint n = 16; HHash *T = hhashnew(n); uint x = rand()%n; test(hhashput(T,x,1)); uint i = hhashsucc(T,x,0); test(i == 0); hhashdel(T,x,i); test(hhashsucc(T,x,0) < 0); hhashfree(T); return 0; }
int main(void) { uint n = 16; HHash *T = hhashnew(n); uint x = 15; test(hhashput(T,x,1)); test(hhashsucc(T,x,0) == 0); test(hhashput(T,x,1)); test(hhashsucc(T,x,1) == 1); test(hhashput(T,x,1)); test(hhashsucc(T,x,2) == 2); test(T->m == 3); x = 14; test(hhashput(T,x,1)); test(hhashsucc(T,x,0) == 0); test(hhashput(T,x,1)); test(hhashsucc(T,x,1) == 1); test(!hhashput(T,x,1)); hhashfree(T); return 0; }
int main(void) { uint n = 16; HHash *T = hhashnew(n); uint x = rand()%n; test(hhashput(T,x,1)); test(hhashsucc(T,x,0) == 0); test(hhashput(T,x,1)); test(hhashsucc(T,x,1) == 1); test(hhashput(T,x,1)); test(hhashsucc(T,x,2) == 2); test(hhashput(T,x,1)); test(hhashsucc(T,x,3) == 3); test(!hhashput(T,x,1)); --x; test(hhashput(T,x,1)); test(hhashsucc(T,x,0) == 0); test(!hhashput(T,x,1)); hhashfree(T); return 0; }
void hhsetfree(HHSet *S) { hhashfree(S->T); free(S); }