Documentation
¶
Overview ¶
Package conformance writes a machine-readable conformance suite: inputs and what a reader of BDF v1 must do with them, as this implementation does it. Other implementations run the suite without Go (libbdf's test_conformance does), and `bdf conformance` writes it for a release.
The suite is a directory:
suite.json the cases inputs/... the bytes of each case
suite.json holds {"format": "bdf-conformance/1", "bdf": 1, "opset": 1, "generator": "...", "cases": [...]}. A case has an id, a kind, the input's path and an expectation:
- kind "single": a single-file document. expect.open is "ok" or "error"; for "ok", expect.locked says whether it is encrypted and locked, expect.views lists {id, kind, pages} of the views, expect.parts counts the parts, expect.reads lists parts to read with "read" "ok" or "error" and the decoded "size", and expect.allParts true says every part reads.
- kind "object": an Object part. expect.decode is "ok" or "error"; for "ok", expect.walk says whether every instruction reads, and expect.instructions counts the instructions read before the end or the error.
- kind "paths": a path collection part. expect.decode, and expect.paths counts the paths.
expect.message is this implementation's error, for people; readers need not reproduce it. Expectations are what this implementation does with the input, checked against what the case was written to show.
Index ¶
Constants ¶
const ( OK = "ok" Err = "error" )
const Format = "bdf-conformance/1"
Format names the shape of suite.json.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Case ¶
type Case struct {
ID string `json:"id"`
Kind string `json:"kind"`
Input string `json:"input"`
Note string `json:"note,omitempty"`
Expect Expect `json:"expect"`
}
Case is one input and what a reader must do with it.
type Expect ¶
type Expect struct {
// single
Open string `json:"open,omitempty"`
Locked bool `json:"locked,omitempty"`
Views []ViewExpect `json:"views,omitempty"`
Parts *int `json:"parts,omitempty"`
Reads []ReadExpect `json:"reads,omitempty"`
AllParts bool `json:"allParts,omitempty"`
// object, paths
Decode string `json:"decode,omitempty"`
Walk string `json:"walk,omitempty"`
Instructions *int `json:"instructions,omitempty"`
Paths *int `json:"paths,omitempty"`
// for people
Message string `json:"message,omitempty"`
}
Expect is what happens to a case's input.
type ReadExpect ¶
type ReadExpect struct {
H string `json:"h"`
Read string `json:"read"`
Size *int `json:"size,omitempty"`
}
ReadExpect is the outcome of reading one part.
type Suite ¶
type Suite struct {
Format string `json:"format"`
BDF int `json:"bdf"`
Opset int `json:"opset"`
Generator string `json:"generator"`
Cases []Case `json:"cases"`
// contains filtered or unexported fields
}
Suite is a set of cases and their inputs.
func Build ¶
Build makes the suite: the synthetic cases, and the documents under testdataDir ("" for none) as accept cases.
type ViewExpect ¶
ViewExpect summarises a view.