Skip to content

Commit

Permalink
tree: fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
jsign committed Jun 9, 2023
1 parent 1b76a84 commit e1b2adf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1322,13 +1322,18 @@ func TestManipulateChildren(t *testing.T) {
}

func TestLeafNodeInsert(t *testing.T) {
values := make([][]byte, NodeWidth)
valIdx := 42
values[valIdx] = testValue
ln := NewLeafNode(ffx32KeyTest[:StemSize], values)
ffx31plus42 := append(ffx32KeyTest[:StemSize], byte(valIdx))

tree := New()
if err := tree.Insert(ffx31plus42, testValue, nil); err != nil {
t.Fatalf("failed to insert key: %v", err)
}
tree.Commit()
ln := tree.(*InternalNode).Children()[ffx32KeyTest[0]].(*LeafNode)

// Check we get the value correctly via Get(...).
getValue, err := ln.Get(append(ffx32KeyTest[:StemSize], byte(valIdx)), nil)
getValue, err := ln.Get(ffx31plus42, nil)
if err != nil {
t.Fatalf("failed to get leaf node key/value: %v", err)
}
Expand Down

0 comments on commit e1b2adf

Please sign in to comment.