Skip to content

Commit

Permalink
tree: add extracted test case from TestRandom showing Delete(...) fai…
Browse files Browse the repository at this point in the history
…lure

Signed-off-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
jsign committed Jan 17, 2024
1 parent 22541f1 commit 1d937cb
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1806,3 +1806,36 @@ func TestRandom(t *testing.T) {
t.Fatal(err)
}
}

func TestRandomExtracted(t *testing.T) {
t.Parallel()

k1490, _ := hex.DecodeString("1490d65886f02ffa1a7dca88187dc8176ada23221c83e9f7da9e15c27d0b813d")
val_k1490_0, _ := hex.DecodeString("3a8ee0370c16ba642123f80692ee63ade4477fce3bf0c68b638e189a014d8b04")
k1413, _ := hex.DecodeString("1413dabef075cc47d380d740f7b24050568659c809830b1affbc765b7b651e1e")
val_k1413_0, _ := hex.DecodeString("7469fa29e0d049e80eed8f99f2418bc36ebc3c3b3041515fd519701d60f86b9f")
val_k1413_1, _ := hex.DecodeString("79702b187fa6f75ecd7cad23a2cafc3b13976dcefd99c3ff479300655ef9ef92")

root := New()

if err := root.Insert(k1490, val_k1490_0, nil); err != nil {
panic(err)
}
if err := root.Insert(k1413, val_k1413_0, nil); err != nil {
panic(err)
}
if _, err := root.Delete(k1413, nil); err != nil {
panic(err)
}
if err := root.Insert(k1413, val_k1413_1, nil); err != nil {
panic(err)
}

val, err := root.Get(k1490, nil)
if err != nil {
t.Fatalf("error getting key: %v", err)
}
if !bytes.Equal(val, val_k1490_0) {
t.Fatalf("got %x, expected %x", val, val_k1490_0)
}
}

0 comments on commit 1d937cb

Please sign in to comment.