The checked-in picture of the rules is the network that runs.
3mod common;
5use whiskers_chooser::{RULES, network}; 6 7fn checked_in() -> String { 8 std::fs::read_to_string(std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("docs/chooser-rules.svg")).expect("docs/chooser-rules.svg is checked in") 9} 10 11#[test] 12fn the_drawing_is_the_network_that_runs() { 13 assert_eq!( 14 checked_in(), 15 common::rules_svg(), 16 "docs/chooser-rules.svg is out of date: run `cargo run -p whiskers-chooser --example draw`" 17 ); 18} 19 20#[test] 21fn every_rule_that_runs_is_in_the_picture_and_nothing_else() { 22 let svg = checked_in(); 23 for rule in RULES { 24 assert!(svg.contains(&format!(">{} → ", rule.name)), "the rule {:?} is not drawn", rule.name); 25 } 26 assert_eq!(svg.matches("class=\"rule ").count(), network().terminals.len(), "one box a rule, and no other"); 27 assert!(svg.starts_with("<svg xmlns=\"http://www.w3.org/2000/svg\"")); 28 assert!(!svg.contains("<a "), "nothing in it links"); 29}