aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorKuan-Wei Chiu <visitorckw@gmail.com>2024-01-16 10:16:57 +0800
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-01-16 11:00:51 -0300
commit1bb28b7b4f01709b841c86850e1bb83b554feafe (patch)
tree16c0f016e308e368613139c115a9e9d2e43432a8 /stdlib
parent74d2731a5fb2676b64092bc25e7f193db1b17b2b (diff)
downloadglibc-1bb28b7b4f01709b841c86850e1bb83b554feafe.zip
glibc-1bb28b7b4f01709b841c86850e1bb83b554feafe.tar.gz
glibc-1bb28b7b4f01709b841c86850e1bb83b554feafe.tar.bz2
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>
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/tst-qsort4.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/stdlib/tst-qsort4.c b/stdlib/tst-qsort4.c
index 4635275..247917b 100644
--- a/stdlib/tst-qsort4.c
+++ b/stdlib/tst-qsort4.c
@@ -96,9 +96,7 @@ do_test (void)
check_one_sort ((signed char[16]) {15, 3, 4, 2, 1, 0, 8, 7, 6, 5, 14,
13, 12, 11, 10, 9}, 16);
- /* Array lengths 2 and less are not handled by heapsort_r and
- deferred to insertion sort. */
- for (int i = 3; i <= 8; ++i)
+ for (int i = 2; i <= 8; ++i)
{
signed char *buf = xmalloc (i);
check_combinations (i, buf, 0);