mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-07 19:41:19 +00:00
bcee4845dc
* save state * remove repair * save state * remove emptydb check * save state * add walkAsOf test * add WalkAsOf and MultiWalkAsOf tests * deployed contracts counter * reference counter for contract code * drop storage root&contract hash for changesets * start incarnation is 1(save state) * fix ReorgOverSelfDestruct test * hack fix TestReorgOverSelfDestruct * test benchmark * cleanup * remove useless debug * remove print trie * return remove subtrie call to updateTrieRoot * save state * add mutation test * remove useless test * fix * added mutation commit test * rename experiment to thin history * thin history mutation commit test * fix ethdb tests * getAsOf test * add test&fix history index * fix test * make test for index search * compute trie root incarnation fix * tests fixes * done job in case of panic * fix lint * fix&test for bad incarnation * fix initial incarnation for genesis * fix lint * fix changeset test * fix storage ranges test * fix lint * move set incarnation to create contract * add comment Co-authored-by: ledgerwatch <akhounov@gmail.com> Co-authored-by: Evgeny Danilenko <6655321@bk.ru>
42 lines
623 B
Go
42 lines
623 B
Go
package ethdb
|
|
|
|
import "testing"
|
|
|
|
func TestHistoryIndex_Search(t *testing.T) {
|
|
index := &HistoryIndex{3, 5, 8}
|
|
v, _ := index.Search(1)
|
|
if v != 3 {
|
|
t.Fatal("must be 3")
|
|
}
|
|
v, _ = index.Search(3)
|
|
if v != 3 {
|
|
t.Fatal("must be 3")
|
|
}
|
|
|
|
v, _ = index.Search(4)
|
|
if v != 5 {
|
|
t.Fatal("must be 5")
|
|
}
|
|
|
|
v, _ = index.Search(5)
|
|
if v != 5 {
|
|
t.Fatal("must be 5")
|
|
}
|
|
v, _ = index.Search(7)
|
|
if v != 8 {
|
|
t.Fatal("must be 8")
|
|
}
|
|
_, b := index.Search(9)
|
|
if b {
|
|
t.Fatal("must be not found")
|
|
}
|
|
}
|
|
|
|
func TestHistoryIndex_Search2(t *testing.T) {
|
|
index := &HistoryIndex{}
|
|
_, b := index.Search(1)
|
|
if b {
|
|
t.FailNow()
|
|
}
|
|
}
|