summaryrefslogtreecommitdiffstats
path: root/tests/015
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-06-20 00:11:27 -0700
committerKaz Kylheku <kaz@kylheku.com>2024-06-20 00:11:27 -0700
commit19456350b81fcc95d09468989c34a20fb1ad9bc9 (patch)
treebe03c80bbd89efe58589c78d96dc93a2e935935e /tests/015
parent6bd0f5494990a18352de716987460914858d2f82 (diff)
downloadtxr-19456350b81fcc95d09468989c34a20fb1ad9bc9.tar.gz
txr-19456350b81fcc95d09468989c34a20fb1ad9bc9.tar.bz2
txr-19456350b81fcc95d09468989c34a20fb1ad9bc9.zip
combi: fix broken k 0 edge cases for sequences.
* combi.c (rperm, comb, rcomb): In the default case for generic sequences, check k, like in the other cases and return the special case result. * tests/015/comb.tl: New tests.
Diffstat (limited to 'tests/015')
-rw-r--r--tests/015/comb.tl10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/015/comb.tl b/tests/015/comb.tl
index 9973e94d..70aa9dd3 100644
--- a/tests/015/comb.tl
+++ b/tests/015/comb.tl
@@ -441,3 +441,13 @@
(rperm "a".."c" 2) (("a" "a") ("a" "b") ("a" "c")
("b" "a") ("b" "b") ("b" "c")
("c" "a") ("c" "b") ("c" "c")))
+
+(mtest
+ (perm '(1 2 3) 0) (nil)
+ (rperm '(1 2 3) 0) (nil)
+ (comb '(1 2 3) 0) (nil)
+ (rcomb '(1 2 3) 0) (nil)
+ (perm 1..4 0) (nil)
+ (rperm 1..4 0) (nil)
+ (comb 1..4 0) (nil)
+ (rcomb 1..4 0) (nil))