int main (int argc, char **argv) { int i,j; for (i=1; i<SBS_NUM_TESTS; i++) { uint32_t nbits = i; bitset_set_max_num_elements(nbits); printf ("\n\ni=%d nb=%d\n", i, nbits); uint32_t num_bs = SBS_NUM_TESTS; BitSet *bs; // = (BitSet *) my_malloc(sizeof(BitSet) * num_bs); bs = bitset_new(); /* for (j=0; j<num_bs; j++) { bs[j] = bitset_new(); } */ for (j=0; j<nbits * SBS_DUNNO ; j++) { printf ("j=%d\n", j); int element = rand() % nbits; printf ("set %d\n", element); bitset_add(bs,element); assert (bitset_member(bs,element)); bitset_spit(bs); printf ("\n"); element = rand() % nbits; printf ("unset %d\n", element); bitset_remove(bs,element); assert (!(bitset_member(bs,element))); bitset_spit(bs); printf ("\n"); } bitset_free(bs); } }
// returns TRUE iff label l is in set ls. static SB_INLINE bool labelset_member(LabelSet *ls, uint32_t l) { return bitset_member(*(ls->set),l); }