diff --git a/regressions/ck_array/validate/serial.c b/regressions/ck_array/validate/serial.c index e7ed8b1..cc6a2d8 100644 --- a/regressions/ck_array/validate/serial.c +++ b/regressions/ck_array/validate/serial.c @@ -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) diff --git a/src/ck_array.c b/src/ck_array.c index aa85852..5a427de 100644 --- a/src/ck_array.c +++ b/src/ck_array.c @@ -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; }