mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-27 03:33:33 +08:00
stdlib: Verify heapsort for two-element cases
Adjust the testing approach to start from scenarios with only 2 elements, as insertion sort no longer handles such cases. Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
74d2731a5f
commit
1bb28b7b4f
@ -96,9 +96,7 @@ do_test (void)
|
|||||||
check_one_sort ((signed char[16]) {15, 3, 4, 2, 1, 0, 8, 7, 6, 5, 14,
|
check_one_sort ((signed char[16]) {15, 3, 4, 2, 1, 0, 8, 7, 6, 5, 14,
|
||||||
13, 12, 11, 10, 9}, 16);
|
13, 12, 11, 10, 9}, 16);
|
||||||
|
|
||||||
/* Array lengths 2 and less are not handled by heapsort_r and
|
for (int i = 2; i <= 8; ++i)
|
||||||
deferred to insertion sort. */
|
|
||||||
for (int i = 3; i <= 8; ++i)
|
|
||||||
{
|
{
|
||||||
signed char *buf = xmalloc (i);
|
signed char *buf = xmalloc (i);
|
||||||
check_combinations (i, buf, 0);
|
check_combinations (i, buf, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user