forked from 1b-agent/fieldcraft-upstream
Verification oracle: tests/oracle cases, cargo xtask oracle, fixtures, docs/oracle.md, CI job
The oracle binary (modelcraft-testkit) runs each case's recipe through the command engine, measures its quantities by JSON pointers into step outputs or commands, compares them with the cited references and the frozen fixtures, and writes docs/oracle.md. 20 theory cases (patch tests of every solid element, Timoshenko cantilevers, Lame, Kirsch, beam frequencies, torsion and bending through couplings, explicit waves and impact, CDT invariants), 8 published benchmarks (MacNeal-Harder patch, straight and curved cantilevers, thick cylinder, Scordelis-Lo with solids, NAFEMS LE1, LE10, FV32) and 10 pending cases with citations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NmAttHhUZTokgPeEJia8sm
This commit is contained in:
1 parent
a3cb6d749b
commit
6d9452ad84
144 files changed
+5162
-74
No files matched your search
@@ -0,0 +1,43 @@
|
||||
//! `oracle [--case NAME]... [--bless NAME|all]... [--quick] [--no-write]`: see
|
||||
//! [`modelcraft_testkit::oracle`]; run it as `cargo xtask oracle`.
|
||||
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
use std::process::ExitCode;
|
||||
|
||||
use modelcraft_testkit::oracle::{Options, run};
|
||||
|
||||
const USAGE: &str = "usage: oracle [--case NAME]... [--bless NAME|all]... [--quick] [--no-write]";
|
||||
|
||||
fn main() -> ExitCode {
|
||||
let args: Vec<String> = std::env::args().skip(1).collect();
|
||||
let mut options = Options { write: true, ..Options::default() };
|
||||
let mut it = args.iter();
|
||||
while let Some(a) = it.next() {
|
||||
let value = |it: &mut std::slice::Iter<'_, String>| it.next().cloned().ok_or_else(|| format!("{a} needs a value\n{USAGE}"));
|
||||
let step = match a.as_str() {
|
||||
"--case" => value(&mut it).map(|v| options.cases.push(v)),
|
||||
"--bless" => value(&mut it).map(|v| options.bless.push(v)),
|
||||
"--quick" => {
|
||||
options.quick = true;
|
||||
Ok(())
|
||||
}
|
||||
"--no-write" => {
|
||||
options.write = false;
|
||||
Ok(())
|
||||
}
|
||||
other => Err(format!("unknown argument `{other}`\n{USAGE}")),
|
||||
};
|
||||
if let Err(e) = step {
|
||||
eprintln!("error: {e}");
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
}
|
||||
match run(&modelcraft_testkit::corpus::workspace_root(), &options) {
|
||||
Ok(()) => ExitCode::SUCCESS,
|
||||
Err(e) => {
|
||||
eprintln!("error: {e}");
|
||||
ExitCode::FAILURE
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user