FW Profile - C1 Implementation
FwPrTestCases.c
Go to the documentation of this file.
1 
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include "FwPrConstants.h"
22 #include "FwPrDCreate.h"
23 #include "FwPrSCreate.h"
24 #include "FwPrTestCases.h"
25 #include "FwPrMakeTest.h"
26 
28 extern int fwPrLogMarker[LOG_ARRAY_SIZE];
30 extern int fwPrLogNode[LOG_ARRAY_SIZE];
32 extern int fwPrLogIndex;
33 
34 /* ----------------------------------------------------------------------------------------------------------------- */
51 static int IsClone(FwPrDesc_t prDesc1, FwPrDesc_t prDesc2);
52 
53 static int IsClone(FwPrDesc_t prDesc1, FwPrDesc_t prDesc2) {
55 
56  /* Check that the two procedures share the same base descriptor */
57  if (prDesc1->prBase != prDesc2->prBase)
58  return 0;
59 
60  /* check that the two procedures have the same actions */
61  if (prDesc1->nOfActions != prDesc2->nOfActions) {
62  return 0;
63  }
64  for (i=0; i<prDesc1->nOfActions; i++)
65  if (prDesc1->prActions[i] != prDesc2->prActions[i]) {
66  return 0;
67  }
68 
69  /* check that the two procedures have the same guards */
70  if (prDesc1->nOfGuards != prDesc2->nOfGuards) {
71  return 0;
72  }
73  for (i=0; i<prDesc1->nOfGuards; i++)
74  if (prDesc1->prGuards[i] != prDesc2->prGuards[i]) {
75  return 0;
76  }
77 
78  return 1;
79 }
80 
81 /* ----------------------------------------------------------------------------------------------------------------- */
86 static void DummyAction(FwPrDesc_t prDesc) {
87  return;
88 }
89 
90 /* ----------------------------------------------------------------------------------------------------------------- */
95 static void DummyActionBis(FwPrDesc_t prDesc) {
96  return;
97 }
98 
99 /* ----------------------------------------------------------------------------------------------------------------- */
104 static FwPrBool_t DummyGuard(FwPrDesc_t prDesc) {
105  return 1;
106 }
107 
108 /* ----------------------------------------------------------------------------------------------------------------- */
113 static FwPrBool_t DummyGuardBis(FwPrDesc_t prDesc) {
114  return 1;
115 }
116 
117 /*------------------------------------------------------------------------------------------------- */
119  struct TestPrData sPrData;
120  struct TestPrData* prData = &sPrData;
121  FwPrDesc_t procDesc;
122 
123  /* reset log */
124  fwPrLogIndex = 0;
125 
126  /* Create and initialize data structure to hold the state machine data */
127  prData->counter_1 = 0;
128  prData->flag_1 = 0;
129  prData->flag_2 = 0;
130  prData->flag_3 = 0;
131  prData->flag_4 = 0;
132  prData->flag_5 = 0;
133  prData->flag_6 = 0;
134  prData->marker = 1;
135 
136  /* Create first test procedure */
137  procDesc = FwPrMakeTestPR2(prData);
138  if (procDesc==NULL)
139  return prTestCaseFailure;
140 
141  /* Check configuration of procedure */
142  if (FwPrCheck(procDesc)!=prSuccess) {
143  FwPrRelease(procDesc);
144  return prTestCaseFailure;
145  }
146 
147  /* Start procedure and check outcome of start operation */
148  FwPrStart(procDesc);
149  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(procDesc)!=-1)) {
150  FwPrRelease(procDesc);
151  return prTestCaseFailure;
152  }
153 
154  /* Try re-starting the procedure and check that nothing happens */
155  FwPrStart(procDesc);
156  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(procDesc)!=-1)) {
157  FwPrRelease(procDesc);
158  return prTestCaseFailure;
159  }
160 
161  /* Release memory used by test procedure and return */
162  FwPrRelease(procDesc);
163  return prTestCaseSuccess;
164 }
165 
166 /*------------------------------------------------------------------------------------------------- */
168  struct TestPrData sPrData;
169  struct TestPrData* prData = &sPrData;
170  FwPrDesc_t procDesc;
171 
172  /* reset log */
173  fwPrLogIndex = 0;
174 
175  /* Create and initialize data structure to hold the state machine data */
176  prData->counter_1 = 0;
177  prData->flag_1 = 1;
178  prData->flag_2 = 1;
179  prData->flag_3 = 0;
180  prData->flag_4 = 0;
181  prData->flag_5 = 1;
182  prData->flag_6 = 0;
183  prData->marker = 1;
184 
185  /* Create first test procedure */
186  procDesc = FwPrMakeTestPR2(prData);
187  if (procDesc==NULL)
188  return prTestCaseFailure;
189 
190  /* Check configuration of procedure */
191  if (FwPrCheck(procDesc)!=prSuccess) {
192  FwPrRelease(procDesc);
193  return prTestCaseFailure;
194  };
195 
196  /* Stop procedure and check that nothing happens */
197  FwPrStop(procDesc);
198  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(procDesc)!=0) || (FwPrIsStarted(procDesc))) {
199  FwPrRelease(procDesc);
200  return prTestCaseFailure;
201  }
202 
203  /* Start and execute procedure and check that it reaches node N3 */
204  FwPrStart(procDesc);
205  FwPrExecute(procDesc);
206  if ((prData->counter_1!=3) || (fwPrLogIndex!=3) || (FwPrGetCurNode(procDesc)!=N3) || (!FwPrIsStarted(procDesc))) {
207  FwPrRelease(procDesc);
208  return prTestCaseFailure;
209  }
210 
211  /* Stop and check success */
212  FwPrStop(procDesc);
213  if ((prData->counter_1!=3) || (fwPrLogIndex!=3) || (FwPrGetCurNode(procDesc)!=0) || (FwPrIsStarted(procDesc))) {
214  FwPrRelease(procDesc);
215  return prTestCaseFailure;
216  }
217 
218  /* Release memory used by test procedure and return */
219  FwPrRelease(procDesc);
220  return prTestCaseSuccess;
221 }
222 
223 /*------------------------------------------------------------------------------------------------- */
225  struct TestPrData sPrData;
226  struct TestPrData* prData = &sPrData;
227  FwPrDesc_t procDesc;
228 
229  /* reset log */
230  fwPrLogIndex = 0;
231 
232  /* Create and initialize data structure to hold the state machine data */
233  prData->counter_1 = 0;
234  prData->flag_1 = 1;
235  prData->flag_2 = 1;
236  prData->flag_3 = 1;
237  prData->flag_4 = 1;
238  prData->flag_5 = 0;
239  prData->flag_6 = 0;
240  prData->marker = 1;
241 
242  /* Create first test procedure */
243  procDesc = FwPrMakeTestPR2(prData);
244  if (procDesc==NULL)
245  return prTestCaseFailure;
246 
247  /* Check configuration of procedure */
248  if (FwPrCheck(procDesc)!=prSuccess) {
249  FwPrRelease(procDesc);
250  return prTestCaseFailure;
251  }
252 
253  /* Execute procedure and check that nothing happens */
254  FwPrExecute(procDesc);
255  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(procDesc)!=0) || (FwPrIsStarted(procDesc))) {
256  FwPrRelease(procDesc);
257  return prTestCaseFailure;
258  }
259 
260  /* Release memory used by test procedure and return */
261  FwPrRelease(procDesc);
262  return prTestCaseSuccess;
263 }
264 
265 /*------------------------------------------------------------------------------------------------- */
267  struct TestPrData sPrData;
268  struct TestPrData* prData = &sPrData;
269  FwPrDesc_t procDesc;
270 
271  /* reset log */
272  fwPrLogIndex = 0;
273 
274  /* Create and initialize data structure to hold the state machine data */
275  prData->counter_1 = 0;
276  prData->flag_1 = 0;
277  prData->flag_2 = 0;
278  prData->flag_3 = 0;
279  prData->flag_4 = 0;
280  prData->flag_5 = 0;
281  prData->flag_6 = 0;
282  prData->marker = 1;
283 
284  /* Create first test procedure */
285  procDesc = FwPrMakeTestPR2(prData);
286  if (procDesc==NULL)
287  return prTestCaseFailure;
288 
289  /* Check configuration of procedure */
290  if (FwPrCheck(procDesc)!=prSuccess) {
291  FwPrRelease(procDesc);
292  return prTestCaseFailure;
293  }
294 
295  /* Start procedure and check outcome of start operation */
296  FwPrStart(procDesc);
297  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(procDesc)!=-1)) {
298  FwPrRelease(procDesc);
299  return prTestCaseFailure;
300  }
301 
302  /* Execute procedure and check that nothing happens (guard on control flow is false) */
303  FwPrExecute(procDesc);
304  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(procDesc)!=-1)) {
305  FwPrRelease(procDesc);
306  return prTestCaseFailure;
307  }
308 
309  /* Make first guard true, execute procedure again, and check that procedure moves to N1 */
310  prData->flag_1 = 1;
311  FwPrExecute(procDesc);
312  if ((prData->counter_1!=1) || (fwPrLogIndex!=1) || (FwPrGetCurNode(procDesc)!=N1)) {
313  FwPrRelease(procDesc);
314  return prTestCaseFailure;
315  }
316  if ((fwPrLogMarker[0]!=1) || (fwPrLogNode[0]!=1)) {
317  FwPrRelease(procDesc);
318  return prTestCaseFailure;
319  }
320 
321  /* Release memory used by test procedure and return */
322  FwPrRelease(procDesc);
323  return prTestCaseSuccess;
324 }
325 
326 /*------------------------------------------------------------------------------------------------- */
328  struct TestPrData sPrData;
329  struct TestPrData* prData = &sPrData;
330  FwPrDesc_t procDesc;
331 
332  /* reset log */
333  fwPrLogIndex = 0;
334 
335  /* Create and initialize data structure to hold the state machine data */
336  prData->counter_1 = 0;
337  prData->flag_1 = 1;
338  prData->flag_2 = 1;
339  prData->flag_3 = 0;
340  prData->flag_4 = 0;
341  prData->flag_5 = 1;
342  prData->flag_6 = 0;
343  prData->marker = 1;
344 
345  /* Create first test procedure */
346  procDesc = FwPrMakeTestPR2(prData);
347  if (procDesc==NULL)
348  return prTestCaseFailure;
349 
350  /* Check configuration of procedure */
351  if (FwPrCheck(procDesc)!=prSuccess) {
352  FwPrRelease(procDesc);
353  return prTestCaseFailure;
354  }
355 
356  /* Start procedure and check outcome of start operation */
357  FwPrStart(procDesc);
358  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(procDesc)!=-1)) {
359  FwPrRelease(procDesc);
360  return prTestCaseFailure;
361  }
362 
363  /* Execute procedure and check that procedure reaches node N3 */
364  FwPrExecute(procDesc);
365  if ((prData->counter_1!=3) || (fwPrLogIndex!=3) || (FwPrGetCurNode(procDesc)!=N3)) {
366  FwPrRelease(procDesc);
367  return prTestCaseFailure;
368  }
369  if ((fwPrLogMarker[0]!=1) || (fwPrLogNode[0]!=N1)) {
370  FwPrRelease(procDesc);
371  return prTestCaseFailure;
372  }
373  if ((fwPrLogMarker[1]!=1) || (fwPrLogNode[1]!=N2)) {
374  FwPrRelease(procDesc);
375  return prTestCaseFailure;
376  }
377  if ((fwPrLogMarker[2]!=1) || (fwPrLogNode[2]!=N3)) {
378  FwPrRelease(procDesc);
379  return prTestCaseFailure;
380  }
381 
382  /* Release memory used by test procedure and return */
383  FwPrRelease(procDesc);
384  return prTestCaseSuccess;
385 }
386 
387 /*------------------------------------------------------------------------------------------------- */
389  struct TestPrData sPrData;
390  struct TestPrData* prData = &sPrData;
391  FwPrDesc_t procDesc;
392 
393  /* reset log */
394  fwPrLogIndex = 0;
395 
396  /* Create and initialize data structure to hold the state machine data */
397  prData->counter_1 = 0;
398  prData->flag_1 = 1;
399  prData->flag_2 = 0;
400  prData->flag_3 = 0;
401  prData->flag_4 = 0;
402  prData->flag_5 = 0;
403  prData->flag_6 = 0;
404  prData->marker = 1;
405 
406  /* Create first test procedure */
407  procDesc = FwPrMakeTestPR2(prData);
408  if (procDesc==NULL)
409  return prTestCaseFailure;
410 
411  /* Check configuration of procedure */
412  if (FwPrCheck(procDesc)!=prSuccess) {
413  FwPrRelease(procDesc);
414  return prTestCaseFailure;
415  }
416 
417  /* Start procedure and check outcome of start operation */
418  FwPrStart(procDesc);
419  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(procDesc)!=-1)) {
420  FwPrRelease(procDesc);
421  return prTestCaseFailure;
422  }
423 
424  /* Execute procedure once and check that procedure reaches node N1 */
425  FwPrExecute(procDesc);
426  if ((prData->counter_1!=1) || (fwPrLogIndex!=1) || (FwPrGetCurNode(procDesc)!=N1)) {
427  FwPrRelease(procDesc);
428  return prTestCaseFailure;
429  }
430 
431  /* Set flags to force execution of the loop: N2-D1-D2-N3-N2 */
432  prData->flag_1 = 0;
433  prData->flag_2 = 1;
434  prData->flag_3 = 0;
435  prData->flag_4 = 1;
436  prData->flag_5 = 0;
437  prData->flag_6 = 1;
438  fwPrLogIndex = 0; /* reset log */
439 
440  /* Execute procedure and check that procedure executes loop twice and then terminates */
441  FwPrExecute(procDesc);
442 
443  if ((prData->counter_1!=6) || (fwPrLogIndex!=5) || (FwPrGetCurNode(procDesc)!=0) || (FwPrIsStarted(procDesc))) {
444  FwPrRelease(procDesc);
445  return prTestCaseFailure;
446  }
447  if ((fwPrLogMarker[0]!=1) || (fwPrLogNode[0]!=N2)) {
448  FwPrRelease(procDesc);
449  return prTestCaseFailure;
450  }
451  if ((fwPrLogMarker[1]!=1) || (fwPrLogNode[1]!=N3)) {
452  FwPrRelease(procDesc);
453  return prTestCaseFailure;
454  }
455  if ((fwPrLogMarker[2]!=1) || (fwPrLogNode[2]!=N2)) {
456  FwPrRelease(procDesc);
457  return prTestCaseFailure;
458  }
459  if ((fwPrLogMarker[3]!=1) || (fwPrLogNode[3]!=N3)) {
460  FwPrRelease(procDesc);
461  return prTestCaseFailure;
462  }
463  if ((fwPrLogMarker[4]!=1) || (fwPrLogNode[4]!=N2)) {
464  FwPrRelease(procDesc);
465  return prTestCaseFailure;
466  }
467 
468  /* Release memory used by test procedure and return */
469  FwPrRelease(procDesc);
470  return prTestCaseSuccess;
471 }
472 
473 /*------------------------------------------------------------------------------------------------- */
475  struct TestPrData sPrData;
476  struct TestPrData* prData = &sPrData;
477  FwPrDesc_t procDesc;
478 
479  /* reset log */
480  fwPrLogIndex = 0;
481 
482  /* Create and initialize data structure to hold the state machine data */
483  prData->counter_1 = 0;
484  prData->flag_1 = 1;
485  prData->flag_2 = 0;
486  prData->flag_3 = 0;
487  prData->flag_4 = 0;
488  prData->flag_5 = 0;
489  prData->flag_6 = 0;
490  prData->marker = 1;
491 
492  /* Create first test procedure */
493  procDesc = FwPrMakeTestPR2Static(prData);
494  if (procDesc==NULL)
495  return prTestCaseFailure;
496 
497  /* Check configuration of procedure */
498  if (FwPrCheck(procDesc)!=prSuccess) {
499  return prTestCaseFailure;
500  }
501 
502  /* Start procedure and check outcome of start operation */
503  FwPrStart(procDesc);
504  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(procDesc)!=-1)) {
505  return prTestCaseFailure;
506  }
507 
508  /* Execute procedure once and check that procedure reaches node N1 */
509  FwPrExecute(procDesc);
510  if ((prData->counter_1!=1) || (fwPrLogIndex!=1) || (FwPrGetCurNode(procDesc)!=N1)) {
511  return prTestCaseFailure;
512  }
513 
514  /* Set flags to force execution of the loop: N2-D1-D2-N3-N2 */
515  prData->flag_1 = 0;
516  prData->flag_2 = 1;
517  prData->flag_3 = 0;
518  prData->flag_4 = 1;
519  prData->flag_5 = 0;
520  prData->flag_6 = 1;
521  fwPrLogIndex = 0; /* reset log */
522 
523  /* Execute procedure and check that procedure executes loop twice and then terminates */
524  FwPrExecute(procDesc);
525 
526  if ((prData->counter_1!=6) || (fwPrLogIndex!=5) || (FwPrGetCurNode(procDesc)!=0) || (FwPrIsStarted(procDesc))) {
527  return prTestCaseFailure;
528  }
529  if ((fwPrLogMarker[0]!=1) || (fwPrLogNode[0]!=N2)) {
530  return prTestCaseFailure;
531  }
532  if ((fwPrLogMarker[1]!=1) || (fwPrLogNode[1]!=N3)) {
533  return prTestCaseFailure;
534  }
535  if ((fwPrLogMarker[2]!=1) || (fwPrLogNode[2]!=N2)) {
536  return prTestCaseFailure;
537  }
538  if ((fwPrLogMarker[3]!=1) || (fwPrLogNode[3]!=N3)) {
539  return prTestCaseFailure;
540  }
541  if ((fwPrLogMarker[4]!=1) || (fwPrLogNode[4]!=N2)) {
542  return prTestCaseFailure;
543  }
544 
545  /* Release memory used by test procedure and return */
546  return prTestCaseSuccess;
547 }
548 
549 /*------------------------------------------------------------------------------------------------- */
551  struct TestPrData sPrData;
552  struct TestPrData* prData = &sPrData;
553  FwPrDesc_t procDesc;
554 
555  /* reset log */
556  fwPrLogIndex = 0;
557 
558  /* Create and initialize data structure to hold the state machine data */
559  prData->counter_1 = 0;
560  prData->flag_1 = 1;
561  prData->flag_2 = 0;
562  prData->flag_3 = 0;
563  prData->flag_4 = 0;
564  prData->flag_5 = 0;
565  prData->flag_6 = 0;
566  prData->marker = 1;
567 
568  /* Create first test procedure */
569  procDesc = FwPrMakeTestPR2Dir(prData);
570  if (procDesc==NULL)
571  return prTestCaseFailure;
572 
573  /* Check configuration of procedure */
574  if (FwPrCheck(procDesc)!=prSuccess) {
575  return prTestCaseFailure;
576  }
577 
578  /* Start procedure and check outcome of start operation */
579  FwPrStart(procDesc);
580  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(procDesc)!=-1)) {
581  return prTestCaseFailure;
582  }
583 
584  /* Execute procedure once and check that procedure reaches node N1 */
585  FwPrExecute(procDesc);
586  if ((prData->counter_1!=1) || (fwPrLogIndex!=1) || (FwPrGetCurNode(procDesc)!=N1)) {
587  return prTestCaseFailure;
588  }
589 
590  /* Set flags to force execution of the loop: N2-D1-D2-N3-N2 */
591  prData->flag_1 = 0;
592  prData->flag_2 = 1;
593  prData->flag_3 = 0;
594  prData->flag_4 = 1;
595  prData->flag_5 = 0;
596  prData->flag_6 = 1;
597  fwPrLogIndex = 0; /* reset log */
598 
599  /* Execute procedure and check that procedure executes loop twice and then terminates */
600  FwPrExecute(procDesc);
601 
602  if ((prData->counter_1!=6) || (fwPrLogIndex!=5) || (FwPrGetCurNode(procDesc)!=0) || (FwPrIsStarted(procDesc))) {
603  return prTestCaseFailure;
604  }
605  if ((fwPrLogMarker[0]!=1) || (fwPrLogNode[0]!=N2)) {
606  return prTestCaseFailure;
607  }
608  if ((fwPrLogMarker[1]!=1) || (fwPrLogNode[1]!=N3)) {
609  return prTestCaseFailure;
610  }
611  if ((fwPrLogMarker[2]!=1) || (fwPrLogNode[2]!=N2)) {
612  return prTestCaseFailure;
613  }
614  if ((fwPrLogMarker[3]!=1) || (fwPrLogNode[3]!=N3)) {
615  return prTestCaseFailure;
616  }
617  if ((fwPrLogMarker[4]!=1) || (fwPrLogNode[4]!=N2)) {
618  return prTestCaseFailure;
619  }
620 
621  /* Release memory used by test procedure and return */
622  return prTestCaseSuccess;
623 }
624 
625 /*------------------------------------------------------------------------------------------------- */
627  struct TestPrData sPrData;
628  struct TestPrData* prData = &sPrData;
629  FwPrDesc_t procDesc;
630 
631  /* reset log */
632  fwPrLogIndex = 0;
633 
634  /* Create and initialize data structure to hold the state machine data */
635  prData->counter_1 = 0;
636  prData->flag_1 = 1;
637  prData->flag_2 = 0;
638  prData->flag_3 = 0;
639  prData->flag_4 = 0;
640  prData->flag_5 = 0;
641  prData->flag_6 = 0;
642  prData->marker = 1;
643 
644  /* Create first test procedure */
645  procDesc = FwPrMakeTestPR1(prData);
646  if (procDesc==NULL)
647  return prTestCaseFailure;
648 
649  /* Check configuration of procedure */
650  if (FwPrCheck(procDesc)!=prSuccess) {
651  FwPrRelease(procDesc);
652  return prTestCaseFailure;
653  }
654 
655  /* Start procedure and check outcome of start operation */
656  FwPrStart(procDesc);
657  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(procDesc)!=-1)) {
658  FwPrRelease(procDesc);
659  return prTestCaseFailure;
660  }
661 
662  /* Execute procedure once and check that procedure reaches node N1 */
663  FwPrExecute(procDesc);
664  if ((prData->counter_1!=1) || (fwPrLogIndex!=1) || (FwPrGetCurNode(procDesc)!=N1)) {
665  FwPrRelease(procDesc);
666  return prTestCaseFailure;
667  }
668 
669  /* Execute procedure again and check that procedure remains in node N1 */
670  FwPrExecute(procDesc);
671  if ((prData->counter_1!=1) || (fwPrLogIndex!=1) || (FwPrGetCurNode(procDesc)!=N1)) {
672  FwPrRelease(procDesc);
673  return prTestCaseFailure;
674  }
675 
676  /* Set flags to force execution of procedure to its final node */
677  prData->flag_1 = 0;
678  prData->flag_2 = 1;
679  prData->flag_3 = 1;
680  prData->flag_4 = 1;
681  prData->flag_5 = 0;
682  prData->flag_6 = 0;
683 
684  /* Execute procedure and check that procedure terminates */
685  FwPrExecute(procDesc);
686 
687  if ((prData->counter_1!=3) || (fwPrLogIndex!=3) || (FwPrGetCurNode(procDesc)!=0) || (FwPrIsStarted(procDesc))) {
688  FwPrRelease(procDesc);
689  return prTestCaseFailure;
690  }
691  if ((fwPrLogMarker[0]!=1) || (fwPrLogNode[0]!=N1)) {
692  FwPrRelease(procDesc);
693  return prTestCaseFailure;
694  }
695  if ((fwPrLogMarker[1]!=1) || (fwPrLogNode[1]!=N2)) {
696  FwPrRelease(procDesc);
697  return prTestCaseFailure;
698  }
699  if ((fwPrLogMarker[2]!=1) || (fwPrLogNode[2]!=N3)) {
700  FwPrRelease(procDesc);
701  return prTestCaseFailure;
702  }
703 
704  /* Release memory used by test procedure and return */
705  FwPrRelease(procDesc);
706  return prTestCaseSuccess;
707 }
708 
709 /*------------------------------------------------------------------------------------------------- */
711  struct TestPrData sPrData;
712  struct TestPrData* prData = &sPrData;
713  FwPrDesc_t procDesc;
714 
715  /* reset log */
716  fwPrLogIndex = 0;
717 
718  /* Create and initialize data structure to hold the state machine data */
719  prData->counter_1 = 0;
720  prData->flag_1 = 1;
721  prData->flag_2 = 0;
722  prData->flag_3 = 0;
723  prData->flag_4 = 0;
724  prData->flag_5 = 0;
725  prData->flag_6 = 0;
726  prData->marker = 1;
727 
728  /* Create first test procedure */
729  procDesc = FwPrMakeTestPR1Static(prData);
730  if (procDesc==NULL)
731  return prTestCaseFailure;
732 
733  /* Check configuration of procedure */
734  if (FwPrCheck(procDesc)!=prSuccess) {
735  return prTestCaseFailure;
736  }
737 
738  /* Start procedure and check outcome of start operation */
739  FwPrStart(procDesc);
740  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(procDesc)!=-1)) {
741  return prTestCaseFailure;
742  }
743 
744  /* Execute procedure once and check that procedure reaches node N1 */
745  FwPrExecute(procDesc);
746  if ((prData->counter_1!=1) || (fwPrLogIndex!=1) || (FwPrGetCurNode(procDesc)!=N1)) {
747  return prTestCaseFailure;
748  }
749 
750  /* Execute procedure again and check that procedure remains in node N1 */
751  FwPrExecute(procDesc);
752  if ((prData->counter_1!=1) || (fwPrLogIndex!=1) || (FwPrGetCurNode(procDesc)!=N1)) {
753  return prTestCaseFailure;
754  }
755 
756  /* Set flags to force execution of procedure to its final node */
757  prData->flag_1 = 0;
758  prData->flag_2 = 1;
759  prData->flag_3 = 1;
760  prData->flag_4 = 1;
761  prData->flag_5 = 0;
762  prData->flag_6 = 0;
763 
764  /* Execute procedure and check that procedure terminates */
765  FwPrExecute(procDesc);
766 
767  if ((prData->counter_1!=3) || (fwPrLogIndex!=3) || (FwPrGetCurNode(procDesc)!=0) || (FwPrIsStarted(procDesc))) {
768  return prTestCaseFailure;
769  }
770  if ((fwPrLogMarker[0]!=1) || (fwPrLogNode[0]!=N1)) {
771  return prTestCaseFailure;
772  }
773  if ((fwPrLogMarker[1]!=1) || (fwPrLogNode[1]!=N2)) {
774  return prTestCaseFailure;
775  }
776  if ((fwPrLogMarker[2]!=1) || (fwPrLogNode[2]!=N3)) {
777  return prTestCaseFailure;
778  }
779 
780  /* Release memory used by test procedure and return */
781  return prTestCaseSuccess;
782 }
783 
784 /*------------------------------------------------------------------------------------------------- */
786  FwPrCounterS1_t nOfANodes = 2;
787  FwPrCounterS1_t nOfDNodes = 0;
788  FwPrCounterS1_t nOfFlows = 3;
789  FwPrCounterS1_t nOfActions = 1;
790  FwPrCounterS1_t nOfGuards = 1;
791  struct TestPrData sPrData;
792  struct TestPrData* prData = &sPrData;
793  FwPrDesc_t procDesc;
794 
795  /* reset log */
796  fwPrLogIndex = 0;
797 
798  /* Create a procedure with two states but only add one state to it */
799  procDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
800  FwPrSetData(procDesc, prData);
801 
802  FwPrAddActionNode(procDesc, 1, &DummyAction);
803 
804  FwPrAddFlowIniToAct(procDesc, 1, &DummyGuard);
805  FwPrAddFlowActToAct(procDesc, 1, 2, &DummyGuard);
806 
807  if (FwPrCheck(procDesc)!=prNullActNode) {
808  FwPrRelease(procDesc);
809  return prTestCaseFailure;
810  }
811 
812  /* Now add the missing state but leave its action undefined */
813  FwPrAddActionNode(procDesc, 2, NULL);
814 
815  if (FwPrGetErrCode(procDesc)!=prNullAction) {
816  FwPrRelease(procDesc);
817  return prTestCaseFailure;
818  }
819 
820  FwPrRelease(procDesc);
821  return prTestCaseSuccess;
822 }
823 
824 /*------------------------------------------------------------------------------------------------- */
826  FwPrCounterS1_t nOfANodes = 1;
827  FwPrCounterS1_t nOfDNodes = 0;
828  FwPrCounterS1_t nOfFlows = 1;
829  FwPrCounterS1_t nOfActions = 1;
830  FwPrCounterS1_t nOfGuards = 0;
831  FwPrDesc_t prDesc;
832 
833  /* Attempt to create a procedure with an illegal number of flows */
834  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
835  if (prDesc != NULL)
836  return prTestCaseFailure;
837 
838  /* Attempt to create a procedure with an illegal number of action nodes */
839  nOfANodes = 0;
840  nOfFlows = 2;
841  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
842  if (prDesc != NULL)
843  return prTestCaseFailure;
844 
845  /* Attempt to create a procedure with an illegal number of decision nodes */
846  nOfANodes = 1;
847  nOfDNodes = -1;
848  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
849  if (prDesc != NULL)
850  return prTestCaseFailure;
851 
852  /* Attempt to create a procedure with an illegal number of actions */
853  nOfDNodes = 0;
854  nOfActions = 0;
855  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
856  if (prDesc != NULL)
857  return prTestCaseFailure;
858 
859  nOfActions = 2;
860  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
861  if (prDesc != NULL)
862  return prTestCaseFailure;
863 
864  /* Attempt to create a procedure with an illegal number of guards */
865  nOfActions = 1;
866  nOfGuards = -1;
867  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
868  if (prDesc != NULL)
869  return prTestCaseFailure;
870 
871  nOfGuards = 3;
872  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
873  if (prDesc != NULL)
874  return prTestCaseFailure;
875 
876  return prTestCaseSuccess;
877 }
878 
879 /*------------------------------------------------------------------------------------------------- */
881  FwPrDesc_t prDesc;
882  const FwPrCounterS1_t nOfANodes = 2;
883  const FwPrCounterS1_t nOfDNodes = 1;
884  const FwPrCounterS1_t nOfFlows = 4;
885  const FwPrCounterS1_t nOfActions = 1;
886  const FwPrCounterS1_t nOfGuards = 4;
887 
888  /* Create a procedure with one action node and one decision node an illegal number of flows */
889  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
890  if (prDesc == NULL)
891  return prTestCaseFailure;
892 
893  /* Attempt to add an action node with illegal identifier */
894  FwPrAddActionNode(prDesc, 0, &DummyAction);
895  if (FwPrGetErrCode(prDesc) != prIllActNodeId) {
896  FwPrRelease(prDesc);
897  return prTestCaseFailure;
898  }
899  prDesc->errCode = prSuccess; /* Force error code back to "success" */
900  FwPrAddActionNode(prDesc, nOfANodes+1, &DummyAction);
901  if (FwPrGetErrCode(prDesc) != prIllActNodeId) {
902  FwPrRelease(prDesc);
903  return prTestCaseFailure;
904  }
905  prDesc->errCode = prSuccess; /* Force error code back to "success" */
906 
907  /* Add the action node and then add it again and check that an error is reported */
908  FwPrAddActionNode(prDesc, 1, &DummyAction);
909  FwPrAddActionNode(prDesc, 1, &DummyAction);
910  if (FwPrGetErrCode(prDesc) != prActNodeIdInUse) {
911  FwPrRelease(prDesc);
912  return prTestCaseFailure;
913  }
914  prDesc->errCode = prSuccess; /* Force error code back to "success" */
915 
916  /* Attempt to add a decision node with illegal identifier */
917  FwPrAddDecisionNode(prDesc, 0, 2);
918  if (FwPrGetErrCode(prDesc) != prIllDecNodeId) {
919  FwPrRelease(prDesc);
920  return prTestCaseFailure;
921  }
922  prDesc->errCode = prSuccess; /* Force error code back to "success" */
923  FwPrAddDecisionNode(prDesc, nOfDNodes+1, 2);
924  if (FwPrGetErrCode(prDesc) != prIllDecNodeId) {
925  FwPrRelease(prDesc);
926  return prTestCaseFailure;
927  }
928  prDesc->errCode = prSuccess; /* Force error code back to "success" */
929 
930  /* Attempt to add a decision node with an illegal number of outgoing flows */
931  FwPrAddDecisionNode(prDesc, 1, 1);
932  if (FwPrGetErrCode(prDesc) != prIllNOfOutFlows) {
933  FwPrRelease(prDesc);
934  return prTestCaseFailure;
935  }
936  prDesc->errCode = prSuccess; /* Force error code back to "success" */
937 
938  /* Attempt to add a decision node with too many outgoing flows */
939  FwPrAddDecisionNode(prDesc, 1, 3);
940  if (FwPrGetErrCode(prDesc) != prTooManyOutFlows) {
941  FwPrRelease(prDesc);
942  return prTestCaseFailure;
943  }
944  prDesc->errCode = prSuccess; /* Force error code back to "success" */
945 
946  /* Add the decision node and then add it again and check that an error is reported */
947  FwPrAddDecisionNode(prDesc, 1, 2);
948  FwPrAddDecisionNode(prDesc, 1, 2);
949  if (FwPrGetErrCode(prDesc) != prDecNodeIdInUse) {
950  FwPrRelease(prDesc);
951  return prTestCaseFailure;
952  }
953  prDesc->errCode = prSuccess; /* Force error code back to "success" */
954 
955  /* Attempt to add an action node -- this will fail because all control flows are allocated */
956  FwPrAddActionNode(prDesc, 2, &DummyAction);
957  if (FwPrGetErrCode(prDesc) != prTooManyOutFlows) {
958  FwPrRelease(prDesc);
959  return prTestCaseFailure;
960  }
961 
962  FwPrRelease(prDesc);
963  return prTestCaseSuccess;
964 }
965 
966 /*------------------------------------------------------------------------------------------------- */
968  struct TestPrData sPrData;
969  struct TestPrData* prData = &sPrData;
970  FwPrDesc_t prDesc;
971 
972  /* reset log */
973  fwPrLogIndex = 0;
974 
975  /* Create and initialize data structure to hold the state machine data */
976  prData->counter_1 = 0;
977  prData->flag_1 = 1;
978  prData->flag_2 = 0;
979  prData->flag_3 = 0;
980  prData->flag_4 = 0;
981  prData->flag_5 = 0;
982  prData->flag_6 = 0;
983  prData->marker = 1;
984 
985  /* Create test procedure */
986  prDesc = FwPrMakeTestPR3(prData);
987  if (prDesc==NULL)
988  return prTestCaseFailure;
989 
990  /* Check configuration of procedure */
991  if (FwPrCheck(prDesc)!=prSuccess) {
992  FwPrRelease(prDesc);
993  return prTestCaseFailure;
994  }
995 
996  /* Start procedure and check outcome of start operation */
997  FwPrStart(prDesc);
998  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(prDesc)!=-1)) {
999  FwPrRelease(prDesc);
1000  return prTestCaseFailure;
1001  }
1002 
1003  /* Execute procedure once and check that procedure increments counter and then terminates */
1004  FwPrExecute(prDesc);
1005  if ((prData->counter_1!=1) || (fwPrLogIndex!=1) || (FwPrGetCurNode(prDesc)!=0) || (FwPrIsStarted(prDesc))) {
1006  FwPrRelease(prDesc);
1007  return prTestCaseFailure;
1008  }
1009 
1010  /* Release memory used by test procedure and return */
1011  FwPrRelease(prDesc);
1012  return prTestCaseSuccess;
1013 }
1014 
1015 /*------------------------------------------------------------------------------------------------- */
1017  struct TestPrData sPrData;
1018  struct TestPrData* prData = &sPrData;
1019  FwPrDesc_t procDesc;
1020 
1021  /* reset log */
1022  fwPrLogIndex = 0;
1023 
1024  /* Create and initialize data structure to hold the state machine data */
1025  prData->counter_1 = 0;
1026  prData->flag_1 = 1;
1027  prData->flag_2 = 0;
1028  prData->flag_3 = 0;
1029  prData->flag_4 = 0;
1030  prData->flag_5 = 0;
1031  prData->flag_6 = 0;
1032  prData->marker = 1;
1033 
1034  /* Create test procedure */
1035  procDesc = FwPrMakeTestPR4(prData);
1036  if (procDesc==NULL)
1037  return prTestCaseFailure;
1038 
1039  /* Check configuration of procedure */
1040  if (FwPrCheck(procDesc)!=prSuccess) {
1041  FwPrRelease(procDesc);
1042  return prTestCaseFailure;
1043  }
1044 
1045  /* Start procedure */
1046  FwPrStart(procDesc);
1047  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(procDesc)!=-1)) {
1048  FwPrRelease(procDesc);
1049  return prTestCaseFailure;
1050  }
1051 
1052  /* Execute procedure and check that procedure terminates after passing through N1 */
1053  FwPrExecute(procDesc);
1054  if ((prData->counter_1!=1) || (fwPrLogIndex!=1) || (FwPrGetCurNode(procDesc)!=0)) {
1055  FwPrRelease(procDesc);
1056  return prTestCaseFailure;
1057  }
1058 
1059  /* Set flags to force execution of procedure to its final node */
1060  prData->flag_1 = 0;
1061  prData->flag_2 = 1;
1062  prData->flag_3 = 1;
1063  prData->flag_4 = 1;
1064  prData->flag_5 = 0;
1065  prData->flag_6 = 0;
1066 
1067  /* Restart and execute procedure and check that it terminates */
1068  FwPrStart(procDesc);
1069  FwPrExecute(procDesc);
1070 
1071  if ((prData->counter_1!=1) || (fwPrLogIndex!=1) || (FwPrGetCurNode(procDesc)!=0) || (FwPrIsStarted(procDesc))) {
1072  FwPrRelease(procDesc);
1073  return prTestCaseFailure;
1074  }
1075 
1076  /* Release memory used by test procedure and return */
1077  FwPrRelease(procDesc);
1078  return prTestCaseSuccess;
1079 }
1080 
1081 /*------------------------------------------------------------------------------------------------- */
1083  struct TestPrData sPrData;
1084  struct TestPrData* prData = &sPrData;
1085  FwPrDesc_t procDesc;
1086 
1087  /* reset log */
1088  fwPrLogIndex = 0;
1089 
1090  /* Create and initialize data structure to hold the state machine data */
1091  prData->counter_1 = 0;
1092  prData->flag_1 = 0;
1093  prData->flag_2 = 0;
1094  prData->flag_3 = 0;
1095  prData->flag_4 = 0;
1096  prData->flag_5 = 0;
1097  prData->flag_6 = 0;
1098  prData->marker = 1;
1099 
1100  /* Create test procedure */
1101  procDesc = FwPrMakeTestPR4(prData);
1102  if (procDesc==NULL)
1103  return prTestCaseFailure;
1104 
1105  /* Check configuration of procedure */
1106  if (FwPrCheck(procDesc)!=prSuccess) {
1107  FwPrRelease(procDesc);
1108  return prTestCaseFailure;
1109  }
1110 
1111  /* Start procedure */
1112  FwPrStart(procDesc);
1113  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(procDesc)!=-1)) {
1114  FwPrRelease(procDesc);
1115  return prTestCaseFailure;
1116  }
1117 
1118  /* Execute procedure and check that procedure generates an error */
1119  FwPrExecute(procDesc);
1120  if (FwPrGetErrCode(procDesc)!=prFlowErr) {
1121  FwPrRelease(procDesc);
1122  return prTestCaseFailure;
1123  }
1124 
1125  /* Release memory used by test procedure and return */
1126  FwPrRelease(procDesc);
1127  return prTestCaseSuccess;
1128 }
1129 
1130 /*------------------------------------------------------------------------------------------------- */
1132  FwPrDesc_t prDesc;
1133  const FwPrCounterS1_t nOfANodes = 2;
1134  const FwPrCounterS1_t nOfDNodes = 1;
1135  const FwPrCounterS1_t nOfFlows = 5;
1136  const FwPrCounterS1_t nOfActions = 1;
1137  const FwPrCounterS1_t nOfGuards = 1;
1138 
1139  /* Create the procedure */
1140  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
1141  if (prDesc == NULL)
1142  return prTestCaseFailure;
1143 
1144  /* Attempt adding a control flow from an action node which has not yet been defined */
1145  FwPrAddFlowActToFin(prDesc, N1, NULL);
1146  if (FwPrGetErrCode(prDesc) != prUndefinedFlowSrc) {
1147  FwPrRelease(prDesc);
1148  return prTestCaseFailure;
1149  }
1150  prDesc->errCode = prSuccess; /* Force error code back to "success" */
1151 
1152  /* Attempt adding a control flow from a decision node which has not yet been defined */
1153  FwPrAddFlowDecToFin(prDesc, D1, &DummyGuard);
1154  if (FwPrGetErrCode(prDesc) != prUndefinedFlowSrc) {
1155  FwPrRelease(prDesc);
1156  return prTestCaseFailure;
1157  }
1158  prDesc->errCode = prSuccess; /* Force error code back to "success" */
1159 
1160  /* Add the first action node and the decision node to the procedure */
1161  FwPrAddActionNode(prDesc, N1, &DummyAction);
1162  FwPrAddDecisionNode(prDesc, D1, 2);
1163 
1164  /* Attempt adding a second action node with a new action (there is only room for one action) */
1165  FwPrAddActionNode(prDesc, N2, &DummyActionBis);
1166  if (FwPrGetErrCode(prDesc) != prTooManyActions) {
1167  FwPrRelease(prDesc);
1168  return prTestCaseFailure;
1169  }
1170  prDesc->errCode = prSuccess; /* Force error code back to "success" */
1171 
1172  /* Add the second action node */
1173  FwPrAddActionNode(prDesc, N2, &DummyAction);
1174 
1175  /* Attempt adding a control flow from an action node which does not exist */
1176  FwPrAddFlowActToFin(prDesc, 3, NULL);
1177  if (FwPrGetErrCode(prDesc) != prIllFlowSrc) {
1178  FwPrRelease(prDesc);
1179  return prTestCaseFailure;
1180  }
1181  prDesc->errCode = prSuccess; /* Force error code back to "success" */
1182 
1183  FwPrAddFlowActToFin(prDesc, 0, NULL);
1184  if (FwPrGetErrCode(prDesc) != prIllFlowSrc) {
1185  FwPrRelease(prDesc);
1186  return prTestCaseFailure;
1187  }
1188  prDesc->errCode = prSuccess; /* Force error code back to "success" */
1189 
1190  /* Attempt adding a control flow from a decision node which does not exist */
1191  FwPrAddFlowDecToFin(prDesc, 2, &DummyGuard);
1192  if (FwPrGetErrCode(prDesc) != prIllFlowSrc) {
1193  FwPrRelease(prDesc);
1194  return prTestCaseFailure;
1195  }
1196  prDesc->errCode = prSuccess; /* Force error code back to "success" */
1197 
1198  FwPrAddFlowDecToFin(prDesc, 0, &DummyGuard);
1199  if (FwPrGetErrCode(prDesc) != prIllFlowSrc) {
1200  FwPrRelease(prDesc);
1201  return prTestCaseFailure;
1202  }
1203  prDesc->errCode = prSuccess; /* Force error code back to "success" */
1204 
1205  /* Add the first four control flows */
1206  FwPrAddFlowDecToAct(prDesc, D1, N1, &DummyGuard);
1207  FwPrAddFlowActToAct(prDesc, N1, N2, &DummyGuard);
1208  FwPrAddFlowActToFin(prDesc, N2, NULL);
1209  FwPrAddFlowIniToDec(prDesc, D1, NULL);
1210  if (FwPrGetErrCode(prDesc) != prSuccess) {
1211  FwPrRelease(prDesc);
1212  return prTestCaseFailure;
1213  }
1214 
1215  /* Add the last control flow with a new guard (the flow will be added but an error will
1216  * be reported because in the procedure descriptor there is space for only one guard) */
1217  FwPrAddFlowDecToFin(prDesc, D1, &DummyGuardBis);
1218  if (FwPrGetErrCode(prDesc) != prTooManyGuards) {
1219  FwPrRelease(prDesc);
1220  return prTestCaseFailure;
1221  }
1222  prDesc->errCode = prSuccess; /* Force error code back to "success" */
1223 
1224  /* Attempt to add another control flow */
1225  FwPrAddFlowDecToFin(prDesc, D1, &DummyGuard);
1226  if (FwPrGetErrCode(prDesc) != prTooManyFlows) {
1227  FwPrRelease(prDesc);
1228  return prTestCaseFailure;
1229  }
1230  prDesc->errCode = prSuccess; /* Force error code back to "success" */
1231 
1232  /* Attempt to add another control flow */
1233  FwPrAddFlowActToFin(prDesc, N2, &DummyGuard);
1234  if (FwPrGetErrCode(prDesc) != prTooManyFlows) {
1235  FwPrRelease(prDesc);
1236  return prTestCaseFailure;
1237  }
1238 
1239  /* Release memory used by test procedure and return */
1240  FwPrRelease(prDesc);
1241  return prTestCaseSuccess;
1242 }
1243 
1244 /*------------------------------------------------------------------------------------------------- */
1246  FwPrDesc_t prDesc;
1247  const FwPrCounterS1_t nOfANodes = 2;
1248  const FwPrCounterS1_t nOfDNodes = 0;
1249  const FwPrCounterS1_t nOfFlows = 2;
1250  const FwPrCounterS1_t nOfActions = 1;
1251  const FwPrCounterS1_t nOfGuards = 0;
1252 
1253  /* Create the procedure */
1254  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
1255  if (prDesc == NULL)
1256  return prTestCaseFailure;
1257 
1258  /* Attempt adding a control flow from an action node which has not yet been defined and
1259  * verify that configuration check fails */
1260  FwPrAddFlowActToFin(prDesc, N1, NULL);
1261  if (FwPrCheck(prDesc) != prConfigErr) {
1262  FwPrRelease(prDesc);
1263  return prTestCaseFailure;
1264  }
1265  prDesc->errCode = prSuccess; /* Force error code back to "success" */
1266 
1267  /* Define the procedure but leave one action node undefined */
1268  FwPrAddActionNode(prDesc, N1, &DummyAction);
1269  FwPrAddFlowIniToAct(prDesc, N1, NULL);
1270  FwPrAddFlowActToFin(prDesc, N1, NULL);
1271 
1272  /* Verify that configuration check fails */
1273  if (FwPrCheck(prDesc) != prNullActNode) {
1274  FwPrRelease(prDesc);
1275  return prTestCaseFailure;
1276  }
1277 
1278  /* Release memory used by test procedure and return */
1279  FwPrRelease(prDesc);
1280  return prTestCaseSuccess;
1281 }
1282 
1283 /*------------------------------------------------------------------------------------------------- */
1285  FwPrDesc_t prDesc;
1286  const FwPrCounterS1_t nOfANodes = 1;
1287  const FwPrCounterS1_t nOfDNodes = 1;
1288  const FwPrCounterS1_t nOfFlows = 2;
1289  const FwPrCounterS1_t nOfActions = 1;
1290  const FwPrCounterS1_t nOfGuards = 0;
1291 
1292  /* Create the procedure */
1293  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
1294  if (prDesc == NULL)
1295  return prTestCaseFailure;
1296 
1297  /* Define the procedure but leave one decision node undefined */
1298  FwPrAddActionNode(prDesc, N1, &DummyAction);
1299  FwPrAddFlowIniToAct(prDesc, N1, NULL);
1300  FwPrAddFlowActToFin(prDesc, N1, NULL);
1301 
1302  /* Verify that configuration check fails */
1303  if (FwPrCheck(prDesc) != prNullDecNode) {
1304  FwPrRelease(prDesc);
1305  return prTestCaseFailure;
1306  }
1307 
1308  /* Release memory used by test procedure and return */
1309  FwPrRelease(prDesc);
1310  return prTestCaseSuccess;
1311 }
1312 
1313 /*------------------------------------------------------------------------------------------------- */
1315  FwPrDesc_t prDesc;
1316  const FwPrCounterS1_t nOfANodes = 1;
1317  const FwPrCounterS1_t nOfDNodes = 0;
1318  const FwPrCounterS1_t nOfFlows = 3;
1319  const FwPrCounterS1_t nOfActions = 1;
1320  const FwPrCounterS1_t nOfGuards = 0;
1321 
1322  /* Create the procedure */
1323  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
1324  if (prDesc == NULL)
1325  return prTestCaseFailure;
1326 
1327  /* Define the procedure but leave one control flow undefined */
1328  FwPrAddActionNode(prDesc, N1, &DummyAction);
1329  FwPrAddFlowIniToAct(prDesc, N1, NULL);
1330  FwPrAddFlowActToFin(prDesc, N1, NULL);
1331 
1332  /* Verify that configuration check fails */
1333  if (FwPrCheck(prDesc) != prNullFlow) {
1334  FwPrRelease(prDesc);
1335  return prTestCaseFailure;
1336  }
1337 
1338  /* Release memory used by test procedure and return */
1339  FwPrRelease(prDesc);
1340  return prTestCaseSuccess;
1341 }
1342 
1343 /*------------------------------------------------------------------------------------------------- */
1345  FwPrDesc_t prDesc;
1346  const FwPrCounterS1_t nOfANodes = 1;
1347  const FwPrCounterS1_t nOfDNodes = 0;
1348  const FwPrCounterS1_t nOfFlows = 2;
1349  const FwPrCounterS1_t nOfActions = 1;
1350  const FwPrCounterS1_t nOfGuards = 0;
1351 
1352  /* Create the procedure */
1353  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
1354  if (prDesc == NULL)
1355  return prTestCaseFailure;
1356 
1357  /* Define the procedure */
1358  FwPrAddActionNode(prDesc, N1, &DummyAction);
1359  FwPrAddFlowIniToAct(prDesc, N1+1, NULL); /* Illegal destination */
1360  FwPrAddFlowActToFin(prDesc, N1, NULL);
1361 
1362  /* Verify that configuration check fails */
1363  if (FwPrCheck(prDesc) != prIllegalADest) {
1364  FwPrRelease(prDesc);
1365  return prTestCaseFailure;
1366  }
1367 
1368  /* Release memory used by test procedure and return */
1369  FwPrRelease(prDesc);
1370  return prTestCaseSuccess;
1371 }
1372 
1373 /*------------------------------------------------------------------------------------------------- */
1375  FwPrDesc_t prDesc;
1376  const FwPrCounterS1_t nOfANodes = 1;
1377  const FwPrCounterS1_t nOfDNodes = 1;
1378  const FwPrCounterS1_t nOfFlows = 4;
1379  const FwPrCounterS1_t nOfActions = 1;
1380  const FwPrCounterS1_t nOfGuards = 0;
1381 
1382  /* Create the procedure */
1383  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
1384  if (prDesc == NULL)
1385  return prTestCaseFailure;
1386 
1387  /* Define the procedure but leave one control flow undefined */
1388  FwPrAddActionNode(prDesc, N1, &DummyAction);
1389  FwPrAddDecisionNode(prDesc, D1, 2);
1390 
1391  FwPrAddFlowIniToDec(prDesc, D1+1, NULL); /* Illegal destination */
1392  FwPrAddFlowDecToAct(prDesc, D1, N1, NULL);
1393  FwPrAddFlowDecToFin(prDesc, D1, NULL);
1394  FwPrAddFlowActToFin(prDesc, N1, NULL);
1395 
1396  /* Verify that configuration check fails */
1397  if (FwPrCheck(prDesc) != prIllegalDDest) {
1398  FwPrRelease(prDesc);
1399  return prTestCaseFailure;
1400  }
1401 
1402  /* Release memory used by test procedure and return */
1403  FwPrRelease(prDesc);
1404  return prTestCaseSuccess;
1405 }
1406 
1407 /*------------------------------------------------------------------------------------------------- */
1409  FwPrDesc_t prDesc;
1410  const FwPrCounterS1_t nOfANodes = 2;
1411  const FwPrCounterS1_t nOfDNodes = 0;
1412  const FwPrCounterS1_t nOfFlows = 3;
1413  const FwPrCounterS1_t nOfActions = 2;
1414  const FwPrCounterS1_t nOfGuards = 0;
1415 
1416  /* Create the procedure */
1417  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
1418  if (prDesc == NULL)
1419  return prTestCaseFailure;
1420 
1421  /* Define the procedure */
1422  FwPrAddActionNode(prDesc, N1, &DummyAction);
1423  FwPrAddActionNode(prDesc, N2, &DummyAction);
1424  FwPrAddFlowIniToAct(prDesc, N1, NULL);
1425  FwPrAddFlowActToAct(prDesc, N1, N2, NULL);
1426  FwPrAddFlowActToFin(prDesc, N2, NULL);
1427 
1428  /* Verify that configuration check fails */
1429  if (FwPrCheck(prDesc) != prTooFewActions) {
1430  FwPrRelease(prDesc);
1431  return prTestCaseFailure;
1432  }
1433 
1434  /* Release memory used by test procedure and return */
1435  FwPrRelease(prDesc);
1436  return prTestCaseSuccess;
1437 }
1438 
1439 /*------------------------------------------------------------------------------------------------- */
1441  FwPrDesc_t prDesc;
1442  const FwPrCounterS1_t nOfANodes = 1;
1443  const FwPrCounterS1_t nOfDNodes = 0;
1444  const FwPrCounterS1_t nOfFlows = 2;
1445  const FwPrCounterS1_t nOfActions = 1;
1446  const FwPrCounterS1_t nOfGuards = 1;
1447 
1448  /* Create the procedure */
1449  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
1450  if (prDesc == NULL)
1451  return prTestCaseFailure;
1452 
1453  /* Define the procedure */
1454  FwPrAddActionNode(prDesc, N1, &DummyAction);
1455  FwPrAddFlowIniToAct(prDesc, N1, NULL);
1456  FwPrAddFlowActToFin(prDesc, N1, NULL);
1457 
1458  /* Verify that configuration check fails */
1459  if (FwPrCheck(prDesc) != prTooFewGuards) {
1460  FwPrRelease(prDesc);
1461  return prTestCaseFailure;
1462  }
1463 
1464  /* Release memory used by test procedure and return */
1465  FwPrRelease(prDesc);
1466  return prTestCaseSuccess;
1467 }
1468 
1469 /*------------------------------------------------------------------------------------------------- */
1471  struct TestPrData sPrData;
1472  struct TestPrData* prData = &sPrData;
1473  FwPrDesc_t procDesc;
1474 
1475  /* reset log */
1476  fwPrLogIndex = 0;
1477 
1478  /* Create and initialize data structure to hold the state machine data */
1479  prData->counter_1 = 0;
1480  prData->flag_1 = 1;
1481  prData->flag_2 = 1;
1482  prData->flag_3 = 1;
1483  prData->flag_4 = 1;
1484  prData->flag_5 = 1;
1485  prData->flag_6 = 1;
1486  prData->marker = 1;
1487 
1488  /* Create first test procedure */
1489  procDesc = FwPrMakeTestPR1(prData);
1490  if (procDesc==NULL)
1491  return prTestCaseFailure;
1492 
1493  /* Check configuration of procedure */
1494  if (FwPrCheck(procDesc)!=prSuccess) {
1495  FwPrRelease(procDesc);
1496  return prTestCaseFailure;
1497  }
1498 
1499  /* Run procedure and check that all three action nodes have been executed and the procedure is terminated */
1500  FwPrRun(procDesc);
1501  if ((prData->counter_1!=3) || (fwPrLogIndex!=3) || (FwPrGetCurNode(procDesc)!=0)) {
1502  FwPrRelease(procDesc);
1503  return prTestCaseFailure;
1504  }
1505 
1506  /* Release memory used by test procedure and return */
1507  FwPrRelease(procDesc);
1508  return prTestCaseSuccess;
1509 }
1510 
1511 /*------------------------------------------------------------------------------------------------- */
1513  struct TestPrData sPrData;
1514  struct TestPrData* prData = &sPrData;
1515  FwPrDesc_t prDescBase, prDescDer;
1516 
1517  /* reset log */
1518  fwPrLogIndex = 0;
1519 
1520  /* Initialize data structures for the derive procedure */
1521  prData->counter_1 = 0;
1522  prData->flag_1 = 0;
1523  prData->flag_2 = 0;
1524  prData->flag_3 = 0;
1525  prData->flag_4 = 0;
1526  prData->flag_5 = 0;
1527  prData->flag_6 = 0;
1528  prData->marker = 1;
1529 
1530  /* Create the base procedure */
1531  prDescBase = FwPrMakeTestPR2(NULL);
1532  if (prDescBase==NULL)
1533  return prTestCaseFailure;
1534 
1535  /* Check configuration of base procedure */
1536  if (FwPrCheck(prDescBase) != prSuccess) {
1537  FwPrRelease(prDescBase);
1538  return prTestCaseFailure;
1539  }
1540 
1541  /* Create the derived procedure */
1542  prDescDer = FwPrCreateDer(prDescBase);
1543 
1544  /* Set the data structure for the derived procedure */
1545  FwPrSetData(prDescDer, prData);
1546 
1547  /* Check configuration of derived procedure */
1548  if (FwPrCheck(prDescDer) != prSuccess) {
1549  FwPrRelease(prDescBase);
1550  FwPrReleaseDer(prDescDer);
1551  return prTestCaseFailure;
1552  }
1553 
1554  /* Start procedure and check outcome of start operation */
1555  FwPrStart(prDescDer);
1556  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(prDescDer)!=-1)) {
1557  FwPrRelease(prDescBase);
1558  FwPrReleaseDer(prDescDer);
1559  return prTestCaseFailure;
1560  }
1561 
1562  /* Execute procedure and check that nothing happens (guard on control flow is false) */
1563  FwPrExecute(prDescDer);
1564  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(prDescDer)!=-1)) {
1565  FwPrRelease(prDescBase);
1566  FwPrReleaseDer(prDescDer);
1567  return prTestCaseFailure;
1568  }
1569 
1570  /* Make first guard true, execute procedure again, and check that procedure moves to N1 */
1571  prData->flag_1 = 1;
1572  FwPrExecute(prDescDer);
1573  if ((prData->counter_1!=1) || (fwPrLogIndex!=1) || (FwPrGetCurNode(prDescDer)!=N1)) {
1574  FwPrRelease(prDescBase);
1575  FwPrReleaseDer(prDescDer);
1576  return prTestCaseFailure;
1577  }
1578  if ((fwPrLogMarker[0]!=1) || (fwPrLogNode[0]!=1)) {
1579  FwPrRelease(prDescBase);
1580  FwPrReleaseDer(prDescDer);
1581  return prTestCaseFailure;
1582  }
1583 
1584  /* Release memory used by test procedure and return */
1585  FwPrRelease(prDescBase);
1586  FwPrReleaseDer(prDescDer);
1587  return prTestCaseSuccess;
1588 }
1589 
1590 /*------------------------------------------------------------------------------------------------- */
1592  struct TestPrData sPrData;
1593  struct TestPrData* prData = &sPrData;
1594  FwPrDesc_t prDescBase, prDescDer;
1595 
1596  /* Instantiate data structure for statically created derived procedure */
1597  FW_PR_INST_DER(prDescDerStatic,1,8) /* PR2 has 1 action and 8 guards */
1598 
1599  /* reset log */
1600  fwPrLogIndex = 0;
1601 
1602  /* Initialize data structures for the derive procedure */
1603  prData->counter_1 = 0;
1604  prData->flag_1 = 0;
1605  prData->flag_2 = 0;
1606  prData->flag_3 = 0;
1607  prData->flag_4 = 0;
1608  prData->flag_5 = 0;
1609  prData->flag_6 = 0;
1610  prData->marker = 1;
1611 
1612  /* Create the base procedure */
1613  prDescBase = FwPrMakeTestPR2(NULL);
1614  if (prDescBase==NULL)
1615  return prTestCaseFailure;
1616 
1617  /* Check configuration of base procedure */
1618  if (FwPrCheck(prDescBase) != prSuccess) {
1619  FwPrRelease(prDescBase);
1620  return prTestCaseFailure;
1621  }
1622 
1623  /* Create the derived procedure dynamically */
1624  prDescDer = FwPrCreateDer(prDescBase);
1625 
1626  /* Initialize the statically created derived procedure */
1627  FwPrInitDer(&prDescDerStatic, prDescBase);
1628 
1629  /* Check that derived procedures are clones of their base */
1630  if (!IsClone(prDescBase,prDescDer)) {
1631  FwPrRelease(prDescBase);
1632  FwPrReleaseDer(prDescDer);
1633  return prTestCaseFailure;
1634  }
1635  if (!IsClone(prDescBase,&prDescDerStatic)) {
1636  FwPrRelease(prDescBase);
1637  FwPrReleaseDer(prDescDer);
1638  return prTestCaseFailure;
1639  }
1640 
1641  FwPrRelease(prDescBase);
1642  FwPrReleaseDer(prDescDer);
1643  return prTestCaseSuccess;
1644 }
1645 
1646 /*------------------------------------------------------------------------------------------------- */
1648  struct TestPrData sPrData;
1649  struct TestPrData* prData = &sPrData;
1650  FwPrDesc_t prDescBase, prDescDer;
1651  const FwPrCounterS1_t nOfANodes = 3; /* Number of action nodes */
1652  const FwPrCounterS1_t nOfDNodes = 0; /* Number of decision nodes */
1653  const FwPrCounterS1_t nOfFlows = 4; /* Number of control flows */
1654  const FwPrCounterS1_t nOfActions = 1; /* Number of actions */
1655  const FwPrCounterS1_t nOfGuards = 1; /* Number of guards */
1656 
1657  /* reset log */
1658  fwPrLogIndex = 0;
1659 
1660  /* Initialize data structures for the derived procedure */
1661  prData->counter_1 = 0;
1662  prData->flag_1 = 0;
1663  prData->flag_2 = 0;
1664  prData->flag_3 = 0;
1665  prData->flag_4 = 0;
1666  prData->flag_5 = 0;
1667  prData->flag_6 = 0;
1668  prData->marker = 1;
1669 
1670  /* Create and configure the base procedure */
1671  prDescBase = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
1672  FwPrSetData(prDescBase, prData);
1673 
1674  FwPrAddActionNode(prDescBase, N1, &DummyAction);
1675  FwPrAddActionNode(prDescBase, N2, &DummyAction);
1676  FwPrAddActionNode(prDescBase, N3, &DummyAction);
1677 
1678  FwPrAddFlowIniToAct(prDescBase, N1, &DummyGuard);
1679  FwPrAddFlowActToAct(prDescBase, N1, N2, NULL);
1680  FwPrAddFlowActToAct(prDescBase, N2, N3, NULL);
1681  FwPrAddFlowActToFin(prDescBase, N3, NULL);
1682 
1683  /* Check configuration of base procedure */
1684  if (FwPrCheck(prDescBase) != prSuccess) {
1685  FwPrRelease(prDescBase);
1686  return prTestCaseFailure;
1687  }
1688 
1689  /* Attempt to override an action in the base procedure and check that an error is reported */
1690  FwPrOverrideAction(prDescBase, &DummyAction, &DummyActionBis);
1691  if (FwPrGetErrCode(prDescBase)!=prNotDerivedPr) {
1692  FwPrRelease(prDescBase);
1693  return prTestCaseFailure;
1694  }
1695 
1696  /* Attempt to override a guard in the base procedure and check that an error is reported */
1697  FwPrOverrideGuard(prDescBase, &DummyGuard, &DummyGuardBis);
1698  if (FwPrGetErrCode(prDescBase)!=prNotDerivedPr) {
1699  FwPrRelease(prDescBase);
1700  return prTestCaseFailure;
1701  }
1702  prDescBase->errCode = prSuccess; /* Force error code back to "success" */
1703 
1704  /* Create the derived procedure dynamically */
1705  prDescDer = FwPrCreateDer(prDescBase);
1706 
1707  /* Check configuration of derived procedure */
1708  if (FwPrCheck(prDescDer) != prSuccess) {
1709  FwPrReleaseDer(prDescDer);
1710  FwPrRelease(prDescBase);
1711  return prTestCaseFailure;
1712  }
1713 
1714  /* Attempt to override a non-existent action in the derived procedure */
1715  FwPrOverrideAction(prDescDer, &DummyActionBis, &DummyAction);
1716  if (FwPrGetErrCode(prDescDer)!=prUndefAction) {
1717  FwPrReleaseDer(prDescDer);
1718  FwPrRelease(prDescBase);
1719  return prTestCaseFailure;
1720  }
1721 
1722  /* Attempt to override a non-existent guard in the derived procedure */
1723  FwPrOverrideGuard(prDescDer, &DummyGuardBis, &DummyGuard);
1724  if (FwPrGetErrCode(prDescDer)!=prUndefGuard) {
1725  FwPrReleaseDer(prDescDer);
1726  FwPrRelease(prDescBase);
1727  return prTestCaseFailure;
1728  }
1729 
1730  FwPrReleaseDer(prDescDer);
1731  FwPrRelease(prDescBase);
1732  return prTestCaseSuccess;
1733 }
1734 
1735 /*------------------------------------------------------------------------------------------------- */
1737  struct TestPrData sPrData;
1738  struct TestPrData* prData = &sPrData;
1739  struct TestPrData sPrDataBase;
1740  struct TestPrData* prDataBase = &sPrDataBase;
1741  FwPrDesc_t prDescBase, prDescDer;
1742 
1743  /* reset log */
1744  fwPrLogIndex = 0;
1745 
1746  /* Initialize data structures for the base and derived procedure */
1747  prDataBase->counter_1 = 0;
1748  prDataBase->flag_1 = 0;
1749  prDataBase->flag_2 = 0;
1750  prDataBase->flag_3 = 0;
1751  prDataBase->flag_4 = 0;
1752  prDataBase->flag_5 = 0;
1753  prDataBase->flag_6 = 0;
1754  prDataBase->marker = 1;
1755 
1756  prData->counter_1 = 0;
1757  prData->flag_1 = 0;
1758  prData->flag_2 = 0;
1759  prData->flag_3 = 0;
1760  prData->flag_4 = 0;
1761  prData->flag_5 = 0;
1762  prData->flag_6 = 0;
1763  prData->marker = 1;
1764 
1765  /* Create the base procedure */
1766  prDescBase = FwPrMakeTestPR2(NULL);
1767  if (prDescBase==NULL)
1768  return prTestCaseFailure;
1769  FwPrSetData(prDescBase, prDataBase);
1770 
1771  /* Start and execute once the base procedure */
1772  FwPrStart(prDescBase);
1773  FwPrExecute(prDescBase);
1774 
1775  /* Check configuration of base procedure */
1776  if (FwPrCheck(prDescBase) != prSuccess) {
1777  FwPrRelease(prDescBase);
1778  return prTestCaseFailure;
1779  }
1780 
1781  /* Create the derived procedure (this replaces incrCnt1By1 with incrCnt1By8 and it
1782  * replaces retFlag1 with retFlag2) */
1783  prDescDer = FwPrMakeTestPRDer1(prDescBase, prData);
1784 
1785  /* Check configuration of derived procedure */
1786  if (FwPrCheck(prDescDer) != prSuccess) {
1787  FwPrRelease(prDescBase);
1788  FwPrReleaseDer(prDescDer);
1789  return prTestCaseFailure;
1790  }
1791 
1792  /* Start procedure and check outcome of start operation */
1793  FwPrStart(prDescDer);
1794  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(prDescDer)!=-1)) {
1795  FwPrRelease(prDescBase);
1796  FwPrReleaseDer(prDescDer);
1797  return prTestCaseFailure;
1798  }
1799 
1800  /* Execute procedure and check that nothing happens (guard on control flow out of initial
1801  * node is false) */
1802  FwPrExecute(prDescDer);
1803  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(prDescDer)!=-1)) {
1804  FwPrRelease(prDescBase);
1805  FwPrReleaseDer(prDescDer);
1806  return prTestCaseFailure;
1807  }
1808 
1809  /* Make guard on control flow out of initial node true, execute procedure again,
1810  * and check that procedure moves to N1 */
1811  prData->flag_2 = 1;
1812  prData->flag_3 = 1; /* this causes the procedure to terminate on the first execution */
1813  FwPrExecute(prDescDer);
1814  if ((prData->counter_1!=16) || (fwPrLogIndex!=2) || (FwPrGetCurNode(prDescDer)!=0)) {
1815  FwPrRelease(prDescBase);
1816  FwPrReleaseDer(prDescDer);
1817  return prTestCaseFailure;
1818  }
1819  if ((fwPrLogMarker[0]!=1) || (fwPrLogNode[0]!=N1)) {
1820  FwPrRelease(prDescBase);
1821  FwPrReleaseDer(prDescDer);
1822  return prTestCaseFailure;
1823  }
1824  if ((fwPrLogMarker[1]!=1) || (fwPrLogNode[1]!=N2)) {
1825  FwPrRelease(prDescBase);
1826  FwPrReleaseDer(prDescDer);
1827  return prTestCaseFailure;
1828  }
1829 
1830  /* Release memory used by test procedure and return */
1831  FwPrRelease(prDescBase);
1832  FwPrReleaseDer(prDescDer);
1833  return prTestCaseSuccess;
1834 }
1835 
1836 /*------------------------------------------------------------------------------------------------- */
1838  struct TestPrData sPrData;
1839  struct TestPrData* prData = &sPrData;
1840  struct TestPrData sPrDataBase;
1841  struct TestPrData* prDataBase = &sPrDataBase;
1842  FwPrDesc_t prDescBase, prDescDer;
1843 
1844  /* reset log */
1845  fwPrLogIndex = 0;
1846 
1847  /* Initialize data structures for the base and derived procedure */
1848  prData->counter_1 = 0;
1849  prData->flag_1 = 0;
1850  prData->flag_2 = 0;
1851  prData->flag_3 = 0;
1852  prData->flag_4 = 0;
1853  prData->flag_5 = 0;
1854  prData->flag_6 = 0;
1855  prData->marker = 1;
1856 
1857  prDataBase->counter_1 = 0;
1858  prDataBase->flag_1 = 0;
1859  prDataBase->flag_2 = 0;
1860  prDataBase->flag_3 = 0;
1861  prDataBase->flag_4 = 0;
1862  prDataBase->flag_5 = 0;
1863  prDataBase->flag_6 = 0;
1864  prDataBase->marker = 1;
1865 
1866  /* Create the base procedure */
1867  prDescBase = FwPrMakeTestPR2(NULL);
1868  if (prDescBase==NULL)
1869  return prTestCaseFailure;
1870  FwPrSetData(prDescBase, prDataBase);
1871 
1872  /* Start and execute once the base procedure */
1873  FwPrStart(prDescBase);
1874  FwPrExecute(prDescBase);
1875 
1876  /* Check configuration of base procedure */
1877  if (FwPrCheck(prDescBase) != prSuccess) {
1878  FwPrRelease(prDescBase);
1879  return prTestCaseFailure;
1880  }
1881 
1882  /* Create the derived procedure (this replaces incrCnt1By1 with incrCnt1By8 and it
1883  * replaces retFlag1 with retFlag2) */
1884  prDescDer = FwPrMakeTestPRDer1Static(prDescBase, prData);
1885 
1886  /* Check configuration of derived procedure */
1887  if (FwPrCheck(prDescDer) != prSuccess) {
1888  FwPrRelease(prDescBase);
1889  return prTestCaseFailure;
1890  }
1891 
1892  /* Start procedure and check outcome of start operation */
1893  FwPrStart(prDescDer);
1894  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(prDescDer)!=-1)) {
1895  FwPrRelease(prDescBase);
1896  return prTestCaseFailure;
1897  }
1898 
1899  /* Execute procedure and check that nothing happens (guard on control flow out of initial
1900  * node is false) */
1901  FwPrExecute(prDescDer);
1902  if ((prData->counter_1!=0) || (fwPrLogIndex!=0) || (FwPrGetCurNode(prDescDer)!=-1)) {
1903  FwPrRelease(prDescBase);
1904  return prTestCaseFailure;
1905  }
1906 
1907  /* Make guard on control flow out of initial node true, execute procedure again,
1908  * and check that procedure moves to N1 */
1909  prData->flag_2 = 1;
1910  prData->flag_3 = 1; /* this causes the procedure to terminate on the first execution */
1911  FwPrExecute(prDescDer);
1912  if ((prData->counter_1!=16) || (fwPrLogIndex!=2) || (FwPrGetCurNode(prDescDer)!=0)) {
1913  FwPrRelease(prDescBase);
1914  return prTestCaseFailure;
1915  }
1916  if ((fwPrLogMarker[0]!=1) || (fwPrLogNode[0]!=N1)) {
1917  FwPrRelease(prDescBase);
1918  return prTestCaseFailure;
1919  }
1920  if ((fwPrLogMarker[1]!=1) || (fwPrLogNode[1]!=N2)) {
1921  FwPrRelease(prDescBase);
1922  return prTestCaseFailure;
1923  }
1924 
1925  /* Release memory used by test procedure and return */
1926  FwPrRelease(prDescBase);
1927  return prTestCaseSuccess;
1928 }
1929 
1930 /*------------------------------------------------------------------------------------------------- */
1932  struct TestPrData sPrData;
1933  struct TestPrData* prData = &sPrData;
1934  FwPrDesc_t prDescBase, prDescDer;
1935 
1936  /* reset log */
1937  fwPrLogIndex = 0;
1938 
1939  /* Initialize data structures for the base procedure */
1940  prData->counter_1 = 0;
1941  prData->flag_1 = 1;
1942  prData->flag_2 = 0;
1943  prData->flag_3 = 0;
1944  prData->flag_4 = 0;
1945  prData->flag_5 = 0;
1946  prData->flag_6 = 0;
1947  prData->marker = 1;
1948 
1949  /* Create the base procedure */
1950  prDescBase = FwPrMakeTestPR2(prData);
1951 
1952  /* Check configuration of base procedure */
1953  if (FwPrCheck(prDescBase) != prSuccess) {
1954  FwPrRelease(prDescBase);
1955  return prTestCaseFailure;
1956  }
1957 
1958  /* Start and execute once the base procedure */
1959  FwPrStart(prDescBase);
1960  FwPrExecute(prDescBase);
1961 
1962  /* Force the error code of the base procedure */
1963  prDescBase->errCode = prTooManyActions;
1964 
1965  /* Create the derived procedure dynamically */
1966  prDescDer = FwPrCreateDer(prDescBase);
1967 
1968  /* Check configuration of derived procedure */
1969  if (FwPrCheck(prDescDer) != prConfigErr) {
1970  FwPrReleaseDer(prDescDer);
1971  FwPrRelease(prDescBase);
1972  return prTestCaseFailure;
1973  }
1974 
1975  /* Check state of derived procedure */
1976  if (FwPrGetCurNode(prDescDer)!=0) {
1977  FwPrReleaseDer(prDescDer);
1978  FwPrRelease(prDescBase);
1979  return prTestCaseFailure;
1980  }
1981 
1982  if (FwPrGetErrCode(prDescDer)!=prTooManyActions) {
1983  FwPrReleaseDer(prDescDer);
1984  FwPrRelease(prDescBase);
1985  return prTestCaseFailure;
1986  }
1987 
1988  /* Release memory used by test procedure and return */
1989  FwPrRelease(prDescBase);
1990  FwPrReleaseDer(prDescDer);
1991 
1992  return prTestCaseSuccess;
1993 }
1994 
1995 /*------------------------------------------------------------------------------------------------- */
1997 
1998  /* Create the base procedure (this procedure has 1 action and 3 guards */
1999  FwPrDesc_t prDescBase = FwPrMakeTestPR3(NULL);
2000 
2001  /* Instantiate a derived procedure with 2 action and 3 two guards */
2002  FW_PR_INST_DER(prDescDer1, 2, 3)
2003 
2004  /* Instantiate a derived procedure with 1 action and 4 two guards */
2005  FW_PR_INST_DER(prDescDer2, 1, 4)
2006 
2007  /* Attempt to initialize the first derived procedure and check that this fails because
2008  * the base and derived procedure do not have the same number of actions */
2009  FwPrInitDer(&prDescDer1, prDescBase);
2010  if (FwPrGetErrCode(&prDescDer1)!=prWrongNOfActions) {
2011  FwPrRelease(prDescBase);
2012  return prTestCaseFailure;
2013  }
2014 
2015  /* Attempt to initialize the second derived procedure and check that this fails because
2016  * the base and derived procedure do not have the same number of guards */
2017  FwPrInitDer(&prDescDer2, prDescBase);
2018  if (FwPrGetErrCode(&prDescDer2)!=prWrongNOfGuards) {
2019  FwPrRelease(prDescBase);
2020  return prTestCaseFailure;
2021  }
2022 
2023  FwPrRelease(prDescBase);
2024  return prTestCaseSuccess;
2025 }
2026 
2027 /*------------------------------------------------------------------------------------------------- */
2029  struct TestPrData sPrData;
2030  struct TestPrData* prData = &sPrData;
2031  FwPrDesc_t procDesc;
2032 
2033  /* reset log */
2034  fwPrLogIndex = 0;
2035 
2036  /* Create and initialize data structure to hold the state machine data */
2037  prData->counter_1 = 0;
2038  prData->flag_1 = 1;
2039  prData->flag_2 = 0;
2040  prData->flag_3 = 0;
2041  prData->flag_4 = 0;
2042  prData->flag_5 = 0;
2043  prData->flag_6 = 0;
2044  prData->marker = 1;
2045 
2046  /* Create test procedure */
2047  procDesc = FwPrMakeTestPR5(prData);
2048  if (procDesc==NULL)
2049  return prTestCaseFailure;
2050 
2051  /* Check configuration of procedure */
2052  if (FwPrCheck(procDesc)!=prSuccess) {
2053  FwPrRelease(procDesc);
2054  return prTestCaseFailure;
2055  }
2056 
2057  /* Start procedure */
2058  FwPrStart(procDesc);
2059  if ((prData->counter_1!=0) || (FwPrGetExecCnt(procDesc)!=0) || (FwPrGetCurNode(procDesc)!=-1) || (FwPrGetNodeExecCnt(procDesc)!=0)) {
2060  FwPrRelease(procDesc);
2061  return prTestCaseFailure;
2062  }
2063 
2064  /* Execute procedure and check counters */
2065  FwPrExecute(procDesc);
2066  if ((prData->counter_1!=1) || (FwPrGetExecCnt(procDesc)!=1) || (FwPrGetCurNode(procDesc)!=N1) || (FwPrGetNodeExecCnt(procDesc)!=0)) {
2067  FwPrRelease(procDesc);
2068  return prTestCaseFailure;
2069  }
2070  FwPrExecute(procDesc);
2071  FwPrExecute(procDesc);
2072  if ((prData->counter_1!=1) || (FwPrGetExecCnt(procDesc)!=3) || (FwPrGetCurNode(procDesc)!=N1) || (FwPrGetNodeExecCnt(procDesc)!=2)) {
2073  FwPrRelease(procDesc);
2074  return prTestCaseFailure;
2075  }
2076 
2077  /* Execute procedure again -- this should trigger transition to N2 */
2078  FwPrExecute(procDesc);
2079  if ((prData->counter_1!=4) || (FwPrGetExecCnt(procDesc)!=4) || (FwPrGetCurNode(procDesc)!=N2) || (FwPrGetNodeExecCnt(procDesc)!=0)) {
2080  FwPrRelease(procDesc);
2081  return prTestCaseFailure;
2082  }
2083 
2084  /* Execute procedure again -- procedure remains in N2 */
2085  FwPrExecute(procDesc);
2086  if ((prData->counter_1!=4) || (FwPrGetExecCnt(procDesc)!=5) || (FwPrGetCurNode(procDesc)!=N2) || (FwPrGetNodeExecCnt(procDesc)!=1)) {
2087  FwPrRelease(procDesc);
2088  return prTestCaseFailure;
2089  }
2090 
2091  /* Stop procedure and verify that counters are not reset */
2092  FwPrStop(procDesc);
2093  if ((FwPrGetExecCnt(procDesc)!=5) || (FwPrIsStarted(procDesc)!=0) || (FwPrGetNodeExecCnt(procDesc)!=1)) {
2094  FwPrRelease(procDesc);
2095  return prTestCaseFailure;
2096  }
2097 
2098  /* Start procedure and verify that counters are reset */
2099  FwPrStart(procDesc);
2100  if ((FwPrGetExecCnt(procDesc)!=0) || (FwPrIsStarted(procDesc)!=1) || (FwPrGetNodeExecCnt(procDesc)!=0)) {
2101  FwPrRelease(procDesc);
2102  return prTestCaseFailure;
2103  }
2104 
2105  /* Release memory used by test procedure and return */
2106  FwPrRelease(procDesc);
2107  return prTestCaseSuccess;
2108 }
2109 
2110 /*------------------------------------------------------------------------------------------------- */
2112  struct TestPrData sPrData;
2113  struct TestPrData* prData = &sPrData;
2114  FwPrDesc_t prDescBase;
2115 
2116  /* Instantiate data structure for statically created derived procedure */
2117  FW_PR_INST_DER(prDescDerStatic,1,8) /* PR2 has 1 action and 8 guards */
2118 
2119  /* reset log */
2120  fwPrLogIndex = 0;
2121 
2122  /* Initialize data structures for the base procedure */
2123  prData->counter_1 = 0;
2124  prData->flag_1 = 1;
2125  prData->flag_2 = 0;
2126  prData->flag_3 = 0;
2127  prData->flag_4 = 0;
2128  prData->flag_5 = 0;
2129  prData->flag_6 = 0;
2130  prData->marker = 1;
2131 
2132  /* Create the base procedure */
2133  prDescBase = FwPrMakeTestPR2(prData);
2134 
2135  /* Check configuration of base procedure */
2136  if (FwPrCheck(prDescBase) != prSuccess) {
2137  FwPrRelease(prDescBase);
2138  return prTestCaseFailure;
2139  }
2140 
2141  /* Start and execute once the base procedure */
2142  FwPrStart(prDescBase);
2143  FwPrExecute(prDescBase);
2144 
2145  /* Force the error code of the base procedure */
2146  prDescBase->errCode = prTooManyActions;
2147 
2148  /* Initialize the derived procedure from the base procedure */
2149  FwPrInitDer(&prDescDerStatic, prDescBase);
2150 
2151  /* Check configuration of derived procedure */
2152  if (FwPrCheck(&prDescDerStatic) != prConfigErr) {
2153  FwPrRelease(prDescBase);
2154  return prTestCaseFailure;
2155  }
2156 
2157  /* Check state of derived procedure */
2158  if (FwPrGetCurNode(&prDescDerStatic)!=0) {
2159  FwPrRelease(prDescBase);
2160  return prTestCaseFailure;
2161  }
2162 
2163  if (FwPrGetErrCode(&prDescDerStatic)!=prTooManyActions) {
2164  FwPrRelease(prDescBase);
2165  return prTestCaseFailure;
2166  }
2167 
2168  /* Release memory used by test procedure and return */
2169  FwPrRelease(prDescBase);
2170 
2171  return prTestCaseSuccess;
2172 }
2173 
2174 /*------------------------------------------------------------------------------------------------- */
2176  struct TestPrData sPrData;
2177  struct TestPrData* prData = &sPrData;
2178  FwPrDesc_t procDesc1;
2179  FwPrDesc_t procDesc2;
2180  FwPrDesc_t procDesc3;
2181 
2182  /* reset log */
2183  fwPrLogIndex = 0;
2184 
2185  /* Create and initialize data structure to hold the state machine data */
2186  prData->counter_1 = 0;
2187  prData->flag_1 = 1;
2188  prData->flag_2 = 1;
2189  prData->flag_3 = 1;
2190  prData->flag_4 = 0;
2191  prData->flag_5 = 0;
2192  prData->flag_6 = 0;
2193  prData->marker = 1;
2194 
2195  /* Create test procedures */
2196  procDesc1 = FwPrMakeTestPR6_1(prData);
2197  procDesc2 = FwPrMakeTestPR6_2(prData);
2198  procDesc3 = FwPrMakeTestPR6_3(prData);
2199  if ((procDesc1==NULL) || (procDesc2==NULL) || (procDesc3==NULL))
2200  return prTestCaseFailure;
2201 
2202  /* Start procedures */
2203  FwPrStart(procDesc1);
2204  FwPrStart(procDesc2);
2205  FwPrStart(procDesc3);
2206 
2207  /* Execute procedures once */
2208  FwPrExecute(procDesc1);
2209  FwPrExecute(procDesc2);
2210  FwPrExecute(procDesc3);
2211  if ((FwPrGetCurNode(procDesc1)!=N1) || (FwPrGetCurNode(procDesc2)!=N3) || (FwPrGetCurNode(procDesc3)!=N2)) {
2212  FwPrRelease(procDesc1);
2213  FwPrRelease(procDesc2);
2214  FwPrRelease(procDesc3);
2215  return prTestCaseFailure;
2216  }
2217 
2218  /* Reset flag_1 */
2219  prData->flag_1 = 0;
2220 
2221  /* Stop and restart procedures */
2222  FwPrStop(procDesc1);
2223  FwPrStop(procDesc2);
2224  FwPrStop(procDesc3);
2225  FwPrStart(procDesc1);
2226  FwPrStart(procDesc2);
2227  FwPrStart(procDesc3);
2228 
2229  /* Execute procedures once */
2230  FwPrExecute(procDesc1);
2231  FwPrExecute(procDesc2);
2232  FwPrExecute(procDesc3);
2233  if ((FwPrGetCurNode(procDesc1)!=N2) || (FwPrGetCurNode(procDesc2)!=N3) || (FwPrGetCurNode(procDesc3)!=N2)) {
2234  FwPrRelease(procDesc1);
2235  FwPrRelease(procDesc2);
2236  FwPrRelease(procDesc3);
2237  return prTestCaseFailure;
2238  }
2239 
2240  /* Release memory used by test procedure and return */
2241  FwPrRelease(procDesc1);
2242  FwPrRelease(procDesc2);
2243  FwPrRelease(procDesc3);
2244  return prTestCaseSuccess;
2245 }
2246 
2247 /*------------------------------------------------------------------------------------------------- */
2249  FwPrDesc_t prDesc;
2250  const FwPrCounterS1_t nOfANodes = 2;
2251  const FwPrCounterS1_t nOfDNodes = 0;
2252  const FwPrCounterS1_t nOfFlows = 3;
2253  const FwPrCounterS1_t nOfActions = 1;
2254  const FwPrCounterS1_t nOfGuards = 0;
2255 
2256  /* Create the procedure */
2257  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
2258  if (prDesc == NULL)
2259  return prTestCaseFailure;
2260 
2261  /* Define the procedure */
2262  FwPrAddActionNode(prDesc, N1, &DummyAction);
2263  FwPrAddActionNode(prDesc, N2, &DummyAction);
2264  FwPrAddFlowIniToAct(prDesc, N1, NULL);
2265  FwPrAddFlowActToFin(prDesc, N2, NULL);
2266  FwPrAddFlowActToFin(prDesc, N1, NULL);
2267 
2268  /* Verify that configuration check fails */
2269  if (FwPrCheck(prDesc) != prUnreachableANode) {
2270  FwPrRelease(prDesc);
2271  return prTestCaseFailure;
2272  }
2273 
2274  /* Release memory used by test procedure and return */
2275  FwPrRelease(prDesc);
2276  return prTestCaseSuccess;
2277 }
2278 
2279 /*------------------------------------------------------------------------------------------------- */
2281  FwPrDesc_t prDesc;
2282  const FwPrCounterS1_t nOfANodes = 1;
2283  const FwPrCounterS1_t nOfDNodes = 1;
2284  const FwPrCounterS1_t nOfFlows = 4;
2285  const FwPrCounterS1_t nOfActions = 1;
2286  const FwPrCounterS1_t nOfGuards = 0;
2287 
2288  /* Create the procedure */
2289  prDesc = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
2290  if (prDesc == NULL)
2291  return prTestCaseFailure;
2292 
2293  /* Define the procedure */
2294  FwPrAddActionNode(prDesc, N1, &DummyAction);
2295  FwPrAddDecisionNode(prDesc, D1, 2);
2296  FwPrAddFlowIniToAct(prDesc, N1, NULL);
2297  FwPrAddFlowActToFin(prDesc, N1, NULL);
2298  FwPrAddFlowDecToFin(prDesc, D1, NULL);
2299  FwPrAddFlowDecToFin(prDesc, D1, NULL);
2300 
2301  /* Verify that configuration check fails */
2302  if (FwPrCheck(prDesc) != prUnreachableDNode) {
2303  FwPrRelease(prDesc);
2304  return prTestCaseFailure;
2305  }
2306 
2307  /* Release memory used by test procedure and return */
2308  FwPrRelease(prDesc);
2309  return prTestCaseSuccess;
2310 }
2311 
FwPrTestOutcome_t FwPrTestCaseDerCheck1()
Verify that a derived procedure is, at the time it is created, a structural clone of its base procedu...
FwPrTestOutcome_t FwPrTestCaseCheck5()
Test the ability of the functions which add a control flow to a procedure to detect and report a conf...
FwPrDesc_t FwPrMakeTestPR1Static(struct TestPrData *prData)
Operation to create and configure the procedure PR1 (see FwPrMakeTestPR1 and figure below) statically...
Definition: FwPrMakeTest.c:205
The number of actions added to the procedure is smaller than the number of actions declared when the ...
FwPrCounterS1_t nOfGuards
the number of guards in the procedure
Definition: FwPrPrivate.h:264
An action node is added to a procedure with an illegal (out-of-range) identifier. ...
The number of guards in the base procedure is not the same as in the derived procedure.
Definition: FwPrConstants.h:99
FwPrTestOutcome_t FwPrTestCaseCheck2()
Test the ability of the FwPrCreate function to catch configuration errors.
The number of guards added to the procedure is smaller than the number of guards declared when the pr...
FwPrCounterU3_t FwPrGetNodeExecCnt(FwPrDesc_t prDesc)
Return the Node Execution Counter.
Definition: FwPrCore.c:141
A decision node is added to a procedure with an illegal (out-of-range) identifier.
void FwPrInitDer(FwPrDesc_t prDesc, FwPrDesc_t prDescBase)
Initialize a procedure descriptor to extend another procedure (the base procedure).
Definition: FwPrSCreate.c:51
#define LOG_ARRAY_SIZE
Size of the log arrays.
Definition: FwPrMakeTest.h:46
The overridden guard in a derived procedure does not exist.
FwPrTestOutcome_t FwPrTestCaseCheck13()
Verify the ability of the FwPrCheck function to detect and report a situation where there is an unrea...
FwPrTestOutcome_t FwPrTestCaseDer2()
Create a derived procedure by extending state machine PR2 (see FwPrMakeTestPR2) and by overriding one...
The number of guards added to the procedure exceeds the number of guards declared when the procedure ...
FwPrTestOutcome_t FwPrTestCaseRun1()
Verify the Run command on a procedure.
The overridden action in a derived procedure does not exist.
void FwPrOverrideGuard(FwPrDesc_t prDesc, FwPrGuard_t oldGuard, FwPrGuard_t newGuard)
Override a guard in a derived procedure.
Definition: FwPrConfig.c:448
int flag_6
Flag used in the procedure control flows.
Definition: FwPrMakeTest.h:79
FwPrTestOutcome_t FwPrTestCaseExecute6()
Test a procedure which has one single action node and no guards.
An action node is defined with a null action.
An error was encountered while executing a transition in a procedure (see FwPrExecute).
void FwPrAddFlowIniToDec(FwPrDesc_t prDesc, FwPrCounterS1_t destId, FwPrGuard_t cfGuard)
Create a control flow from the initial node to a decision node and add it to a procedure.
Definition: FwPrConfig.c:180
FwPrTestOutcome_t FwPrTestCaseCheck6()
Verify the ability of the FwPrCheck function to detect and report a situation where there is an uncon...
FwPrCounterS1_t nOfActions
the number of actions in the procedure
Definition: FwPrPrivate.h:262
The number of actions in the base procedure is not the same as in the derived procedure.
Definition: FwPrConstants.h:94
A configuration error has been detected during the procedure configuration process.
An action node is added twice to the same procedure.
FwPrTestOutcome_t FwPrTestCaseExecute1()
Test the Execute command on a procedure which is stopped.
FwPrTestOutcome_t FwPrTestCaseCheck9()
Verify the ability of the FwPrCheck function to detect and report a situation where there is a contro...
FwPrTestOutcome_t FwPrTestCaseDerCheck3()
Verify the correctness of the initial state of a derived procedure.
A choice pseudo-state is added to a procedure with less than 2 out-going control flows.
FwPrDesc_t FwPrMakeTestPR4(struct TestPrData *prData)
Operation to create the test procedure PR4.
Definition: FwPrMakeTest.c:404
FwPrTestOutcome_t FwPrTestCaseExecute2()
Test the Execute command on control flows from the initial nodes and between action nodes...
PrBaseDesc_t * prBase
pointer to the base descriptor
Definition: FwPrPrivate.h:256
int flag_2
Flag used in the procedure control flows.
Definition: FwPrMakeTest.h:71
FwPrDesc_t FwPrMakeTestPR2Dir(struct TestPrData *prData)
Operation to create the test procedure PR2 (see FwPrMakeTestPR2 and figure below) directly by instant...
Definition: FwPrMakeTest.c:267
The procedure has an action node which is not a destination of any control flow.
FwPrDesc_t FwPrMakeTestPR2Static(struct TestPrData *prData)
Operation to create and configure the procedure PR2 (see FwPrMakeTestPR2 and figure below) statically...
Definition: FwPrMakeTest.c:347
FwPrDesc_t FwPrMakeTestPR3(struct TestPrData *prData)
Operation to create the test procedure PR3.
Definition: FwPrMakeTest.c:380
Header file to define all constants and types for the procedure module of the FW Profile.
A control flow is added to a procedure with an illegal (out-of-range) decision node destination...
#define N1
An action node identifier.
Definition: FwPrMakeTest.h:34
#define N2
An action node identifier.
Definition: FwPrMakeTest.h:36
void FwPrAddFlowDecToFin(FwPrDesc_t prDesc, FwPrCounterS1_t srcId, FwPrGuard_t cfGuard)
Create a control flow from a decision node to the final node and add it to a procedure.
Definition: FwPrConfig.c:210
void FwPrStop(FwPrDesc_t prDesc)
Stop a procedure.
Definition: FwPrCore.c:38
A node is added to a procedure which has more out-going transitions than fit into the control flow ar...
int FwPrBool_t
Type used for booleans (0 is "false" and 1 is "true").
Definition: FwPrConstants.h:48
FwPrTestOutcome_t FwPrTestCaseCheck1()
Test the ability of the FwPrCheck function to detect configuration errors.
void FwPrOverrideAction(FwPrDesc_t prDesc, FwPrAction_t oldAction, FwPrAction_t newAction)
Override an action in a derived procedure.
Definition: FwPrConfig.c:429
int flag_1
Flag used in the procedure control flows.
Definition: FwPrMakeTest.h:69
int flag_4
Flag used in the procedure control flows.
Definition: FwPrMakeTest.h:75
int flag_5
Flag used in the procedure control flows.
Definition: FwPrMakeTest.h:77
A control flow is added to a SM with a source which has an illegal value.
FwPrDesc_t FwPrMakeTestPR6_2(struct TestPrData *prData)
Operation to create the test procedure PR6.
Definition: FwPrMakeTest.c:492
void FwPrRelease(FwPrDesc_t prDesc)
Release the memory which was allocated when the procedure descriptor was created. ...
Definition: FwPrDCreate.c:175
FwPrTestOutcome_t FwPrTestCaseDerCheck2()
Verify the ability of the functions which override an action or a guard in a derived procedure to det...
There is an undefined control flow in a procedure.
int fwPrLogMarker[LOG_ARRAY_SIZE]
Array where procedure actions write their marker.
Definition: FwPrMakeTest.c:26
FwPrTestOutcome_t FwPrTestCaseExecute5Static()
Test the behaviour of a procedure created statically.
FwPrDesc_t FwPrMakeTestPR6_1(struct TestPrData *prData)
Operation to create the test procedure PR6.
Definition: FwPrMakeTest.c:460
void FwPrAddFlowActToFin(FwPrDesc_t prDesc, FwPrCounterS1_t srcId, FwPrGuard_t cfGuard)
Create a control flow from an action node to the final node and add it to a procedure.
Definition: FwPrConfig.c:205
The procedure has a decision node which is not a destination of any control flow. ...
void FwPrAddFlowActToAct(FwPrDesc_t prDesc, FwPrCounterS1_t srcId, FwPrCounterS1_t destId, FwPrGuard_t cfGuard)
Create a control flow from an action node to another action node and add it to a procedure.
Definition: FwPrConfig.c:185
FwPrTestOutcome_t FwPrTestCaseCheck8()
Verify the ability of the FwPrCheck function to detect and report a situation where there is an uncon...
FwPrTestOutcome_t FwPrTestCaseStart1()
Test the Start command for the test procedure PR2.
FwPrDesc_t FwPrCreate(FwPrCounterS1_t nOfANodes, FwPrCounterS1_t nOfDNodes, FwPrCounterS1_t nOfFlows, FwPrCounterS1_t nOfActions, FwPrCounterS1_t nOfGuards)
Create a new procedure descriptor.
Definition: FwPrDCreate.c:23
#define FW_PR_INST_DER(PR_DESC, NA, NG)
Instantiate a descriptor for a derived procedure.
Definition: FwPrSCreate.h:197
FwPrDesc_t FwPrCreateDer(FwPrDesc_t prDesc)
Create the descriptor of a derived procedure.
Definition: FwPrDCreate.c:132
There is an undefined decision node in a procedure.
FwPrCounterU3_t FwPrGetExecCnt(FwPrDesc_t prDesc)
Return the Procedure Execution Counter.
Definition: FwPrCore.c:136
FwPrTestOutcome_t FwPrTestCaseDer3()
Create a derived procedure by extending state machine PR2 (see FwPrMakeTestPR2) and by overriding one...
FwPrTestOutcome_t FwPrTestCaseExecute5()
Test a sequence of Execute command which triggers the execution of a linear sequence of actions nodes...
void FwPrSetData(FwPrDesc_t prDesc, void *prData)
Set the pointer to the procedure data in the procedure descriptor.
Definition: FwPrConfig.c:82
int fwPrLogNode[LOG_ARRAY_SIZE]
Array where procedure actions write the state of their SM.
Definition: FwPrMakeTest.c:31
FwPrTestOutcome_t FwPrTestCaseExecute4()
Test an Execute command which triggers the execution of a loop in the procedure.
FwPrTestOutcome_t FwPrTestCaseExecute8()
Verify the functionalities associated to the Procedure Execution Counter and to the Node Execution Co...
FwPrDesc_t FwPrMakeTestPRDer1Static(FwPrDesc_t prDescBase, struct TestPrData *prData)
Create a derived procedure and override one of its actions and one of its guards. ...
Definition: FwPrMakeTest.c:568
void FwPrReleaseDer(FwPrDesc_t prDesc)
Release the memory allocated to a derived procedure descriptor.
Definition: FwPrDCreate.c:205
FwPrErrCode_t errCode
either &#39;success&#39; or the code of the last error encountered by the procedure
Definition: FwPrPrivate.h:270
FwPrDesc_t FwPrMakeTestPR2(struct TestPrData *prData)
Operation to create the test procedure PR2.
Definition: FwPrMakeTest.c:230
FwRtOutcome_t DummyAction(FwRtDesc_t rtDesc)
Dummy function which always returns 1.
Definition: FwRtConfig.c:262
FwPrTestOutcome_t FwPrTestCaseCheck10()
Verify the ability of the FwPrCheck function to detect and report a situation where there is a contro...
The number of actions added to the procedure exceeds the number of actions declared when the procedur...
Test case failure.
Definition: FwPrTestCases.h:31
The procedure where an action or a guard is overridden or a procedure is embedded is not a derived pr...
Declaration of the static creation interface for a FW Procedure.
FwPrDesc_t FwPrMakeTestPR5(struct TestPrData *prData)
Operation to create the test procedure PR5.
Definition: FwPrMakeTest.c:432
FwPrTestOutcome_t FwPrTestCaseExecute7()
Test a procedure which has one decision node directly connected to the initial node.
FwPrTestOutcome_t FwPrTestCaseStop1()
Test the Stop command for the test procedure PR2.
Return codes of a function which has completed execution without errors.
Definition: FwPrConstants.h:85
FwPrTestOutcome_t FwPrTestCaseCheck14()
Verify the ability of the FwPrCheck function to detect and report a situation where there is an unrea...
void FwPrExecute(FwPrDesc_t prDesc)
Execute a procedure.
Definition: FwPrCore.c:43
void FwPrAddDecisionNode(FwPrDesc_t prDesc, FwPrCounterS1_t nodeId, FwPrCounterS1_t nOfOutFlows)
Create a decision node with the given characteristics and add it to a procedure.
Definition: FwPrConfig.c:134
Declaration of functions to create and configure test procedures.
A control flow is added to a procedure with a source (either a state or a source choice pseudo-state)...
signed char FwPrCounterS1_t
Type used for signed counters with a "short" range.
Definition: FwPrConstants.h:78
Structure representing a procedure descriptor.
Definition: FwPrPrivate.h:254
FwPrTestOutcome_t FwPrTestCaseExecute9()
Verify the order of evaluation of the control flow guards.
FwPrAction_t * prActions
the procedure actions
Definition: FwPrPrivate.h:258
#define N3
An action node identifier.
Definition: FwPrMakeTest.h:38
FwPrTestOutcome_t FwPrTestCaseCheck4()
Test the response to a situation where all flows out of a decision node have a false guard...
FwPrDesc_t FwPrMakeTestPR1(struct TestPrData *prData)
Operation to create the test procedure PR1.
Definition: FwPrMakeTest.c:177
A control flow from a certain source is added to a procedure but there isn&#39;t space for it in the cont...
FwPrTestOutcome_t FwPrTestCaseCheck3()
Test the ability of the FwPrAddActionNode and FwPrAddDecisionNode to catch configuration errors...
FwPrTestOutcome_t FwPrTestCaseDerCheck4()
Verify the ability of function FwPrInitDer to detect and report errors.
A decision node is added twice to the same procedure.
FwPrBool_t FwPrIsStarted(FwPrDesc_t prDesc)
Check whether the procedure is started.
Definition: FwPrCore.c:122
FwPrDesc_t FwPrMakeTestPR6_3(struct TestPrData *prData)
Operation to create the test procedure PR6.
Definition: FwPrMakeTest.c:524
FwPrCounterS1_t FwPrGetCurNode(FwPrDesc_t prDesc)
Return the identifier of the current action node in a procedure.
Definition: FwPrCore.c:117
int counter_1
Counter incremented by the procedure actions.
Definition: FwPrMakeTest.h:65
FwPrTestOutcome_t FwPrTestCaseExecute3()
Test an Execute command which triggers the traversal of several nodes.
int marker
Procedure&#39;s marker.
Definition: FwPrMakeTest.h:67
FwPrDesc_t FwPrMakeTestPRDer1(FwPrDesc_t prDescBase, struct TestPrData *prData)
Create a derived procedure and override one of its actions and one of its guards. ...
Definition: FwPrMakeTest.c:555
There is an undefined action node in a procedure.
void FwPrAddFlowIniToAct(FwPrDesc_t prDesc, FwPrCounterS1_t destId, FwPrGuard_t cfGuard)
Create a control flow from the initial node to an action node and add it to a procedure.
Definition: FwPrConfig.c:175
FwPrTestOutcome_t FwPrTestCaseCheck12()
Verify the ability of the FwPrCheck function to detect and report a situation where there is an undef...
Declaration of the dynamical creation interface for a FW Procedure.
void FwPrAddActionNode(FwPrDesc_t prDesc, FwPrCounterS1_t nodeId, FwPrAction_t action)
Create an action node with the given characteristics and add it to a procedure.
Definition: FwPrConfig.c:92
int fwPrLogIndex
Index for write operations in log arrays.
Definition: FwPrMakeTest.c:35
#define D1
A decision node identifier.
Definition: FwPrMakeTest.h:41
Test case success.
Definition: FwPrTestCases.h:27
FwPrErrCode_t FwPrCheck(FwPrDesc_t prDesc)
Check the correctness and completeness of the configuration of a procedure descriptor.
Definition: FwPrConfig.c:341
Declaration of the test cases for the FW Procedure Module.
FwPrTestOutcome_t FwPrTestCaseDer1()
Create a derived procedure by extending state machine PR2 (see FwPrMakeTestPR2) and then verify that ...
FwPrTestOutcome_t
Outcome of a procedure test case.
Definition: FwPrTestCases.h:23
FwPrTestOutcome_t FwPrTestCaseCheck7()
Verify the ability of the FwPrCheck function to detect and report a situation where there is an uncon...
FwPrGuard_t * prGuards
the control flow guards in the procedure
Definition: FwPrPrivate.h:260
FwPrTestOutcome_t FwPrTestCaseCheck11()
Verify the ability of the FwPrCheck function to detect and report a situation where there is an undef...
Type for the data structure passed to all procedures made by the functions declared by this header fi...
Definition: FwPrMakeTest.h:63
A control flow is added to a procedure with an illegal (out-of-range) action node destination...
FwPrTestOutcome_t FwPrTestCaseExecute4Dir()
Test the behaviour of a procedure created by directly instantiating and configuring its data structur...
int flag_3
Flag used in the procedure control flows.
Definition: FwPrMakeTest.h:73
FwPrTestOutcome_t FwPrTestCaseDerCheck5()
Verify the correctness of the initial state of a derived procedure.
void FwPrAddFlowDecToAct(FwPrDesc_t prDesc, FwPrCounterS1_t srcId, FwPrCounterS1_t destId, FwPrGuard_t cfGuard)
Create a control flow from a decision node to an action node and add it to a procedure.
Definition: FwPrConfig.c:195
FwPrTestOutcome_t FwPrTestCaseExecute4Static()
Test the behaviour of a procedure created statically.
void FwPrStart(FwPrDesc_t prDesc)
Start a procedure.
Definition: FwPrCore.c:29
FwPrErrCode_t FwPrGetErrCode(FwPrDesc_t prDesc)
Return the error code of the argument procedure.
Definition: FwPrCore.c:131
void FwPrRun(FwPrDesc_t prDesc)
Run a procedure.
Definition: FwPrCore.c:109
P&P Software GmbH, Copyright 2011, All Rights Reserved