{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package testutil\n\n## Functions\n\n```go\nfunc ConstructBlock(t *testing.T, blockNum uint64, previousHash []byte, simulationResults [][]byte, sign bool) *common.Block\n```\nConstructBlock constructs a single block\n\n```go\nfunc ConstructBlockFromBlockDetails(t *testing.T, blockDetails *BlockDetails, sign bool) *common.Block\n```\n\n```go\nfunc ConstructBlockWithTxid(t *testing.T, blockNum uint64, previousHash []byte, simulationResults [][]byte, txids []string, sign bool) *common.Block\n```\n\n```go\nfunc ConstructBytesProposalResponsePayload(version string, simulationResults []byte) ([]byte, error)\n```\nConstructBytesProposalResponsePayload constructs a ProposalResponse byte with given chaincode version and simulationResults for testing\n\n```go\nfunc ConstructRandomBytes(t testing.TB, size int) []byte\n```\nConstructRandomBytes constructs random bytes of given size\n\n```go\nfunc ConstructTestBlock(t *testing.T, blockNum uint64, numTx int, txSize int) *common.Block\n```\nConstructTestBlock constructs a single block with random contents\n\n```go\nfunc ConstructTestBlocks(t *testing.T, numBlocks int) []*common.Block\n```\nConstructTestBlocks returns a series of blocks starting with blockNum=0. The first block in the returned array is a config tx block that represents a genesis block Except the genesis block, the size of each of the block would be the same.\n\n```go\nfunc ConstructTransaction(_ *testing.T, simulationResults []byte, txid string, sign bool) (*common.Envelope, string, error)\n```\nConstructTransaction constructs a transaction for testing\n\n```go\nfunc ConstructTransactionFromTxDetails(txDetails *TxDetails, sign bool) (*common.Envelope, string, error)\n```\n\n```go\nfunc CopyDir(srcroot, destroot string) error\n```\nCopyDir creates a copy of a dir\n\n```go\nfunc CreateTarBytesForTest(testFiles []*TarFileEntry) []byte\n```\nCreateTarBytesForTest creates a tar byte array for unit testing\n\n```go\nfunc NewBlock(env []*common.Envelope, blockNum uint64, previousHash []byte) *common.Block\n```\n\n```go\nfunc SetTxID(t *testing.T, block *common.Block, txNum int, txID string)\n```\n\n## Types\n\n```go\ntype BlockDetails struct {\n\tBlockNum     uint64\n\tPreviousHash []byte\n\tTxs          []*TxDetails\n}\n```\n\n```go\ntype BlockGenerator struct {\n\t// contains filtered or unexported fields\n}\n```\nBlockGenerator generates a series of blocks for testing\n\n```go\nfunc NewBlockGenerator(t *testing.T, ledgerID string, signTxs bool) (*BlockGenerator, *common.Block)\n```\nNewBlockGenerator instantiates new BlockGenerator for testing\n\n```go\nfunc (bg *BlockGenerator) NextBlock(simulationResults [][]byte) *common.Block\n```\nNextBlock constructs next block in sequence that includes a number of transactions - one per simulationResults\n\n```go\nfunc (bg *BlockGenerator) NextBlockWithTxid(simulationResults [][]byte, txids []string) *common.Block\n```\nNextBlockWithTxid constructs next block in sequence that includes a number of transactions - one per simulationResults\n\n```go\nfunc (bg *BlockGenerator) NextTestBlock(numTx int, txSize int) *common.Block\n```\nNextTestBlock constructs next block in sequence block with 'numTx' number of transactions for testing\n\n```go\nfunc (bg *BlockGenerator) NextTestBlocks(numBlocks int) []*common.Block\n```\nNextTestBlocks constructs 'numBlocks' number of blocks for testing\n\n```go\ntype TarFileEntry struct {\n\tName, Body string\n}\n```\nTarFileEntry is a structure for adding test index files to an tar\n\n```go\ntype TxDetails struct {\n\tTxID                            string\n\tChaincodeName, ChaincodeVersion string\n\tSimulationResults               []byte\n}\n```\n\n","path":"github.com/eric-erki/https-hyperledger.org/common/ledger/testutil","name":"testutil","synopsis":"","isRedistributable":true}
