Commit 42e7d7e5 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add test case related to variable shadowing

parent b92a1142
include ../shared.mk
all: test-ada test-llvm
edit:
$(OPENGEODE) og.pr
test-parse:
$(OPENGEODE) og.pr --check
test-ada:
$(OPENGEODE) og.pr --toAda
mono $(ASN1SCC) -Ada -typePrefix asn1Scc -equal dataview-uniq.asn
$(GNATMAKE) -O$(O) -c *.adb
$(GNATBIND) -n og.ali
test-c:
$(OPENGEODE) og.pr --toC
mono $(ASN1SCC) -c -typePrefix asn1Scc -equal dataview-uniq.asn
$(CC) -O$(O) -c *.c
test-llvm:
$(OPENGEODE) og.pr --llvm -O$(O)
$(LLC) *.ll
$(CC) -O$(O) -c *.s
coverage:
coverage run -p $(OPENGEODE) og.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm coverage
TASTE-Dataview DEFINITIONS ::=
BEGIN
MyChoice ::= CHOICE {
a CHOICE {
b CHOICE {
c BOOLEAN,
d BOOLEAN
},
e BOOLEAN
},
f BOOLEAN
}
Some-Thing ::= MyInteger
MyInteger ::= INTEGER (0..255)
My-OctStr ::= OCTET STRING (SIZE (0..20))
SeqOf ::= SEQUENCE (SIZE(0..100)) OF MyInteger
Type1 ::= INTEGER(0..1)
Type2 ::= BOOLEAN
Toto ::= SEQUENCE { elem-1 Type1, elem-2 Type2 }
SeqBool ::= SEQUENCE(SIZE(1..5)) OF BOOLEAN
Enum ::= ENUMERATED {enum1}
default-seqof SeqOf ::= {4,7,9}
default-str My-OctStr ::= 'DEADBEEF'H
END
SYSTEM og;
/* CIF TEXT (159, 221), (287, 188) */
-- Text area for declarations and comments
use dv comment 'dataview-uniq.asn';
--use dv2 comment 'dataview2.asn';
signal dd(Type2);
signal we(Some_Thing);
procedure hehe;
fpar in/out a_param Type2;
external;
/* CIF ENDTEXT */
CHANNEL c
FROM ENV TO og WITH dd;
FROM og TO ENV WITH we;
ENDCHANNEL;
BLOCK og;
SIGNALROUTE r
FROM ENV TO og WITH dd;
FROM og TO ENV WITH we;
CONNECT c AND r;
/* CIF PROCESS (225, 49), (150, 75) */
PROCESS og;
/* CIF TEXT (57, 58), (287, 140) */
-- Text area for declarations and comments
dcl haha SeqOf;
dcl hihi type2;
dcl test Some_Thing := 4;
/* CIF ENDTEXT */
/* CIF PROCEDURE (404, 228), (73, 35) */
PROCEDURE aProc;
/* CIF TEXT (542, 127), (287, 140) */
dcl tmp Some_Thing := 1;
/* CIF ENDTEXT */
/* CIF START (164, 113), (70, 35) */
START;
/* CIF OUTPUT (154, 163), (89, 35) */
OUTPUT we(test);
/* CIF OUTPUT (155, 213), (88, 35) */
OUTPUT we(tmp)
/* CIF COMMENT (263, 213), (269, 35) */
COMMENT 'check that local variables can be sent';
/* CIF RETURN (181, 263), (35, 35) */
RETURN ;
ENDPROCEDURE;
/* CIF PROCEDURE (439, 309), (70, 35) */
PROCEDURE haha
/* CIF COMMENT (529, 309), (184, 35) */
COMMENT 'same name as a variable';
ENDPROCEDURE;
/* CIF PROCEDURE (414, 353), (124, 35) */
PROCEDURE default_seqof
/* CIF COMMENT (558, 353), (189, 35) */
COMMENT 'same name as a constant';
ENDPROCEDURE;
/* CIF PROCEDURE (430, 404), (78, 35) */
PROCEDURE enum1
/* CIF COMMENT (528, 404), (206, 35) */
COMMENT 'same name as an enum item';
ENDPROCEDURE;
/* CIF START (155, 216), (70, 35) */
START;
/* CIF NEXTSTATE (155, 266), (70, 35) */
NEXTSTATE wait;
/* CIF STATE (296, 231), (70, 35) */
STATE wait;
/* CIF INPUT (289, 286), (84, 35) */
INPUT dd(hihi);
/* CIF PROCEDURECALL (281, 336), (100, 35) */
CALL hehe(hihi);
/* CIF OUTPUT (286, 386), (89, 35) */
OUTPUT we(test);
/* CIF PROCEDURECALL (296, 436), (70, 35) */
CALL haha;
/* CIF PROCEDURECALL (269, 486), (124, 35) */
CALL default_seqof;
/* CIF PROCEDURECALL (292, 536), (78, 35) */
CALL enum1;
/* CIF NEXTSTATE (296, 586), (70, 35) */
NEXTSTATE wait;
ENDSTATE;
ENDPROCESS og;
ENDBLOCK;
ENDSYSTEM;
\ 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