Commit 30dcfe80 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Added testcase to validate chaining of exit procedures

parent aeb3a618
all: test-ada test-llvm
edit:
../../../opengeode.py challenge.pr system_structure.pr
test-parse:
../../../opengeode.py challenge.pr system_structure.pr --check
test-ada:
../../../opengeode.py --toAda challenge.pr system_structure.pr
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c *.adb
gcc -c test_ada.c
gnatbind -n challenge.ali
gnatlink -o testcase test_ada.o challenge.ali -lgnat -lm
./testcase | diff expected -
test-llvm:
../../../opengeode.py challenge.pr system_structure.pr --check --llvm
asn1.exe -c dataview-uniq.asn -typePrefix asn1Scc -equal
llc challenge.ll
clang -c challenge.s
clang -c dataview-uniq.c
clang -c test_llvm.c
clang challenge.o dataview-uniq.o test_llvm.o -o testcase -lm
./testcase | diff expected -
coverage:
coverage run -p ../../../opengeode.py challenge.pr system_structure.pr --toAda
clean:
rm -rf *.adb *.ads *.pyc runSpark.sh spark.idx *.o *.ali gnat.cfg examiner \
bin *.wrn *.gpr testcase *.ll *.s dataview-uniq.c dataview-uniq.h real.c xer.c \
ber.c acn.c asn1crt.c asn1crt.h
/* CIF PROCESS (150, 150), (150, 75) */
PROCESS challenge;
STATE nested;
SUBSTRUCTURE
STATE nested_1;
SUBSTRUCTURE
/* CIF PROCEDURE (110, 183), (74, 35) */
PROCEDURE entry;
/* CIF START (105, 54), (70, 35) */
START;
/* CIF PROCEDURECALL (34, 104), (210, 35) */
CALL writeln('entering nested_1');
/* CIF RETURN (122, 154), (35, 35) */
RETURN ;
ENDPROCEDURE;
/* CIF PROCEDURE (104, 101), (70, 35) */
PROCEDURE exit;
/* CIF START (198, 116), (70, 35) */
START;
/* CIF PROCEDURECALL (142, 166), (181, 35) */
CALL writeln('exit nested_1');
/* CIF RETURN (215, 216), (35, 35) */
RETURN ;
ENDPROCEDURE;
/* CIF START (245, 55), (70, 35) */
START;
/* CIF NEXTSTATE (234, 105), (93, 35) */
NEXTSTATE nested_2;
/* CIF STATE (276, 165), (93, 35) */
STATE nested_2;
ENDSTATE;
ENDSUBSTRUCTURE;
/* CIF PROCEDURE (340, 134), (74, 35) */
PROCEDURE entry;
/* CIF START (121, 85), (70, 35) */
START;
/* CIF PROCEDURECALL (57, 135), (196, 35) */
CALL writeln('entering nested');
/* CIF RETURN (138, 185), (35, 35) */
RETURN ;
ENDPROCEDURE;
/* CIF PROCEDURE (334, 58), (70, 35) */
PROCEDURE exit;
/* CIF START (76, 53), (70, 35) */
START;
/* CIF PROCEDURECALL (27, 103), (167, 35) */
CALL writeln('exit nested');
/* CIF RETURN (93, 153), (35, 35) */
RETURN ;
ENDPROCEDURE;
/* CIF START (136, 68), (70, 35) */
START;
/* CIF NEXTSTATE (124, 118), (93, 35) */
NEXTSTATE nested_1;
/* CIF STATE (124, 118), (93, 35) */
STATE nested_1;
/* CIF INPUT (130, 173), (80, 35) */
INPUT go_off;
/* CIF RETURN (153, 223), (35, 35) */
RETURN ;
ENDSTATE;
ENDSUBSTRUCTURE;
/* CIF START (92, 76), (68, 37) */
START;
/* CIF NEXTSTATE (86, 128), (79, 35) */
NEXTSTATE nested;
/* CIF STATE (389, 131), (70, 35) */
STATE well;
ENDSTATE;
/* CIF STATE (86, 128), (79, 35) */
STATE nested;
/* CIF CONNECT (51, 183), (0, 35) */
CONNECT ;
/* CIF NEXTSTATE (12, 233), (78, 35) */
NEXTSTATE well;
/* CIF INPUT (145, 183), (70, 35) */
INPUT run;
/* CIF NEXTSTATE (145, 233), (70, 35) */
NEXTSTATE -;
ENDSTATE;
ENDPROCESS challenge;
\ No newline at end of file
TASTE-BasicTypes DEFINITIONS ::=
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
entering nested
entering nested_1
exit nested_1
exit nested
entering nested
entering nested_1
exit nested_1
exit nested
/* 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,
IN/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;
#include <math.h>
#include <stdio.h>
/* Ada code external interface */
extern void challenge_run();
extern void challenge_any_one();
extern int adainit();
//extern long long l_result;
/* Provide code called by the Ada state machine as external procedure */
void challenge_RI_pow(long long *a, long long *b, long long *res)
{
*res = (long long)pow((double)*a, (double)*b);
}
int main()
{
adainit();
challenge_run();
challenge_run();
//printf("Internal state: %lld\n", l_result);
challenge_any_one();
challenge_run();
return 0;
}
#include <math.h>
#include <stdio.h>
/* Ada code external interface */
extern void challenge_run();
extern void challenge_go_off();
extern int adainit();
//extern long long l_result;
/* Provide code called by the Ada state machine as external procedure */
void challenge_RI_pow(long long *a, long long *b, long long *res)
{
*res = (long long)pow((double)*a, (double)*b);
}
int main()
{
adainit();
challenge_run();
challenge_go_off();
return 0;
}
#include <math.h>
#include <stdio.h>
/* Ada code external interface */
extern void challenge_run();
extern void challenge_go_off();
extern int challenge_startup();
//extern long long l_result;
/* Provide code called by the Ada state machine as external procedure */
void challenge_RI_pow(long long *a, long long *b, long long *res)
{
*res = (long long)pow((double)*a, (double)*b);
}
int main()
{
challenge_startup();
challenge_run();
challenge_go_off();
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