MCPcopy Create free account
hub / github.com/bytesize-rs/bytesize / test_serde_json

Function test_serde_json

src/serde.rs:98–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

96
97 #[test]
98 fn test_serde_json() {
99 let json = serde_json::to_string(&ByteSize::mib(1)).unwrap();
100 assert_eq!(json, "\"1.0 MiB\"");
101
102 let deserialized = serde_json::from_str::<ByteSize>(&json).unwrap();
103 assert_eq!(deserialized.0, 1048576);
104 }
105}

Callers

nothing calls this directly

Calls 1

mibFunction · 0.85

Tested by

no test coverage detected