]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
stdlib: Verify heapsort for two-element cases
authorKuan-Wei Chiu <visitorckw@gmail.com>
Tue, 16 Jan 2024 02:16:57 +0000 (10:16 +0800)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 16 Jan 2024 14:00:51 +0000 (11:00 -0300)
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>
stdlib/tst-qsort4.c

index 4635275419b8642bd5668ca67a07ce60893bca6d..247917b45496118554de5dc64a592cf0153725d0 100644 (file)
@@ -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);