2020-02-13 14:45:02 +00:00
|
|
|
package eth
|
|
|
|
|
|
|
|
import (
|
|
|
|
"reflect"
|
|
|
|
"testing"
|
2020-03-11 10:31:49 +00:00
|
|
|
|
|
|
|
"github.com/davecgh/go-spew/spew"
|
|
|
|
"github.com/ledgerwatch/turbo-geth/ethdb"
|
2020-02-13 14:45:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestSetStorageModeIfNotExist(t *testing.T) {
|
|
|
|
db := ethdb.NewMemDatabase()
|
2020-05-23 09:19:56 +00:00
|
|
|
sm, err := GetStorageModeFromDB(db)
|
2020-02-13 14:45:02 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if !reflect.DeepEqual(sm, StorageMode{}) {
|
|
|
|
t.Fatal()
|
|
|
|
}
|
|
|
|
|
|
|
|
err = setStorageModeIfNotExist(db, StorageMode{
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2020-05-23 09:19:56 +00:00
|
|
|
sm, err = GetStorageModeFromDB(db)
|
2020-02-13 14:45:02 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if !reflect.DeepEqual(sm, StorageMode{
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
}) {
|
|
|
|
spew.Dump(sm)
|
|
|
|
t.Fatal("not equal")
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|