summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2023-01-02 21:28:52 +0100
committerLeah Neukirchen <leah@vuxu.org>2023-01-02 21:28:52 +0100
commit31afd1f7be00fbd28ea1c66ad9411d4fdf722ea7 (patch)
tree84217bf7ccc5bd5a2cee398b2a1ee66feba811c4 /tests
parenta9897295de1c5b7da066aa2693e9dbfeff282fc2 (diff)
downloadmew-31afd1f7be00fbd28ea1c66ad9411d4fdf722ea7.tar.gz
mew-31afd1f7be00fbd28ea1c66ad9411d4fdf722ea7.tar.xz
mew-31afd1f7be00fbd28ea1c66ad9411d4fdf722ea7.zip
add generic sort, sort!
Diffstat (limited to 'tests')
-rw-r--r--tests/test.mew11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test.mew b/tests/test.mew
index 246f9e7..ba9c223 100644
--- a/tests/test.mew
+++ b/tests/test.mew
@@ -792,3 +792,14 @@
   (test #t (>=? 2 1 1))
 
   (test-error (>=? "foo" 2 #(6 7 8))))
+
+(test-group "sort"
+  (test '(1 2 3) (sort '(3 1 2)))
+  (test #(1 2 3) (sort #(3 1 2)))
+  (test '(1 2 3) (sort '(3 1 2) <))
+  (test '(3 2 1) (sort '(3 1 2) >?)))
+
+(test-group "sort!"
+  (test #(1 2 3) (loc (v #(3 1 2)) (sort! v) v))
+  (test #(3 2 1) (loc (v #(3 1 2)) (sort! v >) v))
+  (test-error (sort! '(3 2 1))))