test_shred_fec_set_index fix (#24540)

This commit is contained in:
Jeff Biseda 2022-04-20 16:26:44 -07:00 committed by GitHub
parent 40b48f807a
commit 96d977fd05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1828,13 +1828,13 @@ pub mod tests {
);
let max_per_block = MAX_DATA_SHREDS_PER_FEC_BLOCK as usize;
data_shreds.iter().enumerate().for_each(|(i, s)| {
let expected_fec_set_index = start_index + ((i / max_per_block) * max_per_block) as u32;
let expected_fec_set_index = start_index + (i - i % max_per_block) as u32;
assert_eq!(s.fec_set_index(), expected_fec_set_index);
});
coding_shreds.iter().enumerate().for_each(|(i, s)| {
let mut expected_fec_set_index = start_index + (i - i % max_per_block) as u32;
while expected_fec_set_index as usize > data_shreds.len() {
while expected_fec_set_index as usize - start_index as usize > data_shreds.len() {
expected_fec_set_index -= max_per_block as u32;
}
assert_eq!(s.fec_set_index(), expected_fec_set_index);