Witness serde: test binary encoding to be backward-compatible
This also removes tests for JSON backward-compatible encoding. Human-readable encoding will be changed in the next commit and this will break backward compatibility, thus that part of the test is removed.
This commit is contained in:
parent
b409ae78a4
commit
93b66c55b3
|
@ -423,20 +423,21 @@ mod test {
|
|||
|
||||
#[cfg(feature = "serde")]
|
||||
#[test]
|
||||
fn test_serde() {
|
||||
use serde_json;
|
||||
fn test_serde_bincode() {
|
||||
use bincode;
|
||||
|
||||
let old_witness_format = vec![vec![0u8], vec![2]];
|
||||
let new_witness_format = Witness::from_vec(old_witness_format.clone());
|
||||
|
||||
let old = serde_json::to_string(&old_witness_format).unwrap();
|
||||
let new = serde_json::to_string(&new_witness_format).unwrap();
|
||||
let old = bincode::serialize(&old_witness_format).unwrap();
|
||||
let new = bincode::serialize(&new_witness_format).unwrap();
|
||||
|
||||
assert_eq!(old, new);
|
||||
|
||||
let back = serde_json::from_str(&new).unwrap();
|
||||
let back: Witness = bincode::deserialize(&new).unwrap();
|
||||
assert_eq!(new_witness_format, back);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue