testutil

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertContains

func AssertContains(t testing.TB, slice interface{}, value interface{})

AssertContains varifies that the slice contains the value

func AssertContainsAll

func AssertContainsAll(t testing.TB, sliceActual interface{}, sliceExpected interface{})

AssertContainsAll varifies that sliceActual is a superset of sliceExpected

func AssertEquals

func AssertEquals(t testing.TB, actual interface{}, expected interface{})

AssertEquals varifies that the two values are equal

func AssertError

func AssertError(t testing.TB, err error, message string)

AssertError varifies that the err is not nil

func AssertNil

func AssertNil(t testing.TB, value interface{})

AssertNil varifies that the value is nil

func AssertNoError

func AssertNoError(t testing.TB, err error, message string)

AssertNoError varifies that the err is nil

func AssertNotEquals

func AssertNotEquals(t testing.TB, actual interface{}, expected interface{})

AssertNotEquals varifies that the two values are not equal

func AssertNotNil

func AssertNotNil(t testing.TB, value interface{})

AssertNotNil varifies that the value is not nil

func AssertPanic

func AssertPanic(t testing.TB, msg string)

AssertPanic varifies that a panic is raised during a test

func AssertSame

func AssertSame(t testing.TB, actual interface{}, expected interface{})

AssertSame varifies that the two values are same

func ConstructBlock

func ConstructBlock(t *testing.T, simulationResults [][]byte, sign bool) *common.Block

ConstructBlock constructs a single block with blockNum=1

func ConstructRandomBytes

func ConstructRandomBytes(t testing.TB, size int) []byte

ConstructRandomBytes constructs random bytes of given size

func ConstructTestBlock

func ConstructTestBlock(t *testing.T, numTx int, txSize int) *common.Block

ConstructTestBlock constructs a single block with blocknum=1

func ConstructTestBlocks

func ConstructTestBlocks(t *testing.T, numBlocks int) []*common.Block

ConstructTestBlocks returns a series of blocks starting with blockNum=1

func ConstructTransaction

func ConstructTransaction(_ *testing.T, simulationResults []byte, sign bool) (*common.Envelope, string, error)

ConstructTransaction constructs a transaction for testing

func Contains

func Contains(slice interface{}, value interface{}) bool

Contains returns true iff the `value` is present in the `slice`

Types

type BlockGenerator

type BlockGenerator struct {
	// contains filtered or unexported fields
}

BlockGenerator generates a series of blocks for testing

func NewBlockGenerator

func NewBlockGenerator(t *testing.T) *BlockGenerator

NewBlockGenerator instantiates new BlockGenerator for testing

func (*BlockGenerator) NextBlock

func (bg *BlockGenerator) NextBlock(simulationResults [][]byte, sign bool) *common.Block

NextBlock constructs next block in sequence that includes a number of transactions - one per simulationResults

func (*BlockGenerator) NextTestBlock

func (bg *BlockGenerator) NextTestBlock(numTx int, txSize int) *common.Block

NextTestBlock constructs next block in sequence block with 'numTx' number of transactions for testing

func (*BlockGenerator) NextTestBlocks

func (bg *BlockGenerator) NextTestBlocks(numBlocks int) []*common.Block

NextTestBlocks constructs 'numBlocks' number of blocks for testing

Jump to

Keyboard shortcuts

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