Commit eabf1981 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Update test case

parent 23565c8c
......@@ -68,9 +68,9 @@ BEGIN
paramless SEQUENCE { },
pulse SEQUENCE { p1 T-Int }
},
msg-out ENUMERATED {
paramlesstogui,
do-something
msg-out CHOICE {
paramlesstogui SEQUENCE { },
do-something SEQUENCE { }
}
}
......@@ -79,28 +79,51 @@ BEGIN
paramlesstogui SEQUENCE { },
poll SEQUENCE { }
},
msg-out ENUMERATED {
arr,
paramless,
pulse
msg-out CHOICE {
arr SEQUENCE { p1 T-SeqOf },
paramless SEQUENCE { },
pulse SEQUENCE { p1 T-Int }
}
}
Event ::= CHOICE {
system-startup SEQUENCE {},
-- List all the TASTE functions present in the system
PID ::= ENUMERATED {
env, another-function, orchestrator, simulator-gui
}
-- Event related to the execution of a PI or call of a RI in the functional code
Function-Event ::= CHOICE {
another-function Another-Function-Event,
orchestrator Orchestrator-Event,
simulator-gui Simulator-Gui-Event
}
-- Define a queue of events
-- Event at interface level (PI or RI), including source and destination ID
Interface-Event ::= SEQUENCE {
source PID,
dest PID,
event Function-Event
}
-- Event sent to the observers
Observable-Event ::= CHOICE {
no-event SEQUENCE {},
system-startup SEQUENCE {},
input-event Interface-Event,
output-event Interface-Event
}
-- Define a queue of events, corresponding to the input queue for each function
max-events INTEGER ::= 10
Events-Ty ::= SEQUENCE (SIZE (0 .. max-events)) OF Event
Events-Ty ::= SEQUENCE (SIZE (0 .. max-events)) OF Observable-Event
-- Global system state
-- Global system state (excluding observers, which are defined later)
System-State ::= SEQUENCE {
events Events-Ty,
-- Message queues
another-function-queue Events-Ty (SIZE (0..2)),
orchestrator-queue Events-Ty (SIZE (0..2)),
another-function Another-function-Context,
orchestrator Orchestrator-Context
}
......@@ -118,7 +141,8 @@ Orchestrator-Context ::= SEQUENCE {
init-done BOOLEAN,
t T-Int,
counter T-Int,
seqof T-SeqOf
seqof T-SeqOf,
magic-number T-Int32
}
END
......
system my_observer;
/* CIF TEXT (147, 177), (267, 126) */
/* CIF TEXT (147, 177), (432, 126) */
use datamodel comment 'observer.asn';
exported procedure observe;
fpar in/out global_state System_State;
referenced;
signal foo;
/* CIF ENDTEXT */
channel c
from env to my_observer with foo;
from env to my_observer with foo,
observe;
endchannel;
block my_observer;
signalroute r
from env to my_observer with foo;
from env to my_observer with foo,
observe;
connect c and r;
/* CIF PROCESS (250, 86), (150, 75) */
/* CIF PROCESS (250, 87), (150, 75) */
process my_observer;
/* CIF TEXT (0, 57), (183, 56) */
dcl st System_State;
/* CIF TEXT (0, 57), (223, 88) */
monitor st System_State;
dcl last_event Event;
monitor event Observable_Event;
/* CIF ENDTEXT */
/* CIF procedure (855, 63), (70, 35) */
/* CIF procedure (836, 63), (70, 35) */
procedure observe;
/* CIF TEXT (38, 48), (313, 72) */
-- this procedure could be generated automatically,
-- and be read-only.
fpar in/out global_state System_State;
/* CIF ENDTEXT */
/* CIF START (181, 153), (70, 35) */
START;
/* CIF task (154, 208), (123, 35) */
task st := global_state;
/* CIF return (198, 263), (35, 35) */
/* CIF return (198, 208), (35, 35) */
return ;
endprocedure;
/* CIF START (287, 60), (70, 35) */
/* CIF START (340, 78), (70, 35) */
START;
/* CIF NEXTSTATE (280, 115), (83, 35) */
/* CIF PROCEDURECALL (295, 133), (159, 35) */
call writeln ('observer init');
/* CIF NEXTSTATE (333, 183), (83, 35) */
NEXTSTATE first_state;
/* CIF state (567, 69), (101, 35) */
/* CIF state (28, 218), (95, 35) */
state end_success;
endstate;
/* CIF state (595, 111), (101, 35) */
state second_state;
/* CIF provided (545, 124), (146, 35) */
provided length(st.events) > 0;
/* CIF task (532, 179), (173, 35) */
task last_event := st.events (0);
/* CIF decision (548, 234), (140, 50) */
decision present(last_event);
/* CIF ANSWER (525, 304), (96, 24) */
(orchestrator):
/* CIF decision (465, 348), (217, 50) */
decision present(last_event.orchestrator);
/* CIF ANSWER (495, 418), (70, 24) */
(msg_in):
/* CIF decision (399, 462), (261, 50) */
decision present(last_event.orchestrator.msg_in);
/* CIF ANSWER (318, 532), (70, 24) */
(arr):
/* CIF PROCEDURECALL (270, 576), (166, 35) */
call writeln('Got arr');
/* CIF ANSWER (487, 532), (82, 24) */
(paramless):
/* CIF PROCEDURECALL (445, 576), (166, 35) */
call writeln('Got paramless');
/* CIF ANSWER (672, 532), (70, 24) */
(pulse):
/* CIF PROCEDURECALL (624, 576), (166, 35) */
call writeln('Got pulse');
enddecision;
/* CIF NEXTSTATE (481, 627), (98, 35) */
/* CIF provided (532, 168), (241, 35) */
provided st.orchestrator.magic_number = 42;
/* CIF PROCEDURECALL (564, 223), (176, 35) */
call writeln ('SUCCESS');
/* CIF NEXTSTATE (602, 278), (101, 35) */
NEXTSTATE end_success;
/* CIF ANSWER (799, 418), (74, 24) */
(msg_out):
/* CIF NEXTSTATE (802, 462), (70, 35) */
NEXTSTATE -;
enddecision;
/* CIF ANSWER (886, 304), (70, 24) */
else:
/* CIF NEXTSTATE (886, 348), (70, 35) */
NEXTSTATE -;
enddecision;
endstate;
/* CIF state (858, 178), (95, 35) */
state end_success;
endstate;
/* CIF state (280, 115), (83, 35) */
/* CIF state (333, 183), (83, 35) */
state first_state;
/* CIF provided (217, 170), (208, 35) */
provided st.orchestrator.counter = 4;
/* CIF PROCEDURECALL (192, 225), (256, 35) */
call writeln ('counter=4, moving to state 2');
/* CIF NEXTSTATE (270, 280), (101, 35) */
/* CIF provided (271, 239), (208, 35) */
provided st.orchestrator.counter = 3;
/* CIF PROCEDURECALL (246, 294), (256, 35) */
call writeln ('counter=0, moving to state 2');
/* CIF NEXTSTATE (324, 349), (101, 35) */
NEXTSTATE second_state;
endstate;
endprocess my_observer;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment