diff options
author | Kevin Ryde <user42@zip.com.au> | 2003-07-28 23:45:31 +0000 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2003-07-28 23:45:31 +0000 |
commit | c6e9db20c196221773ea530ef77e5c86ccfd93a4 (patch) | |
tree | bd164882725fc526bc6d6eb6ded5dca3d4f764a6 /test-suite/tests/srfi-1.test | |
parent | 47f2726f4ce9bc20f29a84c30cd992585495e3c3 (diff) | |
download | guile-c6e9db20c196221773ea530ef77e5c86ccfd93a4.tar.gz |
(concatenate, concatenate!): New tests.
Diffstat (limited to 'test-suite/tests/srfi-1.test')
-rw-r--r-- | test-suite/tests/srfi-1.test | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test-suite/tests/srfi-1.test b/test-suite/tests/srfi-1.test index 704ff561a..880010c12 100644 --- a/test-suite/tests/srfi-1.test +++ b/test-suite/tests/srfi-1.test @@ -44,6 +44,49 @@ ;; +;; concatenate and concatenate! +;; + +(let () + (define (common-tests concatenate-proc unmodified?) + (define (try lstlst want) + (let ((lstlst-copy (copy-tree lstlst)) + (got (concatenate-proc lstlst))) + (if unmodified? + (if (not (equal? lstlst lstlst-copy)) + (error "input lists modified"))) + (equal? got want))) + + (pass-if-exception "too few args" exception:wrong-num-args + (concatenate-proc)) + + (pass-if-exception "too many args" exception:wrong-num-args + (concatenate-proc '() '())) + + (pass-if "no lists" + (try '() '())) + + (pass-if (try '((1)) '(1))) + (pass-if (try '((1 2)) '(1 2))) + (pass-if (try '(() (1)) '(1))) + (pass-if (try '(() () (1)) '(1))) + + (pass-if (try '((1) (2)) '(1 2))) + (pass-if (try '(() (1 2)) '(1 2))) + + (pass-if (try '((1) 2) '(1 . 2))) + (pass-if (try '((1) (2) 3) '(1 2 . 3))) + (pass-if (try '((1) (2) (3 . 4)) '(1 2 3 . 4))) + ) + + (with-test-prefix "concatenate" + (common-tests concatenate #t)) + + (with-test-prefix "concatenate!" + (common-tests concatenate! #f))) + + +;; ;; delete and delete! ;; |