diff options
author | Bobby Bingham <koorogi@koorogi.info> | 2014-09-01 09:34:50 -0500 |
---|---|---|
committer | Bobby Bingham <koorogi@koorogi.info> | 2014-09-01 13:05:34 -0500 |
commit | 2e77b5cb3765e6072816defe5a86892088ffaefd (patch) | |
tree | 7bdf7431eb2cbc7b60f86871b6c2589d20842953 /testcases.c | |
parent | 550130b71aa55fbdf34f387e7904e239f6dddb10 (diff) |
Add concatenated sorted arrays testcase
Diffstat (limited to 'testcases.c')
-rw-r--r-- | testcases.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/testcases.c b/testcases.c index 25a2769..1a50632 100644 --- a/testcases.c +++ b/testcases.c @@ -52,6 +52,13 @@ static void init_sorted(size_t size) for (size_t i = 0; i < size; i++) buffer[i] = i; } +static void init_sorted2(size_t size) +{ + size_t half = size / 2; + for (size_t i = 0; i < half; i++) buffer[i] = i; + for (size_t i = 0; i < size - half; i++) buffer[half+i] = i; +} + static void init_reverse(size_t size) { for (size_t i = 0; i < size; i++) buffer[i] = size - i - 1; @@ -120,6 +127,7 @@ static int qsk_compare(const void *a, const void *b) const struct testcase testcases[] = { { .name = "random", .init = init_random, .cmp = compare }, { .name = "sorted", .init = init_sorted, .cmp = compare }, + { .name = "sorted-sorted", .init = init_sorted2, .cmp = compare }, { .name = "reverse", .init = init_reverse, .cmp = compare }, { .name = "constant", .init = init_constant, .cmp = compare }, { .name = "sorted+noise", .init = init_sorted_noise, .cmp = compare }, |