Skip to content

Commit c84fb16

Browse files
committed
Polish tests.
1 parent e46c5ea commit c84fb16

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

tests/random_op.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,28 @@ int random_op()
288288
*/
289289
}
290290

291+
for (size_t idx=0; idx<golden_set->size; idx++)
292+
{
293+
const void * value = buffer_set_get(buffer_set, &golden_set->data[idx]);
294+
if (!value)
295+
{
296+
printf("value %d not found", golden_set->data[idx]);
297+
print_operations(history);
298+
ret = -1;
299+
break;
300+
}
301+
302+
if (*((const int*)value) != golden_set->data[idx])
303+
{
304+
printf("got %d instead of %d", *((const int*)value), golden_set->data[idx]);
305+
print_operations(history);
306+
ret = -1;
307+
break;
308+
}
309+
}
310+
if (ret != 0)
311+
break;
312+
291313
const uint16_t buffer_set_size = buffer_set_get_size(buffer_set);
292314
if (golden_set->size != buffer_set_size)
293315
{
@@ -302,7 +324,7 @@ int random_op()
302324
}
303325
}
304326

305-
if (!ret)
327+
if (ret != 0)
306328
printf("%d values inserted and erased", count);
307329

308330
buffer_set_destroy(buffer_set);

0 commit comments

Comments
 (0)