From eec322c22542f32c72814b39e7084b86dcc55661 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 9 Jun 2023 09:26:28 -0300 Subject: [PATCH] tree: fix test Signed-off-by: Ignacio Hagopian --- tree_test.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tree_test.go b/tree_test.go index a28d5d51..a6031f29 100644 --- a/tree_test.go +++ b/tree_test.go @@ -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) }