Commit 3a135200 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Complexify test1

parent be88355b
......@@ -10,7 +10,7 @@ test-parse:
test-ada: og.ali dataview-uniq.o | test_ada.o
$(GNATBIND) -n og.ali
$(GNATLINK) -o test_ada test_ada.o og.ali -lgnat
$(GNATLINK) -o test_ada test_ada.o dataview-uniq.o og.ali -lgnat
./test_ada
#gcov og.adb
......
......@@ -31,5 +31,6 @@ SeqBool ::= SEQUENCE(SIZE(1..5)) OF BOOLEAN
default-seqof SeqOf ::= {4,7,9}
default-str My-OctStr ::= 'DEADBEEF'H
test-string My-OctStr ::= '68656c6c6f'H -- "hello"
END
/* CIF PROCESS (149, 150), (150, 75) */
PROCESS og;
/* CIF TEXT (0, 0), (298, 286) */
/* CIF TEXT (2755, 9), (298, 286) */
-- A Demo to test octet strings
-- using various symbols.
......@@ -19,176 +19,186 @@ dcl alwaysFalse Type2 := 0 in {1,2,3};
dcl seqofbool seqBool := { true, true};
/* CIF ENDTEXT */
/* CIF START (427, 26), (100, 50) */
/* CIF START (1427, 35), (100, 50) */
START;
/* CIF TASK (370, 91), (214, 83) */
/* CIF TASK (1370, 100), (214, 83) */
TASK test := 5,
test := power(test, 1),
test := abs(-4+1),
test := abs(test)
/* CIF COMMENT (603, 114), (183, 35) */
/* CIF COMMENT (1603, 123), (183, 35) */
COMMENT 'Task with unicode: voilà!';
/* CIF TASK (375, 189), (204, 50) */
/* CIF TASK (1375, 198), (204, 50) */
TASK first_msg := 'Say hello first!'
/* CIF COMMENT (599, 189), (148, 50) */
/* CIF COMMENT (1599, 198), (148, 50) */
COMMENT 'String assignment';
/* CIF PROCEDURECALL (388, 254), (177, 35) */
/* CIF PROCEDURECALL (1389, 263), (177, 35) */
CALL writeln( first_msg(1,2));
/* CIF PROCEDURECALL (373, 304), (207, 35) */
/* CIF PROCEDURECALL (1374, 313), (207, 35) */
CALL writeln( not (not not true));
/* CIF TASK (394, 354), (165, 50) */
/* CIF TASK (1395, 363), (165, 50) */
TASK seq := default_seqof,
seq := {1,2,3}
/* CIF COMMENT (579, 354), (204, 50) */
/* CIF COMMENT (1579, 363), (204, 50) */
COMMENT 'default_seqof is a constant
defined in the ASN.1 model';
/* CIF TASK (345, 419), (263, 50) */
/* CIF TASK (1346, 428), (263, 50) */
TASK seq := seq // {4, test} // default_seqof
/* CIF COMMENT (629, 419), (156, 50) */
/* CIF COMMENT (1629, 428), (156, 50) */
COMMENT 'Concatenate
two SEQUENCE OF';
/* CIF TASK (408, 484), (137, 50) */
/* CIF TASK (1409, 493), (137, 50) */
TASK 'seq(1) := seq(2)';
/* CIF TASK (382, 549), (189, 50) */
/* CIF TASK (1383, 558), (189, 50) */
TASK seq := seq(0,1) // seq(3, 4)
/* CIF COMMENT (590, 549), (166, 50) */
/* CIF COMMENT (1590, 558), (166, 50) */
COMMENT 'Remove 3rd element';
/* CIF TASK (407, 614), (140, 53) */
/* CIF TASK (1407, 623), (140, 53) */
TASK for x in seq:
call writeln(x);
endfor;
/* CIF PROCEDURECALL (395, 682), (164, 35) */
/* CIF PROCEDURECALL (1395, 691), (164, 35) */
CALL writeln('test=', test);
/* CIF DECISION (425, 732), (104, 70) */
/* CIF DECISION (1425, 741), (104, 70) */
DECISION test in seq
/* CIF COMMENT (549, 747), (170, 39) */
/* CIF COMMENT (1549, 756), (170, 39) */
COMMENT 'Test the "in" operator
Unicode test: Ï';
/* CIF ANSWER (335, 822), (100, 35) */
/* CIF ANSWER (1335, 831), (100, 35) */
(TRUE):
/* CIF PROCEDURECALL (308, 872), (154, 50) */
/* CIF PROCEDURECALL (1308, 881), (154, 50) */
CALL writeln('All OK (1)');
/* CIF ANSWER (498, 822), (100, 35) */
/* CIF ANSWER (1498, 831), (100, 35) */
(FALSE):
/* CIF PROCEDURECALL (466, 872), (164, 50) */
/* CIF PROCEDURECALL (1466, 881), (164, 50) */
CALL writeln('NOT OK (1)')
/* CIF COMMENT (650, 879), (117, 35) */
/* CIF COMMENT (1650, 888), (117, 35) */
COMMENT 'Call UnicÔDË';
ENDDECISION;
/* CIF DECISION (427, 937), (100, 70) */
/* CIF DECISION (1427, 946), (100, 70) */
DECISION 3 in seq
/* CIF COMMENT (547, 954), (256, 35) */
/* CIF COMMENT (1547, 963), (256, 35) */
COMMENT 'test==3 so it should also return true';
/* CIF ANSWER (341, 1027), (100, 35) */
/* CIF ANSWER (1341, 1036), (100, 35) */
(TRUE):
/* CIF PROCEDURECALL (309, 1077), (164, 50) */
/* CIF PROCEDURECALL (1309, 1086), (164, 50) */
CALL writeln('ALL OK (2)');
/* CIF ANSWER (513, 1027), (100, 35) */
/* CIF ANSWER (1513, 1036), (100, 35) */
(FALSE):
/* CIF PROCEDURECALL (481, 1077), (164, 50) */
/* CIF PROCEDURECALL (1481, 1086), (164, 50) */
CALL writeln('NOT OK (2)');
ENDDECISION;
/* CIF NEXTSTATE (427, 1142), (100, 50) */
/* CIF NEXTSTATE (1427, 1151), (100, 50) */
NEXTSTATE Wait;
/* CIF STATE (1204, 151), (100, 50) */
/* CIF STATE (2204, 160), (100, 50) */
STATE Running;
/* CIF INPUT (1204, 221), (100, 50) */
/* CIF INPUT (2204, 230), (100, 50) */
INPUT go(msg);
/* CIF DECISION (1202, 286), (103, 70) */
/* CIF PROCEDURECALL (2203, 300), (101, 35) */
CALL writeln(msg);
/* CIF DECISION (2203, 350), (103, 70) */
DECISION msg
/* CIF COMMENT (1326, 296), (111, 50) */
/* CIF COMMENT (2326, 360), (111, 50) */
COMMENT 'Switch-case
on strings';
/* CIF ANSWER (1454, 376), (100, 35) */
/* CIF ANSWER (2454, 440), (100, 35) */
('egg'):
/* CIF TASK (1433, 426), (141, 50) */
/* CIF TASK (2434, 490), (141, 50) */
TASK msg := msg // '!!'
/* CIF COMMENT (1595, 426), (118, 50) */
/* CIF COMMENT (2595, 490), (118, 50) */
COMMENT 'Concatenate
strings';
/* CIF OUTPUT (1429, 491), (150, 50) */
/* CIF OUTPUT (2429, 555), (150, 50) */
OUTPUT rezult(default_str)
/* CIF COMMENT (1594, 489), (161, 53) */
/* CIF COMMENT (2594, 553), (161, 53) */
COMMENT 'Send a constant
defined in the ASN.1
model';
/* CIF NEXTSTATE (1454, 556), (100, 50) */
/* CIF NEXTSTATE (2454, 620), (100, 50) */
NEXTSTATE Running
/* CIF COMMENT (1574, 563), (96, 35) */
/* CIF COMMENT (2574, 627), (96, 35) */
COMMENT 'Néxtaytè';
/* CIF ANSWER (878, 376), (100, 35) */
/* CIF ANSWER (1864, 440), (100, 35) */
('end'):
/* CIF OUTPUT (872, 426), (112, 50) */
/* CIF OUTPUT (1858, 490), (112, 50) */
OUTPUT rezult
('Goodbye!');
/* CIF NEXTSTATE (878, 493), (100, 50) */
/* CIF NEXTSTATE (1864, 557), (100, 50) */
NEXTSTATE Wait;
/* CIF ANSWER (1042, 376), (100, 35) */
/* CIF ANSWER (2042, 440), (100, 35) */
ELSE:
/* CIF TASK (1021, 426), (141, 50) */
/* CIF TASK (2022, 490), (141, 50) */
TASK msg := msg // '!'
/* CIF COMMENT (1183, 426), (118, 50) */
/* CIF COMMENT (2183, 490), (118, 50) */
COMMENT 'Concatenate
strings';
/* CIF TASK (994, 491), (195, 50) */
/* CIF PROCEDURECALL (2009, 560), (165, 35) */
CALL writeln('msg//! = ', msg);
/* CIF TASK (1995, 610), (195, 50) */
TASK msg := msg(3,4) // msg(1,2)
/* CIF COMMENT (1210, 491), (209, 53) */
/* CIF COMMENT (2210, 610), (209, 53) */
COMMENT 'Concatenate two substrings
(can be used to remove an
element from a list)';
/* CIF TASK (1010, 556), (163, 50) */
/* CIF PROCEDURECALL (1980, 680), (224, 35) */
CALL writeln('msg(3,4)//(1,2) = ',msg);
/* CIF TASK (2011, 730), (163, 50) */
TASK msg := first_msg(1, 2)
/* CIF COMMENT (1186, 553), (177, 53) */
/* CIF COMMENT (2186, 727), (177, 53) */
COMMENT 'Substring
TODO check range
against current Length';
/* CIF OUTPUT (1038, 621), (108, 50) */
/* CIF PROCEDURECALL (1992, 800), (199, 35) */
CALL writeln('first_msg(1,2)=',msg)
/* CIF COMMENT (2212, 800), (98, 35) */
COMMENT 'should be ay';
/* CIF OUTPUT (2038, 850), (108, 50) */
OUTPUT rezult(msg);
/* CIF NEXTSTATE (1042, 686), (100, 50) */
/* CIF NEXTSTATE (2042, 915), (100, 50) */
NEXTSTATE Running;
ENDDECISION;
ENDSTATE;
/* CIF STATE (427, 1142), (100, 50) */
/* CIF STATE (1427, 1151), (100, 50) */
STATE Wait;
/* CIF INPUT (427, 1212), (100, 50) */
/* CIF INPUT (1427, 1221), (100, 50) */
INPUT go(msg)
/* CIF COMMENT (547, 1219), (120, 35) */
/* CIF COMMENT (1547, 1228), (120, 35) */
COMMENT 'Ïñpût unicode';
/* CIF DECISION (420, 1277), (114, 70) */
/* CIF DECISION (1420, 1286), (114, 70) */
DECISION msg = 'hello'
/* CIF COMMENT (554, 1287), (128, 50) */
/* CIF COMMENT (1554, 1296), (128, 50) */
COMMENT 'Boolean test
on string value';
/* CIF ANSWER (638, 1367), (100, 35) */
/* CIF ANSWER (1638, 1376), (100, 35) */
(FALSE):
/* CIF OUTPUT (618, 1417), (139, 50) */
/* CIF OUTPUT (1619, 1426), (139, 50) */
OUTPUT rezult(first_msg)
/* CIF COMMENT (777, 1424), (85, 35) */
/* CIF COMMENT (1777, 1433), (85, 35) */
COMMENT 'OûtpUT';
/* CIF NEXTSTATE (638, 1482), (100, 50) */
/* CIF NEXTSTATE (1638, 1491), (100, 50) */
NEXTSTATE Wait;
/* CIF ANSWER (367, 1367), (100, 35) */
/* CIF ANSWER (1367, 1376), (100, 35) */
(TRUE):
/* CIF OUTPUT (344, 1417), (145, 50) */
/* CIF OUTPUT (1345, 1426), (145, 50) */
OUTPUT rezult('Welcome')
/* CIF COMMENT (509, 1417), (95, 50) */
/* CIF COMMENT (1509, 1426), (95, 50) */
COMMENT 'Send raw
string';
/* CIF DECISION (368, 1482), (98, 50) */
/* CIF DECISION (1368, 1491), (98, 50) */
DECISION 3 in {1,2,3};
/* CIF ANSWER (328, 1552), (88, 33) */
/* CIF ANSWER (1328, 1561), (88, 33) */
(1 in {1,2}):
/* CIF ANSWER (418, 1552), (88, 33) */
/* CIF ANSWER (1418, 1561), (88, 33) */
(0 in {1,2}):
ENDDECISION;
/* CIF DECISION (368, 1600), (98, 50) */
/* CIF DECISION (1368, 1609), (98, 50) */
DECISION 4 in {1,2,3};
/* CIF ANSWER (339, 1670), (66, 33) */
/* CIF ANSWER (1339, 1679), (66, 33) */
(true):
/* CIF ANSWER (422, 1670), (70, 33) */
/* CIF ANSWER (1422, 1679), (70, 33) */
(false):
ENDDECISION;
/* CIF NEXTSTATE (367, 1718), (100, 50) */
/* CIF NEXTSTATE (1367, 1727), (100, 50) */
NEXTSTATE Running;
ENDDECISION;
ENDSTATE;
......
......@@ -11,9 +11,11 @@ void og_RI_rezult (asn1SccMy_OctStr *val)
}
int main() {
asn1SccMy_OctStr toto;
asn1SccMy_OctStr toto = test_string; // send "hello"
adainit();
og_go(&toto);
og_go(&toto); // will move state to Running
og_go(&toto); // will display ay
og_go(&toto); // will display ay
return 0;
}
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