tests

package
v0.0.0-...-0b52aac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreateProposal    = "createProposal"
	CreatePrepare     = "CreatePrepare"
	CreateCommit      = "CreateCommit"
	CreateRoundChange = "CreateRoundChange"
)
View Source
const ChangeProposerFuncInstanceHeight = 10

ChangeProposerFuncInstanceHeight tests with this height will return proposer operator ID 2

Variables

This section is empty.

Functions

This section is empty.

Types

type ControllerSpecTest

type ControllerSpecTest struct {
	Name            string
	RunInstanceData []*RunInstanceData
	OutputMessages  []*qbft.SignedMessage
	ExpectedError   string
	StartHeight     *qbft.Height `json:"omitempty"`
}

func (*ControllerSpecTest) GetPostState

func (test *ControllerSpecTest) GetPostState() (interface{}, error)

func (*ControllerSpecTest) Run

func (test *ControllerSpecTest) Run(t *testing.T)

func (*ControllerSpecTest) TestName

func (test *ControllerSpecTest) TestName() string

type CreateMsgSpecTest

type CreateMsgSpecTest struct {
	Name string
	// ISSUE 217: rename to root
	Value [32]byte
	// ISSUE 217: rename to value
	StateValue                                       []byte
	Round                                            qbft.Round
	RoundChangeJustifications, PrepareJustifications []*qbft.SignedMessage
	CreateType                                       string
	ExpectedRoot                                     string
	ExpectedState                                    types.Root `json:"-"` // Field is ignored by encoding/json"
	ExpectedError                                    string
}

func (*CreateMsgSpecTest) GetPostState

func (test *CreateMsgSpecTest) GetPostState() (interface{}, error)

func (*CreateMsgSpecTest) Run

func (test *CreateMsgSpecTest) Run(t *testing.T)

func (*CreateMsgSpecTest) TestName

func (test *CreateMsgSpecTest) TestName() string

type DecidedState

type DecidedState struct {
	DecidedVal         []byte
	DecidedCnt         uint
	BroadcastedDecided *qbft.SignedMessage
}

type MsgProcessingSpecTest

type MsgProcessingSpecTest struct {
	Name               string
	Pre                *qbft.Instance
	PostRoot           string
	PostState          types.Root `json:"-"` // Field is ignored by encoding/json
	InputMessages      []*qbft.SignedMessage
	OutputMessages     []*qbft.SignedMessage
	ExpectedError      string
	ExpectedTimerState *testingutils.TimerState
}

func (*MsgProcessingSpecTest) GetPostState

func (test *MsgProcessingSpecTest) GetPostState() (interface{}, error)

func (*MsgProcessingSpecTest) Run

func (test *MsgProcessingSpecTest) Run(t *testing.T)

func (*MsgProcessingSpecTest) TestName

func (test *MsgProcessingSpecTest) TestName() string

type MsgSpecTest

type MsgSpecTest struct {
	Name            string
	Messages        []*qbft.SignedMessage
	EncodedMessages [][]byte
	ExpectedRoots   [][32]byte
	ExpectedError   string
}

MsgSpecTest tests encoding and decoding of a msg

func (*MsgSpecTest) GetPostState

func (test *MsgSpecTest) GetPostState() (interface{}, error)

func (*MsgSpecTest) Run

func (test *MsgSpecTest) Run(t *testing.T)

func (*MsgSpecTest) TestName

func (test *MsgSpecTest) TestName() string

type RoundRobinSpecTest

type RoundRobinSpecTest struct {
	Name      string
	Share     *types.Share
	Heights   []qbft.Height
	Rounds    []qbft.Round
	Proposers []types.OperatorID
}

func (*RoundRobinSpecTest) GetPostState

func (test *RoundRobinSpecTest) GetPostState() (interface{}, error)

func (*RoundRobinSpecTest) Run

func (test *RoundRobinSpecTest) Run(t *testing.T)

func (*RoundRobinSpecTest) TestName

func (test *RoundRobinSpecTest) TestName() string

type RunInstanceData

type RunInstanceData struct {
	InputValue           []byte
	InputMessages        []*qbft.SignedMessage
	ControllerPostRoot   string
	ControllerPostState  types.Root `json:"-"` // Field is ignored by encoding/json
	ExpectedTimerState   *testingutils.TimerState
	ExpectedDecidedState DecidedState
	Height               *qbft.Height `json:"omitempty"`
}

type SpecTest

type SpecTest interface {
	TestName() string
	Run(t *testing.T)
	GetPostState() (interface{}, error)
}

func HappyFlow

func HappyFlow() SpecTest

HappyFlow tests a simple full happy flow until decided

func SevenOperators

func SevenOperators() SpecTest

SevenOperators tests a simple full happy flow until decided

func TenOperators

func TenOperators() SpecTest

TenOperators tests a simple full happy flow until decided

func ThirteenOperators

func ThirteenOperators() SpecTest

ThirteenOperators tests a simple full happy flow until decided

type TestF

type TestF func() SpecTest

Directories

Path Synopsis
controller

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL