conformance

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package conformance is the cross-provider differential conformance suite for the committed read-path IR subset. Every case is evaluated by the reference interpreter (core/relalg/interp, the oracle defined by docs/design/ir-semantics.md) and by a real provider through codegen.Renderer; results must be equal after canonical normalization.

The equivalence corpus deliberately avoids the documented deviations listed in the spec (NULL sort placement, collation case folding, non-terminating averages, type-boundary overflow).

Index

Constants

View Source
const TableName = "conf_t"

TableName is the single fixture relation.

Variables

This section is empty.

Functions

func Fixture

func Fixture() interp.DB

Fixture returns the fixture as an interpreter DB.

func Qualified

func Qualified(schema string) string

Qualified returns the schema-qualified table name ("schema.conf_t"), or the bare name when schema is empty.

func Run

func Run(t *testing.T, db store.DB, d dialect.Dialect, schema string)

Run executes the whole corpus differentially: interpreter result vs the provider executing codegen output. Any mismatch is a conformance failure; per the spec it must be fixed or promoted to a documented deviation (and the corpus adjusted) — never silently accepted.

func RunWorkload added in v0.1.9

func RunWorkload(t *testing.T, db store.DB, d dialect.Dialect, cfg workload.Config, schema string)

RunWorkload checks the workload fixture differentially: for every table, a checksum aggregate (row count, per-numeric-column sums, per-nullable- column non-NULL counts) is evaluated by the reference interpreter over the generated rows and by the provider through codegen. Equal results on all providers prove the same governed queries see the same logical data (design doc acceptance #6). String content and date values stay out of the checksums: collation and date rendering are documented deviations.

func Setup

func Setup(ctx context.Context, db store.DB, d dialect.Dialect, schema string) error

Setup creates and seeds the fixture table. Statements run one by one: MySQL-family drivers reject multi-statement strings.

func SetupStatements

func SetupStatements(dialectName, schema string) []string

SetupStatements returns the DDL and seed statements for the given dialect family ("postgres" or the MySQL family used by MySQL and OceanBase). Each statement must be executed separately: MySQL drivers reject multi-statement strings by default.

func SetupWorkload added in v0.1.9

func SetupWorkload(ctx context.Context, db store.DB, d dialect.Dialect, cfg workload.Config, schema string) error

SetupWorkload loads the fixtures/v4 business workload into db under the given schema (empty for the connection's default database). The generator renders the same deterministic data for every dialect; statements run one by one (MySQL-family drivers reject multi-statement strings).

Types

type Case

type Case struct {
	Name    string
	Expr    relalg.Expr
	Ordered bool
}

Case is one differential case: the same IR is evaluated by the reference interpreter and by a provider; results must be equal. Ordered cases carry a Sort whose keys are unique and non-NULL, so they compare in order; everything else compares as a bag.

func Cases

func Cases(schema string) []Case

Cases returns the corpus against the fixture table in the given schema.

Jump to

Keyboard shortcuts

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