diff --git a/nmt_test.go b/nmt_test.go index 8bdb3d8..d44a352 100644 --- a/nmt_test.go +++ b/nmt_test.go @@ -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) }) })