csys: use simple test via eff-proc for checking zero neuron activity
This commit is contained in:
parent
62fb5f883d
commit
a52617136d
3 changed files with 7 additions and 17 deletions
|
|
@ -10,7 +10,7 @@
|
|||
(:alx :alexandria))
|
||||
(:export #:scope #:environ
|
||||
#:make-program
|
||||
#:neuron #:std-proc #:create-zero
|
||||
#:neuron #:std-proc #:eff-proc #:create-zero
|
||||
#:handle-action
|
||||
#:no-op
|
||||
#:notify))
|
||||
|
|
@ -82,6 +82,7 @@
|
|||
(defun eff-proc (msg scope &key params actions)
|
||||
(util:mv-bind (nmsg (nscope scope))
|
||||
(handle-action msg scope :default #'no-op :actions actions :params params)
|
||||
(setf (nth 1 (shape:head nmsg)) :notify)
|
||||
(notify nmsg nscope)
|
||||
(update nscope)))
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
(defun actions ()
|
||||
(list :created #'cell-created
|
||||
:notify #'csys:no-op
|
||||
:default #'forward))
|
||||
|
||||
(defun cell-created (msg scope)
|
||||
|
|
|
|||
|
|
@ -22,15 +22,14 @@
|
|||
|
||||
;;;; testing environment
|
||||
|
||||
(defun check-seq (seq)
|
||||
(defun value-in (seq)
|
||||
(lambda (ctx msg)
|
||||
(let ((t:*test-suite* (tc:suite ctx)))
|
||||
(t:in-seq (shape:data msg) seq))))
|
||||
(t:in-seq (getf (shape:data msg) :value) seq))))
|
||||
|
||||
(defun setup-config ()
|
||||
(config:add :test-receiver :setup #'tc:setup)
|
||||
(config:add-action '(:csys :sub) (check-seq '(4)))
|
||||
(config:add-action '(:csys :add) (check-seq '(1 3 5)))
|
||||
(config:add-action '(:csys :notify :c00 "0-0") (value-in '(1)))
|
||||
(config:add-action '(:csys) (constantly nil))
|
||||
)
|
||||
|
||||
|
|
@ -63,19 +62,8 @@
|
|||
env))
|
||||
|
||||
(deftest test-basic-0 ()
|
||||
(let ((env (setup-test (csys:make-program #'csys:std-proc))))
|
||||
(let ((env (setup-test (csys:make-program #'csys:eff-proc))))
|
||||
(sleep 0.1)
|
||||
(actor:send env (message:create '(:csys :value :c00 "0-0") :data '(:value 1)))
|
||||
(sleep 0.1)
|
||||
(core:shutdown)))
|
||||
|
||||
(deftest x-test-init ()
|
||||
;(csys:send-message '(:csys :sensor :init :zero) '(:std :s1))
|
||||
;(csys:send-message '(:csys :sensor :init :zero) '(:std :s2))
|
||||
(sleep 0.1)
|
||||
;(csys:send-message '(:csys :add :std :s1) 1)
|
||||
;(csys:send-message '(:csys :add :std :s1) 3)
|
||||
;(csys:send-message '(:csys :sub :std :s2) 4)
|
||||
;(csys:send-message '(:csys :add :std :s2) 5)
|
||||
(core:shutdown)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue