From 6e5e0ddb2d31cc32d06f3ce7b5a2b22e770d13ec Mon Sep 17 00:00:00 2001 From: mossid Date: Tue, 19 Feb 2019 14:36:56 +0100 Subject: [PATCH] rm comments, uncomment heap_test --- store/cachekv/heap.go | 31 ------------------------------- store/cachekv/heap_test.go | 22 ---------------------- store/cachekv/store_test.go | 2 -- 3 files changed, 55 deletions(-) diff --git a/store/cachekv/heap.go b/store/cachekv/heap.go index e84921ea15d0..145b23a4d82c 100644 --- a/store/cachekv/heap.go +++ b/store/cachekv/heap.go @@ -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 { @@ -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 } diff --git a/store/cachekv/heap_test.go b/store/cachekv/heap_test.go index fe32f5d9d1c1..d8f6057115a4 100644 --- a/store/cachekv/heap_test.go +++ b/store/cachekv/heap_test.go @@ -1,6 +1,5 @@ package cachekv -/* import ( "bytes" "math/rand" @@ -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()) -} -*/ diff --git a/store/cachekv/store_test.go b/store/cachekv/store_test.go index f443841d7c48..016f1b54bde3 100644 --- a/store/cachekv/store_test.go +++ b/store/cachekv/store_test.go @@ -425,7 +425,6 @@ 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() @@ -433,7 +432,6 @@ func checkIterators(t *testing.T, itr, itr2 types.Iterator) { require.Equal(t, k, k2) require.Equal(t, v, v2) itr2.Next() - i++ } require.False(t, itr.Valid()) require.False(t, itr2.Valid())