tests

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 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 added in v0.2.2

type ControllerSpecTest struct {
	Name            string
	RunInstanceData []*RunInstanceData
	OutputMessages  []*qbft.SignedMessage
	ExpectedError   string
}

func (*ControllerSpecTest) GetPostState added in v0.3.1

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

func (*ControllerSpecTest) Run added in v0.2.2

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

func (*ControllerSpecTest) TestName added in v0.2.2

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 added in v0.3.1

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 added in v0.3.0

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 added in v0.3.1

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 added in v0.3.1

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 added in v0.3.1

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 added in v0.2.7

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 added in v0.3.1

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 added in v0.3.1

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