blob: a3e4b9ae4412dc9ddb0ede0c32c1ffeb5ae35261 (
plain)
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
|
(defun test (test-expr res)
(princ
(list (fill
((differ (eval test-expr) res) 'ok)
('f 'fail))
'--> test-expr))
(newline))
;; atom
(test '(atom 'a) t)
(test '(atom '(x . a)) f)
;(test '(atom 'a) undef)
;; dif
(test '(dif 'a 'b) t)
(test '(dif 'a 'a) f)
(test '(dif 'a '(b . c)) t)
(test '(dif '(b . c) '(b . c)) t)
;; car
(test '(car '(a . b)) 'a)
(test '(car '((a . b) . c)) '(a . b))
;(test '(car 'a) undef)
;; cdr
(test '(cdr '(a . b)) 'b)
(test '(cdr '((a . b) . c)) 'c)
;(test '(cdr 'a) undef)
;; cons
(test '(cons 'a 'b) '(a . b))
(test '(cons '(a . b) 'c) '((a . b) . c))
;; or
(test '(or t (car 'a)) t)
;(test '(or (car 'a) t) undef)
;; and
(test '(and f (car 'a)) f)
;(test '(and (car 'a) f) undef)
|