Skip to content
Snippets Groups Projects

add "long full recoding" test

Merged STEVAN Antoine requested to merge tests into main
+ 16
2
@@ -206,6 +206,7 @@ mod tests {
};
use itertools::Itertools;
use rand::seq::SliceRandom;
use super::recode_with_coeffs;
@@ -441,6 +442,14 @@ mod tests {
}
}
// (encode) | (select k) | (recode) | (decode)
// *
// * * * * ... * * \
// * ------> * ---------> * --> * ... * --> * |--> ?
// * * * * ... * * /
// * \__(#steps)_/
//
// k n k k k k
fn long_full_end_to_end_with_recoding_template<F: PrimeField>(
data: &[u8],
k: usize,
@@ -452,12 +461,17 @@ mod tests {
let mut shards = encode::<F>(data, &Matrix::random(k, n, &mut rng))
.unwrap_or_else(|_| panic!("could not encode {test_case}"));
shards.shuffle(&mut rng);
shards.truncate(k);
for _ in 0..nb_steps {
shards.push(recode_random(&shards, &mut rng).unwrap().unwrap());
shards = (0..k)
.map(|_| recode_random(&shards, &mut rng).unwrap().unwrap())
.collect();
}
try_all_decoding_combinations(data, &shards, k, n, &test_case, Some(100), vec![]);
let actual = decode::<F>(shards).unwrap_or_else(|_| panic!("could not decode {test_case}"));
assert_eq!(data, actual, "bad decoded data with {test_case}",);
}
#[test]
Loading