summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2022-11-27 16:27:10 +0100
committerLeah Neukirchen <leah@vuxu.org>2022-11-27 16:27:10 +0100
commitc53cde4625aba15a5f6f660e11fe91c61f5b6e24 (patch)
tree68a6d0a8bbc015ef097b5854c38bc0581810da47 /tests
parentc5d3b30866dff0bbe3a2891ea4fcc3cd2d075d74 (diff)
downloadmew-c53cde4625aba15a5f6f660e11fe91c61f5b6e24.tar.gz
mew-c53cde4625aba15a5f6f660e11fe91c61f5b6e24.tar.xz
mew-c53cde4625aba15a5f6f660e11fe91c61f5b6e24.zip
extend sample to sample multiple elements without replacement
Diffstat (limited to 'tests')
-rw-r--r--tests/test.mew6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/test.mew b/tests/test.mew
index 50cb6bd..e3a527a 100644
--- a/tests/test.mew
+++ b/tests/test.mew
@@ -44,7 +44,11 @@
 (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))))
-  (test #t ((one-of '(1 . 2) '(3 . 4)) (sample (tbl 1 2 3 4)))))
+  (test #t ((one-of '(1 . 2) '(3 . 4)) (sample (tbl 1 2 3 4))))
+  (test #t (string? (sample "foobar" 3)))
+  (test 3 (len (sample "foobar" 3)))
+  (test "ooo" (sample "ooooo" 3))
+  (test #(1 2 3) (sort (sample #(1 2 3) 3) <)))
 
 (test-group "range"
   (test '(1 2 3) (into '() (range 1 4)))