Documentation ¶
Index ¶
- func CastVotes(t *testing.T, tf *Framework)
- func CastVotesAcceptance(t *testing.T, tf *Framework)
- func CastVotesVoteRank(t *testing.T, tf *Framework)
- func CreateSpendWithoutMembers(t *testing.T, tf *Framework)
- func CreateSpender(t *testing.T, tf *Framework)
- func EvictAcceptedSpender(t *testing.T, tf *Framework)
- func EvictRejectedSpender(t *testing.T, tf *Framework)
- func ExistingSpenderJoinsSpendSets(t *testing.T, tf *Framework)
- func JoinSpendSetTwice(t *testing.T, tf *Framework)
- func LikedInstead(t *testing.T, tf *Framework)
- func SpendAcceptance(t *testing.T, tf *Framework)
- func TestAll(t *testing.T, frameworkProvider func(*testing.T) *Framework)
- func UpdateSpenderParents(t *testing.T, tf *Framework)
- type AccountsTestFramework
- func (f *AccountsTestFramework) Add(alias string)
- func (f *AccountsTestFramework) CreateID(alias string) iotago.AccountID
- func (f *AccountsTestFramework) Delete(alias string) bool
- func (f *AccountsTestFramework) Get(alias string) (seat account.SeatIndex, exists bool)
- func (f *AccountsTestFramework) Has(alias string) bool
- func (f *AccountsTestFramework) ID(alias string) iotago.AccountID
- type Assertions
- func (a *Assertions) Accepted(aliases ...string)
- func (a *Assertions) Children(spendAlias string, childAliases ...string)
- func (a *Assertions) LikedInstead(spendAliases []string, likedInsteadAliases ...string)
- func (a *Assertions) Parents(spendAlias string, parentAliases ...string)
- func (a *Assertions) Pending(aliases ...string)
- func (a *Assertions) Rejected(aliases ...string)
- func (a *Assertions) SpendSetMembers(resourceAlias string, spendAliases ...string)
- func (a *Assertions) SpendSets(spenderAlias string, resourceAliases ...string)
- func (a *Assertions) ValidatorWeight(spendAlias string, weight int64)
- type Framework
- func (f *Framework) CastVotes(nodeAlias string, voteRank int, spenderAliases ...string) error
- func (f *Framework) CreateOrUpdateSpender(alias string, resourceAliases []string) error
- func (f *Framework) EvictSpender(spendAlias string)
- func (f *Framework) LikedInstead(spendAliases ...string) ds.Set[iotago.TransactionID]
- func (f *Framework) SpendSetIDs(aliases ...string) ds.Set[iotago.OutputID]
- func (f *Framework) SpenderIDs(aliases ...string) ds.Set[iotago.TransactionID]
- func (f *Framework) UpdateSpenderParents(spendAlias string, addedParentIDs []string, removedParentIDs []string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CastVotesAcceptance ¶
func CastVotesVoteRank ¶
func CreateSpender ¶
func EvictAcceptedSpender ¶
func EvictRejectedSpender ¶
func JoinSpendSetTwice ¶
func LikedInstead ¶
func SpendAcceptance ¶
func UpdateSpenderParents ¶
Types ¶
type AccountsTestFramework ¶
type AccountsTestFramework struct { Instance *account.Accounts Committee *account.SeatedAccounts // contains filtered or unexported fields }
func NewAccountsTestFramework ¶
func NewAccountsTestFramework(t *testing.T, instance *account.Accounts) *AccountsTestFramework
func (*AccountsTestFramework) Add ¶
func (f *AccountsTestFramework) Add(alias string)
func (*AccountsTestFramework) CreateID ¶
func (f *AccountsTestFramework) CreateID(alias string) iotago.AccountID
func (*AccountsTestFramework) Delete ¶
func (f *AccountsTestFramework) Delete(alias string) bool
func (*AccountsTestFramework) Get ¶
func (f *AccountsTestFramework) Get(alias string) (seat account.SeatIndex, exists bool)
func (*AccountsTestFramework) Has ¶
func (f *AccountsTestFramework) Has(alias string) bool
type Assertions ¶
type Assertions struct {
// contains filtered or unexported fields
}
Assertions provides a set of assertions for the SpendDAG.
func (*Assertions) Accepted ¶
func (a *Assertions) Accepted(aliases ...string)
Accepted asserts that the given spenders are accepted.
func (*Assertions) Children ¶
func (a *Assertions) Children(spendAlias string, childAliases ...string)
Children asserts that the given spender has the given children.
func (*Assertions) LikedInstead ¶
func (a *Assertions) LikedInstead(spendAliases []string, likedInsteadAliases ...string)
LikedInstead asserts that the given spenders return the given LikedInstead spenders.
func (*Assertions) Parents ¶
func (a *Assertions) Parents(spendAlias string, parentAliases ...string)
Parents asserts that the given spend has the given parents.
func (*Assertions) Pending ¶
func (a *Assertions) Pending(aliases ...string)
Pending asserts that the given spenders are pending.
func (*Assertions) Rejected ¶
func (a *Assertions) Rejected(aliases ...string)
Rejected asserts that the given spenders are rejected.
func (*Assertions) SpendSetMembers ¶
func (a *Assertions) SpendSetMembers(resourceAlias string, spendAliases ...string)
SpendSetMembers asserts that the given resource has the given spend set members.
func (*Assertions) SpendSets ¶
func (a *Assertions) SpendSets(spenderAlias string, resourceAliases ...string)
SpendSets asserts that the given spender has the given spend sets.
func (*Assertions) ValidatorWeight ¶
func (a *Assertions) ValidatorWeight(spendAlias string, weight int64)
ValidatorWeight asserts that the given spend has the given validator weight.
type Framework ¶
type Framework struct { // Instance is the SpendDAG instance that is used in the tests. Instance spenddag.SpendDAG[iotago.TransactionID, iotago.OutputID, vote.MockedRank] // Accounts is the AccountsTestFramework that is used in the tests. Accounts *AccountsTestFramework // Assert provides a set of assertions that can be used to verify the state of the SpendDAG. Assert *Assertions // SpenderID is a function that is used to translate a string alias into a (deterministic) iotago.TransactionID. SpenderID func(string) iotago.TransactionID // ResourceID is a function that is used to translate a string alias into a (deterministic) iotago.OutputID. ResourceID func(string) iotago.OutputID // contains filtered or unexported fields }
Framework is a test framework for the SpendDAG that allows to easily create and manipulate the DAG and its validators using human-readable aliases instead of actual IDs.
func NewFramework ¶
func NewFramework( t *testing.T, spendDAG spenddag.SpendDAG[iotago.TransactionID, iotago.OutputID, vote.MockedRank], validators *AccountsTestFramework, spenderID func(string) iotago.TransactionID, resourceID func(string) iotago.OutputID, ) *Framework
NewFramework creates a new instance of the Framework.
func (*Framework) CreateOrUpdateSpender ¶
CreateOrUpdateSpender creates a new spender or adds it to the given SpendSets.
func (*Framework) EvictSpender ¶
EvictSpender evicts given spender from the SpendDAG.
func (*Framework) LikedInstead ¶
LikedInstead returns the set of spenders that are liked instead of the given spenders.
func (*Framework) SpendSetIDs ¶
SpendSetIDs translates the given aliases into an AdvancedSet of iotago.OutputIDs.
func (*Framework) SpenderIDs ¶
SpenderIDs translates the given aliases into an AdvancedSet of iotago.TransactionIDs.