test-mergesort: add test subcommand
commite031e9719d21c11102870b8037bdda995dede5e0
authorRené Scharfe <l.s.r@web.de>
Fri, 1 Oct 2021 09:12:27 +0000 (1 11:12 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 1 Oct 2021 19:43:08 +0000 (1 12:43 -0700)
tree6b9c011250c749edd9a062188ecb92f18aec9519
parentd536a711699dd369083b83dd98f3df1fdf2b08f0
test-mergesort: add test subcommand

Adapt the qsort certification program from "Engineering a Sort Function"
by Bentley and McIlroy for testing our linked list sort function.  It
generates several lists with various distribution patterns and counts
the number of operations llist_mergesort() needs to order them.  It
compares the result to the output of a trusted sort function (qsort(1))
and also checks if the sort is stable.

Also add a test script that makes use of the new subcommand.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/helper/test-mergesort.c
t/t0071-sort.sh [new file with mode: 0755]