Documentation ¶
Overview ¶
Package treetestcases contains test cases to test Merkle tree implementation.
Index ¶
- func LoadFixtures(testdatapath string)
- type Factory
- func (f Factory) BenchmarkCreate(b *testing.B)
- func (f Factory) BenchmarkCreateWithSize(b *testing.B, size int)
- func (f Factory) BenchmarkPath(b *testing.B)
- func (f Factory) BenchmarkPathWithSize(b *testing.B, size int)
- func (f Factory) RunBenchmarks(b *testing.B)
- func (f Factory) RunTests(t *testing.T)
- func (f Factory) TestLeaf(t *testing.T)
- func (f Factory) TestNumLeaves(t *testing.T)
- func (f Factory) TestPath(t *testing.T)
- func (f Factory) TestPathRandom(t *testing.T)
- func (f Factory) TestRoot(t *testing.T)
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 ¶
BenchmarkCreate benchmarks creating trees of different sizes.
func (Factory) BenchmarkCreateWithSize ¶
BenchmarkCreateWithSize benchmarks creating trees of given size.
func (Factory) BenchmarkPath ¶
BenchmarkPath benchmarks computing paths for different sizes.
func (Factory) BenchmarkPathWithSize ¶
BenchmarkPathWithSize benchmarks computing paths for trees of given size.
func (Factory) RunBenchmarks ¶
RunBenchmarks runs all the benchmarks.
func (Factory) TestNumLeaves ¶
TestNumLeaves tests that the implementation returns the correct number of leaves.
func (Factory) TestPathRandom ¶
TestPathRandom tests that the implementation correctly computes paths given random trees.