Derives conformance/registry.json, statifier-ex's claim against its own
corpus, from the regression ratchet (ADR-0070 decisions 3 and 4).
test/passing_tests.json stays ADR-0006's ratchet file and mix test.baseline the only thing that grows it; the emitter calls derive/4
with the ratchet's SCION, W3C and statifier paths and writes what
encode/1 returns. Nothing else writes the registry. The internal_tests
globs never reach this module: they name this repository's unit tests, not
corpus cases.
Each ratchet path names exactly one corpus case - an upstream case by its
generated test module, an authored statifier case, which has none, by
its JSON file under conformance/cases/ - and that case becomes one entry
{case_id, suite}. A path that names no case, or a path two cases share,
stops the derivation naming it. A case in the corpus but not in the
ratchet has no entry: its absence is the claim that statifier-ex does not
pass it.
Claims are per suite, with no tiers: scion, w3c-mandatory,
w3c-optional and statifier, the W3C suite split by each case's
conformance class. A suite with no entries is not claimed, and a registry
with no entries is refused: a claim of nothing is a defect.
The file is sorted - claims by name, entries by suite then case id - with one entry per line, so ratcheting a case in is a one-line diff.
Summary
Functions
The claim a corpus case's entry counts toward.
Derives the registry from cases (the corpus), ratchet (the ratchet's
SCION, W3C and statifier paths, globs already expanded), the corpus hash
the cases were written under, and ratchet_path, which names the path the
ratchet names a case by or returns nil when it has none.
Encodes a registry: pretty, with the claims on one line and one compact entry per line.
Checks a committed registry against the corpus cases, returning one
sentence per problem: no entries at all, or an entry whose case the corpus
lacks or holds under another suite.
Types
Functions
The claim a corpus case's entry counts toward.
Examples
iex> Mix.Statifier.Corpus.Registry.claim(%{"suite" => "w3c", "conformance" => "mandatory"})
"w3c-mandatory"
iex> Mix.Statifier.Corpus.Registry.claim(%{"suite" => "scion"})
"scion"
@spec derive( cases :: [map()], ratchet :: Enumerable.t(), corpus_hash :: String.t(), ratchet_path :: (map() -> Path.t() | nil) ) :: {:ok, t()} | {:error, String.t()}
Derives the registry from cases (the corpus), ratchet (the ratchet's
SCION, W3C and statifier paths, globs already expanded), the corpus hash
the cases were written under, and ratchet_path, which names the path the
ratchet names a case by or returns nil when it has none.
Examples
iex> cases = [
...> %{"id" => "scion/ads/view", "suite" => "scion"},
...> %{"id" => "w3c/test9", "suite" => "w3c", "conformance" => "optional"},
...> %{"id" => "w3c/test8", "suite" => "w3c", "conformance" => "mandatory"}
...> ]
iex> path = fn c -> "test/" <> c["id"] <> "_test.exs" end
iex> {:ok, registry} =
...> Mix.Statifier.Corpus.Registry.derive(
...> cases, ["test/w3c/test9_test.exs", "test/scion/ads/view_test.exs"], "sha256:00", path)
iex> registry["claims"]
["scion", "w3c-optional"]
iex> registry["entries"]
[%{"case_id" => "scion/ads/view", "suite" => "scion"}, %{"case_id" => "w3c/test9", "suite" => "w3c"}]
Encodes a registry: pretty, with the claims on one line and one compact entry per line.
Checks a committed registry against the corpus cases, returning one
sentence per problem: no entries at all, or an entry whose case the corpus
lacks or holds under another suite.