From 7428fad29c7cd5408e5450cdeaf6675844dced7c Mon Sep 17 00:00:00 2001 From: sergeych Date: Sun, 26 Nov 2023 19:43:55 +0300 Subject: [PATCH] more serde tests for fixed and variable length arrays --- src/de.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/de.rs b/src/de.rs index a6dcc82..ace9875 100644 --- a/src/de.rs +++ b/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..]); + } } \ No newline at end of file