summaryrefslogtreecommitdiff
path: root/test-suite/tests/srfi-1.test
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2004-12-06 00:33:40 +0000
committerKevin Ryde <user42@zip.com.au>2004-12-06 00:33:40 +0000
commitee0301df8cdfeb915535084efcf49a198d8a7663 (patch)
treeb92c7df8cb85645605b2f895b8db73f4e50c6284 /test-suite/tests/srfi-1.test
parent872223a89867e042d1d9087cf30270233b9f4d5a (diff)
downloadguile-ee0301df8cdfeb915535084efcf49a198d8a7663.tar.gz
(span): New tests.
Diffstat (limited to 'test-suite/tests/srfi-1.test')
-rw-r--r--test-suite/tests/srfi-1.test58
1 files changed, 58 insertions, 0 deletions
diff --git a/test-suite/tests/srfi-1.test b/test-suite/tests/srfi-1.test
index 18a4c762f..52dd569f8 100644
--- a/test-suite/tests/srfi-1.test
+++ b/test-suite/tests/srfi-1.test
@@ -807,3 +807,61 @@
(and (= (length odd) 10000)
(= (length even) 0))))))
+;;
+;; span
+;;
+
+(with-test-prefix "span"
+
+ (define (test-span lst want-v1 want-v2)
+ (call-with-values
+ (lambda ()
+ (span positive? lst))
+ (lambda (got-v1 got-v2)
+ (and (equal? got-v1 want-v1)
+ (equal? got-v2 want-v2)))))
+
+ (pass-if "empty"
+ (test-span '() '() '()))
+
+ (pass-if "y"
+ (test-span '(1) '(1) '()))
+
+ (pass-if "n"
+ (test-span '(-1) '() '(-1)))
+
+ (pass-if "yy"
+ (test-span '(1 2) '(1 2) '()))
+
+ (pass-if "ny"
+ (test-span '(-1 1) '() '(-1 1)))
+
+ (pass-if "yn"
+ (test-span '(1 -1) '(1) '(-1)))
+
+ (pass-if "nn"
+ (test-span '(-1 -2) '() '(-1 -2)))
+
+ (pass-if "yyy"
+ (test-span '(1 2 3) '(1 2 3) '()))
+
+ (pass-if "nyy"
+ (test-span '(-1 1 2) '() '(-1 1 2)))
+
+ (pass-if "yny"
+ (test-span '(1 -1 2) '(1) '(-1 2)))
+
+ (pass-if "nny"
+ (test-span '(-1 -2 1) '() '(-1 -2 1)))
+
+ (pass-if "yyn"
+ (test-span '(1 2 -1) '(1 2) '(-1)))
+
+ (pass-if "nyn"
+ (test-span '(-1 1 -2) '() '(-1 1 -2)))
+
+ (pass-if "ynn"
+ (test-span '(1 -1 -2) '(1) '(-1 -2)))
+
+ (pass-if "nnn"
+ (test-span '(-1 -2 -3) '() '(-1 -2 -3))))