Skip to content

Commit

Permalink
TestBTree_Put2 test corrections and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Gaetano Padula committed Oct 11, 2024
1 parent 50f207f commit 8ae631a
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions btree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func TestBTree_Put2(t *testing.T) {

defer btree.Close()

for i := 0; i < 500; i++ {
for i := 0; i < 1000; i++ {

err := btree.Put([]byte(strconv.Itoa(i)), []byte(strconv.Itoa(i)))
if err != nil {
Expand All @@ -120,18 +120,20 @@ func TestBTree_Put2(t *testing.T) {

}

//btree.PrintTree()
for i := 0; i < 500; i++ {
key, err := btree.Get([]byte(strconv.Itoa(i)))
if err != nil {
t.Fatal(err)
}

//for i := 0; i < 500; i++ {
// key, err := btree.Get([]byte(strconv.Itoa(i)))
// if err != nil {
// t.Fatal(err)
// }
//
// if key == nil {
// t.Fatal("expected key to be not nil")
// }
//}
if string(key.V[0]) != strconv.Itoa(i) {
t.Fatalf("expected value to be %d, got %s", i, key.V[0])
}

if key == nil {
t.Fatal("expected key to be not nil")
}
}
}

func TestBTree_Delete(t *testing.T) {
Expand Down

0 comments on commit 8ae631a

Please sign in to comment.