File indexing completed on 2025-05-11 08:24:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051 #ifdef HAVE_CONFIG_H
0052 #include "config.h"
0053 #endif
0054
0055 #include <rtems.h>
0056
0057 #include <rtems/test.h>
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067 typedef enum {
0068 RtemsStatusReqIsSuccessful_Pre_Status_Successful,
0069 RtemsStatusReqIsSuccessful_Pre_Status_Other,
0070 RtemsStatusReqIsSuccessful_Pre_Status_NA
0071 } RtemsStatusReqIsSuccessful_Pre_Status;
0072
0073 typedef enum {
0074 RtemsStatusReqIsSuccessful_Post_Result_True,
0075 RtemsStatusReqIsSuccessful_Post_Result_False,
0076 RtemsStatusReqIsSuccessful_Post_Result_NA
0077 } RtemsStatusReqIsSuccessful_Post_Result;
0078
0079 typedef struct {
0080 uint8_t Skip : 1;
0081 uint8_t Pre_Status_NA : 1;
0082 uint8_t Post_Result : 2;
0083 } RtemsStatusReqIsSuccessful_Entry;
0084
0085
0086
0087
0088 typedef struct {
0089
0090
0091
0092
0093 bool result;
0094
0095
0096
0097
0098 rtems_status_code status;
0099
0100 struct {
0101
0102
0103
0104 size_t pcs[ 1 ];
0105
0106
0107
0108
0109 bool in_action_loop;
0110
0111
0112
0113
0114 size_t index;
0115
0116
0117
0118
0119 RtemsStatusReqIsSuccessful_Entry entry;
0120
0121
0122
0123
0124
0125 bool skip;
0126 } Map;
0127 } RtemsStatusReqIsSuccessful_Context;
0128
0129 static RtemsStatusReqIsSuccessful_Context
0130 RtemsStatusReqIsSuccessful_Instance;
0131
0132 static const char * const RtemsStatusReqIsSuccessful_PreDesc_Status[] = {
0133 "Successful",
0134 "Other",
0135 "NA"
0136 };
0137
0138 static const char * const * const RtemsStatusReqIsSuccessful_PreDesc[] = {
0139 RtemsStatusReqIsSuccessful_PreDesc_Status,
0140 NULL
0141 };
0142
0143 static void RtemsStatusReqIsSuccessful_Pre_Status_Prepare(
0144 RtemsStatusReqIsSuccessful_Context *ctx,
0145 RtemsStatusReqIsSuccessful_Pre_Status state
0146 )
0147 {
0148 switch ( state ) {
0149 case RtemsStatusReqIsSuccessful_Pre_Status_Successful: {
0150
0151
0152
0153 ctx->status = RTEMS_SUCCESSFUL;
0154 break;
0155 }
0156
0157 case RtemsStatusReqIsSuccessful_Pre_Status_Other: {
0158
0159
0160
0161 ctx->status = RTEMS_INVALID_ID;
0162 break;
0163 }
0164
0165 case RtemsStatusReqIsSuccessful_Pre_Status_NA:
0166 break;
0167 }
0168 }
0169
0170 static void RtemsStatusReqIsSuccessful_Post_Result_Check(
0171 RtemsStatusReqIsSuccessful_Context *ctx,
0172 RtemsStatusReqIsSuccessful_Post_Result state
0173 )
0174 {
0175 switch ( state ) {
0176 case RtemsStatusReqIsSuccessful_Post_Result_True: {
0177
0178
0179
0180 T_true( ctx->result );
0181 break;
0182 }
0183
0184 case RtemsStatusReqIsSuccessful_Post_Result_False: {
0185
0186
0187
0188 T_false( ctx->result );
0189 break;
0190 }
0191
0192 case RtemsStatusReqIsSuccessful_Post_Result_NA:
0193 break;
0194 }
0195 }
0196
0197 static void RtemsStatusReqIsSuccessful_Action(
0198 RtemsStatusReqIsSuccessful_Context *ctx
0199 )
0200 {
0201 ctx->result = rtems_is_status_successful( ctx->status );
0202 }
0203
0204 static const RtemsStatusReqIsSuccessful_Entry
0205 RtemsStatusReqIsSuccessful_Entries[] = {
0206 { 0, 0, RtemsStatusReqIsSuccessful_Post_Result_True },
0207 { 0, 0, RtemsStatusReqIsSuccessful_Post_Result_False }
0208 };
0209
0210 static const uint8_t
0211 RtemsStatusReqIsSuccessful_Map[] = {
0212 0, 1
0213 };
0214
0215 static size_t RtemsStatusReqIsSuccessful_Scope(
0216 void *arg,
0217 char *buf,
0218 size_t n
0219 )
0220 {
0221 RtemsStatusReqIsSuccessful_Context *ctx;
0222
0223 ctx = arg;
0224
0225 if ( ctx->Map.in_action_loop ) {
0226 return T_get_scope(
0227 RtemsStatusReqIsSuccessful_PreDesc,
0228 buf,
0229 n,
0230 ctx->Map.pcs
0231 );
0232 }
0233
0234 return 0;
0235 }
0236
0237 static T_fixture RtemsStatusReqIsSuccessful_Fixture = {
0238 .setup = NULL,
0239 .stop = NULL,
0240 .teardown = NULL,
0241 .scope = RtemsStatusReqIsSuccessful_Scope,
0242 .initial_context = &RtemsStatusReqIsSuccessful_Instance
0243 };
0244
0245 static inline RtemsStatusReqIsSuccessful_Entry
0246 RtemsStatusReqIsSuccessful_PopEntry( RtemsStatusReqIsSuccessful_Context *ctx )
0247 {
0248 size_t index;
0249
0250 index = ctx->Map.index;
0251 ctx->Map.index = index + 1;
0252 return RtemsStatusReqIsSuccessful_Entries[
0253 RtemsStatusReqIsSuccessful_Map[ index ]
0254 ];
0255 }
0256
0257 static void RtemsStatusReqIsSuccessful_TestVariant(
0258 RtemsStatusReqIsSuccessful_Context *ctx
0259 )
0260 {
0261 RtemsStatusReqIsSuccessful_Pre_Status_Prepare( ctx, ctx->Map.pcs[ 0 ] );
0262 RtemsStatusReqIsSuccessful_Action( ctx );
0263 RtemsStatusReqIsSuccessful_Post_Result_Check(
0264 ctx,
0265 ctx->Map.entry.Post_Result
0266 );
0267 }
0268
0269
0270
0271
0272 T_TEST_CASE_FIXTURE(
0273 RtemsStatusReqIsSuccessful,
0274 &RtemsStatusReqIsSuccessful_Fixture
0275 )
0276 {
0277 RtemsStatusReqIsSuccessful_Context *ctx;
0278
0279 ctx = T_fixture_context();
0280 ctx->Map.in_action_loop = true;
0281 ctx->Map.index = 0;
0282
0283 for (
0284 ctx->Map.pcs[ 0 ] = RtemsStatusReqIsSuccessful_Pre_Status_Successful;
0285 ctx->Map.pcs[ 0 ] < RtemsStatusReqIsSuccessful_Pre_Status_NA;
0286 ++ctx->Map.pcs[ 0 ]
0287 ) {
0288 ctx->Map.entry = RtemsStatusReqIsSuccessful_PopEntry( ctx );
0289 RtemsStatusReqIsSuccessful_TestVariant( ctx );
0290 }
0291 }
0292
0293