aboutsummaryrefslogtreecommitdiffstats
path: root/list-test.csc
diff options
context:
space:
mode:
Diffstat (limited to 'list-test.csc')
-rw-r--r--list-test.csc32
1 files changed, 32 insertions, 0 deletions
diff --git a/list-test.csc b/list-test.csc
index ec4b4ed..e4981e5 100644
--- a/list-test.csc
+++ b/list-test.csc
@@ -125,3 +125,35 @@
(unless (equal? got (want tc))
(errorf t "(revappend {} {}) = {}, want {}." (a tc) (b tc) got (want tc)))))
tests)))
+
+
+(define-test (test-intercalate t)
+ (define-record-type <test-case>
+ (test-case desc x l want)
+ test-case?
+ (desc desc)
+ (x x)
+ (l l)
+ (want want))
+ (let ((tests (list
+ (test-case
+ "simple"
+ ","
+ '("a" "b" "c")
+ '("a" "," "b" "," "c"))
+ (test-case
+ "empty"
+ ","
+ '()
+ '())
+ (test-case
+ "singleton"
+ ","
+ '(1)
+ '(1)))))
+ (for-each
+ (lambda (tc)
+ (let ((got (intercalate (x tc) (l tc))))
+ (unless (equal? got (want tc))
+ (errorf t "(intercalate {} {}) = {}, want {}." (x tc) (l tc) got (want tc)))))
+ tests)))