From c5d3b30866dff0bbe3a2891ea4fcc3cd2d075d74 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Sat, 26 Nov 2022 22:49:20 +0100 Subject: add shuffle!, make shuffle copy the vector --- tests/test.mew | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests') 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)))) -- cgit 1.4.1