run_inline_tests
Stable function · Simulation
Tier: stable · Kind: function · Topic: Simulation
| Julia | TypeScript | Python | Rust | Go |
|---|---|---|---|---|
run_inline_tests | outside profile | not exported | run_inline_tests | outside profile |
Julia
run_inline_tests(inputs; model_name, alg, reltol, abstol, base_dir, compiler, options_for)
run_inline_tests(inputs; model_name=nothing, alg=nothing, reltol=nothing,
abstol=nothing, base_dir=nothing, compiler=:native,
options_for=nothing)
-> Vector{AssertionResult}
Run every inline test (esm-spec §6.6, including the §6.6.5 field assertions) of
the selected component(s) of inputs through esm_problem
and solve,
and return one AssertionResult
per assertion, carrying the actual
value alongside pass/fail.
inputs is a path to a .esm file, a loaded EsmFile
, a directory
(walked recursively for *.esm, sorted), or any iterable of those. Results are
concatenated in input order; models run before reaction_systems.
Per test: solve(esm_problem(input, (time_span.start, time_span.stop); compiler), alg; reltol, abstol, saveat=<assertion times>) with the test’s
initial_conditions / parameter_overrides applied. Each assertion then reads
the asserted variable at its time: a scalar sample, a point sample per coords
(1-based index space, nearest index, exact ties rounding down), or a reduction
per reduce (error norms against a reference: an analytic expression,
evaluated with evaluate_cellwise
, or a
{type: "from_file", path, format?} JSON snapshot resolved against base_dir).
base_dir defaults to the .esm file’s directory, else the working directory.
Assertion tolerances resolve per field over four levels (esm-spec §6.6.4:
assertion > test > model > rel=1e-6), and the pass predicate, wall-time
accounting and JUnit output (write_junit_xml
) are those of
run_esm_tests
(both runners share _run_test_frame!).
Keywords:
alg— the ODE algorithm for every document. Leftnothing, each document getsRosenbrock23when it declaressolver.stiffness: "high"(esm-spec §2.2), elseTsit5; that needs OrdinaryDiffEqRosenbrock or OrdinaryDiffEqTsit5 loaded, and a document with tests and no available solver raises anArgumentError.reltol/abstol— integration tolerances (not the assertion tolerances above). Each resolves most-specific first: anoptions_foroverride, this keyword, the document’ssolver.reltol/solver.abstol, thenDEFAULT_TEST_RELTOL/DEFAULT_TEST_ABSTOL.compiler— passed toesm_problemfor every test.options_for— called once per document, before it is loaded, with its path (or theEsmFilewhen there is none); returns anInlineTestOptionswhose non-nothingfields override the keywords for that document, ornothing.
A document that fails to load throws when inputs names a single document; in
a batch (an iterable or a directory) it contributes one error row naming the
path instead. r.file is the path each row’s document was loaded from (""
for an in-memory EsmFile).
TypeScript
Not available in TypeScript. TypeScript is outside the simulation capability profile (Julia, Python, Rust): build an RHS and integrate it; TypeScript and Go are deliberately non-simulating.
Python
Python does not export this function.
Rust
pub fn run_inline_tests(file: &EsmFile, model_name: Option<&str>, opts: &SolveOptions) -> Vec<AssertionResult>
Run every inline test (esm-spec §6.6, including the §6.6.5 PDE
assertions) of the selected model(s) of file through the official
simulation pathway (crate::problem::esm_problem
/
crate::problem::solve
, the array runtime), and return one
AssertionResult
per assertion — carrying the ACTUAL reduction
value alongside pass/fail, so conformance harnesses can record and
cross-compare the numbers.
Per test: simulate over the test’s time_span (with its
initial_conditions / parameter_overrides applied and opts pinning
the solver family and tolerances; the assertion times become the sampled
saveat); then per assertion the asserted variable’s field is read
at the assertion time and either point-sampled per its coords
(positions in 1-based INDEX space; nearest grid index, exact ties
rounding DOWN — the pinned cross-binding convention) or collapsed per its
reduce (error norms evaluate the reference — an analytic expression
cellwise via evaluate_cellwise
, or a {type: "from_file", path, format?} JSON snapshot resolved against the working directory; set
InlineTestOptions::base_dir to anchor at the .esm file’s directory).
An assertion with neither coords nor reduce samples a scalar state.
Mirrors the Julia binding’s run_inline_tests 1:1 (tolerances per §6.6.4;
the pass predicate is Julia isapprox). Models iterate in sorted name
order for deterministic output.
Go
Not available in Go. Go is outside the simulation capability profile (Julia, Python, Rust): build an RHS and integrate it; TypeScript and Go are deliberately non-simulating.