Fixing tests for non-standard network types in Network serialization
@@ -413,20 +413,23 @@ mod test {
let testnet_bytes = &[0x0Bu8, 0x11u8, 0x09u8, 0x07u8][..];
let regtest_bytes = &[0xFAu8, 0xBFu8, 0xB5u8, 0xDAu8][..];
let signet_bytes = &[0x0Au8, 0x03u8, 0xCFu8, 0x40u8][..];
- //let random_bytes = &[0xA1u8, 0xA2u8, 0xA3u8, 0xA4u8][..];
let mainnet = Network::strict_decode(mainnet_bytes).unwrap();
let testnet = Network::strict_decode(testnet_bytes).unwrap();
let regtest = Network::strict_decode(regtest_bytes).unwrap();
let signet = Network::strict_decode(signet_bytes).unwrap();
- //let other = Network::strict_decode(random_bytes).unwrap();
assert!(test_suite(&mainnet, &mainnet_bytes, 4).is_ok());
assert!(test_suite(&testnet, &testnet_bytes, 4).is_ok());
assert!(test_suite(&regtest, &regtest_bytes, 4).is_ok());
assert!(test_suite(&signet, &signet_bytes, 4).is_ok());
- // TODO: Network::Other failing the below assertion
- //assert!(test_suite(&other, &random_bytes, 4).is_ok());
+ }
+
+ #[test]
+ #[should_panic]
+ fn test_encoding_network_failure() {
+ let random_bytes = &[0xA1u8, 0xA2u8, 0xA3u8, 0xA4u8][..];
+ Network::strict_decode(random_bytes).unwrap();
}
#[test]
