test

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxBalance that will be used for deposit testing.
	MaxBalance = uint64(1) << 30
	// MinBalance is the minimal amount that will to be deposited.
	MinBalance = uint64(1) << 20
)
View Source
const (
	Host = "http://127.0.0.1"
	Port = 4943
)

Variables

View Source
var DefaultTestTimeout = 200

Functions

func DefaultRandomOpts

func DefaultRandomOpts() pchtest.RandomOpt

DefaultRandomOpts returns the default options for tests value random generation.

func FundAll

func FundAll(ctx context.Context, funders []*channel.Funder, reqs []*pchannel.FundingReq) error

func NewRandL2Account

func NewRandL2Account() (wallet.Account, error)

func WithBalancesRange

func WithBalancesRange() pchtest.RandomOpt

WithBalancesRange specifies the Balances range.

Types

type DepositSetup

type DepositSetup struct {
	FReqs     []*pchannel.FundingReq
	FIDs      []uint64
	FinalBals []pchannel.Bal
	DReqs     []*channel.DepositReq
}

func NewDepositSetup

func NewDepositSetup(params *pchannel.Params, state *pchannel.State, accs ...wallet.Account) *DepositSetup

type Setup

type Setup struct {
	T       *testing.T
	Rng     *rand.Rand
	L1Accs  []*principal.Principal
	L2Accs  []wallet.Account
	ICConns []*chanconn.Connector
}

func NewTestSetup

func NewTestSetup(t *testing.T) *Setup

func (*Setup) AssertNoRegistered

func (s *Setup) AssertNoRegistered(cid pchannel.ID)

func (*Setup) AssertRegistered

func (s *Setup) AssertRegistered(cid pchannel.ID)

func (*Setup) GetChannelBalances

func (s *Setup) GetChannelBalances(cid pchannel.ID) ([]uint64, error)

func (*Setup) GetL1Balances

func (s *Setup) GetL1Balances() ([]uint64, error)

func (*Setup) GetPerunBalances

func (s *Setup) GetPerunBalances() ([]uint64, error)

func (*Setup) NewCtx

func (s *Setup) NewCtx() context.Context

NewCtx returns a new context that will timeout after DefaultTestTimeout blocks and cancel on test cleanup.

func (*Setup) NewRandomParamAndState

func (s *Setup) NewRandomParamAndState() (*pchannel.Params, *pchannel.State)

NewRandomParamAndState generates compatible Params and State.

type TransferSetup

type TransferSetup struct {
	L1Accounts  []*principal.Principal
	MinterAcc   *principal.Principal
	Balances    []uint64
	AmountForTx []uint64
}

Jump to

Keyboard shortcuts

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