Skip to content

Commit

Permalink
rm comments, uncomment heap_test
Browse files Browse the repository at this point in the history
  • Loading branch information
mossid committed Feb 26, 2019
1 parent 106541f commit 6e5e0dd
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 55 deletions.
31 changes: 0 additions & 31 deletions store/cachekv/heap.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,32 +246,6 @@ func (it *hptr) siftDown() {
grandChild.set(bubble)
bubble = tmp
}

/*
target := it
left := it.leftChild()
right := it.rightChild()
if left.exists() {
if !target.isParent(left) {
target = left
}
}
if right.exists() {
if !target.isParent(right) {
target = right
}
}
if target == it {
return
}
fmt.Printf("swap %X %X\n", it.key(), target.key())
it.swap(target)
target.siftDown()
*/
}

type heap struct {
Expand Down Expand Up @@ -314,11 +288,6 @@ func newHeap(pairs cmnpairs, ascending bool) (res *heap) {
for i := len(pairs) / 2; i >= 0; i-- {
res.ptr(i).siftDown()
}
/*
for k, v := range res.indexByKey {
fmt.Printf("%X %d\n", []byte(k), v)
}
*/
return
}

Expand Down
22 changes: 0 additions & 22 deletions store/cachekv/heap_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package cachekv

/*
import (
"bytes"
"math/rand"
Expand Down Expand Up @@ -126,24 +125,3 @@ func TestHeapDuplicateElements(t *testing.T) {

require.Equal(t, size, heap.length())
}
func TestHeapDeleteElements(t *testing.T) {
size := 1000
pairs1 := make([]cmn.KVPair, 0, size)
pairs2 := make([]cmn.KVPair, 0, size)
for i := 0; i < size; i++ {
bz := randgen(i)
pairs1 = append(pairs1, cmn.KVPair{Key: bz, Value: bz})
pairs2 = append(pairs2, cmn.KVPair{Key: bz, Value: bz})
}
heap := newHeap(cmnpairs(pairs1), true)
for _, pair := range pairs2 {
heap.del(pair.Key)
}
require.Equal(t, 0, heap.length())
}
*/
2 changes: 0 additions & 2 deletions store/cachekv/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,15 +425,13 @@ func assertIterateDomainCompare(t *testing.T, st types.KVStore, mem dbm.DB) {
}

func checkIterators(t *testing.T, itr, itr2 types.Iterator) {
i := 0
for ; itr.Valid(); itr.Next() {
require.True(t, itr2.Valid())
k, v := itr.Key(), itr.Value()
k2, v2 := itr2.Key(), itr2.Value()
require.Equal(t, k, k2)
require.Equal(t, v, v2)
itr2.Next()
i++
}
require.False(t, itr.Valid())
require.False(t, itr2.Valid())
Expand Down

0 comments on commit 6e5e0dd

Please sign in to comment.