summaryrefslogtreecommitdiffstats
path: root/tests/012/sort.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-05-02 21:06:07 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-05-02 21:06:07 -0700
commit84b01680e17abcd5b1bd0efdd9f014f0e4378938 (patch)
tree1199c4775112d1afbd7f312de28904f525fddb06 /tests/012/sort.tl
parentfe3a2b33165ee0d7765ba4e838e9c4875d8fb195 (diff)
downloadtxr-84b01680e17abcd5b1bd0efdd9f014f0e4378938.tar.gz
txr-84b01680e17abcd5b1bd0efdd9f014f0e4378938.tar.bz2
txr-84b01680e17abcd5b1bd0efdd9f014f0e4378938.zip
sort: move tests into tests/012.
* tests/010/sort.tl: File moved to tests/012. The reason is that the tests 010 run with the --gc-debug torture tests. That test case runs way too long under that test because of the testing of many permutations and whatnot.
Diffstat (limited to 'tests/012/sort.tl')
-rw-r--r--tests/012/sort.tl45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/012/sort.tl b/tests/012/sort.tl
new file mode 100644
index 00000000..1fcc0c2d
--- /dev/null
+++ b/tests/012/sort.tl
@@ -0,0 +1,45 @@
+(load "../common")
+
+(test (sort ()) nil)
+
+(let* ((list (conses '(1 2 3 4 5 6 7 8)))
+ (sp (uniq [mapcar sort (perm list (len list))])))
+ (mvtest (len sp) 1
+ (car sp) list))
+
+(test (sort #()) #())
+
+(let* ((vec (conses #(1 2 3 4 5 6 7 8)))
+ (sp (uniq [mapcar sort (perm vec (len vec))])))
+ (mvtest (len sp) 1
+ (car sp) vec))
+
+(let* ((list (range* 0 1000))
+ (slist (shuffle list)))
+ (mvtest
+ (sort list) list
+ (sort slist) list
+ (sort list (fun greater)) (reverse list)
+ (sort slist (fun greater)) (reverse list)))
+
+(test (ssort ()) nil)
+
+(let* ((list (conses '(1 2 3 4 5 6 7 8)))
+ (sp (uniq [mapcar ssort (perm list (len list))])))
+ (mvtest (len sp) 1
+ (car sp) list))
+
+(test (ssort #()) #())
+
+(let* ((vec (conses #(1 2 3 4 5 6 7 8)))
+ (sp (uniq [mapcar ssort (perm vec (len vec))])))
+ (mvtest (len sp) 1
+ (car sp) vec))
+
+(let* ((list (range* 0 1000))
+ (slist (shuffle list)))
+ (mvtest
+ (ssort list) list
+ (ssort slist) list
+ (ssort list (fun greater)) (reverse list)
+ (ssort slist (fun greater)) (reverse list)))