main
John Lauer source: the crates, flows, docs and skills of adom-aiflow 0.1.5, so PRs can be opened against them ad411ea
use aiflow_board::Board;

#[test]
fn reads_the_esc_fixture_when_present() {
    let p = "/home/adom/project/adom-desktop-kicad-bridge/demo/routing/esc/esc-g431-fable-placed-planes.kicad_pcb";
    if !std::path::Path::new(p).is_file() {
        return;
    }
    let b = Board::load(p).unwrap();
    assert_eq!(b.pads.len(), 365, "copper pads");
    assert_eq!(b.footprints.len(), 149, "footprints");
    assert_eq!(b.copper_layers.len(), 4);
    assert_eq!(b.bbox, (104.0, 58.0, 168.0, 132.0));
    let q1 = b.pad_by_key("Q1.5").unwrap();
    assert_eq!(q1.net, "+VBAT");
    assert!((q1.x - 155.75).abs() < 0.05 && (q1.y - 108.5).abs() < 0.05, "{} {}", q1.x, q1.y);
    assert!(b.nets.get("GND").map(|v| v.len()).unwrap_or(0) > 60);
    let u5 = b.pad_by_key("U5.5").unwrap();
    assert!(u5.half_long > u5.half_short && u5.min_dim() < 0.5, "U5.5 is a narrow pin: {} {}", u5.half_long, u5.half_short);
}