Remove unnecessary usage of `Vec`

This commit is contained in:
Jack Grigg 2022-04-28 20:58:31 +00:00
parent 30f9452743
commit 4ec036c851
2 changed files with 6 additions and 18 deletions

View File

@ -161,27 +161,18 @@ mod tests {
#[test]
fn i2lebsp_k_round_trip() {
{
let bitstring = (0..K).map(|_| rand::random()).collect::<Vec<_>>();
assert_eq!(
i2lebsp_k(lebs2ip_k(&bitstring) as usize).to_vec(),
bitstring
);
let bitstring = [0; K].map(|_| rand::random());
assert_eq!(i2lebsp_k(lebs2ip_k(&bitstring) as usize), bitstring);
}
{
let bitstring = [false; K];
assert_eq!(
i2lebsp_k(lebs2ip_k(&bitstring) as usize).to_vec(),
bitstring
);
assert_eq!(i2lebsp_k(lebs2ip_k(&bitstring) as usize), bitstring);
}
{
let bitstring = [true; K];
assert_eq!(
i2lebsp_k(lebs2ip_k(&bitstring) as usize).to_vec(),
bitstring
);
assert_eq!(i2lebsp_k(lebs2ip_k(&bitstring) as usize), bitstring);
}
}

View File

@ -302,11 +302,8 @@ mod tests {
#[test]
fn i2lebsp_round_trip() {
{
let bitstring = (0..64).map(|_| rand::random()).collect::<Vec<_>>();
assert_eq!(
i2lebsp::<64>(lebs2ip::<64>(&bitstring.clone().try_into().unwrap())).to_vec(),
bitstring
);
let bitstring = [0; 64].map(|_| rand::random());
assert_eq!(i2lebsp(lebs2ip(&bitstring)), bitstring);
}
{