Example #1
0
static ulong fill(HHSet *S) {
  ulong m = 0;
  for (ulong i = 0; i < 128; ++i) {
    ulong y = rand() + 1;
    if (!hhsetget(S, y)) {
      test(hhsetput(S, y));
      ++m;
    }
    test(hhsetget(S, x));
  }
  return m;
}
Example #2
0
static uint
fill(HHSet *S)
{
	uint m = 0;
	for(uint i = 0; i < 128; ++i){
		uint y = rand()+1;
		if(!hhsetget(S,y)){
			test(hhsetput(S,y));
			++m;
		}
		test(hhsetget(S,x));
	}
	return m;
}
Example #3
0
int
main(void)
{
	uint n = 16;
	uint m = 0;
	HHSet *S = hhsetnew(n,NULL,NULL);
	for(uint i = 0; i < 30; ++i){
		uint x = rand()+1;
		if(!hhsetget(S,x)){
			test(hhsetput(S,x));
			++m;
		}
	}
	test(S->T->m == m);
	hhsetfree(S);
	return 0;
}