Commit 4e0b052c authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add test case with ASN.1 constants

parent 91b5d0a3
include ../shared.mk
all: test-ada test-llvm
edit:
$(OPENGEODE) orchestrator.pr system_structure.pr
test-parse:
$(OPENGEODE) orchestrator.pr system_structure.pr --check
test-ada: orchestrator.ali dataview-uniq.o | test_ada.o
$(GNATBIND) -n orchestrator.ali
$(GNATLINK) -o test_ada test_ada.o orchestrator.ali -lgnat
./test_ada
test-c: orchestrator.c test_c.o dataview-uniq.o
$(CC) -include missing.h orchestrator.c -c -o orchestrator.o
$(CC) test_c.o dataview-uniq.o orchestrator.o -lm -o test_c
./test_c | diff expected -
test-llvm: orchestrator.o
test-python:
$(OPENGEODE) orchestrator.pr system_structure.pr --shared
$(ASN1SCC) -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
$(GNATMAKE) -O$(O) -gnat2012 -c *.adb
$(GNATBIND) -n -Lliborchestrator orchestrator
$(GNATMAKE) -c -gnat2012 b~orchestrator.adb
$(CC) -shared -fPIC -o liborchestrator.so b~orchestrator.o orchestrator.o taste_basictypes.o adaasn1rtl.o -lgnat
python -c "from ctypes import *; test=CDLL('./liborchestrator.so'); test.liborchestratorinit()"
test-vhdl : test-c
bambu orchestrator.c test_c.c --experimental-setup=BAMBU
coverage:
coverage run -p $(OPENGEODE) orchestrator.pr system_structure.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm coverage
TASTE-BasicTypes DEFINITIONS ::=
BEGIN
MyBoolean ::= BOOLEAN
TASTE-Peek-id ::= INTEGER (0..4294967295)
TASTE-Peek-id-list ::= SEQUENCE (SIZE (1..10)) OF TASTE-Peek-id
VariableString ::= OCTET STRING (SIZE (1..10))
FixedString ::= OCTET STRING (SIZE (5))
SeqBool ::= SEQUENCE (SIZE(1..5)) OF BOOLEAN
SeqBoolFix ::= SEQUENCE (SIZE(2)) OF BOOLEAN
SeqEnum ::= SEQUENCE (SIZE(1..5)) OF ENUMERATED { hello2, world2 }
SeqEnumFix ::= SEQUENCE (SIZE(2)) OF ENUMERATED { hello, world }
MyEnum ::= ENUMERATED {a, b, c, d, eE}
MyChoice ::= CHOICE {c1 BOOLEAN, cDe2 BOOLEAN}
SeqOpt ::= SEQUENCE { a BOOLEAN OPTIONAL , b BOOLEAN, c SEQUENCE { a BOOLEAN } OPTIONAL, d OCTET STRING (SIZE (0..10)) OPTIONAL}
SeqNonOpt ::= SEQUENCE { a BOOLEAN }
NamedInt ::= INTEGER { one(1), two(2) } (1..2)
Enum-with-dash ::= ENUMERATED { first-one, second-one }
NamedInt-with-dash ::= INTEGER { first-value(0), second-value(3) } ( 0 | 3 )
myOne NamedInt ::= one
myBool MyBoolean ::= TRUE
myInt TASTE-Peek-id ::= 5
myString VariableString ::= 'DEADBEEF'H
mySeqBool SeqBool ::= { TRUE, FALSE }
myEnum MyEnum ::= eE
myCh MyChoice ::= c1: TRUE
mySeq SeqNonOpt ::= { a TRUE }
END
/* CIF PROCESS (295, 56), (150, 75) */
PROCESS orchestrator
/* CIF COMMENT (405, 192), (71, 35) */
COMMENT 'Hello';
/* CIF TEXT (649, 323), (294, 140) */
-- Text area for declarations and comments
dcl toto NamedInt := one;
dcl tutu Enum_with_dash := first_one;
dcl titi NamedInt_with_dash := second_value;
/* CIF ENDTEXT */
/* CIF START (530, 150), (80, 36) */
START;
/* CIF NEXTSTATE (512, 201), (116, 33) */
NEXTSTATE Wait_for_GUI;
/* CIF STATE (1063, 119), (116, 33) */
STATE Wait_for_GUI;
ENDSTATE;
/* CIF STATE (512, 201), (116, 33) */
STATE Wait_for_GUI;
/* CIF INPUT (529, 254), (82, 35) */
INPUT pulse(titi);
/* CIF PROCEDURECALL (522, 309), (96, 35) */
CALL writeln(titi);
/* CIF OUTPUT (508, 359), (123, 35) */
OUTPUT telemetry(tutu);
/* CIF TASK (501, 414), (138, 35) */
TASK tutu := second_one;
/* CIF NEXTSTATE (535, 464), (70, 35) */
NEXTSTATE -;
ENDSTATE;
ENDPROCESS orchestrator;
\ No newline at end of file
/* CIF Keep Specific Geode ASNFilename 'dataview-uniq.asn' */
USE Datamodel;
SYSTEM orchestrator;
SIGNAL pulse(namedint_with_dash);
SIGNAL telemetry(enum_with_dash);
CHANNEL c
FROM ENV TO orchestrator WITH pulse;
FROM orchestrator TO ENV WITH telemetry;
ENDCHANNEL;
BLOCK orchestrator;
SIGNALROUTE r
FROM ENV TO orchestrator WITH pulse;
FROM orchestrator TO ENV WITH telemetry;
CONNECT c and r;
PROCESS orchestrator REFERENCED;
ENDBLOCK;
ENDSYSTEM;
#include <math.h>
#include <stdio.h>
#include "dataview-uniq.h"
extern void adainit();
void orchestrator_RI_telemetry(void *_){}
void orchestrator_RI_S_SET_GNC_LV_SIM_CONTEXT_FOR_NEXT_MAJOR_CYCLE(void *_){}
void orchestrator_RI_Scheduler(void *_){}
void orchestrator_RI_VESAT_Simulation_Step(void *_){}
void orchestrator_RI_plot(void *_) {}
void orchestrator_RI_S_JUMP_TO_NEXT_MAJOR_CYCLE() {}
void orchestrator_RI_S_GET_GNC_LV_SIM_INPUTS_FOR_NEXT_MAJOR_CYCLE(void *_){}
int main()
{
printf("[C Code] Running test\n");
adainit();
return 0;
}
Supports Markdown
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