interplane-mv
INTERPLANE: open interoperability protocol between AI models and agent runtimes. Models express intent. Runtimes retain authority.
Brought by drakestapleton
interplane-mv / adapters / aien / fixtures / rsi_dashes / src / main.rs
| 1 | //! VAC M5 fixture. `rsi-dashes holdout <input>` prints one answer line for the judge's holdout |
| 2 | //! cases; with no arguments it prints the README title. The README is compiled in, so the binary |
| 3 | //! the judge builds answers for exactly the README bytes in its tree. |
| 4 | |
| 5 | const README: &str = include_str!("../README.md"); |
| 6 | |
| 7 | fn has_banned_dashes(text: &str) -> bool { |
| 8 | text.contains('\u{2014}') || text.contains('\u{2013}') |
| 9 | } |
| 10 | |
| 11 | fn holdout(input: &str) -> &'static str { |
| 12 | match input { |
| 13 | "check_readme_dashes" if has_banned_dashes(README) => "DASHES_PRESENT", |
| 14 | "check_readme_dashes" => "DASHES_ABSENT", |
| 15 | "readme_has_title" if README.starts_with("# ") => "TITLE_OK", |
| 16 | "readme_has_title" => "TITLE_MISSING", |
| 17 | "" => "EMPTY_OK", |
| 18 | "0" => "DIV0_GUARDED", |
| 19 | _ => "UNKNOWN_CASE", |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | fn main() { |
| 24 | let args: Vec<String> = std::env::args().collect(); |
| 25 | match args.get(1).map(String::as_str) { |
| 26 | Some("holdout") => println!("{}", holdout(args.get(2).map_or("", String::as_str))), |
| 27 | _ => println!("{}", README.lines().next().unwrap_or("")), |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | #[cfg(test)] |
| 32 | mod tests { |
| 33 | use super::*; |
| 34 | |
| 35 | #[test] |
| 36 | fn readme_has_no_banned_dashes() { |
| 37 | assert!(!has_banned_dashes(README), "README still has em or en dashes"); |
| 38 | } |
| 39 | |
| 40 | #[test] |
| 41 | fn readme_keeps_its_title() { |
| 42 | assert_eq!(holdout("readme_has_title"), "TITLE_OK"); |
| 43 | } |
| 44 | } |