//! Phase-0 benchmark: end-to-end solve on three reference cycles.
//!
//! Each benchmark builds a real CoolProp-backed emergent-pressure R134a cycle
//! and solves it with the fallback Newton solver.

use criterion::{black_box, criterion_group, criterion_main, Criterion};

mod common;

fn bench_reference_cycle_a(c: &mut Criterion) {
    c.bench_function("full_solve_reference_cycle_a", |b| {
        b.iter(|| {
            let mut system = common::build_reference_cycle_a();
            common::solve_reference_system(&mut system);
            black_box(());
        });
    });
}

fn bench_reference_cycle_b(c: &mut Criterion) {
    c.bench_function("full_solve_reference_cycle_b", |b| {
        b.iter(|| {
            let mut system = common::build_reference_cycle_b();
            common::solve_reference_system(&mut system);
            black_box(());
        });
    });
}

fn bench_reference_cycle_c(c: &mut Criterion) {
    c.bench_function("full_solve_reference_cycle_c", |b| {
        b.iter(|| {
            let mut system = common::build_reference_cycle_c();
            common::solve_reference_system(&mut system);
            black_box(());
        });
    });
}

criterion_group! {
    name = benches;
    config = common::end_to_end_criterion();
    targets = bench_reference_cycle_a, bench_reference_cycle_b, bench_reference_cycle_c
}
criterion_main!(benches);
