use asteroidsfactory::config::parameters::*;
use asteroidsfactory::physics::{gravity, thermal};

#[test]
fn gravitational_binding_energy_positive() {
    let mass = sphere_mass(50000.0, 2700.0);
    let e = gravity::gravitational_binding_energy(mass, 50000.0);
    assert!(e > 0.0);
}

#[test]
fn roche_limit_fluid_greater_than_rigid() {
    let rf = gravity::roche_limit_fluid(1.0e6, 5000.0, 2500.0);
    let rr = gravity::roche_limit_rigid(1.0e6, 5000.0, 2500.0);
    assert!(rf > rr);
}

#[test]
fn tidal_force_positive() {
    let f = gravity::tidal_force(SOLAR_MASS, 500.0, AU);
    assert!(f > 0.0);
}

#[test]
fn specific_angular_momentum_circular() {
    let h = gravity::specific_angular_momentum(AU, 0.0, SOLAR_MASS);
    assert!(h > 0.0);
}

#[test]
fn orbital_energy_negative() {
    let e = gravity::orbital_energy(1.0e15, SOLAR_MASS, AU);
    assert!(e < 0.0);
}

#[test]
fn close_approach_velocity() {
    let v = gravity::close_approach_velocity(10000.0, EARTH_MASS, EARTH_RADIUS);
    assert!(v > 10000.0);
}

#[test]
fn equilibrium_temp_at_1au() {
    let t = thermal::equilibrium_temperature_detailed(SOLAR_LUMINOSITY, 1.0, 0.3, 0.9);
    assert!(t > 200.0);
    assert!(t < 400.0);
}

#[test]
fn yarkovsky_drift_nonzero() {
    let drift = thermal::yarkovsky_drift_rate(500.0, 2500.0, 2.5, 0.15, 45.0);
    assert!(drift.abs() > 0.0);
}

#[test]
fn yorp_torque_positive() {
    let torque = thermal::yorp_torque_estimate(500.0, 2.5, 0.15);
    assert!(torque > 0.0);
}

#[test]
fn thermal_inertia_positive() {
    let ti = thermal::thermal_inertia_estimate(2500.0, 0.1, 800.0);
    assert!(ti > 0.0);
}

#[test]
fn diurnal_skin_depth_positive() {
    let d = thermal::diurnal_skin_depth(0.1, 2500.0, 800.0, 6.0 * 3600.0);
    assert!(d > 0.0);
}

#[test]
fn sublimation_temp_at_1au() {
    let t = thermal::sublimation_temperature_estimate(1.0, 0.1);
    assert!(t > 200.0);
}
