2
;;;; Author: Paul Dietz
3
;;;; Created: Thu Apr 9 19:32:56 1998
4
;;;; Contains: A global variable containing a list of
5
;;;; as many kinds of CL objects as we can think of
6
;;;; This list is used to test many other CL functions
10
(defparameter *condition-types*
19
floating-point-inexact
20
floating-point-invalid-operation
21
floating-point-underflow
22
floating-point-overflow
42
(defparameter *condition-objects*
43
(locally (declare (optimize safety))
44
(loop for tp in *condition-types* append
45
(handler-case (list (make-condition tp))
48
(defparameter *standard-package-names*
49
'("COMMON-LISP" "COMMON-LISP-USER" "KEYWORD"))
51
(defparameter *package-objects*
52
(locally (declare (optimize safety))
53
(loop for pname in *standard-package-names* append
54
(handler-case (let ((pkg (find-package pname)))
58
(defparameter *integers*
62
;; Integers near the fixnum/bignum boundaries
63
,@(loop for i from -5 to 5 collect (+ i most-positive-fixnum))
64
,@(loop for i from -5 to 5 collect (+ i most-negative-fixnum))
65
;; Powers of two, negatives, and off by one.
66
,@(loop for i from 1 to 64 collect (ash 1 i))
67
,@(loop for i from 1 to 64 collect (1- (ash 1 i)))
68
,@(loop for i from 1 to 64 collect (ash -1 i))
69
,@(loop for i from 1 to 64 collect (1+ (ash -1 i)))
72
;; Some arbitrarily chosen integers
73
12387131 1272314 231 -131 -561823 23713 -1234611312123 444121 991)))
75
(defparameter *floats*
78
most-positive-short-float
79
least-positive-short-float
80
least-positive-normalized-short-float
81
most-positive-double-float
82
least-positive-double-float
83
least-positive-normalized-double-float
84
most-positive-long-float
85
least-positive-long-float
86
least-positive-normalized-long-float
87
most-positive-single-float
88
least-positive-single-float
89
least-positive-normalized-single-float
90
most-negative-short-float
91
least-negative-short-float
92
least-negative-normalized-short-float
93
most-negative-single-float
94
least-negative-single-float
95
least-negative-normalized-single-float
96
most-negative-double-float
97
least-negative-double-float
98
least-negative-normalized-double-float
99
most-negative-long-float
100
least-negative-long-float
101
least-negative-normalized-long-float
103
short-float-negative-epsilon
105
single-float-negative-epsilon
107
double-float-negative-epsilon
109
long-float-negative-epsilon)
110
when (boundp sym) collect (symbol-value sym))
112
0.0 1.0 -1.0 313123.13 283143.231 -314781.9
113
1.31283d2 834.13812D-45
114
8131238.1E14 -4618926.231e-2
115
-37818.131F3 81.318231f-19
116
1.31273s3 12361.12S-7
117
6124.124l0 13123.1L-23)))
119
(defparameter *ratios*
120
'(1/3 1/1000 1/1000000000000000 -10/3 -1000/7 -987129387912381/13612986912361
121
189729874978126783786123/1234678123487612347896123467851234671234))
123
(defparameter *complexes*
129
#C(1289713.12312 -9.12681271)
131
#C(-1.0D-100 -1.0D-100)
149
(defparameter *numbers*
155
(defparameter *reals* (append *integers* *floats* *ratios*))
157
(defparameter *rationals* (append *integers* *ratios*))
159
(defun try-to-read-chars (&rest namelist)
160
(declare (optimize safety))
162
for name in namelist append
164
(list (read-from-string
165
(concatenate 'string "\#\\" name)))
168
(defparameter *characters*
172
,@(try-to-read-chars "Rubout"
179
#\a #\A #\0 #\9 #\. #\( #\) #\[ #\]
183
(defparameter *strings*
187
(make-string 1 :initial-element (code-char 0))
188
(make-string 10 :initial-element (code-char 0))))
190
"" "A" "a" "0" "abcdef"
191
"~!@#$%^&*()_+`1234567890-=<,>.?/:;\"'{[}]|\\ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYXZ"
192
(make-string 100000 :initial-element #\g)
193
(let ((s (make-string 256)))
196
do (let ((c (code-char i)))
198
(setf (elt s i) c))))
200
;; Specialized strings
202
:element-type 'character
203
:displaced-to (make-array 5 :element-type 'character
204
:initial-contents "abcde")
205
:displaced-index-offset 1)
206
(make-array 10 :initial-element #\x
208
:element-type 'character)
209
(make-array 10 :initial-element #\x
210
:element-type 'base-char)
211
(make-array 3 :initial-element #\y
213
:element-type 'base-char)
216
(defparameter *conses*
222
(defparameter *circular-conses*
224
(let ((s (copy-list '(a b c d))))
227
(let ((s (list nil)))
230
(let ((s (list nil)))
234
(defparameter *booleans* '(nil t))
235
(defparameter *keywords* '(:a :b :|| :|a| :|1234|))
236
(defparameter *uninterned-symbols*
237
(list '#:nil '#:t '#:foo '#:||))
238
(defparameter *cl-test-symbols*
239
`(,(intern "a" :cl-test)
240
,(intern "" :cl-test)
242
(list (intern (make-string 1 :initial-element (code-char 0)) :cl-test)))
244
(let* ((s (make-string 10 :initial-element (code-char 0)))
247
(setf (subseq s 3 4) "a")
248
(setf (subseq s2 4 5) "a")
249
(setf (subseq s3 4 5) "a")
250
(setf (subseq s3 7 8) "b")
251
(list (intern s :cl-test)
253
(intern s3 :cl-test))))
256
(defparameter *cl-user-symbols*
261
cl-user::*print-readably*
264
(defparameter *symbols*
265
(append *booleans* *keywords* *uninterned-symbols*
269
(defparameter *array-dimensions*
271
for i from 0 to 8 collect
272
(loop for j from 1 to i collect 2)))
274
(defparameter *default-array-target* (make-array '(300)))
276
(defparameter *arrays*
278
(list (make-array '10))
279
(mapcar #'make-array *array-dimensions*)
282
(loop for tp in '(fixnum float bit character base-char
283
(signed-byte 8) (unsigned-byte 8))
284
for element in '(18 16.0f0 0 #\x #\y 127 200)
287
for d in *array-dimensions*
288
collect (make-array d :element-type tp
289
:initial-element element)))
292
(loop for i from 1 to 64
294
(list (make-array 10 :element-type `(unsigned-byte ,i)
296
(make-array 10 :element-type `(signed-byte ,i)
297
:initial-element 0)))
301
for d in *array-dimensions*
302
collect (make-array d :adjustable t))
306
for d in *array-dimensions*
308
collect (make-array d :displaced-to *default-array-target*
309
:displaced-index-offset i))
316
(make-array 10 :element-type 'bit
317
:initial-contents '(0 1 1 0 1 1 1 1 0 1)
319
(make-array 5 :element-type 'bit
320
:displaced-to #*0111000110
321
:displaced-index-offset 3)
322
(make-array 10 :element-type 'bit
323
:initial-contents '(1 1 0 0 1 1 1 0 1 1)
329
(make-array '(10) :element-type '(integer 0 (256))
330
:initial-contents '(8 9 10 11 12 1 2 3 4 5))
331
(make-array '(10) :element-type '(integer -128 (128))
332
:initial-contents '(8 9 -10 11 -12 1 -2 -3 4 5))
333
(make-array '(6) :element-type '(integer 0 (#.(ash 1 16)))
334
:initial-contents '(5 9 100 1312 23432 87))
335
(make-array '(4) :element-type '(integer 0 (#.(ash 1 28)))
336
:initial-contents '(100000 231213 8123712 19))
337
(make-array '(4) :element-type '(integer 0 (#.(ash 1 32)))
338
:initial-contents '(#.(1- (ash 1 32)) 0 872312 10000000))
340
(make-array nil :element-type '(integer 0 (256))
342
(make-array '(2 2) :element-type '(integer 0 (256))
343
:initial-contents '((34 98)(14 119)))
348
(make-array '(5) :element-type 'short-float
349
:initial-contents '(1.0s0 2.0s0 3.0s0 4.0s0 5.0s0))
350
(make-array '(5) :element-type 'single-float
351
:initial-contents '(1.0f0 2.0f0 3.0f0 4.0f0 5.0f0))
352
(make-array '(5) :element-type 'double-float
353
:initial-contents '(1.0d0 2.0d0 3.0d0 4.0d0 5.0d0))
354
(make-array '(5) :element-type 'long-float
355
:initial-contents '(1.0l0 2.0l0 3.0l0 4.0l0 5.0l0))
358
;; The ever-popular NIL array
359
(locally (declare (optimize safety))
361
(list (make-array '(0) :element-type nil))
364
;; more kinds of arrays here later?
367
(defparameter *hash-tables*
370
(make-hash-table :test #'eq)
371
(make-hash-table :test #'eql)
372
(make-hash-table :test #'equal)
373
#-(or GCL CMU ECL) (make-hash-table :test #'equalp)
376
(defparameter *pathnames*
378
(declare (optimize safety))
380
(ignore-errors (list (make-pathname :name "foo")))
381
(ignore-errors (list (make-pathname :name "FOO" :case :common)))
382
(ignore-errors (list (make-pathname :name "bar")))
383
(ignore-errors (list (make-pathname :name "foo" :type "txt")))
384
(ignore-errors (list (make-pathname :name "bar" :type "txt")))
385
(ignore-errors (list (make-pathname :name "XYZ" :type "TXT" :case :common)))
386
(ignore-errors (list (make-pathname :name nil)))
387
(ignore-errors (list (make-pathname :name :wild)))
388
(ignore-errors (list (make-pathname :name nil :type "txt")))
389
(ignore-errors (list (make-pathname :name :wild :type "txt")))
390
(ignore-errors (list (make-pathname :name :wild :type "TXT" :case :common)))
391
(ignore-errors (list (make-pathname :name :wild :type "abc" :case :common)))
392
(ignore-errors (list (make-pathname :directory :wild)))
393
(ignore-errors (list (make-pathname :type :wild)))
394
(ignore-errors (list (make-pathname :version :wild)))
395
(ignore-errors (list (make-pathname :version :newest)))
398
(eval-when (load eval compile)
400
(declare (optimize safety))
402
(setf (logical-pathname-translations "CLTESTROOT")
403
`(("**;*.*.*" ,(make-pathname :directory '(:absolute :wild-inferiors)
404
:name :wild :type :wild)))))
406
(setf (logical-pathname-translations "CLTEST")
407
`(("**;*.*.*" ,(make-pathname
410
(truename (make-pathname)))
412
:name :wild :type :wild)))))
415
(defparameter *logical-pathnames*
417
(declare (optimize safety))
419
(ignore-errors (list (logical-pathname "CLTESTROOT:")))
422
(defparameter *streams*
435
(defparameter *readtables*
439
(defstruct foo-structure
442
(defstruct bar-structure
445
(defparameter *structures*
447
(make-foo-structure :x 1 :y 'a :z nil)
448
(make-foo-structure :x 1 :y 'a :z nil)
449
(make-bar-structure :x 1 :y 'a :z nil)
452
(defun meaningless-user-function-for-universe (x y z)
453
(list (+ x 1) (+ y 2) (+ z 3)))
455
(defgeneric meaningless-user-generic-function-for-universe (x y z)
456
#+(or (not :gcl) :setf) (:method ((x integer) (y integer) (z integer)) (+ x y z))
459
(eval-when (:load-toplevel)
460
(compile 'meaningless-user-function-for-universe)
461
(compile 'meaningless-user-generic-function-for-universe)
464
(defparameter *functions*
465
(list #'cons #'car #'append #'values
466
(macro-function 'cond)
467
#'meaningless-user-function-for-universe
468
#'meaningless-user-generic-function-for-universe
471
(defparameter *methods*
477
(defparameter *random-states*
478
(list (make-random-state)))
480
(defparameter *universe*
486
(mapcar #'copy-seq *strings*)
502
(defparameter *mini-universe*
509
(list (copy-seq (first *strings*)))
523
'(;;; Others to fill in gaps
524
1.2s0 1.3f0 1.5d0 1.8l0 3/5 10000000000000000000000))))