Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
ad11aa98
Commit
ad11aa98
authored
Jul 02, 2014
by
Maxime Perrotin
Browse files
Test shortcircuit operator (test6)
parent
994c2754
Changes
4
Hide whitespace changes
Inline
Side-by-side
tests/regression/test6/Makefile
View file @
ad11aa98
...
@@ -7,6 +7,11 @@ test-ada:
...
@@ -7,6 +7,11 @@ test-ada:
../../../opengeode.py
--toAda
myfunction.pr system_structure.pr
../../../opengeode.py
--toAda
myfunction.pr system_structure.pr
asn1.exe
-Ada
dataview-uniq.asn
-typePrefix
asn1Scc
-equal
asn1.exe
-Ada
dataview-uniq.asn
-typePrefix
asn1Scc
-equal
gnatmake
-c
myfunction.adb
gnatmake
-c
myfunction.adb
gcc
-c
test.c
gnatbind
-n
myfunction.ali
gnatlink
-o
testcase test.o myfunction.ali
-lgnat
./testcase
./testcase | diff expected -
coverage
:
coverage
:
coverage run
-p
../../../opengeode.py myfunction.pr system_structure.pr
--toAda
coverage run
-p
../../../opengeode.py myfunction.pr system_structure.pr
--toAda
...
...
tests/regression/test6/expected
0 → 100644
View file @
ad11aa98
[C Code] Running test
OK
tests/regression/test6/myfunction.pr
View file @
ad11aa98
...
@@ -22,7 +22,7 @@ dcl someInt t_uInt8 := 2;
...
@@ -22,7 +22,7 @@ dcl someInt t_uInt8 := 2;
-- To test 'op_not'
-- To test 'op_not'
dcl opnot T_boolean := not true;
dcl opnot T_boolean := not true;
/* CIF ENDTEXT */
/* CIF ENDTEXT */
/* CIF PROCEDURE (
891
, 490), (91, 35) */
/* CIF PROCEDURE (
982
, 490), (91, 35) */
PROCEDURE factorial;
PROCEDURE factorial;
/* CIF TEXT (29, 42), (215, 48) */
/* CIF TEXT (29, 42), (215, 48) */
fpar in N MyInteger,
fpar in N MyInteger,
...
@@ -41,52 +41,61 @@ endfor;
...
@@ -41,52 +41,61 @@ endfor;
ENDPROCEDURE;
ENDPROCEDURE;
/* CIF START (591, 0), (100, 50) */
/* CIF START (591, 0), (100, 50) */
START;
START;
/* CIF DECISION (516, 65), (250, 50) */
/* CIF TASK (586, 65), (110, 35) */
DECISION someint = 5 and then somereal=1.1
TASK someInt := 0;
or else someint = 6;
/* CIF DECISION (504, 115), (273, 87) */
/* CIF ANSWER (561, 135), (70, 23) */
DECISION someint /=0 and then (10 / someInt > 0)
or else someint = 0
/* CIF COMMENT (793, 124), (179, 68) */
COMMENT 'Using "and else" is the
short-circuit form. The
second part should not
be evaluated.';
/* CIF ANSWER (561, 222), (70, 23) */
(true):
(true):
/* CIF ANSWER (651, 135), (70, 23) */
/* CIF TASK (541, 260), (110, 35) */
TASK someInt := 5;
/* CIF PROCEDURECALL (537, 310), (117, 38) */
CALL writeln('OK');
/* CIF ANSWER (664, 222), (70, 23) */
(false):
(false):
ENDDECISION;
ENDDECISION;
/* CIF NEXTSTATE (591,
18
3), (100, 50) */
/* CIF NEXTSTATE (591,
36
3), (100, 50) */
NEXTSTATE Wait;
NEXTSTATE Wait;
/* CIF STATE (591,
18
3), (100, 50) */
/* CIF STATE (591,
36
3), (100, 50) */
STATE Wait;
STATE Wait;
/* CIF INPUT (810,
25
3), (100, 50) */
/* CIF INPUT (810,
43
3), (100, 50) */
INPUT mytimer;
INPUT mytimer;
/* CIF PROCEDURECALL (792, 318), (135, 50) */
/* CIF PROCEDURECALL (769, 498), (182, 50) */
CALL writeln
CALL writeln('timer expired');
('timer expired');
/* CIF PROCEDURECALL (780, 563), (160, 35) */
/* CIF PROCEDURECALL (780, 383), (160, 35) */
CALL factorial(3, someint);
CALL factorial(3, someint);
/* CIF NEXTSTATE (810,
43
3), (100, 50) */
/* CIF NEXTSTATE (810,
61
3), (100, 50) */
NEXTSTATE Wait;
NEXTSTATE Wait;
/* CIF INPUT (450,
25
3), (198, 50) */
/* CIF INPUT (450,
43
3), (198, 50) */
INPUT start_something (toto);
INPUT start_something (toto);
/* CIF OUTPUT (414,
31
8), (270, 50) */
/* CIF OUTPUT (414,
49
8), (270, 50) */
OUTPUT result_data((toto+1) mod 2147483647);
OUTPUT result_data((toto+1) mod 2147483647);
/* CIF PROCEDURECALL (474,
38
3), (150, 50) */
/* CIF PROCEDURECALL (474,
56
3), (150, 50) */
CALL writeln
CALL writeln
('Hello Toto', toto);
('Hello Toto', toto);
/* CIF PROCEDURECALL (483, 448), (132, 50) */
/* CIF PROCEDURECALL (451, 628), (196, 50) */
CALL set_timer
CALL set_timer(1000, myTimer);
(1000, myTimer);
/* CIF TASK (391, 693), (316, 35) */
/* CIF TASK (391, 513), (316, 35) */
TASK someReal := power(someReal, someInt mod 1);
TASK someReal := power(someReal, someInt mod 1);
/* CIF PROCEDURECALL (379,
56
3), (340, 35) */
/* CIF PROCEDURECALL (379,
74
3), (340, 35) */
CALL writeln('1.5 ** 2 == ', someReal, ' (should be 2.25 )');
CALL writeln('1.5 ** 2 == ', someReal, ' (should be 2.25 )');
/* CIF TASK (448,
61
3), (201, 35) */
/* CIF TASK (448,
79
3), (201, 35) */
TASK someReal := float(someInt);
TASK someReal := float(someInt);
/* CIF TASK (428,
66
3), (241, 35) */
/* CIF TASK (428,
84
3), (241, 35) */
TASK someInt := fix(someReal) mod 255;
TASK someInt := fix(someReal) mod 255;
/* CIF TASK (473,
71
3), (152, 35) */
/* CIF TASK (473,
89
3), (152, 35) */
TASK opnot := not opnot;
TASK opnot := not opnot;
/* CIF TASK (470,
76
3), (157, 35) */
/* CIF TASK (470,
94
3), (157, 35) */
TASK someint := -someint;
TASK someint := -someint;
/* CIF TASK (467,
81
3), (164, 35) */
/* CIF TASK (467,
99
3), (164, 35) */
TASK someint := (-8) mod 5;
TASK someint := (-8) mod 5;
/* CIF NEXTSTATE (498,
86
3), (102, 50) */
/* CIF NEXTSTATE (498,
104
3), (102, 50) */
NEXTSTATE wait;
NEXTSTATE wait;
ENDSTATE;
ENDSTATE;
ENDPROCESS myfunction;
ENDPROCESS myfunction;
\ No newline at end of file
tests/regression/test6/test.c
0 → 100644
View file @
ad11aa98
#include <math.h>
#include <stdio.h>
extern
void
adainit
();
void
myfunction_RI_result_data
(
long
long
*
val
)
{
printf
(
"[C] result_data: %lld
\n
"
,
*
val
);
}
void
myfunction_RI_set_mytimer
(
long
long
*
val
)
{
printf
(
"[C] SET MyTimer: %lld
\n
"
,
*
val
);
}
void
myfunction_RI_reset_mytimer
()
{
printf
(
"RESET MyTimer
\n
"
);
}
int
main
()
{
printf
(
"[C Code] Running test
\n
"
);
adainit
();
return
0
;
}
Write
Preview
Supports
Markdown
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