crosscheck

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0, MIT Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package crosscheck verifies that the TeX and Typst frontends lower the pinned paired corpus to equivalent semantic IR and render equal output.

Crosscheck is test infrastructure. It is not imported by the renderer and uses pinned, tracked fixtures only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareOutputToFixture

func CompareOutputToFixture(got *display.Box, want fixture.Frame) string

CompareOutputToFixture compares renderer output to a Typlet frame. Both values are first expressed in the fixture frame's anchor coordinate system.

func CompareOutputs

func CompareOutputs(got, want *display.Box) string

CompareOutputs compares two renderer outputs in baseline coordinates.

func CompareReports

func CompareReports(want, got Report) error

CompareReports checks exact case order, kinds, and reviewed reasons.

func LoadPairedCorpus

func LoadPairedCorpus(fixtureRoot string) (*fixture.Corpus, error)

LoadPairedCorpus loads the exact 81-case Typlet paired corpus and frames.

Types

type CaseResult

type CaseResult struct {
	ID          string `json:"id"`
	Index       int    `json:"index"`
	Category    string `json:"category"`
	Kind        Kind   `json:"kind"`
	Detail      string `json:"detail,omitempty"`
	KnownReason string `json:"reason,omitempty"`
}

CaseResult records the complete disposition of one corpus case.

type Kind

type Kind string

Kind classifies the first observable difference in a paired case.

const (
	Pass                     Kind = "pass"
	SemanticIRMismatch       Kind = "semantic-ir-mismatch"
	LayoutMismatch           Kind = "layout-mismatch"
	FixtureMismatch          Kind = "fixture-mismatch"
	DocumentedPairDifference Kind = "documented-pair-difference"
	Unexplained              Kind = "unexplained"
)

func (Kind) Valid

func (k Kind) Valid() bool

type KnownDifference

type KnownDifference struct {
	Kind   Kind   `json:"kind"`
	Reason string `json:"reason"`
}

type Options

type Options struct {
	FixtureRoot      string
	KnownDifferences string
}

Options configure one paired-corpus verification.

type Report

type Report struct {
	SchemaVersion  int          `json:"schemaVersion"`
	Corpus         string       `json:"corpus"`
	ToleranceDIP   float64      `json:"toleranceDIP"`
	Total          int          `json:"total"`
	Pass           int          `json:"pass"`
	SemanticIR     int          `json:"semanticIRMismatch"`
	Layout         int          `json:"layoutMismatch"`
	Fixture        int          `json:"fixtureMismatch"`
	PairDifference int          `json:"documentedPairDifference"`
	Unexplained    int          `json:"unexplained"`
	Cases          []CaseResult `json:"cases"`
}

Report is a deterministic, complete account of a paired corpus.

func LoadReport

func LoadReport(path string) (Report, error)

LoadReport decodes and validates a committed baseline.

func Refresh

func Refresh(ctx context.Context, opts Options, reasons map[string]string) (Report, error)

Refresh recomputes observed dispositions while requiring explicit reasons for every new non-passing kind and for every kind transition.

func ReviewedRefresh

func ReviewedRefresh(results []CaseResult, previous Report, reasons map[string]string) (Report, error)

ReviewedRefresh applies the explicit baseline review policy to observed cases. Details may change under an unchanged kind; a kind transition or new non-passing case requires a reviewer-supplied reason.

func Verify

func Verify(ctx context.Context, opts Options) (Report, error)

Verify loads and verifies all 81 paired cases.

func (Report) MarshalCanonical

func (r Report) MarshalCanonical() ([]byte, error)

MarshalCanonical returns stable, indented JSON with a trailing newline.

func (Report) Validate

func (r Report) Validate() error

Validate checks conservation and requires every non-pass result to have an explicit reviewed reason. It does not compare a caller's expectation file.

type SemanticDifference

type SemanticDifference struct {
	Path     string
	Expected string
	Actual   string
}

func CompareSemantic

func CompareSemantic(want, got any) *SemanticDifference

func (*SemanticDifference) String

func (d *SemanticDifference) String() string

Jump to

Keyboard shortcuts

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