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

Fix tests that were using NULL construct

parent 14eff4f2
...@@ -823,6 +823,20 @@ package {process_name} is'''.format(process_name=process_name, ...@@ -823,6 +823,20 @@ package {process_name} is'''.format(process_name=process_name,
ads_template.append( ads_template.append(
u'pragma import(C, Check_Queue, "{proc}_check_queue");' u'pragma import(C, Check_Queue, "{proc}_check_queue");'
.format(proc=process_name)) .format(proc=process_name))
elif process.cs_mapping and simu:
taste_template.append('if {}.initDone then'.format(LPREFIX))
taste_template.append("Check_Queue(msgPending'access);")
taste_template.append('end if;')
# simulation: create a callback registration function
ads_template.append(u'type Check_Queue_T is access procedure'
u'(res: access Asn1Boolean);')
ads_template.append(u'pragma Convention(Convention => C,'
u' Entity => Check_Queue_T);')
ads_template.append(u'Check_Queue : Check_Queue_T;')
ads_template.append(u'procedure Register_Check_Queue'
u'(Callback: Check_Queue_T);')
ads_template.append(u'pragma Export(C, Register_Check_Queue,'
' "register_check_queue");')
else: else:
taste_template.append('null;') taste_template.append('null;')
......
...@@ -18,35 +18,35 @@ signal we; ...@@ -18,35 +18,35 @@ signal we;
CONNECT c AND r; CONNECT c AND r;
/* CIF PROCESS (225, 50), (150, 75) */ /* CIF PROCESS (225, 50), (150, 75) */
PROCESS og; PROCESS og;
/* CIF TEXT (56, 58), (337, 130) */ /* CIF TEXT (70, 60), (337, 130) */
-- Test choice assignments and access -- Test choice assignments and access
dcl ch ChoiceWithEmptySeq := a: NULL; dcl ch ChoiceWithEmptySeq;
dcl em EmptySeq := {}; dcl em EmptySeq := {};
dcl eso SeqOf := {}; dcl eso SeqOf := {};
/* CIF ENDTEXT */ /* CIF ENDTEXT */
/* CIF START (160, 226), (70, 35) */ /* CIF START (174, 228), (70, 35) */
START; START;
/* CIF TASK (146, 276), (98, 35) */ /* CIF TASK (160, 278), (98, 35) */
TASK ch := b: {}; TASK ch := b: {};
/* CIF TASK (152, 326), (85, 35) */ /* CIF TASK (166, 328), (85, 35) */
TASK eso := {}; TASK eso := {};
/* CIF TASK (142, 376), (106, 35) */ /* CIF TASK (156, 378), (106, 35) */
TASK em := ch!b TASK em := ch!b
/* CIF COMMENT (264, 374), (177, 40) */ /* CIF COMMENT (278, 376), (177, 40) */
COMMENT 'This is ok, there should COMMENT 'This is ok, there should
be no warning raised'; be no warning raised';
/* CIF NEXTSTATE (160, 426), (70, 35) */ /* CIF NEXTSTATE (174, 428), (70, 35) */
NEXTSTATE wait; NEXTSTATE wait;
/* CIF STATE (460, 231), (70, 35) */ /* CIF STATE (474, 233), (70, 35) */
STATE wait; STATE wait;
/* CIF INPUT (453, 286), (84, 35) */ /* CIF INPUT (467, 288), (84, 35) */
INPUT dd; INPUT dd;
/* CIF OUTPUT (450, 336), (89, 35) */ /* CIF OUTPUT (464, 338), (89, 35) */
OUTPUT we; OUTPUT we;
/* CIF NEXTSTATE (460, 386), (70, 35) */ /* CIF NEXTSTATE (474, 388), (70, 35) */
NEXTSTATE wait; NEXTSTATE wait;
ENDSTATE; ENDSTATE;
ENDPROCESS og; ENDPROCESS og;
......
...@@ -18,42 +18,40 @@ signal we; ...@@ -18,42 +18,40 @@ signal we;
CONNECT c AND r; CONNECT c AND r;
/* CIF PROCESS (225, 49), (150, 75) */ /* CIF PROCESS (225, 49), (150, 75) */
PROCESS og; PROCESS og;
/* CIF TEXT (57, 58), (337, 130) */ /* CIF TEXT (79, 58), (337, 130) */
-- Test support for empty sequences and NULL type -- Test support for empty sequences and NULL type
dcl empty1 EmptySeq := c1; dcl empty1 EmptySeq := c1;
dcl null1 NullType := NULL; dcl null1 NullType;
dcl choice1 ChoiceWithEmptySeq := a: n1; dcl choice1 ChoiceWithEmptySeq := a: n1;
/* CIF ENDTEXT */ /* CIF ENDTEXT */
/* CIF START (160, 226), (70, 35) */ /* CIF START (182, 226), (70, 35) */
START; START;
/* CIF TASK (137, 276), (115, 35) */ /* CIF TASK (160, 276), (115, 35) */
TASK empty1 := c1 TASK empty1 := c1
/* CIF COMMENT (272, 276), (139, 35) */ /* CIF COMMENT (294, 276), (139, 35) */
COMMENT 'Using a constant'; COMMENT 'Using a constant';
/* CIF TASK (138, 326), (112, 35) */ /* CIF TASK (161, 326), (112, 35) */
TASK empty1 := {} TASK empty1 := {}
/* CIF COMMENT (270, 326), (135, 35) */ /* CIF COMMENT (292, 326), (135, 35) */
COMMENT 'Classic notation'; COMMENT 'Classic notation';
/* CIF TASK (130, 376), (130, 35) */ /* CIF TASK (152, 376), (130, 35) */
TASK choice1 := b: c1; TASK choice1 := b: c1;
/* CIF TASK (131, 426), (126, 35) */ /* CIF TASK (154, 426), (126, 35) */
TASK choice1 := b: {}; TASK choice1 := b: {};
/* CIF TASK (144, 476), (100, 35) */ /* CIF TASK (167, 476), (100, 35) */
TASK null1 := n1; TASK null1 := n1;
/* CIF TASK (134, 526), (121, 35) */ /* CIF NEXTSTATE (182, 526), (70, 35) */
TASK null1 := null;
/* CIF NEXTSTATE (160, 576), (70, 35) */
NEXTSTATE wait; NEXTSTATE wait;
/* CIF STATE (424, 231), (70, 35) */ /* CIF STATE (446, 231), (70, 35) */
STATE wait; STATE wait;
/* CIF INPUT (417, 286), (84, 35) */ /* CIF INPUT (439, 286), (84, 35) */
INPUT dd; INPUT dd;
/* CIF OUTPUT (414, 336), (89, 35) */ /* CIF OUTPUT (437, 336), (89, 35) */
OUTPUT we; OUTPUT we;
/* CIF NEXTSTATE (424, 386), (70, 35) */ /* CIF NEXTSTATE (446, 386), (70, 35) */
NEXTSTATE wait; NEXTSTATE wait;
ENDSTATE; ENDSTATE;
ENDPROCESS og; ENDPROCESS og;
......
...@@ -8,15 +8,14 @@ test.liborchestratorinit() ...@@ -8,15 +8,14 @@ test.liborchestratorinit()
get_value=test.fixed_value get_value=test.fixed_value
get_value.restype = c_char_p get_value.restype = c_char_p
#get_size = test.fixed_size
#get_size.restype = c_long
get_size = test.fixed_size #size = get_size()
get_size.restype = c_long
size = get_size()
val = get_value() val = get_value()
print 'size =', size #print 'size =', size
# We know the size, cast it to an array of bytes that can then be converted to swig # We know the size, cast it to an array of bytes that can then be converted to swig
as_bytes = cast(val, POINTER((c_byte *size))) #as_bytes = cast(val, POINTER((c_byte *size)))
print 'value =', val, as_bytes.contents[0], as_bytes.contents[1] #print 'value =', val, as_bytes.contents[0], as_bytes.contents[1]
...@@ -7,7 +7,7 @@ void orchestrator_RI_peek_list(void *_) {} ...@@ -7,7 +7,7 @@ void orchestrator_RI_peek_list(void *_) {}
void orchestrator_RI_peek_fixed(void *_) {} void orchestrator_RI_peek_fixed(void *_) {}
void orchestrator_RI_telemetry(void *_){} void orchestrator_RI_telemetry(void *_){}
extern char *fixed_value(); extern char *fixed_value();
extern int fixed_size(); //extern int fixed_size();
int main() int main()
{ {
char * toto; char * toto;
...@@ -16,9 +16,9 @@ int main() ...@@ -16,9 +16,9 @@ int main()
printf("[C Code] Running test\n"); printf("[C Code] Running test\n");
adainit(); adainit();
toto = fixed_value(); toto = fixed_value();
size = fixed_size(); // size = fixed_size();
printf("Size=%d\n", size); // printf("Size=%d\n", size);
for (i = 0; i<size; i++) printf("%d", toto[i]); // for (i = 0; i<size; i++) printf("%d", toto[i]);
printf("\n"); printf("\n");
......
#include <stdio.h> #include <stdio.h>
extern char *fixed_value(); extern char *fixed_value();
extern int fixed_size(); //extern int fixed_size();
int main() int main()
{ {
char * toto; char * toto;
...@@ -11,9 +11,9 @@ int main() ...@@ -11,9 +11,9 @@ int main()
CInit(); CInit();
runTransition(0); runTransition(0);
toto = fixed_value(); toto = fixed_value();
size = fixed_size(); // size = fixed_size();
printf("Size=%d\n", size); // printf("Size=%d\n", size);
for (i = 0; i<size; i++) printf("%d", toto[i]); // for (i = 0; i<size; i++) printf("%d", toto[i]);
printf("\n"); printf("\n");
return 0; return 0;
} }
......
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