tests

package
Version: v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BenchmarkSpec_Marshal_Map3StrInt

func BenchmarkSpec_Marshal_Map3StrInt(b *testing.B, np ipld.NodePrototype)

func BenchmarkSpec_Marshal_Map3StrInt_CodecNull

func BenchmarkSpec_Marshal_Map3StrInt_CodecNull(b *testing.B, np ipld.NodePrototype)

func BenchmarkSpec_Marshal_MapNStrMap3StrInt

func BenchmarkSpec_Marshal_MapNStrMap3StrInt(b *testing.B, np ipld.NodePrototype)

func BenchmarkSpec_Unmarshal_Map3StrInt

func BenchmarkSpec_Unmarshal_Map3StrInt(b *testing.B, np ipld.NodePrototype)

func BenchmarkSpec_Unmarshal_MapNStrMap3StrInt

func BenchmarkSpec_Unmarshal_MapNStrMap3StrInt(b *testing.B, np ipld.NodePrototype)

func BenchmarkSpec_Walk_Map3StrInt

func BenchmarkSpec_Walk_Map3StrInt(b *testing.B, np ipld.NodePrototype)

func BenchmarkSpec_Walk_MapNStrMap3StrInt

func BenchmarkSpec_Walk_MapNStrMap3StrInt(b *testing.B, np ipld.NodePrototype)

func SchemaTestListsContainingLists

func SchemaTestListsContainingLists(t *testing.T, engine Engine)

TestListsContainingLists is probing *two* things:

- that lists can nest, obviously
- that representation semantics are held correctly when we recurse, both in builders and in reading

To cover that latter situation, this depends on structs (so we can use rename directives on the representation to make it distinctive).

func SchemaTestListsContainingMaybe

func SchemaTestListsContainingMaybe(t *testing.T, engine Engine)

func SchemaTestMapsContainingMaps

func SchemaTestMapsContainingMaps(t *testing.T, engine Engine)

TestMapsContainingMaps is probing *two* things:

- that maps can nest, obviously
- that representation semantics are held correctly when we recurse, both in builders and in reading

To cover that latter situation, this depends on structs (so we can use rename directives on the representation to make it distinctive).

func SchemaTestMapsContainingMaybe

func SchemaTestMapsContainingMaybe(t *testing.T, engine Engine)

func SchemaTestMapsWithComplexKeys

func SchemaTestMapsWithComplexKeys(t *testing.T, engine Engine)

func SchemaTestRequiredFields

func SchemaTestRequiredFields(t *testing.T, engine Engine)

func SchemaTestString

func SchemaTestString(t *testing.T, engine Engine)

func SchemaTestStructNesting

func SchemaTestStructNesting(t *testing.T, engine Engine)

func SchemaTestStructReprStringjoin

func SchemaTestStructReprStringjoin(t *testing.T, engine Engine)

TestStructReprStringjoin exercises... well, what it says on the tin.

These should pass even if the natural map representation doesn't. No maybes are exercised.

func SchemaTestStructReprTuple

func SchemaTestStructReprTuple(t *testing.T, engine Engine)

func SchemaTestStructsContainingMaybe

func SchemaTestStructsContainingMaybe(t *testing.T, engine Engine)

TestStructsContainingMaybe checks all the variations of "nullable" and "optional" on struct fields. It does this twice: once for the child maybes being implemented with pointers, and once with maybes implemented as embeds. The child values are scalars.

Both type-level generic build and access as well as representation build and access are exercised; the representation used is map (the native representation for structs).

func SchemaTestUnionKeyed

func SchemaTestUnionKeyed(t *testing.T, engine Engine)

func SchemaTestUnionKeyedComplexChildren

func SchemaTestUnionKeyedComplexChildren(t *testing.T, engine Engine)

Test keyed unions again, but this time with more complex types as children.

The previous tests used scalar types as the children; this exercises most things, but also has a couple (extremely non-obvious) simplifications: namely, because the default representation for strings are "natural" representations, the ReprAssemblers are actually aliases of the type-level Assemblers! Aaaand that makes a few things "work" by coincidence that wouldn't otherwise fly.

func SchemaTestUnionKeyedReset

func SchemaTestUnionKeyedReset(t *testing.T, engine Engine)

TestUnionKeyedReset puts a union inside a list, so that we can use the list's reuse of assembler as a test of the assembler's reset feature. The value inside the union is also more complex than a scalar value so that we test resetting gets passed down, too.

func SchemaTestUnionKinded

func SchemaTestUnionKinded(t *testing.T, engine Engine)

func SchemaTestUnionStringprefix

func SchemaTestUnionStringprefix(t *testing.T, engine Engine)

func SpecBenchmarkMapStrInt_25n_AssembleEntry

func SpecBenchmarkMapStrInt_25n_AssembleEntry(b *testing.B, np ipld.NodePrototype)

func SpecBenchmarkMapStrInt_25n_AssembleStandard

func SpecBenchmarkMapStrInt_25n_AssembleStandard(b *testing.B, np ipld.NodePrototype)

func SpecBenchmarkMapStrInt_25n_Iteration

func SpecBenchmarkMapStrInt_25n_Iteration(b *testing.B, np ipld.NodePrototype)

func SpecBenchmarkMapStrInt_3n_AssembleEntry

func SpecBenchmarkMapStrInt_3n_AssembleEntry(b *testing.B, np ipld.NodePrototype)

func SpecBenchmarkMapStrInt_3n_AssembleStandard

func SpecBenchmarkMapStrInt_3n_AssembleStandard(b *testing.B, np ipld.NodePrototype)

func SpecBenchmarkMapStrInt_3n_Iteration

func SpecBenchmarkMapStrInt_3n_Iteration(b *testing.B, np ipld.NodePrototype)

func SpecTestListString

func SpecTestListString(t *testing.T, np ipld.NodePrototype)

func SpecTestMapStrInt

func SpecTestMapStrInt(t *testing.T, np ipld.NodePrototype)

func SpecTestMapStrListStr

func SpecTestMapStrListStr(t *testing.T, np ipld.NodePrototype)

func SpecTestMapStrMapStrInt

func SpecTestMapStrMapStrInt(t *testing.T, np ipld.NodePrototype)

func SpecTestString

func SpecTestString(t *testing.T, np ipld.NodePrototype)

Types

type Engine

type Engine interface {
	Init(t *testing.T, ts schema.TypeSystem)
	PrototypeByName(name string) ipld.NodePrototype
}

Engine describes the interface that can be supplied to run tests on schemas.

The PrototypeByName function can get its job done using only interface types that we already know from outside any generated code, so you can write tests that have no _compile time_ dependency on the generated code. This makes it easier for IDEs and suchlike to help you write and check the test functions.

Ask for prototypes using the type name alone (no package prefix); their representation prototypes can be obtained by appending ".Repr".

Directories

Path Synopsis
The corpus package exports some values useful for building tests and benchmarks.
The corpus package exports some values useful for building tests and benchmarks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to