use al_jabr::{column_vector, matrix, ColumnVector, Matrix}; #[test] fn test_serialize() { let v = column_vector![1u32, 2, 3, 4, 5, 6, 7]; assert_eq!(serde_json::to_string(&v).unwrap(), "[[1,2,3,4,5,6,7]]"); let m = matrix![[1u32, 2], [3u32, 4],]; assert_eq!(serde_json::to_string(&m).unwrap(), "[[1,3],[2,4]]"); } // Doesn't currently work due to a compiler bug. #[test] fn test_deserialize() { let v: ColumnVector = serde_json::from_str("[[1,2,3,4,5,6,7]]").unwrap(); assert_eq!(v, column_vector![1u32, 2, 3, 4, 5, 6, 7],); let m: Matrix = serde_json::from_str("[[1,3],[2,4]]").unwrap(); assert_eq!(m, matrix![[1u32, 2], [3u32, 4],],); }