From a52617136d9f2beffeea1a40dd8514541b30bad2 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Thu, 23 Jul 2026 15:00:56 +0200 Subject: [PATCH] csys: use simple test via eff-proc for checking zero neuron activity --- csys/csys.lisp | 3 ++- csys/environ.lisp | 1 + test/test-csys.lisp | 20 ++++---------------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/csys/csys.lisp b/csys/csys.lisp index bdbf787..f82d30b 100644 --- a/csys/csys.lisp +++ b/csys/csys.lisp @@ -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))) diff --git a/csys/environ.lisp b/csys/environ.lisp index 885bf5c..5d00601 100644 --- a/csys/environ.lisp +++ b/csys/environ.lisp @@ -25,6 +25,7 @@ (defun actions () (list :created #'cell-created + :notify #'csys:no-op :default #'forward)) (defun cell-created (msg scope) diff --git a/test/test-csys.lisp b/test/test-csys.lisp index 4e86122..9932b95 100644 --- a/test/test-csys.lisp +++ b/test/test-csys.lisp @@ -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) - )