regressions: Additional coverage for delete mode.

ck_pring
Samy Al Bahra 11 years ago
parent 355bd611b4
commit f769f842a4

@ -1,6 +1,6 @@
.PHONY: clean distribution
OBJECTS=serial parallel_bytestring
OBJECTS=serial parallel_bytestring parallel_bytestring.delete
all: $(OBJECTS)
@ -10,6 +10,9 @@ serial: serial.c ../../../include/ck_hs.h ../../../src/ck_hs.c
parallel_bytestring: parallel_bytestring.c ../../../include/ck_hs.h ../../../src/ck_hs.c ../../../src/ck_epoch.c
$(CC) $(PTHREAD_CFLAGS) $(CFLAGS) -o parallel_bytestring parallel_bytestring.c ../../../src/ck_hs.c ../../../src/ck_epoch.c
parallel_bytestring.delete: parallel_bytestring.c ../../../include/ck_hs.h ../../../src/ck_hs.c ../../../src/ck_epoch.c
$(CC) $(PTHREAD_CFLAGS) $(CFLAGS) -DHS_DELETE -o parallel_bytestring.delete parallel_bytestring.c ../../../src/ck_hs.c ../../../src/ck_epoch.c
clean:
rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe

@ -140,11 +140,16 @@ static struct ck_malloc my_allocator = {
static void
set_init(void)
{
unsigned int mode = CK_HS_MODE_OBJECT | CK_HS_MODE_SPMC;
#ifdef HS_DELETE
mode |= CK_HS_MODE_DELETE;
#endif
ck_epoch_init(&epoch_hs);
ck_epoch_register(&epoch_hs, &epoch_wr);
common_srand48((long int)time(NULL));
if (ck_hs_init(&hs, CK_HS_MODE_OBJECT | CK_HS_MODE_SPMC, hs_hash, hs_compare, &my_allocator, 65536, common_lrand48()) == false) {
if (ck_hs_init(&hs, mode, hs_hash, hs_compare, &my_allocator, 65536, common_lrand48()) == false) {
perror("ck_hs_init");
exit(EXIT_FAILURE);
}

@ -117,7 +117,7 @@ run_test(unsigned int is, unsigned int ad)
h = test[i][0];
ck_hs_put(&hs[j], h, test[i]);
if (ck_hs_put(&hs[j], h, test[i]) == true) {
ck_error("ERROR [%u] [1]: put must fail on collision.\n", is);
ck_error("ERROR [%u] [1]: put must fail on collision (%s).\n", is, test[i]);
}
if (ck_hs_get(&hs[j], h, test[i]) == NULL) {
ck_error("ERROR [%u]: get must not fail after put\n", is);

Loading…
Cancel
Save