corpus

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

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

Values come as JSON strings. It is assumed you can unmarshal those. The reason we do this is so that this corpus package doesn't import any particular concrete implementation of ld.Node... since that would make it ironically incapable of being used for that Node's tests.

The naming convention is roughly as follows:

  • {Kind}{{Count}|N}{KeyKind}{ValueKind}
  • 'Kind' is usually 'Map' or 'List'. It can also be a scalar like 'Int', in which case that's it.
  • If a specific int is given for 'Count', that's the size of the thing;
  • if 'N' is present, it's a scalable corpus and you can decide the size.
  • 'KeyKind' is present for maps (it will be string...).
  • 'ValueKind' is present for maps and lists. It can recurse.

Of course, this naming convention is not perfectly specific, but it's usually enough for our needs, or at least enough to get started. Some corpuses designed for probing (for example) tuple-represented structs will end up with interesting designations for various reasons:

  • some corpuses are meant to test struct semantics. This is usually what it means when you see fixed size maps. "List5Various" can also be this reason (it's for tuple-represented structs).
  • some corpuses are meant to test nullable or optional semantics. These might have name suffixes like "WithNull" to indicate this.

Everything is exported as a function, for consistency. Many functions need no args. Some functions need an argument for "N".

If you're using these corpuses in a benchmark, don't forget to call `b.ResetTimer()` after getting the corpus.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Map3StrInt

func Map3StrInt() string

func MapNStrInt

func MapNStrInt(n int) string

func MapNStrMap3StrInt

func MapNStrMap3StrInt(n int) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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