Commit 719c510a authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add test case using NULL and empty sequences

The parser does not parse these constructs properly but this demo shows
a workaround using constants defined in the ASN.1 model
parent ad5944fd
include ../shared.mk
all: test-ada test-llvm
edit:
$(OPENGEODE) og.pr
test-parse:
$(OPENGEODE) og.pr --check
test-ada:
$(OPENGEODE) og.pr --toAda
$(ASN1SCC) -Ada dataview.asn -typePrefix asn1Scc -equal
$(GNATMAKE) -O$(O) -c *.adb
$(GNATBIND) -n og.ali
test-c:
$(OPENGEODE) og.pr --toC
$(ASN1SCC) -c dataview.asn -typePrefix asn1Scc -equal
$(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
EmptySeq ::= SEQUENCE {}
NullType ::= NULL
ChoiceWithEmptySeq ::= CHOICE {
a NULL,
b EmptySeq,
c NullType
}
c1 EmptySeq ::= {}
n1 NullType ::= NULL
c2 ChoiceWithEmptySeq ::= a: NULL
c3 ChoiceWithEmptySeq ::= b: {}
c4 ChoiceWithEmptySeq ::= c: NULL
END
SYSTEM og;
/* CIF TEXT (159, 221), (287, 188) */
-- Text area for declarations and comments
use dv comment 'dataview.asn';
signal dd;
signal we;
/* 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), (331, 140) */
-- Test support for empty sequences and NULL type
dcl empty1 EmptySeq := c1;
dcl null1 NullType;
dcl choice1 ChoiceWithEmptySeq;
/* CIF ENDTEXT */
/* CIF START (155, 216), (70, 35) */
START;
/* CIF TASK (132, 266), (115, 35) */
TASK empty1 := c1;
/* CIF TASK (118, 316), (144, 35) */
TASK choice1 := b: c1;
/* CIF NEXTSTATE (155, 366), (70, 35) */
NEXTSTATE wait;
/* CIF STATE (296, 231), (70, 35) */
STATE wait;
/* CIF INPUT (289, 286), (84, 35) */
INPUT dd;
/* CIF OUTPUT (286, 336), (89, 35) */
OUTPUT we;
/* CIF NEXTSTATE (296, 386), (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