csys: allow testing with multiple different neural nets: move env and services setup to individual test
This commit is contained in:
parent
c04546ffe7
commit
de72fe9aaf
1 changed files with 22 additions and 24 deletions
|
|
@ -43,33 +43,31 @@
|
|||
(util:lgi nmsg)
|
||||
(actor:send (core:mailbox (tc:receiver t:*test-suite*)) nmsg))))
|
||||
|
||||
;;;; test runner
|
||||
|
||||
(defun run ()
|
||||
(async:init)
|
||||
(let* ((t:*test-suite* (make-instance 'tc:test-suite :name "csys"))
|
||||
(csys:*environment* (make-instance 'test-env :test-suite t:*test-suite*)))
|
||||
(let ((t:*test-suite* (make-instance 'tc:test-suite :name "csys")))
|
||||
(load (t:test-path "config-csys" "etc"))
|
||||
(setup-config)
|
||||
(core:setup-services)
|
||||
(async:init)
|
||||
(unwind-protect
|
||||
(let ((rcvr (core:find-service :test-receiver)))
|
||||
(setf (tc:receiver t:*test-suite*) rcvr)
|
||||
(test-init rcvr))
|
||||
(test-init)
|
||||
(sleep 0.1)
|
||||
(core:shutdown)
|
||||
;(tc:check-expected)
|
||||
(t:show-result))))
|
||||
|
||||
(deftest test-init (rcvr)
|
||||
(setf (gethash '(:effect :default) (csys:procs csys:*environment*)) #'eff-proc)
|
||||
;(csys:make-eff-proc (eff-handler '(1 3 4 5))))
|
||||
(csys: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)
|
||||
)
|
||||
;;;; tests
|
||||
|
||||
(deftest test-init ()
|
||||
(let ((csys:*environment* (make-instance 'test-env :test-suite t:*test-suite*))
|
||||
rcvr)
|
||||
(setf (gethash '(:effect :default) (csys:procs csys:*environment*)) #'eff-proc)
|
||||
(setup-config)
|
||||
(core:setup-services)
|
||||
(setf (tc:receiver t:*test-suite*) (core:find-service :test-receiver))
|
||||
(csys: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