File: test-pair.scm

package info (click to toggle)
sigscheme 0.8.3-8
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 12,236 kB
  • ctags: 7,208
  • sloc: lisp: 37,498; ansic: 30,948; sh: 9,257; makefile: 744; asm: 333; ruby: 288
file content (447 lines) | stat: -rw-r--r-- 20,623 bytes parent folder | download | duplicates (14)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
#! /usr/bin/env sscm -C UTF-8
;; -*- buffer-file-coding-system: utf-8 -*-

;;  Filename : test-pair.scm
;;  About    : unit tests for pairs
;;
;;  Copyright (C) 2006 YAMAMOTO Kengo <yamaken AT bp.iij4u.or.jp>
;;  Copyright (c) 2007-2008 SigScheme Project <uim-en AT googlegroups.com>
;;
;;  All rights reserved.
;;
;;  Redistribution and use in source and binary forms, with or without
;;  modification, are permitted provided that the following conditions
;;  are met:
;;
;;  1. Redistributions of source code must retain the above copyright
;;     notice, this list of conditions and the following disclaimer.
;;  2. Redistributions in binary form must reproduce the above copyright
;;     notice, this list of conditions and the following disclaimer in the
;;     documentation and/or other materials provided with the distribution.
;;  3. Neither the name of authors nor the names of its contributors
;;     may be used to endorse or promote products derived from this software
;;     without specific prior written permission.
;;
;;  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
;;  IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
;;  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
;;  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
;;  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
;;  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
;;  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
;;  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
;;  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
;;  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;;  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

(require-extension (unittest))

(define tn test-name)
(define *test-track-progress* #f)

(tn "pair?")
(assert-eq? (tn) #f (pair? #f))
(assert-eq? (tn) #f (pair? #t))
(assert-eq? (tn) #f (pair? '()))
(if (provided? "sigscheme")
    (begin
      (assert-eq? (tn) #f (pair? (eof)))
      (assert-eq? (tn) #f (pair? (undef)))))
(assert-eq? (tn) #f (pair? 0))
(assert-eq? (tn) #f (pair? 1))
(assert-eq? (tn) #f (pair? 3))
(assert-eq? (tn) #f (pair? -1))
(assert-eq? (tn) #f (pair? -3))
(assert-eq? (tn) #f (pair? 'symbol))
(assert-eq? (tn) #f (pair? 'SYMBOL))
(assert-eq? (tn) #f (pair? #\a))
(assert-eq? (tn) #f (pair? #\あ))
(assert-eq? (tn) #f (pair? ""))
(assert-eq? (tn) #f (pair? " "))
(assert-eq? (tn) #f (pair? "a"))
(assert-eq? (tn) #f (pair? "A"))
(assert-eq? (tn) #f (pair? "aBc12!"))
(assert-eq? (tn) #f (pair? "あ"))
(assert-eq? (tn) #f (pair? "あ0イう12!"))
(assert-eq? (tn) #f (pair? +))
(assert-eq? (tn) #f (pair? (lambda () #t)))

;; syntactic keywords should not be appeared as operand
(if sigscheme?
    (begin
      ;; pure syntactic keyword
      (assert-error (tn) (lambda () (pair? else)))
      ;; expression keyword
      (assert-error (tn) (lambda () (pair? do)))))

(call-with-current-continuation
 (lambda (k)
   (assert-eq? (tn) #f (pair? k))))
(assert-eq? (tn) #f (pair? (current-output-port)))
(assert-eq? (tn) #t (pair? '(#t . #t)))
(assert-eq? (tn) #t (pair? (cons #t #t)))
(assert-eq? (tn) #t (pair? '(0 1 2)))
(assert-eq? (tn) #t (pair? (list 0 1 2)))
(assert-eq? (tn) #f (pair? '#()))
(assert-eq? (tn) #f (pair? (vector)))
(assert-eq? (tn) #f (pair? '#(0 1 2)))
(assert-eq? (tn) #f (pair? (vector 0 1 2)))

(tn "cons")
(assert-equal? (tn) '(a) (cons 'a '()))
(assert-equal? (tn) '((a) b c d) (cons '(a) '(b c d)))
(assert-equal? (tn) '(a . 3) (cons 'a 3))
(assert-equal? (tn) '((a b) . c) (cons '(a b) 'c))
(assert-equal? (tn) '(a b c) (cons 'a '(b c)))

(tn "car")
(assert-equal? (tn) 'a (car '(a b c)))
(assert-equal? (tn) '(a) (car '((a) b c)))
(assert-equal? (tn) 1 (car '(1 . 2)))
(if (and (provided? "sigscheme")
         (provided? "siod-bugs"))
    (assert-equal? (tn) '() (car '()))
    (assert-error  (tn) (lambda () (car '()))))

(tn "car various type objects")
(if (and (provided? "sigscheme")
         (provided? "siod-bugs"))
    (assert-equal? (tn) '() (car #f))
    (assert-error  (tn) (lambda () (car #f))))
(assert-error  (tn) (lambda () (car #t)))
(if (provided? "sigscheme")
    (begin
      (assert-error  (tn) (lambda () (car (eof))))
      (assert-error  (tn) (lambda () (car (undef))))))
(assert-error  (tn) (lambda () (car 0)))
(assert-error  (tn) (lambda () (car 1)))
(assert-error  (tn) (lambda () (car 3)))
(assert-error  (tn) (lambda () (car -1)))
(assert-error  (tn) (lambda () (car -3)))
(assert-error  (tn) (lambda () (car 'symbol)))
(assert-error  (tn) (lambda () (car 'SYMBOL)))
(assert-error  (tn) (lambda () (car #\a)))
(assert-error  (tn) (lambda () (car #\あ)))
(assert-error  (tn) (lambda () (car "")))
(assert-error  (tn) (lambda () (car " ")))
(assert-error  (tn) (lambda () (car "a")))
(assert-error  (tn) (lambda () (car "A")))
(assert-error  (tn) (lambda () (car "aBc12!")))
(assert-error  (tn) (lambda () (car "あ")))
(assert-error  (tn) (lambda () (car "あ0イう12!")))
(assert-error  (tn) (lambda () (car +)))
(assert-error  (tn) (lambda () (car (lambda () #t))))

;; syntactic keywords should not be appeared as operand
(if sigscheme?
    (begin
      ;; pure syntactic keyword
      (assert-error (tn) (lambda () (car else)))
      ;; expression keyword
      (assert-error (tn) (lambda () (car do)))))

(call-with-current-continuation
 (lambda (k)
   (assert-error  (tn) (lambda () (car k)))))
(assert-error  (tn) (lambda () (car (current-output-port))))
(assert-equal? (tn) #t (car '(#t . #t)))
(assert-equal? (tn) #t (car (cons #t #t)))
(assert-equal? (tn) 0 (car '(0 1 2)))
(assert-equal? (tn) 0 (car (list 0 1 2)))
(assert-error  (tn) (lambda () (car '#())))
(assert-error  (tn) (lambda () (car (vector))))
(assert-error  (tn) (lambda () (car '#(0 1 2))))
(assert-error  (tn) (lambda () (car (vector 0 1 2))))


(tn "cdr")
(assert-equal? (tn) '(b c d) (cdr '((a) b c d)))
(assert-equal? (tn) 2 (cdr '(1 . 2)))
(if (and (provided? "sigscheme")
         (provided? "siod-bugs"))
    (assert-equal? (tn) '() (cdr '()))
    (assert-error  (tn) (lambda () (cdr '()))))

(tn "cdr various type objects")
(if (and (provided? "sigscheme")
         (provided? "siod-bugs"))
    (assert-equal? (tn) '() (cdr #f))
    (assert-error  (tn) (lambda () (cdr #f))))
(assert-error  (tn) (lambda () (cdr #t)))
(if (provided? "sigscheme")
    (begin
      (assert-error  (tn) (lambda () (cdr (eof))))
      (assert-error  (tn) (lambda () (cdr (undef))))))
(assert-error  (tn) (lambda () (cdr 0)))
(assert-error  (tn) (lambda () (cdr 1)))
(assert-error  (tn) (lambda () (cdr 3)))
(assert-error  (tn) (lambda () (cdr -1)))
(assert-error  (tn) (lambda () (cdr -3)))
(assert-error  (tn) (lambda () (cdr 'symbol)))
(assert-error  (tn) (lambda () (cdr 'SYMBOL)))
(assert-error  (tn) (lambda () (cdr #\a)))
(assert-error  (tn) (lambda () (cdr #\あ)))
(assert-error  (tn) (lambda () (cdr "")))
(assert-error  (tn) (lambda () (cdr " ")))
(assert-error  (tn) (lambda () (cdr "a")))
(assert-error  (tn) (lambda () (cdr "A")))
(assert-error  (tn) (lambda () (cdr "aBc12!")))
(assert-error  (tn) (lambda () (cdr "あ")))
(assert-error  (tn) (lambda () (cdr "あ0イう12!")))
(assert-error  (tn) (lambda () (cdr +)))
(assert-error  (tn) (lambda () (cdr (lambda () #t))))

;; syntactic keywords should not be appeared as operand
(if sigscheme?
    (begin
      ;; pure syntactic keyword
      (assert-error (tn) (lambda () (cdr else)))
      ;; expression keyword
      (assert-error (tn) (lambda () (cdr do)))))

(call-with-current-continuation
 (lambda (k)
   (assert-error  (tn) (lambda () (cdr k)))))
(assert-error  (tn) (lambda () (cdr (current-output-port))))
(assert-equal? (tn) #t (cdr '(#t . #t)))
(assert-equal? (tn) #t (cdr (cons #t #t)))
(assert-equal? (tn) '(1 2) (cdr '(0 1 2)))
(assert-equal? (tn) '(1 2) (cdr (list 0 1 2)))
(assert-error  (tn) (lambda () (cdr '#())))
(assert-error  (tn) (lambda () (cdr (vector))))
(assert-error  (tn) (lambda () (cdr '#(0 1 2))))
(assert-error  (tn) (lambda () (cdr (vector 0 1 2))))


(tn "set-car!")
(define my-set-car!
  (lambda (kons x)
    (set-car! kons x)
    kons))
(assert-error  (tn) (lambda()  (set-car! '() 2)))
(assert-error  (tn) (lambda()  (set-car! (list) 2)))
(if (and (provided? "sigscheme")
         (provided? "compat-siod"))
    (assert-equal? (tn) 2 (set-car! (list 0) 2))
    (undef))

(assert-equal? (tn) '(2)       (my-set-car! (list 0) 2))
(assert-equal? (tn) '(2 . 1)   (my-set-car! (cons 0 1) 2))
(assert-equal? (tn) '(2 1)     (my-set-car! (list 0 1) 2))
(assert-equal? (tn) '(2 1 . 2) (my-set-car! (cons 0 '(1 . 2)) 2))
(if (and (provided? "sigscheme")
         (provided? "const-list-literal"))
    (begin
      (assert-error  (tn) (lambda () (set-car! '(0) 2)))
      (assert-error  (tn) (lambda () (set-car! '(0 . 1) 2)))
      (assert-error  (tn) (lambda () (set-car! '(0 1) 2)))
      (assert-error  (tn) (lambda () (set-car! '(0 1 . 2) 2))))
    (begin
      (assert-equal? (tn) '(2)       (my-set-car! '(0) 2))
      (assert-equal? (tn) '(2 . 1)   (my-set-car! '(0 . 1) 2))
      (assert-equal? (tn) '(2 1)     (my-set-car! '(0 1) 2))
      (assert-equal? (tn) '(2 1 . 2) (my-set-car! '(0 1 . 2) 2))))

(tn "set-cdr!")
(define my-set-cdr!
  (lambda (kons x)
    (set-cdr! kons x)
    kons))
(assert-error  (tn) (lambda()  (set-cdr! '() 2)))
(assert-error  (tn) (lambda()  (set-cdr! (list) 2)))
(if (and (provided? "sigscheme")
         (provided? "compat-siod"))
    (assert-equal? (tn) 2 (set-cdr! (list 0) 2))
    (undef))

(assert-equal? (tn) '(0 . 2)   (my-set-cdr! (list 0) 2))
(assert-equal? (tn) '(0 . 2)   (my-set-cdr! (cons 0 1) 2))
(assert-equal? (tn) '(0 . 2)   (my-set-cdr! (list 0 1) 2))
(assert-equal? (tn) '(0 . 2)   (my-set-cdr! (cons 0 '(1 . 2)) 2))
(if (and (provided? "sigscheme")
         (provided? "const-list-literal"))
    (begin
      (assert-error  (tn) (lambda () (set-cdr! '(0) 2)))
      (assert-error  (tn) (lambda () (set-cdr! '(0 . 1) 2)))
      (assert-error  (tn) (lambda () (set-cdr! '(0 1) 2)))
      (assert-error  (tn) (lambda () (set-cdr! '(0 1 . 2) 2))))
    (begin
      (assert-equal? (tn) '(0 . 2) (my-set-cdr! '(0) 2))
      (assert-equal? (tn) '(0 . 2) (my-set-cdr! '(0 . 1) 2))
      (assert-equal? (tn) '(0 . 2) (my-set-cdr! '(0 1) 2))
      (assert-equal? (tn) '(0 . 2) (my-set-cdr! '(0 1 . 2) 2))))


(define tree (cons (cons (cons '(0  . 1)
                               '(2  . 3))
                         (cons '(4  . 5)
                               '(6  . 7)))
                   (cons (cons '(8  . 9)
                               '(10 . 11))
                         (cons '(12 . 13)
                               '(14 . 15)))))
(assert-equal? "caar"   '((0 . 1)   . (2 . 3))   (caar tree))
(assert-equal? "cadr"   '((8 . 9)   . (10 . 11)) (cadr tree))
(assert-equal? "cdar"   '((4 . 5)   . (6 . 7))   (cdar tree))
(assert-equal? "cddr"   '((12 . 13) . (14 . 15)) (cddr tree))
(assert-equal? "caddr"  '(12 . 13) (caddr tree))
(assert-equal? "cdddr"  '(14 . 15) (cdddr tree))
(if (or (not (provided? "sigscheme"))
        (provided? "deep-cadrs"))
    (begin
      (assert-equal? "caaar"  '(0  . 1)  (caaar tree))
      (assert-equal? "caadr"  '(8  . 9)  (caadr tree))
      (assert-equal? "cadar"  '(4  . 5)  (cadar tree))
      (assert-equal? "cdaar"  '(2  . 3)  (cdaar tree))
      (assert-equal? "cdadr"  '(10 . 11) (cdadr tree))
      (assert-equal? "cddar"  '(6  . 7)  (cddar tree))
      (assert-equal? "caaaar" 0  (caaaar tree))
      (assert-equal? "caaadr" 8  (caaadr tree))
      (assert-equal? "caadar" 4  (caadar tree))
      (assert-equal? "caaddr" 12 (caaddr tree))
      (assert-equal? "cadaar" 2  (cadaar tree))
      (assert-equal? "cadadr" 10 (cadadr tree))
      (assert-equal? "caddar" 6  (caddar tree))
      (assert-equal? "cadddr" 14 (cadddr tree))
      (assert-equal? "cdaaar" 1  (cdaaar tree))
      (assert-equal? "cdaadr" 9  (cdaadr tree))
      (assert-equal? "cdadar" 5  (cdadar tree))
      (assert-equal? "cdaddr" 13 (cdaddr tree))
      (assert-equal? "cddaar" 3  (cddaar tree))
      (assert-equal? "cddadr" 11 (cddadr tree))
      (assert-equal? "cdddar" 7  (cdddar tree))
      (assert-equal? "cddddr" 15 (cddddr tree))))

(if (and (provided? "sigscheme")
         (provided? "siod-bugs"))
    (begin
      (assert-equal? "caar empty list"   '() (caar '()))
      (assert-equal? "cadr empty list"   '() (cadr '()))
      (assert-equal? "cdar empty list"   '() (cdar '()))
      (assert-equal? "cddr empty list"   '() (cddr '()))
      (assert-equal? "caddr empty list"  '() (caddr '()))
      (assert-equal? "cdddr empty list"  '() (cdddr '()))
      (if (or (not (provided? "sigscheme"))
              (provided? "deep-cadrs"))
          (begin
            (assert-equal? "caaar empty list"  '() (caaar '()))
            (assert-equal? "caadr empty list"  '() (caadr '()))
            (assert-equal? "cadar empty list"  '() (cadar '()))
            (assert-equal? "cdaar empty list"  '() (cdaar '()))
            (assert-equal? "cdadr empty list"  '() (cdadr '()))
            (assert-equal? "cddar empty list"  '() (cddar '()))
            (assert-equal? "caaaar empty list" '() (caaaar '()))
            (assert-equal? "caaadr empty list" '() (caaadr '()))
            (assert-equal? "caadar empty list" '() (caadar '()))
            (assert-equal? "caaddr empty list" '() (caaddr '()))
            (assert-equal? "cadaar empty list" '() (cadaar '()))
            (assert-equal? "cadadr empty list" '() (cadadr '()))
            (assert-equal? "caddar empty list" '() (caddar '()))
            (assert-equal? "cadddr empty list" '() (cadddr '()))
            (assert-equal? "cdaaar empty list" '() (cdaaar '()))
            (assert-equal? "cdaadr empty list" '() (cdaadr '()))
            (assert-equal? "cdadar empty list" '() (cdadar '()))
            (assert-equal? "cdaddr empty list" '() (cdaddr '()))
            (assert-equal? "cddaar empty list" '() (cddaar '()))
            (assert-equal? "cddadr empty list" '() (cddadr '()))
            (assert-equal? "cdddar empty list" '() (cdddar '()))
            (assert-equal? "cddddr empty list" '() (cddddr '())))))
    (begin
      (assert-error  "caar empty list"   (lambda () (caar '())))
      (assert-error  "cadr empty list"   (lambda () (cadr '())))
      (assert-error  "cdar empty list"   (lambda () (cdar '())))
      (assert-error  "cddr empty list"   (lambda () (cddr '())))
      (assert-error  "caddr empty list"  (lambda () (caddr '())))
      (assert-error  "cdddr empty list"  (lambda () (cdddr '())))
      (if (or (not (provided? "sigscheme"))
              (provided? "deep-cadrs"))
          (begin
            (assert-error  "caaar empty list"  (lambda () (caaar '())))
            (assert-error  "caadr empty list"  (lambda () (caadr '())))
            (assert-error  "cadar empty list"  (lambda () (cadar '())))
            (assert-error  "cdaar empty list"  (lambda () (cdaar '())))
            (assert-error  "cdadr empty list"  (lambda () (cdadr '())))
            (assert-error  "cddar empty list"  (lambda () (cddar '())))
            (assert-error  "caaaar empty list" (lambda () (caaaar '())))
            (assert-error  "caaadr empty list" (lambda () (caaadr '())))
            (assert-error  "caadar empty list" (lambda () (caadar '())))
            (assert-error  "caaddr empty list" (lambda () (caaddr '())))
            (assert-error  "cadaar empty list" (lambda () (cadaar '())))
            (assert-error  "cadadr empty list" (lambda () (cadadr '())))
            (assert-error  "caddar empty list" (lambda () (caddar '())))
            (assert-error  "cadddr empty list" (lambda () (cadddr '())))
            (assert-error  "cdaaar empty list" (lambda () (cdaaar '())))
            (assert-error  "cdaadr empty list" (lambda () (cdaadr '())))
            (assert-error  "cdadar empty list" (lambda () (cdadar '())))
            (assert-error  "cdaddr empty list" (lambda () (cdaddr '())))
            (assert-error  "cddaar empty list" (lambda () (cddaar '())))
            (assert-error  "cddadr empty list" (lambda () (cddadr '())))
            (assert-error  "cdddar empty list" (lambda () (cdddar '())))
            (assert-error  "cddddr empty list" (lambda () (cddddr '())))))))

(assert-error  "caar insufficient list"   (lambda () (caar '(0 . 1))))
(assert-error  "cadr insufficient list"   (lambda () (cadr '(0 . 1))))
(assert-error  "cdar insufficient list"   (lambda () (cdar '(0 . 1))))
(assert-error  "cddr insufficient list"   (lambda () (cddr '(0 . 1))))
(assert-error  "caddr insufficient list"  (lambda () (caddr '(0 . 1))))
(assert-error  "cdddr insufficient list"  (lambda () (cdddr '(0 . 1))))
(if (or (not (provided? "sigscheme"))
        (provided? "deep-cadrs"))
    (begin
      (assert-error  "caaar insufficient list"  (lambda () (caaar '(0 . 1))))
      (assert-error  "caadr insufficient list"  (lambda () (caadr '(0 . 1))))
      (assert-error  "cadar insufficient list"  (lambda () (cadar '(0 . 1))))
      (assert-error  "cdaar insufficient list"  (lambda () (cdaar '(0 . 1))))
      (assert-error  "cdadr insufficient list"  (lambda () (cdadr '(0 . 1))))
      (assert-error  "cddar insufficient list"  (lambda () (cddar '(0 . 1))))
      (assert-error  "caaaar insufficient list" (lambda () (caaaar '(0 . 1))))
      (assert-error  "caaadr insufficient list" (lambda () (caaadr '(0 . 1))))
      (assert-error  "caadar insufficient list" (lambda () (caadar '(0 . 1))))
      (assert-error  "caaddr insufficient list" (lambda () (caaddr '(0 . 1))))
      (assert-error  "cadaar insufficient list" (lambda () (cadaar '(0 . 1))))
      (assert-error  "cadadr insufficient list" (lambda () (cadadr '(0 . 1))))
      (assert-error  "caddar insufficient list" (lambda () (caddar '(0 . 1))))
      (assert-error  "cadddr insufficient list" (lambda () (cadddr '(0 . 1))))
      (assert-error  "cdaaar insufficient list" (lambda () (cdaaar '(0 . 1))))
      (assert-error  "cdaadr insufficient list" (lambda () (cdaadr '(0 . 1))))
      (assert-error  "cdadar insufficient list" (lambda () (cdadar '(0 . 1))))
      (assert-error  "cdaddr insufficient list" (lambda () (cdaddr '(0 . 1))))
      (assert-error  "cddaar insufficient list" (lambda () (cddaar '(0 . 1))))
      (assert-error  "cddadr insufficient list" (lambda () (cddadr '(0 . 1))))
      (assert-error  "cdddar insufficient list" (lambda () (cdddar '(0 . 1))))
      (assert-error  "cddddr insufficient list" (lambda () (cddddr '(0 . 1))))))

(assert-error  "caar invalid object"   (lambda () (caar #t)))
(assert-error  "cadr invalid object"   (lambda () (cadr #t)))
(assert-error  "cdar invalid object"   (lambda () (cdar #t)))
(assert-error  "cddr invalid object"   (lambda () (cddr #t)))
(assert-error  "caddr invalid object"  (lambda () (caddr #t)))
(assert-error  "cdddr invalid object"  (lambda () (cdddr #t)))
(if (or (not (provided? "sigscheme"))
        (provided? "deep-cadrs"))
    (begin
      (assert-error  "caaar invalid object"  (lambda () (caaar #t)))
      (assert-error  "caadr invalid object"  (lambda () (caadr #t)))
      (assert-error  "cadar invalid object"  (lambda () (cadar #t)))
      (assert-error  "cdaar invalid object"  (lambda () (cdaar #t)))
      (assert-error  "cdadr invalid object"  (lambda () (cdadr #t)))
      (assert-error  "cddar invalid object"  (lambda () (cddar #t)))
      (assert-error  "caaaar invalid object" (lambda () (caaaar #t)))
      (assert-error  "caaadr invalid object" (lambda () (caaadr #t)))
      (assert-error  "caadar invalid object" (lambda () (caadar #t)))
      (assert-error  "caaddr invalid object" (lambda () (caaddr #t)))
      (assert-error  "cadaar invalid object" (lambda () (cadaar #t)))
      (assert-error  "cadadr invalid object" (lambda () (cadadr #t)))
      (assert-error  "caddar invalid object" (lambda () (caddar #t)))
      (assert-error  "cadddr invalid object" (lambda () (cadddr #t)))
      (assert-error  "cdaaar invalid object" (lambda () (cdaaar #t)))
      (assert-error  "cdaadr invalid object" (lambda () (cdaadr #t)))
      (assert-error  "cdadar invalid object" (lambda () (cdadar #t)))
      (assert-error  "cdaddr invalid object" (lambda () (cdaddr #t)))
      (assert-error  "cddaar invalid object" (lambda () (cddaar #t)))
      (assert-error  "cddadr invalid object" (lambda () (cddadr #t)))
      (assert-error  "cdddar invalid object" (lambda () (cdddar #t)))
      (assert-error  "cddddr invalid object" (lambda () (cddddr #t)))))


(total-report)