T07: Cargo workspace scaffold — cb-kernel/cb-events/cb-game-runtime/games-ground/cb-sim, HashMap deny-lint, scenario format + runner stub, Criterion skeleton, Makefile, CI
Some checks failed
ci / check (push) Has been cancelled
Some checks failed
ci / check (push) Has been cancelled
This commit is contained in:
parent
396990539a
commit
467e2c561d
23 changed files with 1625 additions and 0 deletions
59
tools/cb-sim/src/main.rs
Normal file
59
tools/cb-sim/src/main.rs
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
//! cb-sim — scenario runner binary (GameKernel K17; precursor of `cb sim`).
|
||||
//! T07 scope: parse and validate scenario files, report coverage tags.
|
||||
//! T08 wires execution. Exit codes: 0 all passed, 1 failures, 2 not yet
|
||||
//! executable (parse-only), 64 usage error.
|
||||
|
||||
use cb_game_runtime::{scenario, RunOutcome, ScenarioFile};
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = std::env::args().skip(1).collect();
|
||||
if args.is_empty() {
|
||||
eprintln!("usage: cb-sim <scenario.yaml>...");
|
||||
std::process::exit(64);
|
||||
}
|
||||
|
||||
let mut unimplemented = false;
|
||||
let mut failed = false;
|
||||
|
||||
for path in &args {
|
||||
let text = match std::fs::read_to_string(path) {
|
||||
Ok(t) => t,
|
||||
Err(e) => {
|
||||
eprintln!("{path}: read error: {e}");
|
||||
failed = true;
|
||||
continue;
|
||||
}
|
||||
};
|
||||
match ScenarioFile::from_yaml(&text) {
|
||||
Err(e) => {
|
||||
eprintln!("{path}: parse error: {e}");
|
||||
failed = true;
|
||||
}
|
||||
Ok(sc) => match scenario::run(&sc) {
|
||||
RunOutcome::Passed { covers } => {
|
||||
println!("PASS {} covers={}", sc.scenario, covers.join(","));
|
||||
}
|
||||
RunOutcome::Failed { reason } => {
|
||||
println!("FAIL {} — {reason}", sc.scenario);
|
||||
failed = true;
|
||||
}
|
||||
RunOutcome::Unimplemented => {
|
||||
println!(
|
||||
"PARSED {} covers={}{} (runner not yet implemented — T08)",
|
||||
sc.scenario,
|
||||
sc.covers.join(","),
|
||||
if sc.provisional { " provisional" } else { "" }
|
||||
);
|
||||
unimplemented = true;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
if failed {
|
||||
std::process::exit(1);
|
||||
}
|
||||
if unimplemented {
|
||||
std::process::exit(2);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue