mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
tests: fix tests to use new statedb constructor
This commit is contained in:
parent
73582c4a6e
commit
a92cba5619
1 changed files with 18 additions and 0 deletions
|
|
@ -18,6 +18,8 @@ package state
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
|
@ -44,3 +46,19 @@ func BenchmarkCutCustomTrim(b *testing.B) {
|
||||||
common.TrimLeftZeroes(value[:])
|
common.TrimLeftZeroes(value[:])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BenchmarkHashKey-6 1221526 975 ns/op
|
||||||
|
func BenchmarkHashKey(b *testing.B) {
|
||||||
|
key := common.HexToHash("0x01")
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
crypto.Keccak256Hash(key[:])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//BenchmarkEncodeValue-6 4843382 219 ns/op
|
||||||
|
func BenchmarkEncodeValue(b *testing.B) {
|
||||||
|
value := common.HexToHash("0x01")
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
rlp.EncodeToBytes(common.TrimLeftZeroes(value[:]))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue