;;;; decons/test-asys - tests for the asys (asynchronous actor systems) package (in-package :decons/test-decons) (defun probe (msg state syns env) (let ((t:*test-suite* env)) (== (actor:content msg) (pop state)) (actor:become (lambda (msg) (probe msg state syns env))) )) (defun test-asys () (async:init) (test-neuron-basics) (async:finish)) (deftest test-neuron-basics () (let* ((prb (asys:neuron #'probe :env t:*test-suite* :state '(43 44 9 13))) ;(syn1 (asys:synapse prb (asys:set-content #'1+))) (syn1 (asys:synapse prb #'1+)) ;(syn3 (asys:synapse prb (asys:inhibit))) (fw (asys:neuron #'asys:forward :syns (list syn1))) (syn2 (asys:synapse fw #'1+)) (cum (asys:neuron #'asys:cumulate :state 0 :syns (list syn2)))) (actor:send fw 42) (actor:send fw 43) (actor:send cum 7) (actor:send cum 4) (sleep 0.1) ))