source: rtems-central/rtemsspec/tests/test_validation.py @ a581446

Last change on this file since a581446 was a581446, checked in by Sebastian Huber <sebastian.huber@…>, on 08/04/20 at 10:01:59

validation: Fix N/A scope description

  • Property mode set to 100644
File size: 34.8 KB
Line 
1# SPDX-License-Identifier: BSD-2-Clause
2""" Unit tests for the rtemsspec.validation module. """
3
4# Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12#    notice, this list of conditions and the following disclaimer in the
13#    documentation and/or other materials provided with the distribution.
14#
15# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25# POSSIBILITY OF SUCH DAMAGE.
26
27import os
28import pytest
29
30from rtemsspec.validation import generate
31from rtemsspec.items import EmptyItemCache, ItemCache
32from rtemsspec.tests.util import create_item_cache_config_and_copy_spec
33
34
35def test_validation(tmpdir):
36    validation_config = {}
37    base_directory = os.path.join(tmpdir, "base")
38    validation_config["base-directory"] = base_directory
39
40    generate(validation_config, EmptyItemCache())
41
42    item_cache_config = create_item_cache_config_and_copy_spec(
43        tmpdir, "spec-validation", with_spec_types=True)
44    generate(validation_config, ItemCache(item_cache_config))
45
46    with open(os.path.join(base_directory, "ts.c"), "r") as src:
47        content = """/* SPDX-License-Identifier: BSD-2-Clause */
48
49/**
50 * @file
51 *
52 * @ingroup RTEMSTestSuiteBlueGreen
53 */
54
55/*
56 * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
57 *
58 * Redistribution and use in source and binary forms, with or without
59 * modification, are permitted provided that the following conditions
60 * are met:
61 * 1. Redistributions of source code must retain the above copyright
62 *    notice, this list of conditions and the following disclaimer.
63 * 2. Redistributions in binary form must reproduce the above copyright
64 *    notice, this list of conditions and the following disclaimer in the
65 *    documentation and/or other materials provided with the distribution.
66 *
67 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
68 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
69 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
70 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
71 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
72 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
73 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
74 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
75 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
76 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
77 * POSSIBILITY OF SUCH DAMAGE.
78 */
79
80#ifdef HAVE_CONFIG_H
81#include "config.h"
82#endif
83
84#include <blue.h>
85
86#include "green.h"
87
88#include <rtems/test.h>
89
90/**
91 * @defgroup RTEMSTestSuiteBlueGreen Blue Green
92 *
93 * @ingroup RTEMSTestSuites
94 *
95 * @brief Test Suite
96 *
97 * The Blue Green description.
98 *
99 * @{
100 */
101
102/* Blue green code */
103
104/** @} */
105"""
106        assert content == src.read()
107
108    with open(os.path.join(base_directory, "tc12.c"), "r") as src:
109        content = """/* SPDX-License-Identifier: BSD-2-Clause */
110
111/**
112 * @file
113 *
114 * @ingroup RTEMSTestCaseClassicTaskIdentification
115 * @ingroup RTEMSTestCaseTestCase
116 * @ingroup RTEMSTestCaseTestCase2
117 */
118
119/*
120 * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
121 *
122 * Redistribution and use in source and binary forms, with or without
123 * modification, are permitted provided that the following conditions
124 * are met:
125 * 1. Redistributions of source code must retain the above copyright
126 *    notice, this list of conditions and the following disclaimer.
127 * 2. Redistributions in binary form must reproduce the above copyright
128 *    notice, this list of conditions and the following disclaimer in the
129 *    documentation and/or other materials provided with the distribution.
130 *
131 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
132 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
133 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
134 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
135 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
136 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
137 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
138 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
139 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
140 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
141 * POSSIBILITY OF SUCH DAMAGE.
142 */
143
144#ifdef HAVE_CONFIG_H
145#include "config.h"
146#endif
147
148#include <a.h>
149#include <b.h>
150#include <rtems.h>
151
152#include "x.h"
153#include "y.h"
154
155#include <rtems/test.h>
156
157/**
158 * @defgroup RTEMSTestCaseClassicTaskIdentification Classic Task Identification
159 *
160 * @ingroup RTEMSTestSuiteBlueGreen
161 *
162 * @brief Test Case
163 *
164 * @{
165 */
166
167typedef enum {
168  ClassicTaskIdentification_Pre_Name_Invalid,
169  ClassicTaskIdentification_Pre_Name_Self,
170  ClassicTaskIdentification_Pre_Name_Valid,
171  ClassicTaskIdentification_Pre_Name_NA
172} ClassicTaskIdentification_Pre_Name;
173
174typedef enum {
175  ClassicTaskIdentification_Pre_Node_Local,
176  ClassicTaskIdentification_Pre_Node_Remote,
177  ClassicTaskIdentification_Pre_Node_Invalid,
178  ClassicTaskIdentification_Pre_Node_SearchAll,
179  ClassicTaskIdentification_Pre_Node_SearchOther,
180  ClassicTaskIdentification_Pre_Node_SearchLocal,
181  ClassicTaskIdentification_Pre_Node_NA
182} ClassicTaskIdentification_Pre_Node;
183
184typedef enum {
185  ClassicTaskIdentification_Pre_Id_NullPtr,
186  ClassicTaskIdentification_Pre_Id_Valid,
187  ClassicTaskIdentification_Pre_Id_NA
188} ClassicTaskIdentification_Pre_Id;
189
190typedef enum {
191  ClassicTaskIdentification_Post_Status_Ok,
192  ClassicTaskIdentification_Post_Status_InvAddr,
193  ClassicTaskIdentification_Post_Status_InvName,
194  ClassicTaskIdentification_Post_Status_InvNode,
195  ClassicTaskIdentification_Post_Status_InvId,
196  ClassicTaskIdentification_Post_Status_NA
197} ClassicTaskIdentification_Post_Status;
198
199typedef enum {
200  ClassicTaskIdentification_Post_Id_Nop,
201  ClassicTaskIdentification_Post_Id_NullPtr,
202  ClassicTaskIdentification_Post_Id_Self,
203  ClassicTaskIdentification_Post_Id_LocalTask,
204  ClassicTaskIdentification_Post_Id_RemoteTask,
205  ClassicTaskIdentification_Post_Id_NA
206} ClassicTaskIdentification_Post_Id;
207
208/**
209 * @brief Test context for Classic Task Identification test case.
210 */
211typedef struct {
212  /**
213   * @brief Brief context member description.
214   *
215   * Context member description.
216   */
217  rtems_status_code status;
218
219  rtems_name name;
220
221  uint32_t node;
222
223  rtems_id *id;
224
225  rtems_id id_value;
226
227  rtems_id id_local_task;
228
229  rtems_id id_remote_task;
230
231  /**
232   * @brief This member defines the pre-condition states for the next action.
233   */
234  size_t pcs[ 3 ];
235
236  /**
237   * @brief This member indicates if the test action loop is currently
238   *   executed.
239   */
240  bool in_action_loop;
241} ClassicTaskIdentification_Context;
242
243static ClassicTaskIdentification_Context
244  ClassicTaskIdentification_Instance;
245
246static const char * const ClassicTaskIdentification_PreDesc_Name[] = {
247  "Invalid",
248  "Self",
249  "Valid",
250  "NA"
251};
252
253static const char * const ClassicTaskIdentification_PreDesc_Node[] = {
254  "Local",
255  "Remote",
256  "Invalid",
257  "SearchAll",
258  "SearchOther",
259  "SearchLocal",
260  "NA"
261};
262
263static const char * const ClassicTaskIdentification_PreDesc_Id[] = {
264  "NullPtr",
265  "Valid",
266  "NA"
267};
268
269static const char * const * const ClassicTaskIdentification_PreDesc[] = {
270  ClassicTaskIdentification_PreDesc_Name,
271  ClassicTaskIdentification_PreDesc_Node,
272  ClassicTaskIdentification_PreDesc_Id,
273  NULL
274};
275
276/* Test rtems_task_ident() support */
277
278static void ClassicTaskIdentification_Pre_Name_Prepare(
279  ClassicTaskIdentification_Context *ctx,
280  ClassicTaskIdentification_Pre_Name state
281)
282{
283  /* Prologue */
284
285  switch ( state ) {
286    case ClassicTaskIdentification_Pre_Name_Invalid: {
287      ctx->name = 1;
288      break;
289    }
290
291    case ClassicTaskIdentification_Pre_Name_Self: {
292      ctx->name = RTEMS_SELF;
293      break;
294    }
295
296    case ClassicTaskIdentification_Pre_Name_Valid: {
297      ctx->name = rtems_build_name( 'T', 'A', 'S', 'K' );
298      break;
299    }
300
301    case ClassicTaskIdentification_Pre_Name_NA:
302      break;
303  }
304
305  /* Epilogue */
306}
307
308static void ClassicTaskIdentification_Pre_Node_Prepare(
309  ClassicTaskIdentification_Context *ctx,
310  ClassicTaskIdentification_Pre_Node state
311)
312{
313  switch ( state ) {
314    case ClassicTaskIdentification_Pre_Node_Local: {
315      ctx->node = 1;
316      break;
317    }
318
319    case ClassicTaskIdentification_Pre_Node_Remote: {
320      ctx->node = 2;
321      break;
322    }
323
324    case ClassicTaskIdentification_Pre_Node_Invalid: {
325      ctx->node = 256;
326      break;
327    }
328
329    case ClassicTaskIdentification_Pre_Node_SearchAll: {
330      ctx->node = RTEMS_SEARCH_ALL_NODES;
331      break;
332    }
333
334    case ClassicTaskIdentification_Pre_Node_SearchOther: {
335      ctx->node = RTEMS_SEARCH_OTHER_NODES;
336      break;
337    }
338
339    case ClassicTaskIdentification_Pre_Node_SearchLocal: {
340      ctx->node = RTEMS_SEARCH_LOCAL_NODE;
341      break;
342    }
343
344    case ClassicTaskIdentification_Pre_Node_NA:
345      break;
346  }
347}
348
349static void ClassicTaskIdentification_Pre_Id_Prepare(
350  ClassicTaskIdentification_Context *ctx,
351  ClassicTaskIdentification_Pre_Id   state
352)
353{
354  switch ( state ) {
355    case ClassicTaskIdentification_Pre_Id_NullPtr: {
356      ctx->id = NULL;
357      break;
358    }
359
360    case ClassicTaskIdentification_Pre_Id_Valid: {
361      ctx->id_value = 0xffffffff;
362      ctx->id = &ctx->id_value;
363      break;
364    }
365
366    case ClassicTaskIdentification_Pre_Id_NA:
367      break;
368  }
369}
370
371static void ClassicTaskIdentification_Post_Status_Check(
372  ClassicTaskIdentification_Context    *ctx,
373  ClassicTaskIdentification_Post_Status state
374)
375{
376  switch ( state ) {
377    case ClassicTaskIdentification_Post_Status_Ok: {
378      T_rsc(ctx->status, RTEMS_SUCCESSFUL);
379      break;
380    }
381
382    case ClassicTaskIdentification_Post_Status_InvAddr: {
383      T_rsc(ctx->status, RTEMS_INVALID_ADDRESS);
384      break;
385    }
386
387    case ClassicTaskIdentification_Post_Status_InvName: {
388      T_rsc(ctx->status, RTEMS_INVALID_NAME);
389      break;
390    }
391
392    case ClassicTaskIdentification_Post_Status_InvNode: {
393      T_rsc(ctx->status, RTEMS_INVALID_NODE);
394      break;
395    }
396
397    case ClassicTaskIdentification_Post_Status_InvId: {
398      T_rsc(ctx->status, RTEMS_INVALID_ID);
399      break;
400    }
401
402    case ClassicTaskIdentification_Post_Status_NA:
403      break;
404  }
405}
406
407static void ClassicTaskIdentification_Post_Id_Check(
408  ClassicTaskIdentification_Context *ctx,
409  ClassicTaskIdentification_Post_Id  state
410)
411{
412  switch ( state ) {
413    case ClassicTaskIdentification_Post_Id_Nop: {
414      T_eq_ptr(ctx->id, &ctx->id_value);
415      T_eq_u32(ctx->id_value, 0xffffffff);
416      break;
417    }
418
419    case ClassicTaskIdentification_Post_Id_NullPtr: {
420      T_null(ctx->id)
421      break;
422    }
423
424    case ClassicTaskIdentification_Post_Id_Self: {
425      T_eq_ptr(ctx->id, &ctx->id_value);
426      T_eq_u32(ctx->id_value, rtems_task_self());
427      break;
428    }
429
430    case ClassicTaskIdentification_Post_Id_LocalTask: {
431      T_eq_ptr(ctx->id, &ctx->id_value);
432      T_eq_u32(ctx->id_value, ctx->id_local_task);
433      break;
434    }
435
436    case ClassicTaskIdentification_Post_Id_RemoteTask: {
437      T_eq_ptr(ctx->id, &ctx->id_value);
438      T_eq_u32(ctx->id_value, ctx->id_remote_task);
439      break;
440    }
441
442    case ClassicTaskIdentification_Post_Id_NA:
443      break;
444  }
445}
446
447/**
448 * @brief Setup brief description.
449 *
450 * Setup description.
451 */
452static void ClassicTaskIdentification_Setup(
453  ClassicTaskIdentification_Context *ctx
454)
455{
456  rtems_status_code sc;
457
458  sc = rtems_task_create(
459    rtems_build_name( 'T', 'A', 'S', 'K' ),
460    1,
461    RTEMS_MINIMUM_STACK_SIZE,
462    RTEMS_DEFAULT_MODES,
463    RTEMS_DEFAULT_ATTRIBUTES,
464    &ctx->id_local_task
465  );
466  T_assert_rsc_success( sc );
467}
468
469static void ClassicTaskIdentification_Setup_Wrap( void *arg )
470{
471  ClassicTaskIdentification_Context *ctx;
472
473  ctx = arg;
474  ctx->in_action_loop = false;
475  ClassicTaskIdentification_Setup( ctx );
476}
477
478static void ClassicTaskIdentification_Teardown(
479  ClassicTaskIdentification_Context *ctx
480)
481{
482  rtems_status_code sc;
483
484  if ( ctx->id_local_task != 0 ) {
485    sc = rtems_task_delete( ctx->id_local_task );
486    T_rsc_success( sc );
487  }
488}
489
490static void ClassicTaskIdentification_Teardown_Wrap( void *arg )
491{
492  ClassicTaskIdentification_Context *ctx;
493
494  ctx = arg;
495  ctx->in_action_loop = false;
496  ClassicTaskIdentification_Teardown( ctx );
497}
498
499static void ClassicTaskIdentification_Scope( void *arg, char *buf, size_t n )
500{
501  ClassicTaskIdentification_Context *ctx;
502
503  ctx = arg;
504
505  if ( ctx->in_action_loop ) {
506    T_get_scope( ClassicTaskIdentification_PreDesc, buf, n, ctx->pcs );
507  }
508}
509
510static T_fixture ClassicTaskIdentification_Fixture = {
511  .setup = ClassicTaskIdentification_Setup_Wrap,
512  .stop = NULL,
513  .teardown = ClassicTaskIdentification_Teardown_Wrap,
514  .scope = ClassicTaskIdentification_Scope,
515  .initial_context = &ClassicTaskIdentification_Instance
516};
517
518static const uint8_t ClassicTaskIdentification_TransitionMap[][ 2 ] = {
519  {
520    ClassicTaskIdentification_Post_Status_InvAddr,
521    ClassicTaskIdentification_Post_Id_NullPtr
522  }, {
523    ClassicTaskIdentification_Post_Status_InvName,
524    ClassicTaskIdentification_Post_Id_Nop
525  }, {
526    ClassicTaskIdentification_Post_Status_InvAddr,
527    ClassicTaskIdentification_Post_Id_NullPtr
528  }, {
529    ClassicTaskIdentification_Post_Status_InvName,
530    ClassicTaskIdentification_Post_Id_Nop
531  }, {
532    ClassicTaskIdentification_Post_Status_InvAddr,
533    ClassicTaskIdentification_Post_Id_NullPtr
534  }, {
535    ClassicTaskIdentification_Post_Status_InvName,
536    ClassicTaskIdentification_Post_Id_Nop
537  }, {
538    ClassicTaskIdentification_Post_Status_InvAddr,
539    ClassicTaskIdentification_Post_Id_NullPtr
540  }, {
541    ClassicTaskIdentification_Post_Status_InvName,
542    ClassicTaskIdentification_Post_Id_Nop
543  }, {
544    ClassicTaskIdentification_Post_Status_InvAddr,
545    ClassicTaskIdentification_Post_Id_NullPtr
546  }, {
547    ClassicTaskIdentification_Post_Status_InvName,
548    ClassicTaskIdentification_Post_Id_Nop
549  }, {
550    ClassicTaskIdentification_Post_Status_InvAddr,
551    ClassicTaskIdentification_Post_Id_NullPtr
552  }, {
553    ClassicTaskIdentification_Post_Status_InvName,
554    ClassicTaskIdentification_Post_Id_Nop
555  }, {
556    ClassicTaskIdentification_Post_Status_InvAddr,
557    ClassicTaskIdentification_Post_Id_NullPtr
558  }, {
559    ClassicTaskIdentification_Post_Status_Ok,
560    ClassicTaskIdentification_Post_Id_Self
561  }, {
562    ClassicTaskIdentification_Post_Status_InvAddr,
563    ClassicTaskIdentification_Post_Id_NullPtr
564  }, {
565    ClassicTaskIdentification_Post_Status_Ok,
566    ClassicTaskIdentification_Post_Id_Self
567  }, {
568    ClassicTaskIdentification_Post_Status_InvAddr,
569    ClassicTaskIdentification_Post_Id_NullPtr
570  }, {
571    ClassicTaskIdentification_Post_Status_Ok,
572    ClassicTaskIdentification_Post_Id_Self
573  }, {
574    ClassicTaskIdentification_Post_Status_InvAddr,
575    ClassicTaskIdentification_Post_Id_NullPtr
576  }, {
577    ClassicTaskIdentification_Post_Status_Ok,
578    ClassicTaskIdentification_Post_Id_Self
579  }, {
580    ClassicTaskIdentification_Post_Status_InvAddr,
581    ClassicTaskIdentification_Post_Id_NullPtr
582  }, {
583    ClassicTaskIdentification_Post_Status_Ok,
584    ClassicTaskIdentification_Post_Id_Self
585  }, {
586    ClassicTaskIdentification_Post_Status_InvAddr,
587    ClassicTaskIdentification_Post_Id_NullPtr
588  }, {
589    ClassicTaskIdentification_Post_Status_Ok,
590    ClassicTaskIdentification_Post_Id_Self
591  }, {
592    ClassicTaskIdentification_Post_Status_InvAddr,
593    ClassicTaskIdentification_Post_Id_NullPtr
594  }, {
595    ClassicTaskIdentification_Post_Status_Ok,
596    ClassicTaskIdentification_Post_Id_LocalTask
597  }, {
598    ClassicTaskIdentification_Post_Status_InvAddr,
599    ClassicTaskIdentification_Post_Id_NullPtr
600  }, {
601#if defined(RTEMS_MULTIPROCESSING)
602    ClassicTaskIdentification_Post_Status_Ok,
603    ClassicTaskIdentification_Post_Id_RemoteTask
604#else
605    ClassicTaskIdentification_Post_Status_InvName,
606    ClassicTaskIdentification_Post_Id_Nop
607#endif
608  }, {
609    ClassicTaskIdentification_Post_Status_InvAddr,
610    ClassicTaskIdentification_Post_Id_NullPtr
611  }, {
612    ClassicTaskIdentification_Post_Status_InvName,
613    ClassicTaskIdentification_Post_Id_Nop
614  }, {
615    ClassicTaskIdentification_Post_Status_InvAddr,
616    ClassicTaskIdentification_Post_Id_NullPtr
617  }, {
618    ClassicTaskIdentification_Post_Status_Ok,
619    ClassicTaskIdentification_Post_Id_LocalTask
620  }, {
621    ClassicTaskIdentification_Post_Status_InvAddr,
622    ClassicTaskIdentification_Post_Id_NullPtr
623  }, {
624#if defined(RTEMS_MULTIPROCESSING)
625    ClassicTaskIdentification_Post_Status_Ok,
626    ClassicTaskIdentification_Post_Id_RemoteTask
627#else
628    ClassicTaskIdentification_Post_Status_InvName,
629    ClassicTaskIdentification_Post_Id_Nop
630#endif
631  }, {
632    ClassicTaskIdentification_Post_Status_InvAddr,
633    ClassicTaskIdentification_Post_Id_NullPtr
634  }, {
635    ClassicTaskIdentification_Post_Status_Ok,
636    ClassicTaskIdentification_Post_Id_LocalTask
637  }
638};
639
640static const struct {
641  uint8_t Skip : 1;
642  uint8_t Pre_Name_NA : 1;
643  uint8_t Pre_Node_NA : 1;
644  uint8_t Pre_Id_NA : 1;
645} ClassicTaskIdentification_TransitionInfo[] = {
646  {
647    0, 0, 0, 0
648  }, {
649    0, 0, 0, 0
650  }, {
651    0, 0, 0, 0
652  }, {
653    0, 0, 0, 0
654  }, {
655    0, 0, 0, 0
656  }, {
657    0, 0, 0, 0
658  }, {
659    0, 0, 0, 0
660  }, {
661    0, 0, 0, 0
662  }, {
663    0, 0, 0, 0
664  }, {
665    0, 0, 0, 0
666  }, {
667    0, 0, 0, 0
668  }, {
669    0, 0, 0, 0
670  }, {
671    0, 0, 0, 0
672  }, {
673    0, 0, 0, 0
674  }, {
675    0, 0, 0, 0
676  }, {
677    0, 0, 0, 0
678  }, {
679    0, 0, 0, 0
680  }, {
681    0, 0, 0, 0
682  }, {
683    0, 0, 0, 0
684  }, {
685    0, 0, 0, 0
686  }, {
687    0, 0, 0, 0
688  }, {
689    0, 0, 0, 0
690  }, {
691    0, 0, 0, 0
692  }, {
693    0, 0, 0, 0
694  }, {
695    0, 0, 0, 0
696  }, {
697    0, 0, 0, 0
698  }, {
699    0, 0, 0, 0
700  }, {
701#if defined(RTEMS_MULTIPROCESSING)
702    0, 0, 0, 0
703#else
704    0, 0, 0, 0
705#endif
706  }, {
707    0, 0, 0, 0
708  }, {
709    0, 0, 0, 0
710  }, {
711    0, 0, 0, 0
712  }, {
713    0, 0, 0, 0
714  }, {
715    0, 0, 0, 0
716  }, {
717#if defined(RTEMS_MULTIPROCESSING)
718    0, 0, 0, 0
719#else
720    0, 0, 0, 0
721#endif
722  }, {
723    0, 0, 0, 0
724  }, {
725    0, 0, 0, 0
726  }
727};
728
729/**
730 * @fn void T_case_body_ClassicTaskIdentification( void )
731 *
732 * @brief Test rtems_task_ident() brief description.
733 *
734 * Test rtems_task_ident() description.
735 */
736T_TEST_CASE_FIXTURE(
737  ClassicTaskIdentification,
738  &ClassicTaskIdentification_Fixture
739)
740{
741  ClassicTaskIdentification_Context *ctx;
742  size_t index;
743
744  ctx = T_fixture_context();
745  ctx->in_action_loop = true;
746  index = 0;
747
748  for (
749    ctx->pcs[ 0 ] = ClassicTaskIdentification_Pre_Name_Invalid;
750    ctx->pcs[ 0 ] < ClassicTaskIdentification_Pre_Name_NA;
751    ++ctx->pcs[ 0 ]
752  ) {
753    if ( ClassicTaskIdentification_TransitionInfo[ index ].Pre_Name_NA ) {
754      ctx->pcs[ 0 ] = ClassicTaskIdentification_Pre_Name_NA;
755      index += ( ClassicTaskIdentification_Pre_Name_NA - 1 )
756        * ClassicTaskIdentification_Pre_Node_NA
757        * ClassicTaskIdentification_Pre_Id_NA;
758    }
759
760    for (
761      ctx->pcs[ 1 ] = ClassicTaskIdentification_Pre_Node_Local;
762      ctx->pcs[ 1 ] < ClassicTaskIdentification_Pre_Node_NA;
763      ++ctx->pcs[ 1 ]
764    ) {
765      if ( ClassicTaskIdentification_TransitionInfo[ index ].Pre_Node_NA ) {
766        ctx->pcs[ 1 ] = ClassicTaskIdentification_Pre_Node_NA;
767        index += ( ClassicTaskIdentification_Pre_Node_NA - 1 )
768          * ClassicTaskIdentification_Pre_Id_NA;
769      }
770
771      for (
772        ctx->pcs[ 2 ] = ClassicTaskIdentification_Pre_Id_NullPtr;
773        ctx->pcs[ 2 ] < ClassicTaskIdentification_Pre_Id_NA;
774        ++ctx->pcs[ 2 ]
775      ) {
776        if ( ClassicTaskIdentification_TransitionInfo[ index ].Pre_Id_NA ) {
777          ctx->pcs[ 2 ] = ClassicTaskIdentification_Pre_Id_NA;
778          index += ( ClassicTaskIdentification_Pre_Id_NA - 1 );
779        }
780
781        if ( ClassicTaskIdentification_TransitionInfo[ index ].Skip ) {
782          ++index;
783          continue;
784        }
785
786        ClassicTaskIdentification_Pre_Name_Prepare( ctx, ctx->pcs[ 0 ] );
787        ClassicTaskIdentification_Pre_Node_Prepare( ctx, ctx->pcs[ 1 ] );
788        ClassicTaskIdentification_Pre_Id_Prepare( ctx, ctx->pcs[ 2 ] );
789        ctx->status = rtems_task_ident( ctx->name, ctx->node, ctx->id );
790        ClassicTaskIdentification_Post_Status_Check(
791          ctx,
792          ClassicTaskIdentification_TransitionMap[ index ][ 0 ]
793        );
794        ClassicTaskIdentification_Post_Id_Check(
795          ctx,
796          ClassicTaskIdentification_TransitionMap[ index ][ 1 ]
797        );
798        ++index;
799      }
800    }
801  }
802}
803
804/** @} */
805
806/**
807 * @defgroup RTEMSTestCaseTestCase Test Case
808 *
809 * @ingroup RTEMSTestSuiteBlueGreen
810 *
811 * @brief Test Case
812 *
813 * @{
814 */
815
816/* Test case support code */
817
818/**
819 * @fn void T_case_body_TestCase( void )
820 *
821 * @brief Test case brief description.
822 *
823 * Test case description.
824 *
825 * This test case performs the following actions:
826 *
827 * - Test case action 0 description.
828 *
829 *   - Test case action 0 check 0 description.
830 *
831 *   - Test case action 0 check 1 description.
832 *
833 * - Test case action 1 description.
834 *
835 *   - Test case action 1 check 0 description.
836 *
837 *   - Test case action 1 check 1 description.
838 */
839T_TEST_CASE( TestCase )
840{
841  /* Test case prologue code */
842
843  T_plan(2);
844
845  /* Test case action 0 code */
846  /* Test case action 0 check 0 code */
847  /* Test case action 0 check 1 code; step 0 */
848
849  /* Test case action 1 code */
850  /* Test case action 1 check 0 code; step 1 */
851  /* Test case action 1 check 1 code */
852
853  /* Test case epilogue code */
854}
855
856/** @} */
857
858/**
859 * @defgroup RTEMSTestCaseTestCase2 Test Case 2
860 *
861 * @ingroup RTEMSTestSuiteBlueGreen
862 *
863 * @brief Test Case
864 *
865 * @{
866 */
867
868/**
869 * @fn void T_case_body_TestCase2( void )
870 *
871 * @brief Test case 2 brief description.
872 *
873 * Test case 2 description.
874 *
875 * This test case performs the following actions:
876 *
877 * - Test case 2 action 0 description.
878 *
879 *   - Test case 2 action 0 check 0 description.
880 *
881 *   - Test case 2 action 0 check 1 description.
882 *
883 * - Test case 2 action 1 description.
884 */
885T_TEST_CASE_FIXTURE( TestCase2, &test_case_2_fixture )
886{
887  /* Test case 2 action 0 code */
888  /* Test case 2 action 0 check 0 code */
889  /* Test case 2 action 0 check 1 code */
890
891  /* Test case 2 action 1 code */
892}
893
894/** @} */
895"""
896        assert content == src.read()
897
898    with open(os.path.join(base_directory, "tc34.c"), "r") as src:
899        content = """/* SPDX-License-Identifier: BSD-2-Clause */
900
901/**
902 * @file
903 *
904 * @ingroup RTEMSTestCaseTestCase3
905 * @ingroup RTEMSTestCaseTestCase4
906 */
907
908/*
909 * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
910 *
911 * Redistribution and use in source and binary forms, with or without
912 * modification, are permitted provided that the following conditions
913 * are met:
914 * 1. Redistributions of source code must retain the above copyright
915 *    notice, this list of conditions and the following disclaimer.
916 * 2. Redistributions in binary form must reproduce the above copyright
917 *    notice, this list of conditions and the following disclaimer in the
918 *    documentation and/or other materials provided with the distribution.
919 *
920 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
921 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
922 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
923 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
924 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
925 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
926 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
927 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
928 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
929 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
930 * POSSIBILITY OF SUCH DAMAGE.
931 */
932
933#ifdef HAVE_CONFIG_H
934#include "config.h"
935#endif
936
937#include <c.h>
938
939#include "z.h"
940
941#include <rtems/test.h>
942
943/**
944 * @defgroup RTEMSTestCaseTestCase3 Test Case 3
945 *
946 * @ingroup RTEMSTestSuiteBlueGreen
947 *
948 * @brief Test Case
949 *
950 * @{
951 */
952
953/**
954 * @fn void T_case_body_TestCase3( void )
955 *
956 * @brief Test case 3 brief description.
957 *
958 * Test case 3 description.
959 *
960 * This test case performs the following actions:
961 *
962 * - Test case 3 action 0 description.
963 *
964 *   - Test case 3 action 0 check 0 description.
965 */
966T_TEST_CASE( TestCase3 )
967{
968  T_plan(1);
969
970  /* Test case 3 action 0 code */
971  /* Test case 3 action 0 check 0 code; step 0 */
972}
973
974/** @} */
975
976/**
977 * @defgroup RTEMSTestCaseTestCase4 Test Case 4
978 *
979 * @ingroup RTEMSTestSuiteBlueGreen
980 *
981 * @brief Test Case
982 *
983 * @{
984 */
985
986/**
987 * @fn void T_case_body_TestCase4( void )
988 *
989 * @brief Test case 4 brief description.
990 *
991 * Test case 4 description.
992 */
993T_TEST_CASE( TestCase4 )
994{
995  /* Test case 4 epilogue code */
996}
997
998/** @} */
999"""
1000        assert content == src.read()
1001    with open(os.path.join(base_directory, "action2.h"), "r") as src:
1002        content = """/* SPDX-License-Identifier: BSD-2-Clause */
1003
1004/**
1005 * @file
1006 *
1007 * @ingroup RTEMSTestCaseAction2
1008 */
1009
1010/*
1011 * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
1012 *
1013 * Redistribution and use in source and binary forms, with or without
1014 * modification, are permitted provided that the following conditions
1015 * are met:
1016 * 1. Redistributions of source code must retain the above copyright
1017 *    notice, this list of conditions and the following disclaimer.
1018 * 2. Redistributions in binary form must reproduce the above copyright
1019 *    notice, this list of conditions and the following disclaimer in the
1020 *    documentation and/or other materials provided with the distribution.
1021 *
1022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1023 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1024 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1025 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
1026 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1027 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1028 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1029 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1030 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1031 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1032 * POSSIBILITY OF SUCH DAMAGE.
1033 */
1034
1035#ifndef _ACTION2_H
1036#define _ACTION2_H
1037
1038#include <d.h>
1039
1040#include "e.h"
1041
1042#ifdef __cplusplus
1043extern "C" {
1044#endif
1045
1046/**
1047 * @addtogroup RTEMSTestCaseAction2
1048 *
1049 * @{
1050 */
1051
1052typedef enum {
1053  Action2_Pre_A_X,
1054  Action2_Pre_A_Y,
1055  Action2_Pre_A_NA
1056} Action2_Pre_A;
1057
1058typedef enum {
1059  Action2_Pre_B_X,
1060  Action2_Pre_B_Y,
1061  Action2_Pre_B_Z,
1062  Action2_Pre_B_NA
1063} Action2_Pre_B;
1064
1065typedef enum {
1066  Action2_Post_A_X,
1067  Action2_Post_A_Y,
1068  Action2_Post_A_NA
1069} Action2_Post_A;
1070
1071typedef enum {
1072  Action2_Post_B_X,
1073  Action2_Post_B_Y,
1074  Action2_Post_B_NA
1075} Action2_Post_B;
1076
1077/* Header code for Action 2 with Action2_Run() */
1078
1079/**
1080 * @brief Test brief.
1081 *
1082 * Test description.
1083 *
1084 * @param[in] a Parameter A description.
1085 *
1086 * @param b Parameter B description.
1087 *
1088 * @param[out] c Parameter C description.
1089 */
1090void Action2_Run( int *a, int b, int *c );
1091
1092/** @} */
1093
1094#ifdef __cplusplus
1095}
1096#endif
1097
1098#endif /* _ACTION2_H */
1099"""
1100        assert content == src.read()
1101    with open(os.path.join(base_directory, "action2.c"), "r") as src:
1102        content = """/* SPDX-License-Identifier: BSD-2-Clause */
1103
1104/**
1105 * @file
1106 *
1107 * @ingroup RTEMSTestCaseAction2
1108 */
1109
1110/*
1111 * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
1112 *
1113 * Redistribution and use in source and binary forms, with or without
1114 * modification, are permitted provided that the following conditions
1115 * are met:
1116 * 1. Redistributions of source code must retain the above copyright
1117 *    notice, this list of conditions and the following disclaimer.
1118 * 2. Redistributions in binary form must reproduce the above copyright
1119 *    notice, this list of conditions and the following disclaimer in the
1120 *    documentation and/or other materials provided with the distribution.
1121 *
1122 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1123 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1124 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1125 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
1126 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1127 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1128 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1129 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1130 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1131 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1132 * POSSIBILITY OF SUCH DAMAGE.
1133 */
1134
1135#ifdef HAVE_CONFIG_H
1136#include "config.h"
1137#endif
1138
1139#include <a.h>
1140
1141#include "b.h"
1142
1143#include <rtems/test.h>
1144
1145/**
1146 * @defgroup RTEMSTestCaseAction2 Action 2
1147 *
1148 * @ingroup RTEMSTestSuiteBlueGreen
1149 *
1150 * @brief Test Case
1151 *
1152 * @{
1153 */
1154
1155/**
1156 * @brief Test context for Action 2 test case.
1157 */
1158typedef struct {
1159  /**
1160   * @brief Context member brief.
1161   *
1162   * Context member description.
1163   */
1164  int member;
1165
1166  /**
1167   * @brief This member contains a copy of the corresponding Action2_Run()
1168   *   parameter.
1169   */
1170  int *a;
1171
1172  /**
1173   * @brief This member contains a copy of the corresponding Action2_Run()
1174   *   parameter.
1175   */
1176  int b;
1177
1178  /**
1179   * @brief This member contains a copy of the corresponding Action2_Run()
1180   *   parameter.
1181   */
1182  int *c;
1183
1184  /**
1185   * @brief This member defines the pre-condition states for the next action.
1186   */
1187  size_t pcs[ 2 ];
1188
1189  /**
1190   * @brief This member indicates if the test action loop is currently
1191   *   executed.
1192   */
1193  bool in_action_loop;
1194} Action2_Context;
1195
1196static Action2_Context
1197  Action2_Instance;
1198
1199static const char * const Action2_PreDesc_A[] = {
1200  "X",
1201  "Y",
1202  "NA"
1203};
1204
1205static const char * const Action2_PreDesc_B[] = {
1206  "X",
1207  "Y",
1208  "Z",
1209  "NA"
1210};
1211
1212static const char * const * const Action2_PreDesc[] = {
1213  Action2_PreDesc_A,
1214  Action2_PreDesc_B,
1215  NULL
1216};
1217
1218/* Support code */
1219
1220static void Action2_Pre_A_Prepare( Action2_Context *ctx, Action2_Pre_A state )
1221{
1222  /* Pre A prologue. */
1223
1224  switch ( state ) {
1225    case Action2_Pre_A_X: {
1226      /* Pre A X */
1227      break;
1228    }
1229
1230    case Action2_Pre_A_Y: {
1231      /* Pre A Y */
1232      break;
1233    }
1234
1235    case Action2_Pre_A_NA:
1236      break;
1237  }
1238
1239  /* Pre A epilogue. */
1240}
1241
1242static void Action2_Pre_B_Prepare( Action2_Context *ctx, Action2_Pre_B state )
1243{
1244  /* Pre B prologue. */
1245
1246  switch ( state ) {
1247    case Action2_Pre_B_X: {
1248      /* Pre B X */
1249      break;
1250    }
1251
1252    case Action2_Pre_B_Y: {
1253      /* Pre B Y */
1254      break;
1255    }
1256
1257    case Action2_Pre_B_Z: {
1258      /* Pre B Z */
1259      break;
1260    }
1261
1262    case Action2_Pre_B_NA:
1263      break;
1264  }
1265
1266  /* Pre B epilogue. */
1267}
1268
1269static void Action2_Post_A_Check( Action2_Context *ctx, Action2_Post_A state )
1270{
1271  /* Post A prologue. */
1272
1273  switch ( state ) {
1274    case Action2_Post_A_X: {
1275      /* Post A X */
1276      break;
1277    }
1278
1279    case Action2_Post_A_Y: {
1280      /* Post A Y */
1281      break;
1282    }
1283
1284    case Action2_Post_A_NA:
1285      break;
1286  }
1287
1288  /* Post A epilogue. */
1289}
1290
1291static void Action2_Post_B_Check( Action2_Context *ctx, Action2_Post_B state )
1292{
1293  /* Post B prologue. */
1294
1295  switch ( state ) {
1296    case Action2_Post_B_X: {
1297      /* Post B X */
1298      break;
1299    }
1300
1301    case Action2_Post_B_Y: {
1302      /* Post B Y */
1303      break;
1304    }
1305
1306    case Action2_Post_B_NA:
1307      break;
1308  }
1309
1310  /* Post B epilogue. */
1311}
1312
1313/**
1314 * @brief Setup brief.
1315 *
1316 * Setup description.
1317 */
1318static void Action2_Setup( Action2_Context *ctx )
1319{
1320  /* Setup code */
1321}
1322
1323static void Action2_Setup_Wrap( void *arg )
1324{
1325  Action2_Context *ctx;
1326
1327  ctx = arg;
1328  ctx->in_action_loop = false;
1329  Action2_Setup( ctx );
1330}
1331
1332/**
1333 * @brief Teardown brief.
1334 *
1335 * Teardown description.
1336 */
1337static void Action2_Teardown( Action2_Context *ctx )
1338{
1339  /* Teardown code */
1340}
1341
1342static void Action2_Teardown_Wrap( void *arg )
1343{
1344  Action2_Context *ctx;
1345
1346  ctx = arg;
1347  ctx->in_action_loop = false;
1348  Action2_Teardown( ctx );
1349}
1350
1351static void Action2_Scope( void *arg, char *buf, size_t n )
1352{
1353  Action2_Context *ctx;
1354
1355  ctx = arg;
1356
1357  if ( ctx->in_action_loop ) {
1358    T_get_scope( Action2_PreDesc, buf, n, ctx->pcs );
1359  }
1360}
1361
1362static T_fixture Action2_Fixture = {
1363  .setup = Action2_Setup_Wrap,
1364  .stop = NULL,
1365  .teardown = Action2_Teardown_Wrap,
1366  .scope = Action2_Scope,
1367  .initial_context = &Action2_Instance
1368};
1369
1370static const uint8_t Action2_TransitionMap[][ 2 ] = {
1371  {
1372    Action2_Post_A_X,
1373    Action2_Post_B_Y
1374  }, {
1375    Action2_Post_A_Y,
1376    Action2_Post_B_X
1377  }, {
1378    Action2_Post_A_X,
1379    Action2_Post_B_X
1380  }, {
1381    Action2_Post_A_X,
1382    Action2_Post_B_Y
1383  }, {
1384    Action2_Post_A_Y,
1385    Action2_Post_B_X
1386  }, {
1387    Action2_Post_A_NA,
1388    Action2_Post_B_NA
1389  }
1390};
1391
1392static const struct {
1393  uint8_t Skip : 1;
1394  uint8_t Pre_A_NA : 1;
1395  uint8_t Pre_B_NA : 1;
1396} Action2_TransitionInfo[] = {
1397  {
1398    0, 0, 0
1399  }, {
1400    0, 1, 0
1401  }, {
1402    0, 0, 0
1403  }, {
1404    0, 0, 0
1405  }, {
1406    0, 1, 0
1407  }, {
1408    1, 0, 0
1409  }
1410};
1411
1412static T_fixture_node Action2_Node;
1413
1414void Action2_Run( int *a, int b, int *c )
1415{
1416  Action2_Context *ctx;
1417  size_t index;
1418
1419  ctx = T_push_fixture( &Action2_Node, &Action2_Fixture );
1420
1421  ctx->a = a;
1422  ctx->b = b;
1423  ctx->c = c;
1424  ctx->in_action_loop = true;
1425  index = 0;
1426
1427  for (
1428    ctx->pcs[ 0 ] = Action2_Pre_A_X;
1429    ctx->pcs[ 0 ] < Action2_Pre_A_NA;
1430    ++ctx->pcs[ 0 ]
1431  ) {
1432    if ( Action2_TransitionInfo[ index ].Pre_A_NA ) {
1433      ctx->pcs[ 0 ] = Action2_Pre_A_NA;
1434      index += ( Action2_Pre_A_NA - 1 )
1435        * Action2_Pre_B_NA;
1436    }
1437
1438    for (
1439      ctx->pcs[ 1 ] = Action2_Pre_B_X;
1440      ctx->pcs[ 1 ] < Action2_Pre_B_NA;
1441      ++ctx->pcs[ 1 ]
1442    ) {
1443      if ( Action2_TransitionInfo[ index ].Pre_B_NA ) {
1444        ctx->pcs[ 1 ] = Action2_Pre_B_NA;
1445        index += ( Action2_Pre_B_NA - 1 );
1446      }
1447
1448      if ( Action2_TransitionInfo[ index ].Skip ) {
1449        ++index;
1450        continue;
1451      }
1452
1453      Action2_Pre_A_Prepare( ctx, ctx->pcs[ 0 ] );
1454      Action2_Pre_B_Prepare( ctx, ctx->pcs[ 1 ] );
1455      /* Action */
1456      Action2_Post_A_Check(
1457        ctx,
1458        Action2_TransitionMap[ index ][ 0 ]
1459      );
1460      Action2_Post_B_Check(
1461        ctx,
1462        Action2_TransitionMap[ index ][ 1 ]
1463      );
1464      ++index;
1465    }
1466  }
1467
1468  T_pop_fixture();
1469}
1470
1471/** @} */
1472"""
1473        assert content == src.read()
Note: See TracBrowser for help on using the repository browser.