erigon-pulse/turbo/snapshotsync/snapshot_mode_test.go
b00ris 6464da7670
Remote snapshot downloader (#1343)
* save state

* save state

* save state

* refactoring

* fix

* save state

* save state

* fmt

* fix lint

* restore torrents for external downloader

* fix lint

* download

* skip debug test

* debug

* remote debug

* small cli fixes

* skip debug test

* external snapshot predownloader

* get rid of remote downloader

* fix lint

* clean makefile

* fix lint

* fix lint

* cleanup

* fix ci

* fmt

* remove proto from interfaces

* Squashed 'interfaces/' content from commit acd02bb94

git-subtree-dir: interfaces
git-subtree-split: acd02bb94c5a421aa8f8d1fd76cd8aad668e9fcb
2020-11-13 16:16:47 +00:00

42 lines
691 B
Go

package snapshotsync
import (
"reflect"
"testing"
)
func TestSnapshotMode(t *testing.T) {
sm := SnapshotMode{}
sm.Receipts = true
if sm.ToString() != "r" {
t.Fatal(sm.ToString())
}
sm.State = true
if sm.ToString() != "sr" {
t.Fatal(sm.ToString())
}
sm.Bodies = true
if sm.ToString() != "bsr" {
t.Fatal(sm.ToString())
}
sm.Headers = true
if sm.ToString() != "hbsr" {
t.Fatal(sm.ToString())
}
}
func TestSnapshotModeFromString(t *testing.T) {
sm, err := SnapshotModeFromString("hsbr")
if err != nil {
t.Fatal(err)
}
if reflect.DeepEqual(sm, SnapshotMode{
Headers: true,
Bodies: true,
State: true,
Receipts: true,
}) == false {
t.Fatal(sm)
}
}