ck_array: Additional regressions coverage and code clean-up.

ck_pring
Samy Al Bahra 11 years ago
parent ef15380a62
commit 493360636b

@ -145,14 +145,29 @@ main(void)
ck_array_remove(&array, (void *)i);
}
for (i = 0; i < ITERATION * 2; i++) {
for (i = 0; i < ITERATION * 16; i++) {
ck_array_put(&array, (void *)i);
}
for (i = 0; i < ITERATION * 8; i++) {
ck_array_commit(&array);
for (i = 0; i < ITERATION * 128; i++) {
ck_array_put(&array, (void *)i);
if (ck_array_put_unique(&array, (void *)i) != -1)
ck_error("put_unique for non-unique value should fail.\n");
}
for (i = 0; i < ITERATION * 64; i++) {
bool f = ck_array_remove(&array, (void *)i);
if (f == false && i < ITERATION * 144)
ck_error("Remove failed for existing entry.\n");
if (f == true && i > ITERATION * 144)
ck_error("Remove succeeded for non-existing entry.\n");
}
ck_array_commit(&array);
ck_array_deinit(&array, false);
if (ck_array_initialized(&array) == true)

@ -176,7 +176,6 @@ ck_array_remove(struct ck_array *array, void *value)
/* If there are pending additions, immediately eliminate the operation. */
if (target->n_committed != array->n_entries) {
target = array->active;
ck_pr_store_ptr(&target->values[i], target->values[--array->n_entries]);
return true;
}

Loading…
Cancel
Save