diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-09-21 20:15:58 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-09-22 09:28:20 +0200 |
commit | 3756347e83f7e7a2cb7863849fa13a96c7b68acc (patch) | |
tree | a68c8d8e5d7c6fc248ed8eccd3ebfea574862fc2 /rtemsspec/tests/test_validation.py | |
parent | spec: Add missing file (diff) | |
download | rtems-central-3756347e83f7e7a2cb7863849fa13a96c7b68acc.tar.bz2 |
validation: Fix skipping of transition variants
Diffstat (limited to '')
-rw-r--r-- | rtemsspec/tests/test_validation.py | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/rtemsspec/tests/test_validation.py b/rtemsspec/tests/test_validation.py index 2bc8b934..fc1bdc4e 100644 --- a/rtemsspec/tests/test_validation.py +++ b/rtemsspec/tests/test_validation.py @@ -2233,36 +2233,44 @@ static T_fixture Action2_Fixture = { .initial_context = &Action2_Instance }; -static inline Action2_Entry Action2_PopEntry( Action2_Context *ctx ) -{ - size_t index; - - index = ctx->Map.index; - ctx->Map.index = index + 1; - return Action2_Entries[ - Action2_Map[ index ] - ]; -} +static const uint8_t Action2_Weights[] = { + 9, 3, 1 +}; static void Action2_Skip( Action2_Context *ctx, size_t index ) { - size_t increment; - - ctx->Map.skip = false; - increment = 1; - switch ( index + 1 ) { case 1: - increment *= Action2_Pre_B_NA - ctx->Map.pci[ 1 ]; ctx->Map.pci[ 1 ] = Action2_Pre_B_NA - 1; /* Fall through */ case 2: - increment *= Action2_Pre_C_NA - ctx->Map.pci[ 2 ]; ctx->Map.pci[ 2 ] = Action2_Pre_C_NA - 1; break; } +} + +static inline Action2_Entry Action2_PopEntry( Action2_Context *ctx ) +{ + size_t index; + + if ( ctx->Map.skip ) { + size_t i; + + ctx->Map.skip = false; + index = 0; + + for ( i = 0; i < 3; ++i ) { + index += Action2_Weights[ i ] * ctx->Map.pci[ i ]; + } + } else { + index = ctx->Map.index; + } + + ctx->Map.index = index + 1; - ctx->Map.index += increment - 1; + return Action2_Entries[ + Action2_Map[ index ] + ]; } static void Action2_SetPreConditionStates( Action2_Context *ctx ) @@ -2307,6 +2315,7 @@ void Action2_Run( int *a, int b, int *c ) ctx = T_push_fixture( &Action2_Node, &Action2_Fixture ); ctx->Map.in_action_loop = true; ctx->Map.index = 0; + ctx->Map.skip = false; for ( ctx->Map.pci[ 0 ] = Action2_Pre_A_A0; |