csys: use simple test via eff-proc for checking zero neuron activity

This commit is contained in:
Helmut Merz 2026-07-23 15:00:56 +02:00
parent 62fb5f883d
commit a52617136d
3 changed files with 7 additions and 17 deletions

View file

@ -10,7 +10,7 @@
(:alx :alexandria)) (:alx :alexandria))
(:export #:scope #:environ (:export #:scope #:environ
#:make-program #:make-program
#:neuron #:std-proc #:create-zero #:neuron #:std-proc #:eff-proc #:create-zero
#:handle-action #:handle-action
#:no-op #:no-op
#:notify)) #:notify))
@ -82,6 +82,7 @@
(defun eff-proc (msg scope &key params actions) (defun eff-proc (msg scope &key params actions)
(util:mv-bind (nmsg (nscope scope)) (util:mv-bind (nmsg (nscope scope))
(handle-action msg scope :default #'no-op :actions actions :params params) (handle-action msg scope :default #'no-op :actions actions :params params)
(setf (nth 1 (shape:head nmsg)) :notify)
(notify nmsg nscope) (notify nmsg nscope)
(update nscope))) (update nscope)))

View file

@ -25,6 +25,7 @@
(defun actions () (defun actions ()
(list :created #'cell-created (list :created #'cell-created
:notify #'csys:no-op
:default #'forward)) :default #'forward))
(defun cell-created (msg scope) (defun cell-created (msg scope)

View file

@ -22,15 +22,14 @@
;;;; testing environment ;;;; testing environment
(defun check-seq (seq) (defun value-in (seq)
(lambda (ctx msg) (lambda (ctx msg)
(let ((t:*test-suite* (tc:suite ctx))) (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 () (defun setup-config ()
(config:add :test-receiver :setup #'tc:setup) (config:add :test-receiver :setup #'tc:setup)
(config:add-action '(:csys :sub) (check-seq '(4))) (config:add-action '(:csys :notify :c00 "0-0") (value-in '(1)))
(config:add-action '(:csys :add) (check-seq '(1 3 5)))
(config:add-action '(:csys) (constantly nil)) (config:add-action '(:csys) (constantly nil))
) )
@ -63,19 +62,8 @@
env)) env))
(deftest test-basic-0 () (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) (sleep 0.1)
(actor:send env (message:create '(:csys :value :c00 "0-0") :data '(:value 1))) (actor:send env (message:create '(:csys :value :c00 "0-0") :data '(:value 1)))
(sleep 0.1) (sleep 0.1)
(core:shutdown))) (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)
)