File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -511,4 +511,23 @@ mod tests {
511511 assert_eq ! ( first_interval, Duration :: from_millis( 6 ) ) ;
512512 assert_eq ! ( num_flashblocks, 143 ) ;
513513 }
514+
515+ // ============================================================================
516+ // Zero remaining time -- This happens when FCU arrives after the deadline
517+ // ============================================================================
518+
519+ #[ test]
520+ fn zero_time_left ( ) {
521+ // We should get zero flashblocks since there's no time left
522+ let block_time = Duration :: from_secs ( 2 ) ;
523+ let remaining_time = Duration :: from_millis ( 0 ) ;
524+ let interval = Duration :: from_millis ( 200 ) ;
525+
526+ let ( num_flashblocks, first_interval) =
527+ partition_time_into_flashblocks ( block_time, remaining_time, interval) ;
528+
529+ // 0 / 200 = 0 with remainder 0
530+ assert_eq ! ( first_interval, Duration :: from_millis( 200 ) ) ;
531+ assert_eq ! ( num_flashblocks, 0 ) ;
532+ }
514533}
You can’t perform that action at this time.
0 commit comments