more serde tests for fixed and variable length arrays
This commit is contained in:
parent
94ba11f8e2
commit
7428fad29c
17
src/de.rs
17
src/de.rs
@ -377,4 +377,21 @@ mod tests {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_arrays() {
|
||||
let x = (1,2,3,4,5);
|
||||
// println!("{:?}",x);
|
||||
// println!("{}", to_dump(to_bytes(&x).unwrap().as_slice()));
|
||||
assert_eq!(5,to_bytes(&x).unwrap().len());
|
||||
testeq(&x);
|
||||
let y: [u8; 5] = [1,2,3,4,5];
|
||||
println!("{}", to_dump(to_bytes(&y).unwrap().as_slice()));
|
||||
assert_eq!(5, to_bytes(&y).unwrap().len());
|
||||
assert_eq!(y, to_bytes(&y).unwrap()[..]);
|
||||
testeq(&y);
|
||||
let z = vec![1,2,3,4,5];
|
||||
assert_eq!(6, to_bytes(&z).unwrap().len());
|
||||
assert_eq!(z, to_bytes(&z).unwrap()[1..]);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user