-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.lisp
40 lines (38 loc) · 1.08 KB
/
test.lisp
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
(define-class 'person nil 'name "Eve" 'age "undefined")
(define-class 'student 'person
'name "Eva Lu Ator"
'university "Berkeley"
'talk '(method ()
(princ "My name is ")
(princ (get-slot this 'name))
(terpri)
(princ "My age is ")
(princ (get-slot this 'age)))
'setScazzato '(method (bool)
(print "son vivo")
(set-slot this 'scazzato bool)
)
)
(assert (not (check_args '(1 2 3))))
(assert (not (check_args '(1 2))))
(assert (not (check_args '(a ciao 123 bhu))))
(assert (check_args '(ciao 5)))
(assert (check_args '(:ciao 5)))
(assert (check_args '()))
(assert (not (check_parent 'nonesiste)))
(add-class-spec 'nonesiste '(nonesiste () ()))
(assert (check_parent 'nonesiste))
(assert (check_parent nil))
(assert (methodp '(method ()
(princ "Mi chiamo ")
(princ (get-slot this 'name))
(terpri)
(princ "e studio alla Bicocca.")
(terpri))))
(assert (not (methodp '(42))))
(defparameter pippo (new 'student))
(set-slot pippo 'scazzato 10)
(assert (eq (get-slot pippo 'scazzato) 10))
(assert (not (get-slot pippo 'ciao)))
(setScazzato pippo 3)
(assert (eq (get-slot pippo 'scazzato) 3))