From 31afd1f7be00fbd28ea1c66ad9411d4fdf722ea7 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Mon, 2 Jan 2023 21:28:52 +0100 Subject: add generic sort, sort! --- tests/test.mew | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests') 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)))) -- cgit 1.4.1