summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-12-02 08:05:53 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-12-02 08:05:53 -0800
commit29ffa06feca713b458f810194b5a5a733c93a3f7 (patch)
tree779bc547c05ac749364fa9be74660236694fa43c /tests
parent9b3459ca129ffe680f8e8c8caeb00167c7180a22 (diff)
downloadtxr-29ffa06feca713b458f810194b5a5a733c93a3f7.tar.gz
txr-29ffa06feca713b458f810194b5a5a733c93a3f7.tar.bz2
txr-29ffa06feca713b458f810194b5a5a733c93a3f7.zip
tuples: add test cases.
* tests/012/seq.tl: Numerous test cases for tuples.
Diffstat (limited to 'tests')
-rw-r--r--tests/012/seq.tl49
1 files changed, 48 insertions, 1 deletions
diff --git a/tests/012/seq.tl b/tests/012/seq.tl
index d27adcef..7e0ae00f 100644
--- a/tests/012/seq.tl
+++ b/tests/012/seq.tl
@@ -214,4 +214,51 @@
[separate integerp "a1b2c3d4"] ("" "a1b2c3d4"))
(mtest
- (tuples 0 '(1 2 3)) :error)
+ (tuples 0 nil) :error
+ (tuples 3.5 '(1 2 3)) :error
+ (tuples -1 "abc") :error)
+
+(mtest
+ (tuples 1 nil) nil
+ (tuples 1 "") nil
+ (tuples 1 #()) nil)
+
+(mtest
+ (tuples 1 '(a)) ((a))
+ (tuples 1 "a") ("a")
+ (tuples 1 #(1)) (#(1)))
+
+(mtest
+ (tuples 1 '(a b c)) ((a) (b) (c))
+ (tuples 1 "abc") ("a" "b" "c")
+ (tuples 1 #(1 2 3)) (#(1) #(2) #(3)))
+
+(mtest
+ (tuples 1 '(a b c) 'd) ((a) (b) (c))
+ (tuples 1 "abc" #\d) ("a" "b" "c")
+ (tuples 1 #(1 2 3) 4) (#(1) #(2) #(3)))
+
+(mtest
+ (tuples 2 '(a b c)) ((a b) (c))
+ (tuples 2 "abc") ("ab" "c")
+ (tuples 2 #(1 2 3)) (#(1 2) #(3)))
+
+(mtest
+ (tuples 3 '(a b c)) ((a b c))
+ (tuples 3 "abc") ("abc")
+ (tuples 3 #(1 2 3)) (#(1 2 3)))
+
+(mtest
+ (tuples 2 '(a b c) 'd) ((a b) (c d))
+ (tuples 2 "abc" #\d) ("ab" "cd")
+ (tuples 2 #(1 2 3) 4) (#(1 2) #(3 4)))
+
+(defun lforce (list)
+ [mapdo identity list]
+ list)
+
+(test
+ (lforce (tuples 2 "abc" 3)) :error)
+
+(test
+ (take 3 (tuples 3 (range 0))) ((0 1 2) (3 4 5) (6 7 8)))