Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenGEODE
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
TASTE
OpenGEODE
Commits
d0fe4b85
Commit
d0fe4b85
authored
Oct 04, 2020
by
Maxime Perrotin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test case
parent
db0741b8
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
459 additions
and
0 deletions
+459
-0
tests/testsuite/test-via/Makefile
tests/testsuite/test-via/Makefile
+49
-0
tests/testsuite/test-via/Makefile.challenge
tests/testsuite/test-via/Makefile.challenge
+6
-0
tests/testsuite/test-via/challenge.gpr
tests/testsuite/test-via/challenge.gpr
+16
-0
tests/testsuite/test-via/challenge.pr
tests/testsuite/test-via/challenge.pr
+255
-0
tests/testsuite/test-via/challenge.pr.ini
tests/testsuite/test-via/challenge.pr.ini
+3
-0
tests/testsuite/test-via/dataview-uniq.asn
tests/testsuite/test-via/dataview-uniq.asn
+39
-0
tests/testsuite/test-via/dataview_c.gpr
tests/testsuite/test-via/dataview_c.gpr
+16
-0
tests/testsuite/test-via/expected
tests/testsuite/test-via/expected
+18
-0
tests/testsuite/test-via/system_structure.pr
tests/testsuite/test-via/system_structure.pr
+32
-0
tests/testsuite/test6/myfunction_ri.ada
tests/testsuite/test6/myfunction_ri.ada
+25
-0
No files found.
tests/testsuite/test-via/Makefile
0 → 100644
View file @
d0fe4b85
include
../shared.mk
ROOT_MODEL
=
system_structure.pr
all
:
test-ada test-llvm
edit
:
$(OPENGEODE)
challenge.pr system_structure.pr
test-parse
:
$(OPENGEODE)
challenge.pr system_structure.pr
--check
test-qgen-parse
:
$(TESTQGEN_PARSE)
$(ROOT_MODEL)
test-qgen-ada
:
$(TESTQGEN_ADA)
$(ROOT_MODEL)
test-qgen-c
:
$(TESTQGEN_C)
$(ROOT_MODEL)
test-qgen-gt-ada
:
$(TESTQGEN_GT_ADA)
$(ROOT_MODEL)
test-qgen-gt-c
:
$(TESTQGEN_GT_C)
$(ROOT_MODEL)
test-ada
:
dataview-uniq.o | test_ada.o
cp
challenge_ri.ada challenge_ri.adb
$(OPENGEODE)
challenge.pr system_structure.pr
--toAda
mono
$(ASN1SCC)
-Ada
-typePrefix
asn1Scc
-equal
*
.asn
gnat make challenge
$(GNATBIND)
-n
challenge.ali
$(GNATLINK)
-o
test_ada test_ada.o challenge.ali
-lm
./test_ada | diff expected -
test-c
:
challenge.c test_c.o dataview-uniq.o
$(CC)
-include
missing.h challenge.c
-c
-o
challenge.o
$(CC)
test_c.o challenge.c dataview-uniq.o
-lm
-o
test_c
./test_c | diff expected -
test-llvm
:
challenge.o dataview-uniq.o | test_llvm.o
$(CC)
challenge.o dataview-uniq.o test_llvm.o
-o
test_llvm
-lm
./test_llvm| diff expected -
coverage
:
coverage run
-p
$(OPENGEODE)
challenge.pr system_structure.pr
--toAda
.PHONY
:
all edit test-parse test-ada test-llvm coverage
tests/testsuite/test-via/Makefile.challenge
0 → 100644
View file @
d0fe4b85
all
:
gprbuild
-p
-P
challenge.gpr
# generate Ada code from the SDL model
gprbuild
-p
-P
dataview_ada.gpr
# generate Ada code from the ASN.1 model
gprbuild
-p
-P
code/challenge_ada.gpr
# build the Ada code
clean
:
rm
-rf
obj code
\ No newline at end of file
tests/testsuite/test-via/challenge.gpr
0 → 100644
View file @
d0fe4b85
project
challenge
is
for
Languages
use
(
"SDL"
);
for
Source_Dirs
use
(
"."
);
for
Object_Dir
use
"code"
;
for
Source_Files
use
(
"challenge.pr"
);
package
Naming
is
for
Body_Suffix
(
"SDL"
)
use
".pr"
;
end
Naming
;
package
Compiler
is
for
Driver
(
"SDL"
)
use
"opengeode"
;
for
Object_File_Suffix
(
"SDL"
)
use
".adb"
;
for
Leading_Required_Switches
(
"SDL"
)
use
(
"--toAda"
);
end
Compiler
;
end
challenge
;
\ No newline at end of file
tests/testsuite/test-via/challenge.pr
0 → 100644
View file @
d0fe4b85
/* CIF PROCESS (150, 150), (150, 75) */
process challenge;
state on;
substructure
in (via_toto);
out (ret0);
state hello;
substructure
/* CIF procedure (892, 436), (73, 35) */
procedure entry;
/* CIF START (178, 136), (70, 35) */
START;
/* CIF PROCEDURECALL (160, 186), (106, 35) */
call writeln('8');
/* CIF PROCEDURECALL (145, 236), (136, 35) */
call writeln('Hello!');
/* CIF return (195, 286), (35, 35) */
return ;
endprocedure;
/* CIF START (349, 133), (70, 35) */
START;
/* CIF NEXTSTATE (312, 183), (144, 35) */
NEXTSTATE wait_in_sub_hello;
/* CIF state (582, 147), (144, 35) */
state wait_in_sub_hello;
endstate;
endsubstructure;
/* CIF TEXT (294, 251), (334, 95) */
dcl myresult T_UInt8 := 4;
-- Use a variable with the same name as a variable
-- in the outer scope, to check that code generators
-- use the proper one
dcl result T_UInt32 := 9;
/* CIF ENDTEXT */
/* CIF procedure (606, 54), (73, 35) */
procedure entry
/* CIF comment (695, 31), (190, 88) */
comment 'Special Entry
procedure - called
automatically upon
entrance to the nested
state';
/* CIF START (191, 78), (70, 35) */
START;
/* CIF PROCEDURECALL (100, 128), (251, 35) */
call writeln('ENTERING NESTED STATE');
/* CIF return (208, 178), (35, 35) */
return ;
endprocedure;
/* CIF procedure (291, 522), (102, 35) */
procedure inner_proc;
/* CIF TEXT (31, 41), (364, 93) */
fpar in toto T_UInt8;
-- Redefine a variable declared in outer scope
dcl result t_Boolean := true;
/* CIF ENDTEXT */
/* CIF START (479, 97), (70, 35) */
START;
/* CIF label (471, 147), (86, 35) */
hey_joe:
/* CIF PROCEDURECALL (457, 197), (113, 35) */
call writeln('10');
/* CIF task (453, 247), (121, 35) */
task result := false;
/* CIF label (473, 297), (82, 35) */
leaving:
/* CIF return (496, 347), (35, 35) */
return ;
endprocedure;
/* CIF procedure (610, 143), (70, 33) */
procedure exit
/* CIF comment (700, 118), (157, 93) */
comment 'Special exit
procedure - called
automatically when
leaving the nested
state';
/* CIF START (163, 119), (70, 35) */
START;
/* CIF PROCEDURECALL (68, 169), (259, 35) */
call writeln('LEAVING the nested state');
/* CIF return (180, 219), (35, 35) */
return ;
endprocedure;
/* CIF START (1240, 7), (89, 35) */
START via_toto ;
/* CIF PROCEDURECALL (1232, 57), (106, 35) */
call writeln('3');
/* CIF return (1267, 107), (35, 35) */
return ret0;
/* CIF START (990, 8), (70, 35) */
START;
/* CIF PROCEDURECALL (972, 58), (106, 35) */
call writeln('7');
/* CIF label (970, 108), (111, 35) */
inside_label:
/* CIF PROCEDURECALL (957, 158), (137, 35) */
call pow(3,3, result);
/* CIF decision (988, 208), (74, 50) */
decision result;
/* CIF ANSWER (913, 278), (92, 24) */
(myresult):
/* CIF ANSWER (1037, 278), (70, 24) */
ELSE:
/* CIF task (1015, 318), (115, 35) */
task myresult := 5;
enddecision;
/* CIF label (981, 369), (88, 35) */
nslabel:
/* CIF NEXTSTATE (990, 419), (70, 35) */
NEXTSTATE hello;
/* CIF label (564, 472), (141, 35) */
connection another_floating:
/* CIF PROCEDURECALL (578, 522), (113, 35) */
call writeln('9');
/* CIF task (577, 572), (115, 35) */
task myresult := 1;
/* CIF PROCEDURECALL (553, 622), (164, 35) */
call inner_proc(myresult);
/* CIF return (617, 672), (35, 35) */
return ;
/* CIF End Label */
endconnection;
/* CIF label (184, 324), (90, 35) */
connection to_label:
/* CIF join (212, 374), (35, 35) */
join another_floating;
/* CIF End Label */
endconnection;
/* CIF state (52, 0), (70, 35) */
state hello;
/* CIF input (52, 61), (70, 35) */
input run;
/* CIF PROCEDURECALL (0, 111), (175, 35) */
call writeln('27 == ', result);
/* CIF PROCEDURECALL (52, 161), (70, 35) */
call toto;
/* CIF task (25, 211), (125, 53) */
task myresult := 88,
result := 33;
/* CIF join (70, 279), (35, 35) */
join to_label;
endstate;
endsubstructure;
/* CIF TEXT (506, 0), (298, 56) */
-- This system tests nested states
dcl result T_uint32 :=0;
/* CIF ENDTEXT */
/* CIF procedure (24, 247), (66, 35) */
procedure toto;
/* CIF TEXT (371, 134), (298, 140) */
-- Declare your variables
-- Syntax: DCL <variable name> <type name>;
dcl i T_Int8 := 1;
/* CIF ENDTEXT */
/* CIF START (178, 86), (70, 35) */
START;
/* CIF decision (178, 136), (70, 50) */
decision i;
/* CIF ANSWER (131, 206), (73, 24) */
(1):
/* CIF task (96, 246), (143, 35) */
task i := (i + 1) mod 127;
/* CIF return (150, 296), (35, 35) */
return ;
/* CIF ANSWER (249, 206), (70, 24) */
ELSE:
/* CIF PROCEDURECALL (249, 246), (70, 35) */
call foo;
/* CIF return (266, 296), (35, 35) */
return ;
enddecision;
endprocedure;
/* CIF procedure (19, 183), (70, 35) */
procedure foo;
/* CIF START (190, 53), (70, 35) */
START;
/* CIF return (207, 103), (35, 35) */
return ;
endprocedure;
/* CIF START (526, 99), (68, 37) */
START;
/* CIF PROCEDURECALL (507, 151), (106, 35) */
call writeln('1');
/* CIF NEXTSTATE (525, 201), (70, 35) */
NEXTSTATE OFF;
/* CIF state (496, 356), (132, 35) */
state on via via_toto
/* CIF comment (694, 369), (219, 33) */
comment 'Enter substate via entry point';
/* CIF connect (527, 411), (70, 35) */
connect ;
/* CIF NEXTSTATE (527, 466), (70, 35) */
NEXTSTATE OFF;
endstate;
/* CIF state (525, 201), (70, 35) */
state OFF;
/* CIF input (527, 256), (70, 35) */
input run;
/* CIF PROCEDURECALL (509, 306), (106, 35) */
call writeln('2');
/* CIF NEXTSTATE (496, 356), (132, 35) */
NEXTSTATE on via via_toto
/* CIF comment (694, 369), (219, 33) */
comment 'Enter substate via entry point';
endstate;
/* CIF state (1000, 72), (65, 35) */
state on;
/* CIF input (1192, 127), (88, 35) */
input any_one;
/* CIF NEXTSTATE (1180, 177), (113, 35) */
NEXTSTATE -;
/* CIF input (1302, 127), (78, 35) */
input go_off;
/* CIF NEXTSTATE (1310, 177), (62, 35) */
NEXTSTATE OFF;
/* CIF connect (1033, 127), (0, 35) */
connect ret0;
/* CIF PROCEDURECALL (980, 177), (106, 35) */
call writeln('4');
/* CIF NEXTSTATE (1000, 227), (67, 35) */
NEXTSTATE Safe;
/* CIF connect (717, 127), (0, 35) */
connect ;
/* CIF PROCEDURECALL (644, 177), (147, 35) */
call writeln('11 (end)');
/* CIF PROCEDURECALL (682, 227), (70, 35) */
call toto;
/* CIF NEXTSTATE (682, 277), (70, 35) */
NEXTSTATE off;
endstate;
/* CIF state (156, 285), (73, 35) */
state Safe;
/* CIF input (101, 340), (70, 35) */
input *;
/* CIF PROCEDURECALL (83, 390), (106, 35) */
call writeln('5');
/* CIF PROCEDURECALL (71, 440), (130, 35) */
call pow(2,2, result);
/* CIF PROCEDURECALL (52, 490), (168, 35) */
call writeln('4 == ', result);
/* CIF NEXTSTATE (101, 540), (70, 35) */
NEXTSTATE -;
/* CIF input (296, 340), (88, 35) */
input any_one;
/* CIF PROCEDURECALL (283, 390), (113, 35) */
call writeln('6');
/* CIF NEXTSTATE (305, 440), (70, 35) */
NEXTSTATE on;
endstate;
endprocess challenge;
\ No newline at end of file
tests/testsuite/test-via/challenge.pr.ini
0 → 100644
View file @
d0fe4b85
[General]
geometry
=
@ByteArray(
\x
1
\x
d9
\x
d0
\x
cb
\0\x
2
\0\0\0\0\0
Y
\0\0\0\0\0\0\x
4Q
\0\0\x
3
\x
5
\0\0\0\\\0\0\0\x
1d
\0\0\x
4N
\0\0\x
3
\x
2
\0\0\0\0\0\0\0\0\a\x
80)
windowState
=
@ByteArray(
\0\0\0\x
ff
\0\0\0\0\x
fd
\0\0\0\x
2
\0\0\0\x
1
\0\0\x
1
\x
12
\0\0\x
1
\x
fb
\x
fc
\x
2
\0\0\0\x
1
\x
fc
\0\0\0
<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
BEGIN
-- Set of TASTE predefined basic types
T-Int32 ::= INTEGER (-2147483648 .. 2147483647)
T-UInt32 ::= INTEGER (0 .. 4294967295)
T-Int8 ::= INTEGER (-128 .. 127)
T-UInt8 ::= INTEGER (0 .. 255)
T-Boolean ::= BOOLEAN
BitString ::= BIT STRING (SIZE(32))
OctString ::= OCTET STRING (SIZE(4))
SeqBit ::= SEQUENCE (SIZE(32)) OF BOOLEAN
SeqBit2 ::= SEQUENCE (SIZE(1..32)) OF BOOLEAN
END
TASTE-Dataview DEFINITIONS ::=
BEGIN
IMPORTS T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean FROM TASTE-BasicTypes;
-- A few simple types to start with ASN.1
challenge T-UInt32 ::= 18
bound T-UInt32 ::= 1000000
nb-bit T-UInt32 ::= 20
val-max T-UInt32 ::= 1048575
count-max T-UInt32 ::= 524288
exceed-nb T-UInt32 ::= 48575
CountTab ::= SEQUENCE (SIZE(nb-bit)) OF T-UInt32
END
tests/testsuite/test-via/dataview_c.gpr
0 → 100644
View file @
d0fe4b85
project
DataView_c
is
for
Languages
use
(
"ASN1"
);
for
Source_Dirs
use
(
"."
);
for
Source_Files
use
(
"dataview-uniq.asn"
);
for
Object_Dir
use
"code"
;
package
Naming
is
for
Body_Suffix
(
"ASN1"
)
use
".asn"
;
end
Naming
;
package
Compiler
is
for
Driver
(
"ASN1"
)
use
"asn1.exe"
;
for
Leading_Required_Switches
(
"ASN1"
)
use
(
"-c"
,
"-typePrefix"
,
"Asn1Scc"
);
end
Compiler
;
end
DataView_c
;
\ No newline at end of file
tests/testsuite/test-via/expected
0 → 100644
View file @
d0fe4b85
1
2
ENTERING NESTED STATE
3
LEAVING the nested state
4
5
4 == 4
6
ENTERING NESTED STATE
7
8
Hello!
27 == 27
9
10
LEAVING the nested state
11 (end)
tests/testsuite/test-via/system_structure.pr
0 → 100644
View file @
d0fe4b85
/* CIF Keep Specific Geode ASNFilename 'dataview-uniq.asn' */
USE Datamodel;
SYSTEM challenge;
PROCEDURE pow COMMENT '#c_predef';
FPAR
IN a T_UInt32,
IN b T_UInt32,
OUT res T_UInt32;
EXTERNAL;
SIGNAL run;
SIGNAL go_off;
SIGNAL any_one;
signal any_two;
CHANNEL c
FROM ENV TO challenge WITH run, go_off, any_one, any_two;
ENDCHANNEL;
BLOCK challenge;
SIGNALROUTE r
FROM ENV TO challenge WITH run, go_off, any_one, any_two;
CONNECT c and r;
PROCESS challenge REFERENCED;
ENDBLOCK;
ENDSYSTEM;
tests/testsuite/test6/myfunction_ri.ada
0 → 100644
View file @
d0fe4b85
-- Stub generated by OpenGEODE.
-- You can edit this file, it will not be overwritten
package
body
myfunction_RI
is
procedure
result_data
(
titi
:
in
out
asn1SccT_Int32
)
is
procedure
Result_Data
(
Titi
:
in
out
asn1SccT_Int32
)
with
Import
,
Convention
=>
C
,
Link_Name
=>
"myfunction_RI_result_data"
;
begin
Result_Data
(
Titi
);
end
Result_Data
;
procedure
SET_myTimer
(
Val
:
in
out
asn1SccT_UInt32
)
is
procedure
SET_myTimer
(
Val
:
in
out
asn1SccT_UInt32
)
with
Import
,
Convention
=>
C
,
Link_Name
=>
"myfunction_RI_SET_myTimer"
;
begin
Set_myTimer
(
Val
);
end
Set_myTimer
;
procedure
RESET_myTimer
is
procedure
RESET_myTimer
with
Import
,
Convention
=>
C
,
Link_Name
=>
"myfunction_RI_RESET_myTimer"
;
begin
RESET_myTimer
;
end
RESET_myTimer
;
end
myfunction_RI
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment