prysm-pulse/beacon-chain/db/simulator_test.go
Ed Mazurek 10b237e72d db methods: remove Get prefix (#1351)
* db methods: remove Get prefix for getter functions

* db methods: consistent test names by removing Get
2019-01-21 17:34:11 +08:00

37 lines
645 B
Go

package db
import (
"testing"
)
func TestSimulatorSlotAndSaveSimulatorSlot(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)
retSlot, err := db.SimulatorSlot()
if err != nil {
t.Fatalf("get slot failed: %v", err)
}
if retSlot != 0 {
t.Fatalf("empty db does not have a simulator slot of 0")
}
slot := uint64(10)
err = db.SaveSimulatorSlot(slot)
if err != nil {
t.Fatalf("save slot failed: %v", err)
}
retSlot, err = db.SimulatorSlot()
if err != nil {
t.Fatalf("get slot failed: %v", err)
}
if retSlot != slot {
t.Errorf("retrieved slot not the same as the one saved to disk %d : %d", retSlot, slot)
}
}