Skip to content

Commit

Permalink
Update nasa#113, replace some UT random values with fixed values
Browse files Browse the repository at this point in the history
The use of random numbers in a couple test cases was causing an
unpredictable flow through the code.  This replaces with fixed
values so get consistent flows.

Specifically, the "acknak_count" should always be less than the
"ack_limit".  The UT use of random numbers allowed it to be
greater.  However, if it is greater than the limit, it should
still follow the limit/error path, not the successful path.
  • Loading branch information
jphickey committed Dec 16, 2021
1 parent f9c00c6 commit d800b4b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions unit-test/cf_cfdp_s_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -3612,7 +3612,7 @@ void Test_CF_CFDP_S_Tick_ArmedTimerExpiredAnd_sub_state_EqTo_SEND_WAIT_FOR_EOF_A
int *arg_cont = NULL;
uint16 initial_inactivity_timer = Any_uint16();
uint16 initial_fault_ack_limit = Any_uint16();
uint8 dummy_ack_limit = Any_uint8();
uint8 dummy_ack_limit = 10;
CF_Timer_t *context_CF_Timer_Expired[2];
CF_Timer_t *context_CF_Timer_Tick;

Expand All @@ -3622,7 +3622,7 @@ void Test_CF_CFDP_S_Tick_ArmedTimerExpiredAnd_sub_state_EqTo_SEND_WAIT_FOR_EOF_A
arg_t->flags.com.ack_timer_armed = 1;
arg_t->state_data.s.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK;

arg_t->state_data.s.s2.acknak_count = Any_uint8_Except(dummy_ack_limit - 1);
arg_t->state_data.s.s2.acknak_count = 5; /* must remain less than ack_limit after increment */

CF_AppData.config_table = &dummy_config_table;
CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.inactivity_timer = initial_inactivity_timer;
Expand Down Expand Up @@ -3692,7 +3692,7 @@ void Test_CF_CFDP_S_Tick_ArmedTimerExpiredAnd_sub_state_EqTo_SEND_WAIT_FOR_EOF_A
int *arg_cont = NULL;
uint16 initial_inactivity_timer = Any_uint16();
uint16 initial_fault_ack_limit = Any_uint16();
uint8 dummy_ack_limit = Any_uint8();
uint8 dummy_ack_limit = 10;
CF_Timer_t *context_CF_Timer_Expired[2];
CF_Timer_t *context_CF_Timer_Tick;
CF_Transaction_t *context_CF_CFDP_ArmAckTimer;
Expand All @@ -3703,7 +3703,7 @@ void Test_CF_CFDP_S_Tick_ArmedTimerExpiredAnd_sub_state_EqTo_SEND_WAIT_FOR_EOF_A
arg_t->flags.com.ack_timer_armed = 1;
arg_t->state_data.s.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK;

arg_t->state_data.s.s2.acknak_count = Any_uint8_Except(dummy_ack_limit - 1);
arg_t->state_data.s.s2.acknak_count = 5; /* must remain less than ack_limit after increment */

CF_AppData.config_table = &dummy_config_table;
CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.inactivity_timer = initial_inactivity_timer;
Expand Down

0 comments on commit d800b4b

Please sign in to comment.