Test with m prefix
We have a single test case that tests for the m prefix while all the others do not. Move one test case into the loop and then test on each iteration the path with m prefix added.
This commit is contained in:
parent
c5073f4c51
commit
0c9dd31f53
|
@ -1151,20 +1151,21 @@ mod tests {
|
||||||
ChildNumber::from_hardened_idx(2).unwrap(),
|
ChildNumber::from_hardened_idx(2).unwrap(),
|
||||||
ChildNumber::from_normal_idx(2).unwrap(),
|
ChildNumber::from_normal_idx(2).unwrap(),
|
||||||
]),
|
]),
|
||||||
];
|
("0'/1/2'/2/1000000000", vec![
|
||||||
for (path, expected) in valid_paths {
|
|
||||||
assert_eq!(path.parse::<DerivationPath>().unwrap(), expected.into());
|
|
||||||
}
|
|
||||||
|
|
||||||
let want = DerivationPath::from(vec![
|
|
||||||
ChildNumber::ZERO_HARDENED,
|
ChildNumber::ZERO_HARDENED,
|
||||||
ChildNumber::ONE_NORMAL,
|
ChildNumber::ONE_NORMAL,
|
||||||
ChildNumber::from_hardened_idx(2).unwrap(),
|
ChildNumber::from_hardened_idx(2).unwrap(),
|
||||||
ChildNumber::from_normal_idx(2).unwrap(),
|
ChildNumber::from_normal_idx(2).unwrap(),
|
||||||
ChildNumber::from_normal_idx(1000000000).unwrap(),
|
ChildNumber::from_normal_idx(1000000000).unwrap(),
|
||||||
]);
|
]),
|
||||||
assert_eq!("0'/1/2'/2/1000000000".parse::<DerivationPath>().unwrap(), want);
|
];
|
||||||
assert_eq!("m/0'/1/2'/2/1000000000".parse::<DerivationPath>().unwrap(), want);
|
for (path, expected) in valid_paths {
|
||||||
|
// Access the inner private field so we don't have to clone expected.
|
||||||
|
assert_eq!(path.parse::<DerivationPath>().unwrap().0, expected);
|
||||||
|
// Test with the leading `m` for good measure.
|
||||||
|
let prefixed = format!("m/{}", path);
|
||||||
|
assert_eq!(prefixed.parse::<DerivationPath>().unwrap().0, expected);
|
||||||
|
}
|
||||||
|
|
||||||
let s = "0'/50/3'/5/545456";
|
let s = "0'/50/3'/5/545456";
|
||||||
assert_eq!(s.parse::<DerivationPath>(), s.into_derivation_path());
|
assert_eq!(s.parse::<DerivationPath>(), s.into_derivation_path());
|
||||||
|
|
Loading…
Reference in New Issue