add test to NewKeyFromString for empty and zeroed extended key
This commit is contained in:
parent
1b747bcbc7
commit
4fabcca216
|
@ -438,6 +438,7 @@ func TestErrors(t *testing.T) {
|
|||
err error
|
||||
neuter bool
|
||||
neuterErr error
|
||||
extKey *ExtendedKey
|
||||
}{
|
||||
{
|
||||
name: "invalid key length",
|
||||
|
@ -461,6 +462,22 @@ func TestErrors(t *testing.T) {
|
|||
neuter: true,
|
||||
neuterErr: chaincfg.ErrUnknownHDKeyID,
|
||||
},
|
||||
{
|
||||
name: "zeroed extended key",
|
||||
key: EmptyExtendedKeyString,
|
||||
err: nil,
|
||||
neuter: false,
|
||||
neuterErr: nil,
|
||||
extKey: &ExtendedKey{},
|
||||
},
|
||||
{
|
||||
name: "empty string",
|
||||
key: "",
|
||||
err: nil,
|
||||
neuter: false,
|
||||
neuterErr: nil,
|
||||
extKey: &ExtendedKey{},
|
||||
},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
|
@ -477,6 +494,13 @@ func TestErrors(t *testing.T) {
|
|||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if test.extKey != nil {
|
||||
if !reflect.DeepEqual(extKey, test.extKey) {
|
||||
t.Errorf("ExtKey #%d (%s): mismatched extended key -- got: %+v, want: %+v", i, test.name, extKey, test.extKey)
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue