More type testing.

This commit is contained in:
Teknique 2023-05-26 18:29:06 -07:00
parent 9daf47d117
commit f1e12a8ac3

View File

@ -11,14 +11,34 @@ pub async fn test_round_trip_peerinfo() {
} }
pub async fn test_alignedu64() { pub async fn test_alignedu64() {
let a = AlignedU64::new(0x0123456789abcdef); let orig = AlignedU64::new(0x0123456789abcdef);
let copy = deserialize_json(&serialize_json(orig)).unwrap();
let b = serialize_json(a); assert_eq!(orig, copy);
let c = deserialize_json(&b).unwrap(); }
assert_ne!(a, c); pub async fn test_fourcc() {
let orig = FourCC::from_str("D34D").unwrap();
let copy = deserialize_json(&serialize_json(orig)).unwrap();
assert_eq!(orig, copy);
}
pub async fn test_safetyspec() {
let orig = SafetySpec {
preferred_route: Some(CryptoKey::new(*b"thisISaKEYthat's32charsLONGitIS!")),
hop_count: 23,
stability: Stability::default(),
sequencing: Sequencing::default(),
};
let copy = deserialize_json(&serialize_json(orig)).unwrap();
assert_eq!(orig, copy);
} }
pub async fn test_all() { pub async fn test_all() {
test_round_trip_peerinfo().await; test_round_trip_peerinfo().await;
test_alignedu64().await;
test_fourcc().await;
test_safetyspec().await;
} }