Commit b0c045c8 authored by Maxime Perrotin's avatar Maxime Perrotin

Fix test cases due to stricter type checkings

parent 38264417
......@@ -2172,7 +2172,7 @@ def primary_index(root, context, pos):
elif is_number(idx_bty):
# Check range only is index is given as a raw number
if float(idx_bty.Max) >= float(r_max) \
or float(idx_bty.Min) < 1:
or float(idx_bty.Min) < 0:
errors.append(error(root,
'Index range [{id1} .. {id2}] '
'outside of range [{r1} .. {r2}]'
......@@ -2192,9 +2192,10 @@ def primary_index(root, context, pos):
def primary_substring(root, context, pos):
''' Primary substring analysis '''
# Check documentation of primary_index
# Substring parameters must be ground expression : var (3, 5)
# Substring parameters should be ground expression : var (3, 5)
# and not var (a, b), because allowing a and b to have a range does
# not allow to compute a fixed size for the substring
# It is only reported as a warning but this is questionable
node, errors, warnings = ogAST.PrimSubstring(), [], []
......@@ -2236,9 +2237,8 @@ def primary_substring(root, context, pos):
min1, max1 = 0, 0
if min0 != max0 or min1 != max1:
msg = 'Substring bounds must be ground expressions, not variables'
errors.append(error(root, msg))
min1, max1 = 0, 0
msg = 'Substring bounds should be ground expressions'
warnings.append(warning(root, msg))
if min0 < 0 or min1 < 0:
msg = 'Substring bounds cannot be negative'
......
This diff is collapsed.
/* CIF PROCESS (250, 150), (150, 75) */
PROCESS packetmanager;
STATE AGGREGATION wait;
SUBSTRUCTURE
STATE packetReceival;
SUBSTRUCTURE
/* CIF TEXT (673, 16), (357, 140) */
-- Text area for declarations and comments
DCL noOfSentPackets My8BitArrayValueInteger := 1;
/* CIF ENDTEXT */
/* CIF START (28, 0), (70, 35) */
START;
/* CIF NEXTSTATE (0, 58), (127, 35) */
NEXTSTATE frameReceival;
/* CIF STATE (345, 0), (127, 35) */
STATE frameReceival;
/* CIF INPUT (318, 55), (181, 35) */
INPUT ReceivePacket(packet);
/* CIF OUTPUT (287, 105), (244, 35) */
OUTPUT SendFrameCount(length(packet));
/* CIF LABEL (348, 155), (122, 54) */
frameSending:
/* CIF OUTPUT (264, 224), (290, 35) */
OUTPUT SendFrame(packet(noOfSentPackets - 1));
/* CIF DECISION (258, 274), (301, 50) */
DECISION length(packet) = noOfSentPackets;
/* CIF ANSWER (137, 344), (70, 23) */
(true):
/* CIF RETURN (155, 382), (35, 35) */
RETURN ;
/* CIF ANSWER (618, 344), (70, 23) */
(false):
/* CIF TASK (339, 382), (628, 35) */
TASK noOfSentPackets := if noOfsentPackets = 255 then noOfSentPackets else noOfSentPackets + 1 fi;
/* CIF JOIN (636, 432), (35, 35) */
JOIN frameSending;
ENDDECISION;
ENDSTATE;
ENDSUBSTRUCTURE;
STATE frameReceival;
SUBSTRUCTURE
process packetmanager;
state aggregation wait;
substructure
state frameReceival;
substructure
/* CIF TEXT (1100, 14), (336, 140) */
-- Text area for declarations and comments
......@@ -49,42 +13,79 @@ PROCESS packetmanager;
START;
/* CIF NEXTSTATE (22, 50), (164, 35) */
NEXTSTATE frameCountReceival;
/* CIF STATE (270, 0), (164, 35) */
STATE frameCountReceival;
/* CIF INPUT (231, 55), (243, 35) */
INPUT ReceiveFrameCount(frameCount);
/* CIF state (726, 0), (127, 35) */
state frameReceival;
/* CIF input (695, 55), (189, 35) */
input ReceiveFrame(frame);
/* CIF task (515, 105), (548, 40) */
task frameCounter := if frameCounter = 255 then frameCounter else frameCounter + 1 fi;
/* CIF task (498, 165), (582, 35) */
task packet := packet (0, frameCounter -1) // { frame } // packet (frameCounter, length(packet));
/* CIF decision (675, 215), (229, 41) */
decision frameCounter = frameCount;
/* CIF ANSWER (631, 276), (70, 24) */
(true):
/* CIF output (585, 316), (162, 35) */
output SendPacket(packet);
/* CIF return (648, 366), (35, 35) */
return ;
/* CIF ANSWER (873, 276), (70, 24) */
(false):
/* CIF NEXTSTATE (844, 316), (127, 35) */
NEXTSTATE frameReceival;
enddecision;
endstate;
/* CIF state (270, 0), (164, 35) */
state frameCountReceival;
/* CIF input (231, 55), (243, 35) */
input ReceiveFrameCount(frameCount);
/* CIF NEXTSTATE (289, 105), (127, 35) */
NEXTSTATE frameReceival;
ENDSTATE;
/* CIF STATE (726, 0), (127, 35) */
STATE frameReceival;
/* CIF INPUT (695, 55), (189, 35) */
INPUT ReceiveFrame(frame);
/* CIF TASK (515, 105), (548, 38) */
TASK frameCounter := if frameCounter = 255 then frameCounter else frameCounter + 1 fi,
packet(frameCounter - 1) := frame;
/* CIF DECISION (675, 161), (229, 41) */
DECISION frameCounter = frameCount;
/* CIF ANSWER (631, 222), (70, 23) */
endstate;
endsubstructure;
state packetReceival;
substructure
/* CIF TEXT (673, 16), (357, 140) */
-- Text area for declarations and comments
DCL noOfSentPackets My8BitArrayValueInteger := 1;
/* CIF ENDTEXT */
/* CIF START (28, 0), (70, 35) */
START;
/* CIF NEXTSTATE (0, 58), (127, 35) */
NEXTSTATE frameReceival;
/* CIF state (345, 0), (127, 35) */
state frameReceival;
/* CIF input (318, 55), (181, 35) */
input ReceivePacket(packet);
/* CIF output (287, 105), (244, 35) */
output SendFrameCount(length(packet));
/* CIF label (348, 155), (122, 54) */
frameSending:
/* CIF output (264, 224), (290, 35) */
output SendFrame(packet(noOfSentPackets - 1));
/* CIF decision (258, 274), (301, 50) */
decision length(packet) = noOfSentPackets;
/* CIF ANSWER (137, 344), (70, 24) */
(true):
/* CIF OUTPUT (585, 260), (162, 35) */
OUTPUT SendPacket(packet);
/* CIF RETURN (648, 310), (35, 35) */
RETURN ;
/* CIF ANSWER (873, 222), (70, 23) */
/* CIF return (155, 384), (35, 35) */
return ;
/* CIF ANSWER (618, 344), (70, 24) */
(false):
/* CIF NEXTSTATE (844, 260), (127, 35) */
NEXTSTATE frameReceival;
ENDDECISION;
ENDSTATE;
ENDSUBSTRUCTURE;
/* CIF STATE (11, 0), (134, 35) */
STATE frameReceival;
ENDSTATE;
/* CIF STATE (0, 49), (159, 35) */
STATE packetReceival;
ENDSTATE;
ENDSUBSTRUCTURE;
/* CIF task (339, 384), (628, 35) */
task noOfSentPackets := if noOfsentPackets = 255 then noOfSentPackets else noOfSentPackets + 1 fi;
/* CIF join (636, 434), (35, 35) */
join frameSending;
enddecision;
endstate;
endsubstructure;
/* CIF state (0, 49), (159, 35) */
state packetReceival;
endstate;
/* CIF state (11, 0), (134, 35) */
state frameReceival;
endstate;
endsubstructure;
/* CIF TEXT (328, 13), (300, 140) */
-- Text area for declarations and comments
......@@ -96,11 +97,11 @@ packet(frameCounter - 1) := frame;
/* CIF ENDTEXT */
/* CIF START (49, 1), (70, 35) */
START;
/* CIF LABEL (49, 56), (70, 35) */
/* CIF label (49, 56), (70, 35) */
waiting:
/* CIF NEXTSTATE (49, 111), (70, 35) */
NEXTSTATE wait;
/* CIF STATE (175, 1), (70, 35) */
STATE wait;
ENDSTATE;
ENDPROCESS packetmanager;
\ No newline at end of file
/* CIF state (175, 1), (70, 35) */
state wait;
endstate;
endprocess packetmanager;
\ No newline at end of file
......@@ -29,10 +29,12 @@ My16BitArrayValueInteger ::= INTEGER (0..65535)
MyPacket ::= SEQUENCE (SIZE (0..255)) OF MyFrame
-- Stack for data in bits
MyDataStack ::= SEQUENCE (SIZE (40..2000)) OF BOOLEAN
--MyDataStack ::= SEQUENCE (SIZE (40..2000)) OF BOOLEAN
MyDataStack ::= SEQUENCE (SIZE (2000)) OF BOOLEAN
-- Stack for data of FCS calculation
MyFcsStack ::= SEQUENCE (SIZE (224..2192)) OF BOOLEAN -- Frame has empty info or is full
MyFcsStack ::= SEQUENCE (SIZE (2192)) OF BOOLEAN -- Frame has empty info or is full
--MyFcsStack ::= SEQUENCE (SIZE (224..2192)) OF BOOLEAN -- Frame has empty info or is full
-- Integer for data of FCS calculation
MyFcsStackInteger ::= INTEGER (0..2175)
......
......@@ -26,13 +26,13 @@ My16BitArrayInteger ::= INTEGER (0..15)
My16BitArrayValueInteger ::= INTEGER (0..65535)
-- Packet structure
MyPacket ::= SEQUENCE (SIZE (0..255)) OF MyFrame
MyPacket ::= SEQUENCE (SIZE (255)) OF MyFrame
-- Stack for data in bits
MyDataStack ::= SEQUENCE (SIZE (40..2000)) OF BOOLEAN
MyDataStack ::= SEQUENCE (SIZE (2000)) OF BOOLEAN
-- Stack for data of FCS calculation
MyFcsStack ::= SEQUENCE (SIZE (224..2192)) OF BOOLEAN -- Frame has empty info or is full
MyFcsStack ::= SEQUENCE (SIZE (2192)) OF BOOLEAN -- Frame has empty info or is full
-- Integer for data of FCS calculation
MyFcsStackInteger ::= INTEGER (0..2175)
......@@ -104,7 +104,7 @@ MyCntrl ::= My8BitArray -- Fixed value 0x03
MyCode ::= My8BitArray
-- INFO: Operation data
MyOperationData ::= SEQUENCE (SIZE (0..250)) OF My8BitArray
MyOperationData ::= SEQUENCE (SIZE (250)) OF My8BitArray
-- INFO: Info Frame check sequence
MyIfcs ::= My16BitArray
......@@ -116,22 +116,22 @@ MyAuth ::= My16BitArray
MyFcs ::= My16BitArray
-- Stack of L3 frames
MyL3Stack ::= SEQUENCE (SIZE (0..255)) OF MyL3Data
MyL3Stack ::= SEQUENCE (SIZE (255)) OF MyL3Data
-- Stack of L3 frame numbers
MyL3StackNumbers ::= SEQUENCE (SIZE (0..255)) OF BOOLEAN
MyL3StackNumbers ::= SEQUENCE (SIZE (255)) OF BOOLEAN
-- Integer for L3 frame stack numbering
MyL3StackInteger ::= INTEGER (0..254)
-- Stack of L3 missing frame numbers in octets
MyL3MissingStack ::= SEQUENCE (SIZE (0..255)) OF My8BitArray
MyL3MissingStack ::= SEQUENCE (SIZE (255)) OF My8BitArray
-- Stack for L3 data in bits
MyL3DataStack ::= SEQUENCE (SIZE (0..1960)) OF BOOLEAN
MyL3DataStack ::= SEQUENCE (SIZE (1960)) OF BOOLEAN
-- Stack for data of L3 FCS calculation
MyL3FcsStack ::= SEQUENCE (SIZE (80..2040)) OF BOOLEAN -- L3 frame is empty or full
MyL3FcsStack ::= SEQUENCE (SIZE (2040)) OF BOOLEAN -- L3 frame is empty or full
-- Integer for data of L3 FCS calculation
MyL3FcsStackInteger ::= INTEGER (0..2023)
......@@ -179,19 +179,19 @@ MyL3Mrt ::= My16BitArray
MyL3Fnum ::= My8BitArray
-- L3 FRAME: Data
MyL3Data ::= SEQUENCE (SIZE (0..245)) OF My8BitArray
MyL3Data ::= SEQUENCE (SIZE (245)) OF My8BitArray
-- Integer for L3 data
MyL3DataInteger ::= INTEGER (0..244)
-- Stack for L3 acknowledgement data in bits
MyL3AckDataStack ::= SEQUENCE (SIZE (0..1952)) OF BOOLEAN
MyL3AckDataStack ::= SEQUENCE (SIZE (1952)) OF BOOLEAN
-- Stack for data of L3 acknowledgement FCS calculation
MyL3AckFcsStack ::= SEQUENCE (SIZE (88..2040)) OF BOOLEAN -- L3 acknowledgement frame is empty or full
MyL3AckFcsStack ::= SEQUENCE (SIZE (2040)) OF BOOLEAN -- L3 acknowledgement frame is empty or full
-- Stack of L3 missing frame numbers
MyL3AckMissingStack ::= SEQUENCE (SIZE (0..244)) OF INTEGER (0..255)
MyL3AckMissingStack ::= SEQUENCE (SIZE (244)) OF INTEGER (0..255)
-- Integer for stack of L3 missing frame stack numbering
MyL3AckMissingStackInteger ::= INTEGER (0..243)
......@@ -219,7 +219,7 @@ MyL3Lfn ::= My8BitArray
MyL3Hfn ::= My8BitArray
-- L3 ACKNOWLEDGEMENT FRAME: Frame numbers missing
MyL3Rrq ::= SEQUENCE (SIZE (0..244)) OF My8BitArray
MyL3Rrq ::= SEQUENCE (SIZE (244)) OF My8BitArray
-- Integer for L3 frame numbers missing
MyL3RrqInteger ::= INTEGER (0..243)
......@@ -234,7 +234,7 @@ MyInputData ::= SEQUENCE {
}
-- INPUT DATA: Raw data
MyRawData ::= SEQUENCE (SIZE (0..62475)) OF My8BitArray -- Up to 255 frames of data
MyRawData ::= SEQUENCE (SIZE (62475)) OF My8BitArray -- Up to 255 frames of data
-- Integer for raw data numbering
MyRawDataInteger ::= INTEGER (0..62475)
......
SYSTEM orchestrator;
system orchestrator;
/* CIF TEXT (880, 108), (315, 128) */
use datatypes comment 'dataview-uniq.asn';
signal pulse (t_int);
signal arr (t_seqof);
signal paramless;
signal pulse (t_int);
signal arr (t_seqof);
signal paramless;
/* CIF ENDTEXT */
CHANNEL c
FROM ENV TO orchestrator WITH pulse,
channel c
from env to orchestrator with pulse,
arr,
paramless;
ENDCHANNEL;
BLOCK orchestrator;
SIGNALROUTE r
FROM ENV TO orchestrator WITH pulse,
endchannel;
block orchestrator;
signalroute r
from env to orchestrator with pulse,
arr,
paramless;
CONNECT c AND r;
connect c and r;
/* CIF PROCESS (465, 158), (265, 176) */
PROCESS orchestrator;
/* CIF TEXT (964, 71), (268, 140) */
process orchestrator;
/* CIF TEXT (1129, 71), (282, 140) */
-- Text area for declarations and comments
dcl t t_int := 0;
dcl counter t_int := 0;
dcl seqof t_seqof;
dcl t t_int := 0;
dcl counter t_int := 0;
dcl seqof t_seqof;
/* CIF ENDTEXT */
/* CIF START (434, 48), (70, 34) */
/* CIF START (550, 48), (70, 34) */
START;
/* CIF PROCEDURECALL (363, 102), (211, 35) */
CALL writeln( 'Orchestrator startup');
/* CIF NEXTSTATE (435, 152), (67, 35) */
/* CIF PROCEDURECALL (477, 102), (216, 35) */
call writeln( 'Orchestrator startup');
/* CIF NEXTSTATE (552, 152), (67, 35) */
NEXTSTATE wait;
/* CIF STATE (825, 94), (70, 35) */
STATE running;
/* CIF INPUT (825, 149), (70, 35) */
INPUT *;
/* CIF NEXTSTATE (825, 204), (70, 35) */
NEXTSTATE wait;
ENDSTATE;
/* CIF STATE (435, 152), (67, 35) */
STATE wait;
/* CIF INPUT (89, 207), (70, 35) */
INPUT pulse(t);
/* CIF DECISION (89, 262), (70, 50) */
DECISION t;
/* CIF ANSWER (27, 332), (70, 23) */
/* CIF state (552, 152), (67, 35) */
state wait;
/* CIF input (91, 207), (70, 35) */
input pulse(t);
/* CIF decision (91, 262), (70, 50) */
decision t;
/* CIF ANSWER (29, 332), (70, 24) */
(0):
/* CIF TASK (0, 375), (124, 53) */
TASK seqof := {1,1,1,1},
/* CIF task (0, 376), (128, 56) */
task seqof := {1,1,1,1},
counter := 0,
t := 0;
/* CIF NEXTSTATE (27, 443), (70, 35) */
/* CIF NEXTSTATE (29, 450), (70, 35) */
NEXTSTATE wait;
/* CIF ANSWER (161, 332), (70, 23) */
/* CIF ANSWER (163, 332), (70, 24) */
else:
/* CIF TASK (134, 375), (124, 53) */
TASK seqof := {1,1,1,1},
/* CIF task (134, 376), (128, 56) */
task seqof := {1,1,1,1},
counter := 0,
t := 0;
/* CIF NEXTSTATE (161, 443), (70, 35) */
/* CIF NEXTSTATE (162, 450), (70, 35) */
NEXTSTATE running;
ENDDECISION;
/* CIF INPUT (405, 207), (83, 35) */
INPUT arr(seqof);
/* CIF TASK (345, 262), (202, 35) */
TASK counter := (counter + 1) mod 4;
/* CIF DECISION (386, 317), (121, 50) */
DECISION seqof = {4,4,4,4}
enddecision;
/* CIF input (490, 207), (84, 35) */
input arr(seqof);
/* CIF task (428, 262), (208, 35) */
task counter := (counter + 1) mod 4;
/* CIF decision (472, 317), (121, 50) */
decision seqof = {4,4,4,4}
and counter = 0;
/* CIF ANSWER (359, 387), (70, 23) */
/* CIF ANSWER (367, 387), (70, 24) */
(true):
/* CIF PROCEDURECALL (268, 430), (250, 35) */
CALL writeln( 'Property should be checked');
/* CIF ANSWER (556, 387), (70, 23) */
/* CIF PROCEDURECALL (272, 431), (259, 35) */
call writeln( 'Property should be checked');
/* CIF ANSWER (642, 387), (70, 24) */
(false):
/* CIF TASK (540, 430), (103, 35) */
TASK seqof(1) := 1;
ENDDECISION;
/* CIF NEXTSTATE (412, 480), (70, 35) */
/* CIF task (623, 431), (107, 35) */
task 'seqof(1) := 1'
/* CIF comment (751, 431), (233, 40) */
comment 'This is not possible because seqof
has a variable size.';
/* CIF task (542, 486), (269, 35) */
task seqof := { 1 } // seqof (1, length(seqof));
enddecision;
/* CIF NEXTSTATE (498, 536), (70, 35) */
NEXTSTATE -;
/* CIF INPUT (684, 207), (83, 35) */
INPUT paramless;
/* CIF TASK (674, 262), (104, 38) */
TASK counter := 4,
/* CIF input (1013, 207), (86, 35) */
input paramless;
/* CIF task (1005, 262), (104, 40) */
task counter := 4,
t := 1;
/* CIF TASK (663, 320), (124, 38) */
TASK seqof := {1,1,1,1};
/* CIF NEXTSTATE (691, 373), (70, 35) */
/* CIF task (994, 322), (125, 38) */
task seqof := {1,1,1,1};
/* CIF NEXTSTATE (1021, 375), (70, 35) */
NEXTSTATE running;
ENDSTATE;
ENDPROCESS orchestrator;
ENDBLOCK;
ENDSYSTEM;
\ No newline at end of file
endstate;
/* CIF state (1421, 94), (70, 35) */
state running;
/* CIF input (1422, 149), (70, 35) */
input *;
/* CIF NEXTSTATE (1422, 204), (70, 35) */
NEXTSTATE wait;
endstate;
endprocess orchestrator;
endblock;
endsystem;
\ No newline at end of file
/* CIF PROCESS (197, 146), (150, 75) */
process myfunction;
/* CIF TEXT (7, 43), (334, 41) */
-- Test substrings in various contexts and operators
/* CIF ENDTEXT */
/* CIF TEXT (0, 133), (282, 216) */
dcl str MyOctStr := 'abc';
dcl variable_str String := 'Hello!';
......@@ -14,9 +17,6 @@ process myfunction;
dcl fixedseq FixedIntSeq := {0,1,2,3,4};
dcl n t_UInt8;
/* CIF ENDTEXT */
/* CIF TEXT (7, 43), (334, 41) */
-- Test substrings in various contexts and operators
/* CIF ENDTEXT */
/* CIF procedure (1416, 490), (91, 35) */
procedure factorial;
/* CIF TEXT (29, 42), (215, 53) */
......@@ -27,11 +27,11 @@ process myfunction;
START;
/* CIF task (284, 83), (97, 35) */
task result := 1;
/* CIF task (223, 133), (220, 53) */
/* CIF task (223, 133), (220, 56) */
task for x in range(1, n+1):
result := (result * x) mod 255
endfor;
/* CIF return (315, 201), (35, 35) */
/* CIF return (315, 207), (35, 35) */
return ;
endprocedure;
/* CIF START (353, 217), (65, 37) */
......@@ -196,17 +196,11 @@ endfor
task 'seqbool2 := seqbool2 and seqbool2'
/* CIF comment (530, 2220), (216, 35) */
comment 'Variable-length -> raise error';
/* CIF task (300, 2276), (171, 35) */
task seqint (0,0) := seqint(1, 1);
/* CIF task (290, 2331), (191, 35) */
task ' iseq (10, 11) := seqint (0, 1)'
/* CIF comment (501, 2331), (255, 35) */
comment 'that should raise an error, it does not!';
/* CIF task (288, 2386), (195, 35) */
task ' iseq (10, 15) := iseq (20,25)'
/* CIF comment (503, 2386), (255, 35) */
comment 'that should raise an error, it does not!';
/* CIF NEXTSTATE (351, 2436), (68, 33) */
/* CIF task (223, 2276), (324, 35) */
task 'seqint := {seqint(1)} // seqint(1, length(seqint))'
/* CIF comment (567, 2276), (283, 35) */
comment 'I dont understand why this raises an error';
/* CIF NEXTSTATE (351, 2326), (68, 33) */
NEXTSTATE Wait;
/* CIF state (839, 313), (70, 35) */
state wait;
......
Markdown is supported
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