Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
diff tests/farray-array.t @ 778:84527b00d29a
farray.sh: Implement Heapsort in the "standard" implementation.
BUGS: Performance here equals Shellsort.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 25 Oct 2024 20:29:04 +0200 |
| parents | 75a8b69c04f0 |
| children | 0bb535e50271 |
line wrap: on
line diff
--- a/tests/farray-array.t Thu Oct 24 11:44:35 2024 +0200 +++ b/tests/farray-array.t Fri Oct 25 20:29:04 2024 +0200 @@ -1396,6 +1396,19 @@ $ farray_release TEST $ check_no_array_artifacts + $ farray_create TEST 5 3 2 4 + $ farray_heapsort TEST + $ check_array_is_sorted "$TEST" + $ farray_debug TEST + DEBUG: array `TEST' has length 4 + DEBUG: the items: + DEBUG: 1: `2' + DEBUG: 2: `3' + DEBUG: 3: `4' + DEBUG: 4: `5' + $ farray_release TEST + $ check_no_array_artifacts + $ create_random_array UNSORTED 1000 $ check_array_is_sorted "$UNSORTED" [1] @@ -1416,6 +1429,26 @@ $ check_array_is_sorted "$TEST" $ farray_release TEST + $ farray_create TEST + $ farray_splice "" TEST 1 "" UNSORTED + $ check_array_is_sorted "$TEST" + [1] + $ farray_heapsort TEST + $ check_array_is_sorted "$TEST" + $ farray_release TEST + + $ farray_release UNSORTED + $ check_no_array_artifacts + +# Extra checks for Heapsort + + $ farray_create UNSORTED '189548216' '544226607' '690563482' '224884577' '843524724' '922143089' '917031008' '602352555' '397442038' '350475285' + $ farray_create TEST + $ farray_splice "" TEST 1 "" UNSORTED + $ farray_heapsort TEST + $ check_array_is_sorted "$TEST" + + $ farray_release TEST $ farray_release UNSORTED $ check_no_array_artifacts
