Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
kazoo
Commits
eabf1981
Commit
eabf1981
authored
Apr 11, 2021
by
Maxime Perrotin
Browse files
Update test case
parent
23565c8c
Changes
2
Show whitespace changes
Inline
Side-by-side
test/iterators/work/simulation/observer/observer.asn
View file @
eabf1981
...
...
@@ -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
...
...
test/iterators/work/simulation/observer/observer.pr
View file @
eabf1981
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, 8
6
), (150, 75) */
/* CIF PROCESS (250, 8
7
), (150, 75) */
process my_observer;
/* CIF TEXT (0, 57), (
18
3,
56
) */
dcl
st System_State;
/* CIF TEXT (0, 57), (
22
3,
88
) */
monitor
st System_State;
dcl last_event
Event;
monitor event Observable_
Event;
/* CIF ENDTEXT */
/* CIF procedure (8
55
, 63), (70, 35) */
/* CIF procedure (8
36
, 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
, 1
15
), (83, 35) */
/* CIF state (
333
, 1
83
), (83, 35) */
state first_state;
/* CIF provided (2
17, 170
), (208, 35) */
provided st.orchestrator.counter =
4
;
/* CIF PROCEDURECALL (
192
, 2
25
), (256, 35) */
call writeln ('counter=
4
, moving to state 2');
/* CIF NEXTSTATE (
270, 280
), (101, 35) */
/* CIF provided (2
71, 239
), (208, 35) */
provided st.orchestrator.counter =
3
;
/* CIF PROCEDURECALL (
246
, 2
94
), (256, 35) */
call writeln ('counter=
0
, moving to state 2');
/* CIF NEXTSTATE (
324, 349
), (101, 35) */
NEXTSTATE second_state;
endstate;
endprocess my_observer;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment