test

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Mrsh marsha.Marsha = cborgen.New()
	Crpt               = factory.MustNew(crpt.Ed25519, crypto.SHA3_256)
	Util               = model.New(Mrsh, Crpt)
)
View Source
var (
	TestPublicKey        crpt.PublicKey
	TestPrivateKey       crpt.PrivateKey
	TestAddress          crpt.Address
	TestSignature        m.Signature
	TestTransaction      m.Transaction
	TestTransactionHash  m.TransactionHash
	TestTransactionSlice m.TransactionSlice
	TestBlockHeader      m.BlockHeader
	TestBlock            m.Block

	TestHash = m.Hash32{
		0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4,
		0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4,
	}
	TestHash2 = m.Hash32{
		0x5, 0x6, 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, 0x7, 0x8,
		0x5, 0x6, 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, 0x7, 0x8,
	}
	TestBlockHash   = TestHash
	TestBlockHashes = make([]m.BlockHash, 1)
	TestAddress2    = m.Address(TestHash)
)

Functions

func FixCountRange added in v0.0.4

func FixCountRange(min, max int) (int, int)

func GenRandomBlock added in v0.0.5

func GenRandomBlock(prevHashCount int, extraBytes []byte, txCount int) *m.BlockExt

GenRandomBlock creates a random Block for test with the given number of previous block hashes, Extra data and Transactions.

func GenRandomBlockHeader added in v0.0.5

func GenRandomBlockHeader(prevHashCount int, extraBytes []byte) *m.BlockHeader

GenRandomBlockHeader creates a random BlockHeader for test with the given number of previous block hashes and Extra data.

func GenRandomBlockHeaderExts added in v0.0.5

func GenRandomBlockHeaderExts(min, max, prevHashCount int, extraBytes []byte) []*m.BlockHeaderExt

GenRandomBlockHeaders creates random BlockHeaderExts for test with the given number of previous block hashes and Extra data.

func GenRandomBlocks added in v0.0.5

func GenRandomBlocks(min, max, prevHashCount int, extraBytes []byte, txCount int) []*m.BlockExt

GenRandomBlocks creates random Blocks for test with the given number of previous block hashes, Extra data and Transactions.

func GenRandomCid

func GenRandomCid() cid.Cid

GenRandomCid generates a random CID for test.

func GenRandomHash

func GenRandomHash() m.Hash32

GenRandomHash generates a random hash for test.

func GenRandomHashes

func GenRandomHashes() []m.Hash32

GenRandomHash generates random hashes for test.

func GenRandomTransaction

func GenRandomTransaction() *m.Transaction

GenRandomTransaction generates a random Transaction for test. NOTE: Sig is not a valid signature.

func GenRandomTransactionExt

func GenRandomTransactionExt() *m.TransactionExt

GenRandomTransactionExt generates a random TransactionExt for test.

func GenRandomTransactionExtSlice added in v0.0.4

func GenRandomTransactionExtSlice(min, max int) m.TransactionExtSlice

GenRandomTransactionExt generates random TransactionExtSlice for test.

func GenTestBlockHeaderWithExtra

func GenTestBlockHeaderWithExtra(extraBytes []byte) *m.BlockHeader

GenTestBlockHeaderWithExtra creates a BlockHeader for test with given Extra data.

func GenTestModels

func GenTestModels()

Gen test models

func SetUtil

func SetUtil(u *m.Util)

Types

type TransactionNoSig

type TransactionNoSig struct {
	Type  m.TransactionType
	From  m.Address
	Nonce uint64
	To    m.Address
	Data  []byte
	Extra []byte
}

func (*TransactionNoSig) InitNilEmbeddedStruct

func (t *TransactionNoSig) InitNilEmbeddedStruct()

func (*TransactionNoSig) MarshalCBOR

func (t *TransactionNoSig) MarshalCBOR(w io.Writer) error

func (TransactionNoSig) Ptr

func (t TransactionNoSig) Ptr() marsha.StructPtr

func (*TransactionNoSig) UnmarshalCBOR

func (t *TransactionNoSig) UnmarshalCBOR(r io.Reader) (int, error)

func (*TransactionNoSig) Val

func (p *TransactionNoSig) Val() marsha.Struct

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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