Add type annotations in serde tests

This commit is contained in:
S.Brandeis 2020-01-25 20:24:21 +01:00 committed by Sébastien Crozet
parent 6d608cb99f
commit 4d97447cbd
1 changed files with 4 additions and 2 deletions

View File

@ -14,7 +14,8 @@ macro_rules! test_serde(
fn $test() { fn $test() {
let v: $ty<f32> = rand::random(); let v: $ty<f32> = rand::random();
let serialized = serde_json::to_string(&v).unwrap(); let serialized = serde_json::to_string(&v).unwrap();
assert_eq!(v, serde_json::from_str(&serialized).unwrap()); let deserialized: $ty<f32> = serde_json::from_str(&serialized).unwrap();
assert_eq!(v, deserialized);
} }
)*} )*}
); );
@ -23,7 +24,8 @@ macro_rules! test_serde(
fn serde_dmatrix() { fn serde_dmatrix() {
let v: DMatrix<f32> = DMatrix::new_random(3, 4); let v: DMatrix<f32> = DMatrix::new_random(3, 4);
let serialized = serde_json::to_string(&v).unwrap(); let serialized = serde_json::to_string(&v).unwrap();
assert_eq!(v, serde_json::from_str(&serialized).unwrap()); let deserialized: DMatrix<f32> = serde_json::from_str(&serialized).unwrap();
assert_eq!(v, deserialized);
} }
test_serde!( test_serde!(