basic test suite for exec helper done

This commit is contained in:
Robin Müller 2025-01-23 16:53:54 +01:00
parent 32bc2826d9
commit 9130e68bce

View File

@ -173,7 +173,6 @@ impl SequenceExecutionHelper {
/// Confirm that a sequence which is awaiting a success check is done /// Confirm that a sequence which is awaiting a success check is done
pub fn confirm_sequence_done(&mut self) { pub fn confirm_sequence_done(&mut self) {
if let SequenceExecutionHelperState::AwaitingSuccessCheck = self.state { if let SequenceExecutionHelperState::AwaitingSuccessCheck = self.state {
self.current_sequence_index = Some(self.current_sequence_index.unwrap() + 1);
self.state = SequenceExecutionHelperState::Busy; self.state = SequenceExecutionHelperState::Busy;
if let (Some(last_sequence_index), Some(current_sequence_index)) = if let (Some(last_sequence_index), Some(current_sequence_index)) =
(self.last_sequence_index, self.current_sequence_index) (self.last_sequence_index, self.current_sequence_index)
@ -182,6 +181,7 @@ impl SequenceExecutionHelper {
self.state = SequenceExecutionHelperState::Idle; self.state = SequenceExecutionHelperState::Idle;
} }
} }
self.current_sequence_index = Some(self.current_sequence_index.unwrap() + 1);
} }
} }
@ -638,7 +638,10 @@ mod tests {
.unwrap(), .unwrap(),
ModeCommandingResult::Done ModeCommandingResult::Done
); );
assert!(self.execution_helper.state() == SequenceExecutionHelperState::Idle); assert_eq!(
self.execution_helper.state(),
SequenceExecutionHelperState::Idle
);
assert!(self.sender.requests.borrow().is_empty()); assert!(self.sender.requests.borrow().is_empty());
} }
@ -987,6 +990,8 @@ mod tests {
assert!(tb.execution_helper.awaiting_success_check()); assert!(tb.execution_helper.awaiting_success_check());
assert_eq!(tb.execution_helper.current_sequence_index().unwrap(), 1); assert_eq!(tb.execution_helper.current_sequence_index().unwrap(), 1);
tb.generic_checks_subsystem_md1_step1(expected_req_id); tb.generic_checks_subsystem_md1_step1(expected_req_id);
tb.execution_helper.confirm_sequence_done();
tb.check_run_is_no_op();
} }
// TODO: Test subsystem commanding helper // TODO: Test subsystem commanding helper