Commit fcd5f4d1 authored by 陈德海's avatar 陈德海

change mempool QueueDirection test

parent 97bb538d
......@@ -134,5 +134,18 @@ func TestQueueDirection(t *testing.T) {
cache.Push(item4)
cache.Push(item5)
cache.txList.Print()
assert.Equal(t, true, cache.txList.GetIterator().First().Score >= cache.txList.GetIterator().Last().Score)
i := 0
lastScore := cache.txList.GetIterator().First().Score
var tmpScore int64
cache.Walk(5, func(value *drivers.Item) bool {
tmpScore = cache.txMap[string(value.Value.Hash())].Score
if lastScore < tmpScore {
return false
}
lastScore = tmpScore
i++
return true
})
assert.Equal(t, 5, i)
assert.Equal(t, true, lastScore == cache.txList.GetIterator().Last().Score)
}
......@@ -134,5 +134,18 @@ func TestQueueDirection(t *testing.T) {
cache.Push(item4)
cache.Push(item5)
cache.txList.Print()
assert.Equal(t, true, cache.txList.GetIterator().First().Score >= cache.txList.GetIterator().Last().Score)
i := 0
lastScore := cache.txList.GetIterator().First().Score
var tmpScore int64
cache.Walk(5, func(value *drivers.Item) bool {
tmpScore = cache.txMap[string(value.Value.Hash())].Score
if lastScore < tmpScore {
return false
}
lastScore = tmpScore
i++
return true
})
assert.Equal(t, 5, i)
assert.Equal(t, true, lastScore == cache.txList.GetIterator().Last().Score)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment