diff tests/farray-array.t @ 779:0bb535e50271

farray.sh: Implement Heapsort in the "bottom-up" implementation. BUGS: A little bit slower than the "standard" implementation.
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 26 Oct 2024 13:52:25 +0200
parents 84527b00d29a
children 11f3101c1980
line wrap: on
line diff
--- a/tests/farray-array.t	Fri Oct 25 20:29:04 2024 +0200
+++ b/tests/farray-array.t	Sat Oct 26 13:52:25 2024 +0200
@@ -1409,6 +1409,19 @@
   $ farray_release TEST
   $ check_no_array_artifacts
 
+  $ farray_create TEST 5 3 2 4
+  $ farray_heapsort_bottomup 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]
@@ -1437,18 +1450,33 @@
   $ check_array_is_sorted "$TEST"
   $ farray_release TEST
 
+  $ farray_create TEST
+  $ farray_splice "" TEST 1 "" UNSORTED
+  $ check_array_is_sorted "$TEST"
+  [1]
+  $ farray_heapsort_bottomup 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_create TEST
+  $ farray_splice "" TEST 1 "" UNSORTED
+  $ farray_heapsort_bottomup TEST
+  $ check_array_is_sorted "$TEST"
   $ farray_release TEST
+
   $ farray_release UNSORTED
   $ check_no_array_artifacts
 
@@ -1917,3 +1945,5 @@
 =========
 
   $ check_no_local_artifacts
+
+  $ set