mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-12 04:30:04 +00:00
10b237e72d
* db methods: remove Get prefix for getter functions * db methods: consistent test names by removing Get
37 lines
645 B
Go
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)
|
|
}
|
|
}
|