treetestcases

package
v0.2.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package treetestcases contains test cases to test Merkle tree implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFixtures

func LoadFixtures(testdatapath string)

LoadFixtures loads test fixtures and should be called before running the tests.

Types

type Factory

type Factory struct {
	// New create a Merkle tree from leaves.
	New func(leaves []types.Bytes32) (merkle.Tree, error)

	// Free is an optional function to free a Merkle tree.
	Free func(tree merkle.Tree)
}

Factory wraps functions to allocate and free a Merkle tree, and is used to run the tests on a Merkle tree implementation.

func (Factory) BenchmarkCreate

func (f Factory) BenchmarkCreate(b *testing.B)

BenchmarkCreate benchmarks creating trees of different sizes.

func (Factory) BenchmarkCreateWithSize

func (f Factory) BenchmarkCreateWithSize(b *testing.B, size int)

BenchmarkCreateWithSize benchmarks creating trees of given size.

func (Factory) BenchmarkPath

func (f Factory) BenchmarkPath(b *testing.B)

BenchmarkPath benchmarks computing paths for different sizes.

func (Factory) BenchmarkPathWithSize

func (f Factory) BenchmarkPathWithSize(b *testing.B, size int)

BenchmarkPathWithSize benchmarks computing paths for trees of given size.

func (Factory) RunBenchmarks

func (f Factory) RunBenchmarks(b *testing.B)

RunBenchmarks runs all the benchmarks.

func (Factory) RunTests

func (f Factory) RunTests(t *testing.T)

RunTests runs all the tests.

func (Factory) TestLeaf

func (f Factory) TestLeaf(t *testing.T)

TestLeaf tests that the implementation correctly returns leaves.

func (Factory) TestNumLeaves

func (f Factory) TestNumLeaves(t *testing.T)

TestNumLeaves tests that the implementation returns the correct number of leaves.

func (Factory) TestPath

func (f Factory) TestPath(t *testing.T)

TestPath tests that the implementation correctly computes paths.

func (Factory) TestPathRandom

func (f Factory) TestPathRandom(t *testing.T)

TestPathRandom tests that the implementation correctly computes paths given random trees.

func (Factory) TestRoot

func (f Factory) TestRoot(t *testing.T)

TestRoot tests that the implementation computes the root correctly.

Jump to

Keyboard shortcuts

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