diff options
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! ;; |