7 #include "../src/group.h"
9 void testGroupCreate() {
10 Receptor *r = makeGroup(G_vm,
"ceptr chat");
12 Xaddr mx = _v_new_receptor(G_vm,G_vm->
r,TEST_RECEPTOR,m);
15 spec_is_str_equal(_td(r,
_t_child(r->
root,1)),
"(INSTANCE_OF:ceptr chat)");
16 spec_is_str_equal(_td(r,r->
flux),
"(FLUX (DEFAULT_ASPECT (EXPECTATIONS (EXPECTATION (CARRIER:enrollment) (PATTERN (SEMTREX_SYMBOL_ANY)) (ACTION:enroll) (PARAMS) (END_CONDITIONS (UNLIMITED))) (EXPECTATION (CARRIER:converse) (PATTERN (SEMTREX_SYMBOL_LITERAL (SEMTREX_SYMBOL:MESSAGE_TEXT))) (ACTION:group_listen) (PARAMS (SLOT (USAGE:NULL_SYMBOL))) (END_CONDITIONS (UNLIMITED)))) (SIGNALS)))");
20 T *res = _t_newr(bindings,RESOLUTION);
21 T *w = _t_newr(res,WHICH_RECEPTOR);
22 _t_news(w,ROLE,GROUP);
23 __r_make_addr(w,ACTUAL_RECEPTOR,r->
addr);
24 res = _t_newr(bindings,RESOLUTION);
25 w = _t_newr(res,WHICH_RECEPTOR);
26 _t_news(w,ROLE,MEMBER);
27 __r_make_addr(w,ACTUAL_RECEPTOR,m->
addr);
32 _t_newi(noop,TEST_INT_SYMBOL,314);
35 T *bindings2 =
_t_build(G_sem,0,PROTOCOL_BINDINGS,RESOLUTION,WHICH_PROCESS,GOAL,HANDLER,ACTUAL_PROCESS,proc,NULL_SYMBOL,NULL_SYMBOL,NULL_SYMBOL);
46 spec_is_str_equal(_td(r,
_t_child(__r_get_signals(r,DEFAULT_ASPECT),1)),
"(SIGNAL (ENVELOPE (FROM_ADDRESS (RECEPTOR_ADDR:4)) (TO_ADDRESS (RECEPTOR_ADDR:3)) (ASPECT_IDENT:DEFAULT_ASPECT) (CARRIER:enrollment) (SIGNAL_UUID)) (BODY:{(YUP)}) (RUN_TREE (WHICH_XADDR:MEMBER.1) (PARAMS)))");
50 spec_is_str_equal(t2s(t),
"(ITERATION_DATA (MEMBER (RECEPTOR_ADDR:4)))");
53 res = _t_newr(bindings,RESOLUTION);
54 w = _t_newr(res,WHICH_VALUE);
55 _t_news(w,USAGE,MESSAGE_TEXT);
56 T *val = _t_newr(w,ACTUAL_VALUE);
57 val = _t_new_str(val,MESSAGE_TEXT,
"hi there!");
69 spec_is_str_equal(_td(r,
_t_child(__r_get_signals(r,DEFAULT_ASPECT),2)),
"(SIGNAL (ENVELOPE (FROM_ADDRESS (RECEPTOR_ADDR:4)) (TO_ADDRESS (RECEPTOR_ADDR:3)) (ASPECT_IDENT:DEFAULT_ASPECT) (CARRIER:converse) (SIGNAL_UUID)) (BODY:{(MESSAGE_TEXT:hi there!)}) (RUN_TREE (SIGNAL_UUID) (PARAMS (MESSAGE_TEXT:hi there!))))");
72 _a_get_instances(&r->
instances,MESSAGE_TEXT,t);
73 spec_is_str_equal(t2s(t),
"(ITERATION_DATA (MESSAGE_TEXT:hi there!))");
78 spec_is_str_equal(t2s(t),
"(ITERATION_DATA (MEMBER (RECEPTOR_ADDR:4)))");
81 spec_is_str_equal(_td(m,
_t_child(__r_get_signals(m,DEFAULT_ASPECT),1)),
"(SIGNAL (ENVELOPE (FROM_ADDRESS (RECEPTOR_ADDR:3)) (TO_ADDRESS (RECEPTOR_ADDR:4)) (ASPECT_IDENT:DEFAULT_ASPECT) (CARRIER:converse) (SIGNAL_UUID)) (BODY:{(MESSAGE_TEXT:hi there!)}) (RUN_TREE (TEST_INT_SYMBOL:314) (PARAMS)))");
82 debug_disable(D_PROTOCOL+D_SIGNALS);
T * _t_new_root(Symbol symbol)
T * _t_child(T *t, int i)
ReceptorAddress addr
the address by which to get messages to this receptor instance
Instances instances
the instances store
VMHost * _v_new()
Creates a new virtual machine host.
T * flux
pointer for quick access to the flux
void _v_activate(VMHost *v, Xaddr x)
Receptor * _r_new(SemTable *sem, SemanticID r)
Creates a new receptor.
void _o_initiate(Receptor *r, SemanticID protocol, SemanticID interaction, T *bindings)
T * root
RECEPTOR_INSTANCE semantic tree.
void _o_express_role(Receptor *r, Protocol protocol, Symbol role, Aspect aspect, T *bindings)
Receptor * r
Receptor data for this vm host.
void _v_deliver_signals(VMHost *v, Receptor *sender)
Process _r_define_process(Receptor *r, T *code, char *name, char *intention, T *signature, T *link)
T * _t_build(SemTable *sem, T *parent,...)