Skip to content

Commit

Permalink
add unit test to increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet committed Apr 1, 2022
1 parent 0ae8872 commit 0fd8b22
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -851,3 +851,22 @@ func TestLeafToCommsLessThan16(*testing.T) {
)
leafToComms(p[:], value[:])
}

func TestGetProofItemsOneExtStatusForTwoMissingNodes(t *testing.T) {

root := New()
root.Insert(ffx32KeyTest, zeroKeyTest, nil)

// insert two keys that differ from the inserted stem
// by one byte.
key1, _ := hex.DecodeString("ffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
key2, _ := hex.DecodeString("ffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffff")

_, esses, poas := root.GetProofItems(keylist{key1, key2, ffx32KeyTest})
if len(poas) != 1 {
t.Fatalf("returned %d poas instead of 1", len(poas))
}
if len(esses) != 1 {
t.Fatalf("returned %d extension statuses instead of the expected 1", len(esses))
}
}

0 comments on commit 0fd8b22

Please sign in to comment.