csys testing: use tc:check-message() for checking eff messages
This commit is contained in:
parent
a52617136d
commit
b773e0aedb
3 changed files with 10 additions and 4 deletions
|
|
@ -38,7 +38,7 @@
|
|||
(defun forward (msg scope)
|
||||
(dolist (cell (find-cells (cells scope) (message:addr msg)))
|
||||
(actor:send cell msg))
|
||||
msg)
|
||||
nil)
|
||||
|
||||
;;;; helpers
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
(defun check-message (ctx msg)
|
||||
(let ((key (shape:head msg))
|
||||
(t:*test-suite* (suite ctx)))
|
||||
(util:lgi (expected ctx))
|
||||
(multiple-value-bind (val found) (gethash key (expected ctx))
|
||||
(if found
|
||||
(progn
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@
|
|||
|
||||
(defun setup-config ()
|
||||
(config:add :test-receiver :setup #'tc:setup)
|
||||
(config:add-action '(:csys :notify :c00 "0-0") (value-in '(1)))
|
||||
;(config:add-action '(:csys :notify :c00 "0-0") (value-in '(1)))
|
||||
(config:add-action '(:csys :notify) #'tc:check-message)
|
||||
(config:add-action '(:csys) (constantly nil))
|
||||
)
|
||||
|
||||
|
|
@ -38,7 +39,8 @@
|
|||
(util:mv-bind (nmsg (scope scope))
|
||||
(csys:handle-action msg scope :actions (environ:actions))
|
||||
(util:lgi nmsg (tc:receiver t:*test-suite*))
|
||||
(actor:send (core:mailbox (tc:receiver t:*test-suite*)) nmsg))))
|
||||
(when nmsg
|
||||
(actor:send (core:mailbox (tc:receiver t:*test-suite*)) nmsg)))))
|
||||
|
||||
(defun run ()
|
||||
(let ((t:*test-suite* (make-instance 'tc:test-suite :name "csys")))
|
||||
|
|
@ -47,6 +49,7 @@
|
|||
(unwind-protect
|
||||
(test-basic-0)
|
||||
(sleep 0.1)
|
||||
(tc:check-expected)
|
||||
(t:show-result))))
|
||||
|
||||
;;;; test: initialization
|
||||
|
|
@ -62,8 +65,10 @@
|
|||
env))
|
||||
|
||||
(deftest test-basic-0 ()
|
||||
(let ((env (setup-test (csys:make-program #'csys:eff-proc))))
|
||||
(let ((env (setup-test (csys:make-program #'csys:eff-proc)))
|
||||
(rcvr (tc:receiver t:*test-suite*)))
|
||||
(sleep 0.1)
|
||||
(tc:expect rcvr (message:create '(:csys :notify :c00 "0-0") :data '(:value 1)))
|
||||
(actor:send env (message:create '(:csys :value :c00 "0-0") :data '(:value 1)))
|
||||
(sleep 0.1)
|
||||
(core:shutdown)))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue