Adds roundtrip tests for Network::from_core_arg

This commit is contained in:
Sergi Delgado Segura 2022-12-08 07:18:34 -05:00
parent bd1eb29f61
commit d7006ef80d
1 changed files with 15 additions and 0 deletions

View File

@ -599,4 +599,19 @@ mod tests {
assert_eq!(&magic.to_string(), magic_str);
}
}
#[test]
fn from_to_core_arg() {
let expected_pairs = [
(Network::Bitcoin, "main"),
(Network::Testnet, "test"),
(Network::Regtest, "regtest"),
(Network::Signet, "signet"),
];
for (net, core_arg) in &expected_pairs {
assert_eq!(Network::from_core_arg(core_arg), Ok(*net));
assert_eq!(net.to_core_arg(), *core_arg);
}
}
}