MnaVerification
Namespace: MNALIB · Library: MNA Library
#include <mna/mna_verification.h>
struct MNALIB::MnaVerification
Top-level verification container attached to each MnaNode.
Combines human-readable explanation, declarative checks, evaluation results, and a complete provenance snapshot.
Verification, explanation, and provenance for a graph node.
src/examples/ex_mna/main.cpp
MnaVerification& checks = graph.node("shift").verification;
checks.explanation = "Adds the offset; the result must stay positive.";
MnaVerificationCheck positive;
positive.id = "out_positive";
positive.description = "Output is positive";
positive.phase = "post"; // "pre" sees attributes and inputs, "post" also outputs
positive.expression = "out > 0"; // or MnaScript code whose exit code 0 passes
positive.severity = "error"; // a failed "error" check stops the run
checks.checks.append(positive);
graph.node("source").attributes["value"] = -2.0;
graph.node("source").dirty = true;
const MnaGraphExecutor::Context checked = MnaGraphExecutor::executeIncremental(graph, ctx);
const MnaVerificationResult& verdict = checks.postResults.first();
const MnaProvenance& provenance = checks.provenance; // versions, host, input SHA-256, timing
Public Methods
toJson()
toCbor()
Static Methods
fromJson(json)
fromCbor(cbor)
Example
- Full source:
src/examples/ex_mna/main.cpp - Build target:
ex_mna(runs under CTest)
Used in examples
ex_mna
MNA library: register operations, build and run a graph, bind parameters and save a project.
src/examples/ex_mna/main.cpp, line 173
MnaVerification& checks = graph.node("shift").verification;
checks.explanation = "Adds the offset; the result must stay positive.";
MnaVerificationCheck positive;
positive.id = "out_positive";
positive.description = "Output is positive";
positive.phase = "post"; // "pre" sees attributes and inputs, "post" also outputs
positive.expression = "out > 0"; // or MnaScript code whose exit code 0 passes
positive.severity = "error"; // a failed "error" check stops the run
checks.checks.append(positive);
graph.node("source").attributes["value"] = -2.0;
graph.node("source").dirty = true;
const MnaGraphExecutor::Context checked = MnaGraphExecutor::executeIncremental(graph, ctx);
const MnaVerificationResult& verdict = checks.postResults.first();
const MnaProvenance& provenance = checks.provenance; // versions, host, input SHA-256, timing
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>