Skip to content

Commit

Permalink
test: fix TestNamespacedMerkleTree_calculateAbsenceIndex_Panic
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp committed Mar 30, 2023
1 parent eb012d0 commit 927c7f3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,12 +596,17 @@ func TestNamespacedMerkleTree_calculateAbsenceIndex_Panic(t *testing.T) {
nID namespace.ID
pushData []namespaceDataPair
}{
{"empty tree", []byte{0, 0}, []namespaceDataPair{}},
{"((0,0) == nID < minNID == (0,1))", []byte{0, 0}, generateLeafData(nidLen, 1, 3, []byte{})},
{"((0,3) == nID > maxNID == (0,2))", []byte{0, 3}, generateLeafData(nidLen, 1, 3, []byte{})},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
n := New(sha256.New(), NamespaceIDSize(2))
for _, d := range tt.pushData {
err := n.Push(namespace.PrefixedData(append(d.ID, d.Data...)))
assert.NoError(t, err)
}
shouldPanic(t,
func() { n.calculateAbsenceIndex(tt.nID) })
})
Expand Down

0 comments on commit 927c7f3

Please sign in to comment.