constantp.lsp 1.1 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Mon Jan 13 19:12:17 2003
;;;; Contains: Tests for CONSTANTP

;;; See also defconstant.lsp

(in-package :cl-test)

(deftest constantp.error.1
  (classify-error (constantp))
  program-error)

(deftest constantp.error.2
  (classify-error (constantp nil nil nil))
  program-error)


(deftest constantp.1
  (loop for e in *universe*
	when (and (not (symbolp e))
		   (not (consp e))
		   (not (constantp e)))
	collect e)
  nil)

(deftest constantp.2
  (notnot (constantp t))
  t)
  
(deftest constantp.3
  (notnot (constantp nil))
  t)

(deftest constantp.4
  (notnot (constantp :foo))
  t)

(deftest constantp.5
  (constantp (gensym))
  nil)

(defconstant constantp-test-symbol 1)

(defmacro constantp-macro (form &environment env)
  (notnot (constantp form env)))

(deftest constantp.6
  (constantp-macro constantp-test-symbol)
  t)
  
(deftest constantp.7
  (constantp '(incf x))
  nil)

(deftest constantp.8
  (notnot (constantp 1 nil))
  t)

(deftest constantp.9
  (notnot (constantp ''(((foo)))))
  t)

64
65
66
67
(deftest constantp.10
  (notnot (constantp 'pi))
  t)

68