summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2022-11-26 22:49:20 +0100
committerLeah Neukirchen <leah@vuxu.org>2022-11-26 22:49:20 +0100
commitc5d3b30866dff0bbe3a2891ea4fcc3cd2d075d74 (patch)
tree8306c54203505a8a5c06bcd3f1797aaefbe71ded /tests
parent979045ff8d29863b4fd693d60a6d022b5b1a405e (diff)
downloadmew-c5d3b30866dff0bbe3a2891ea4fcc3cd2d075d74.tar.gz
mew-c5d3b30866dff0bbe3a2891ea4fcc3cd2d075d74.tar.xz
mew-c5d3b30866dff0bbe3a2891ea4fcc3cd2d075d74.zip
add shuffle!, make shuffle copy the vector
Diffstat (limited to 'tests')
-rw-r--r--tests/test.mew6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test.mew b/tests/test.mew
index e697751..50cb6bd 100644
--- a/tests/test.mew
+++ b/tests/test.mew
@@ -35,6 +35,12 @@
   (test #f (=? (shuffle #(1 2 3 4 5 6 7 8 9 0))
                (shuffle #(1 2 3 4 5 6 7 8 9 0)))))
 
+(test-group "shuffle!"
+  (test #t (loc (v #(1 2 3)) (eq? v (shuffle! v))))
+  (test #(1 2 3) (sort (shuffle! #(3 2 1)) <))
+  (test #f (=? (shuffle! #(1 2 3 4 5 6 7 8 9 0))
+               (shuffle! #(1 2 3 4 5 6 7 8 9 0)))))
+
 (test-group "sample"
   (test #t ((one-of 1 2 3) (sample '(1 2 3))))
   (test #t ((one-of 1 2 3) (sample #(1 2 3))))