MnaVerificationResult
Namespace: MNALIB · Library: MNA Library
#include <mna/mna_verification.h>
struct MNALIB::MnaVerificationResult
The result of evaluating a single verification check.
Check evaluation result.
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 182
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
// gain is 2 again, so shift::out = 2 * -2 + 0.5 = -3.5 fails the check
ok &= expect(!verdict.passed && verdict.actualValue == QVariant(false) && checked.abortedNode == "shift" && checked.results.value("shift::out").toDouble() == -3.5 && provenance.mneCppVersion == MNE_CPP_VERSION && provenance.inputHashes.contains("in"),
"MnaVerification: " + verdict.message);
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>