//! E2E for the six float_* named comparison fns. After the
//! milestone, Float comparability survives via float_eq / float_lt
//! / etc. (no Eq Float instance, no `==` callee). Today this test
//! fires `unknown variable: float_eq` since the symbol does not
//! exist — RED-first.

use std::path::PathBuf;
use std::process::Command;

#[test]
fn float_compare_smoke_prints_true_true_false() {
    let manifest_dir = env!("CARGO_MANIFEST_DIR");
    let repo_root = PathBuf::from(manifest_dir).join("../..");
    let fixture = repo_root.join("examples/float_compare_smoke.ail");
    let bin = repo_root.join("target/debug/float_compare_smoke_test_bin");

    let build = Command::new(env!("CARGO_BIN_EXE_ail"))
        .arg("build")
        .arg(&fixture)
        .arg("-o")
        .arg(&bin)
        .output()
        .expect("ail build failed to spawn");
    assert!(
        build.status.success(),
        "ail build failed: stderr={}",
        String::from_utf8_lossy(&build.stderr)
    );

    let run = Command::new(&bin)
        .output()
        .expect("binary failed to spawn");
    assert!(run.status.success(), "binary failed: stderr={}", String::from_utf8_lossy(&run.stderr));
    assert_eq!(
        String::from_utf8_lossy(&run.stdout).as_ref(),
        "true\ntrue\nfalse\n",
        "expected float_eq then float_lt then float_eq mismatch"
    );
}
