diff --git a/test/test-csys.lisp b/test/test-csys.lisp index c9e4f75..ef9524d 100644 --- a/test/test-csys.lisp +++ b/test/test-csys.lisp @@ -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) + ))