Ejemplo n.º 1
0
/*
 * Run tests: for s1 and s2
 * - call test_remove, test_add, test_copy
 * - s is used to make copies of s1 and s2
 */
static void run_tests(cset_t *c1, cset_t *c2, bset_t *s1, bset_t *s2, bset_t *s) {
  printf("\ns1: ");
  show_bset(s1);
  printf("\ns2: ");
  show_bset(s2);
  printf("\n");

  test_copy(c1, s1);
  test_copy(c2, s2);

  bset_empty(s);
  bset_add_set(s, s1);
  test_add_set(c1, c2, s, s2);

  bset_empty(s);
  bset_add_set(s, s2);
  test_add_set(c1, c2, s, s1);

  bset_empty(s);
  bset_add_set(s, s1);
  test_remove_set(c1, c2, s, s2);

  bset_empty(s);
  bset_add_set(s, s2);
  test_remove_set(c1, c2, s, s1);

  test_subset(c1, c2, s1, s2);
  test_disjoint(c1, c2, s1, s2);
}
Ejemplo n.º 2
0
int main(int argc, char **argv)
{
	test_ins();
	test_has();
	test_del();
	test_seq();
	test_union();
	test_intersection();
	test_diff();
	test_subset();
	puts("Success");
}