-
Notifications
You must be signed in to change notification settings - Fork 20
/
test-cc.lisp
executable file
·42 lines (35 loc) · 1.05 KB
/
test-cc.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
41
;; (See defpackage.lisp for license and copyright notigification)
(in-package :cells)
(defmd tcc ()
(tccversion 1)
(tcc-a (c-in nil))
(tcc-2a (c-in nil)))
(defobserver tcc-a ()
(case (^tccversion)
(1 (when new-value
(with-cc :tcc-a-obs
(setf (tcc-2a self) (* 2 new-value))
(with-cc :aha!2
(assert (eql (tcc-2a self) (* 2 new-value))
() "one")
(trc "one happy")))
(with-cc :aha!
(assert (eql (tcc-2a self) (* 2 new-value))
() "two"))))
(2 (when new-value
(with-cc :tcc-a-obs
(setf (tcc-2a self) (* 2 new-value))
(with-cc :aha!2
(assert (eql (tcc-2a self) (* 2 new-value))
() "one")
(trc "one happy")))))))
(defun test-with-cc ()
(let ((self (make-instance 'tcc
:tccversion 2 ;:tcc-2a
)))
(trcx cool 42)
(setf (tcc-a self) 42)
(assert (and (numberp (tcc-2a self))
(= (tcc-2a self) 84)))))
#+test
(test-with-cc)