list.lsp 1.61 KB
Newer Older
1 2 3 4 5 6 7
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sat Apr 19 21:56:04 2003
;;;; Contains: Tests of LIST, LIST*

(in-package :cl-test)

8 9
(compile-and-load "cons-aux.lsp")

10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
(deftest list.1
  (list 'a 'b 'c)
  (a b c))

(deftest list.2
  (list)
  nil)

(deftest list.order.1
  (let ((i 0))
    (list (incf i) (incf i) (incf i) (incf i)))
  (1 2 3 4))

(deftest list.order.2
  (let ((i 0))
    (list (incf i) (incf i) (incf i) (incf i)
sds's avatar
sds committed
26
          (incf i) (incf i) (incf i) (incf i)))
27 28 29 30 31
  (1 2 3 4 5 6 7 8))

(deftest list.order.3
  (let ((i 0))
    (list (incf i) (incf i) (incf i) (incf i)
sds's avatar
sds committed
32 33 34
          (incf i) (incf i) (incf i) (incf i)
          (incf i) (incf i) (incf i) (incf i)
          (incf i) (incf i) (incf i) (incf i)))
35 36
  (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16))

pfdietz's avatar
pfdietz committed
37 38 39 40 41 42
(def-fold-test list.fold.1 (list 'a))
(def-fold-test list.fold.2 (list 'a 'b))
(def-fold-test list.fold.3 (list 'a 'b 'c 'd 'e 'f))

;;; LIST* tests

43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
(deftest list*.1
  (list* 1 2 3)
  (1 2 . 3))

(deftest list*.2
  (list* 'a)
  a)

(deftest list-list*.1
  (list* 'a 'b 'c (list 'd 'e 'f))
  (a b c d e f))

(deftest list*.3
  (list* 1)
  1)

(deftest list*.order.1
  (let ((i 0))
    (list* (incf i) (incf i) (incf i) (incf i)))
  (1 2 3 . 4))

(deftest list*.order.2
  (let ((i 0))
    (list* (incf i) (incf i) (incf i) (incf i)
sds's avatar
sds committed
67 68 69
           (incf i) (incf i) (incf i) (incf i)
           (incf i) (incf i) (incf i) (incf i)
           (incf i) (incf i) (incf i) (incf i)))
70
  (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 . 16))
pfdietz's avatar
pfdietz committed
71 72 73 74

(def-fold-test list*.fold.1 (list* 'a 'b))
(def-fold-test list*.fold.2 (list* 'a 'b 'c))
(def-fold-test list*.fold.3 (list* 'a 'b 'c 'd 'e 'f))