summaryrefslogtreecommitdiff
path: root/bench.c
diff options
context:
space:
mode:
authorBobby Bingham <koorogi@koorogi.info>2014-08-03 13:24:36 -0500
committerBobby Bingham <koorogi@koorogi.info>2014-08-03 13:24:36 -0500
commit7e76ff5acd182ca1a83242e094f2465d4b9a6040 (patch)
tree83e82f88ffb65ea4f8b33ad69fd69a6b72336544 /bench.c
parentf07937bb63ed12a50a203c3f8015649f37bc73e5 (diff)
Make global state explicit in testcase generators
The quicksort-killer testcase will require more global state, unless we go to the effort of implementing qsort_r versions of all the sorting algorithms. Since we're not doing that, we'll simply make the global state explicit.
Diffstat (limited to 'bench.c')
-rw-r--r--bench.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bench.c b/bench.c
index e0629b2..75bf32e 100644
--- a/bench.c
+++ b/bench.c
@@ -34,14 +34,14 @@ int main()
printf("%-*s ", SORT_WIDTH, size == MIN_SIZE ? s->name : "");
for (const struct testcase *t = testcases; t->name; t++) {
comparisons = 0;
- t->init(buffer, size);
+ t->init(size);
if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &start)) abort();
s->func(buffer, size, sizeof(int), t->cmp);
if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &stop)) abort();
printf("%*lu %*lu ", CMP_WIDTH, comparisons, MS_WIDTH, timediff_ms(&start, &stop));
- assert_sorted(buffer, size);
+ assert_sorted(size, t->cmp);
}
printf(" %*zu\n", SIZE_WIDTH, size);
}