add csys/program, move corresponding funtions from test module to program
This commit is contained in:
parent
98df278cf6
commit
e7b76391c2
3 changed files with 37 additions and 24 deletions
32
csys/program.lisp
Normal file
32
csys/program.lisp
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
;;;; cl-scopes/csys/program - common and general csys program definitions
|
||||||
|
|
||||||
|
(defpackage :scopes/csys/program
|
||||||
|
(:use :common-lisp)
|
||||||
|
(:local-nicknames (:actor :scopes/core/actor)
|
||||||
|
(:csys :scopes/csys)
|
||||||
|
(:util :scopes/util))
|
||||||
|
(:export #:basic-0))
|
||||||
|
|
||||||
|
(in-package :scopes/csys/program)
|
||||||
|
|
||||||
|
;;;; basic-0: minimal recursive system
|
||||||
|
|
||||||
|
(defun basic-0 ()
|
||||||
|
(csys:make-program
|
||||||
|
(list '(:c00 :initial) (csys:std-proc :actions (actions-zero-initial))
|
||||||
|
'(:e01 :initial) (csys:eff-proc :actions (csys:basic-actions))
|
||||||
|
':default (csys:std-proc :actions (csys:basic-actions)))))
|
||||||
|
|
||||||
|
(defun actions-zero-initial ()
|
||||||
|
(util:plist-merge (csys:basic-actions)
|
||||||
|
(list :next (next-zero-initial))))
|
||||||
|
|
||||||
|
(defun next-zero-initial ()
|
||||||
|
(lambda (msg scope)
|
||||||
|
(let ((self actor:*self*))
|
||||||
|
(csys:send-create self :cat :e01 :connect :succ)
|
||||||
|
(csys:send-create self :cat :s01 :loc "0-1" :connect :pred)
|
||||||
|
(csys:send-connect self self :op (csys:multiply -1))
|
||||||
|
;; switch :active
|
||||||
|
nil)))
|
||||||
|
|
||||||
|
|
@ -10,7 +10,9 @@
|
||||||
:description "Concurrent cybernetic communications systems."
|
:description "Concurrent cybernetic communications systems."
|
||||||
:depends-on (:scopes-core)
|
:depends-on (:scopes-core)
|
||||||
:components ((:file "csys/csys")
|
:components ((:file "csys/csys")
|
||||||
(:file "csys/environ" :depends-on ("csys/csys")))
|
(:file "csys/environ" :depends-on ("csys/csys"))
|
||||||
|
(:file "csys/program" :depends-on ("csys/csys" "csys/environ"))
|
||||||
|
)
|
||||||
:long-description "scopes/csys: Concurrent cybernetic communication systems."
|
:long-description "scopes/csys: Concurrent cybernetic communication systems."
|
||||||
:in-order-to ((test-op (test-op "scopes-csys/test"))))
|
:in-order-to ((test-op (test-op "scopes-csys/test"))))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
(:environ :scopes/csys/environ)
|
(:environ :scopes/csys/environ)
|
||||||
(:logging :scopes/logging)
|
(:logging :scopes/logging)
|
||||||
(:message :scopes/core/message)
|
(:message :scopes/core/message)
|
||||||
|
(:program :scopes/csys/program)
|
||||||
(:shape :scopes/shape)
|
(:shape :scopes/shape)
|
||||||
(:util :scopes/util)
|
(:util :scopes/util)
|
||||||
(:t :scopes/testing)
|
(:t :scopes/testing)
|
||||||
|
|
@ -60,32 +61,10 @@
|
||||||
(csys:create-zero prg env)
|
(csys:create-zero prg env)
|
||||||
env))
|
env))
|
||||||
|
|
||||||
;;;; test-specific programs / actions
|
|
||||||
;;;; (move to scopes/csys/programs)
|
|
||||||
|
|
||||||
(defun prog-b0 ()
|
|
||||||
(csys:make-program
|
|
||||||
(list '(:c00 :initial) (csys:std-proc :actions (actions-zero-initial))
|
|
||||||
'(:e01 :initial) (csys:eff-proc :actions (csys:basic-actions))
|
|
||||||
':default (csys:std-proc :actions (csys:basic-actions)))))
|
|
||||||
|
|
||||||
(defun actions-zero-initial ()
|
|
||||||
(util:plist-merge (csys:basic-actions)
|
|
||||||
(list :next (next-zero-initial))))
|
|
||||||
|
|
||||||
(defun next-zero-initial ()
|
|
||||||
(lambda (msg scope)
|
|
||||||
(let ((self actor:*self*))
|
|
||||||
(csys:send-create self :cat :e01 :connect :succ)
|
|
||||||
(csys:send-create self :cat :s01 :loc "0-1" :connect :pred)
|
|
||||||
(csys:send-connect self self :op (csys:multiply -1))
|
|
||||||
;; switch :active
|
|
||||||
nil)))
|
|
||||||
|
|
||||||
;;;; test definitions
|
;;;; test definitions
|
||||||
|
|
||||||
(deftest test-basic-0 ()
|
(deftest test-basic-0 ()
|
||||||
(let ((env (setup-test (prog-b0)))
|
(let ((env (setup-test (program:basic-0)))
|
||||||
(rcvr (tc:receiver t:*test-suite*)))
|
(rcvr (tc:receiver t:*test-suite*)))
|
||||||
(sleep 0.1)
|
(sleep 0.1)
|
||||||
;(tc:expect rcvr (message:create '(:csys :effect :e01) :data '(:value 1)))
|
;(tc:expect rcvr (message:create '(:csys :effect :e01) :data '(:value 1)))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue