Commit 1d247b0d authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Complexify the _Equal tests (incomplete)

parent a10ba5bf
......@@ -1653,6 +1653,11 @@ def _sequence_of(seqof):
def _choiceitem(choice):
''' Return the Ada code for a CHOICE expression '''
stmts, choice_str, local_decl = expression(choice.value['value'])
if isinstance(choice.value['value'], (ogAST.PrimSequenceOf,
ogAST.PrimStringLiteral)):
print choice.value['value'].exprType
choice_str = array_content(choice.value['value'], choice_str,
find_basic_type(choice.value['value'].exprType))
ada_string = u'{cType}_{opt}_set({expr})'.format(
cType=type_name(choice.exprType),
opt=choice.value['choice'],
......
......@@ -6,8 +6,12 @@ My-OctStr ::= OCTET STRING (SIZE (0..20))
SeqOf ::= SEQUENCE (SIZE(0..100)) OF My-OctStr
Toto ::= SEQUENCE { elem-1 My-OctStr, elem-2 SeqOf }
Toto ::= SEQUENCE { elem-1 My-OctStr, elem-2 SeqOf OPTIONAL}
AChoice ::= CHOICE {
a T-Bool,
b SeqOf
}
SeqBool ::= SEQUENCE(SIZE(1..5)) OF BOOLEAN
......
......@@ -10,80 +10,108 @@ dcl V3 SeqOf := { 'Hello', 'World!' };
dcl V4 SeqOf := { 'Hello', 'World' };
dcl fail t_bool := false;
-- Test optional field
dcl V5 Toto := { elem_1 'Hello' };
dcl V6 Toto := { elem_1 'Hello', elem_2 {'Hello', 'World'} };
dcl V7 AChoice := a: TRUE;
dcl V8 ACHoice := b: {'Hello', 'World!'};
/* CIF ENDTEXT */
/* CIF START (669, 95), (100, 50) */
/* CIF START (1262, 95), (100, 50) */
START;
/* CIF LABEL (684, 160), (70, 35) */
/* CIF LABEL (1277, 160), (70, 35) */
one:
/* CIF DECISION (670, 210), (98, 50) */
/* CIF DECISION (1263, 210), (98, 50) */
DECISION V1 = V2;
/* CIF ANSWER (587, 280), (73, 28) */
/* CIF ANSWER (1135, 280), (73, 28) */
(true):
/* CIF TASK (562, 323), (123, 35) */
/* CIF TASK (1110, 323), (123, 35) */
TASK fail := false;
/* CIF PROCEDURECALL (548, 373), (150, 38) */
/* CIF PROCEDURECALL (1097, 373), (150, 38) */
CALL writeln('2');
/* CIF LABEL (588, 426), (70, 35) */
/* CIF LABEL (1137, 426), (70, 35) */
two:
/* CIF DECISION (574, 476), (98, 50) */
/* CIF DECISION (1123, 476), (98, 50) */
DECISION V3 = V4;
/* CIF ANSWER (309, 546), (73, 28) */
/* CIF ANSWER (789, 546), (73, 28) */
(true):
/* CIF TASK (284, 589), (123, 35) */
/* CIF TASK (764, 589), (123, 35) */
TASK fail := false;
/* CIF PROCEDURECALL (270, 639), (150, 38) */
/* CIF PROCEDURECALL (750, 639), (150, 38) */
CALL writeln('4');
/* CIF ANSWER (707, 546), (78, 28) */
/* CIF LABEL (784, 692), (82, 35) */
three:
/* CIF DECISION (747, 742), (156, 95) */
DECISION V5 /= V6
and V7 /= V8;
/* CIF ANSWER (713, 857), (73, 28) */
(true):
/* CIF PROCEDURECALL (674, 900), (150, 38) */
CALL writeln('5');
/* CIF TASK (627, 953), (245, 68) */
TASK V5 := V6,
V7 := b: {'Hello', 'World'},
V8!b(1) := V7!b(1)(0 ,4);
/* CIF JOIN (732, 1036), (35, 35) */
JOIN three;
/* CIF ANSWER (918, 857), (78, 28) */
(false):
/* CIF PROCEDURECALL (882, 900), (150, 38) */
CALL writeln('6');
/* CIF NEXTSTATE (922, 953), (70, 35) */
NEXTSTATE wait;
ENDDECISION;
/* CIF ANSWER (1703, 546), (78, 28) */
(false):
/* CIF DECISION (707, 589), (78, 50) */
/* CIF DECISION (1703, 589), (78, 50) */
DECISION fail;
/* CIF ANSWER (664, 659), (73, 28) */
/* CIF ANSWER (1596, 659), (73, 28) */
(true):
/* CIF PROCEDURECALL (474, 702), (452, 38) */
/* CIF PROCEDURECALL (1406, 702), (452, 38) */
CALL writeln('FAIL: V3 = V4 reports FALSE, but...');
/* CIF PROCEDURECALL (431, 755), (539, 35) */
/* CIF PROCEDURECALL (1363, 755), (539, 35) */
CALL writeln('Length of V3(1) =', Length(V3(1)), ' and Value = ', V3(1));
/* CIF PROCEDURECALL (426, 805), (549, 35) */
/* CIF PROCEDURECALL (1358, 805), (549, 35) */
CALL writeln('Length of V4(1) =', Length(V4(1)), ' and Value = ', V4(1));
/* CIF NEXTSTATE (665, 855), (70, 35) */
/* CIF NEXTSTATE (1597, 855), (70, 35) */
NEXTSTATE wait;
/* CIF ANSWER (980, 659), (78, 28) */
/* CIF ANSWER (1976, 659), (78, 28) */
(false):
/* CIF PROCEDURECALL (1940, 702), (150, 38) */
CALL writeln('3');
/* CIF TASK (1917, 755), (196, 35) */
TASK V3(1) := V4(1)(0,4);
/* CIF TASK (1956, 805), (118, 35) */
TASK fail := true;
/* CIF JOIN (1997, 855), (35, 35) */
JOIN two;
ENDDECISION;
/* CIF PROCEDURECALL (671, 905), (150, 38) */
CALL writeln('3');
/* CIF TASK (648, 958), (196, 35) */
TASK V3(1) := V4(1)(0,4);
/* CIF TASK (687, 1008), (118, 35) */
TASK fail := true;
/* CIF JOIN (728, 1058), (35, 35) */
JOIN two;
ENDDECISION;
/* CIF NEXTSTATE (588, 1108), (70, 35) */
NEXTSTATE wait;
/* CIF ANSWER (1150, 280), (78, 28) */
/* CIF ANSWER (2205, 280), (78, 28) */
(false):
/* CIF DECISION (1150, 323), (78, 50) */
/* CIF DECISION (2205, 323), (78, 50) */
DECISION fail;
/* CIF ANSWER (1108, 393), (73, 28) */
/* CIF ANSWER (2163, 393), (73, 28) */
(true):
/* CIF PROCEDURECALL (1068, 436), (153, 38) */
/* CIF PROCEDURECALL (2123, 436), (153, 38) */
CALL writeln('FAIL');
/* CIF NEXTSTATE (1109, 489), (70, 35) */
/* CIF NEXTSTATE (2164, 489), (70, 35) */
NEXTSTATE wait;
/* CIF ANSWER (1268, 393), (78, 28) */
/* CIF ANSWER (2323, 393), (78, 28) */
(false):
/* CIF PROCEDURECALL (2287, 436), (150, 38) */
CALL writeln('1');
/* CIF TASK (2308, 489), (108, 35) */
TASK V2 := V1;
/* CIF TASK (2303, 539), (118, 35) */
TASK fail := true;
/* CIF JOIN (2344, 589), (35, 35) */
JOIN one;
ENDDECISION;
/* CIF PROCEDURECALL (1114, 539), (150, 38) */
CALL writeln('1');
/* CIF TASK (1135, 592), (108, 35) */
TASK V2 := V1;
/* CIF TASK (1130, 642), (118, 35) */
TASK fail := true;
/* CIF JOIN (1171, 692), (35, 35) */
JOIN one;
ENDDECISION;
/* CIF STATE (191, 549), (70, 35) */
/* CIF STATE (715, 549), (70, 35) */
STATE wait;
ENDSTATE;
ENDPROCESS og;
\ No newline at end of file
include ../shared.mk
all: test-ada test-llvm
edit:
$(OPENGEODE) function1.pr system_structure.pr
test-parse:
$(OPENGEODE) functin1.pr system_structure.pr --check
test-ada: function1.ali
test-llvm: function1.o
all:
gnatmake -d -P GPS_project.gpr mainprogram.adb --subdirs=debug -cargs -g -O0
touch builtWithoutCoverage
coverage:
coverage run -p $(OPENGEODE) function1.pr system_structure.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm coverage
if [ -f builtWithoutCoverage ] ; then make clean ; fi
gnatmake -d -P GPS_project.gpr mainprogram.adb --subdirs=debug -cargs -g -O0 -fprofile-arcs -ftest-coverage -largs -fprofile-arcs
cd bin/debug ; ./mainprogram
cd bin/debug ; gcov adaasn1rtl taste_dataview taste_basictypes
clean:
rm -f builtWithoutCoverage ;
gnat clean -r -P GPS_project.gpr --subdirs=debug
\ No newline at end of file
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