moons 0.0.3

Moon celestial simulation crate for the MilkyWay SolarSystem workspace
Documentation
use moons::lighting::earthshine::{dark_side_visibility_index, earthshine_irradiance_lux};
use moons::lighting::eclipses::typical_lunar_eclipse;
use moons::lighting::solar_position::{illumination, solar_elevation_deg, subsolar_longitude_deg};

fn ensure_earth_binary() {
    let earth = moons::interactions::earths::ensure_earths_binary_or_simulate();
    assert!(earth.rotation_angle_deg >= 0.0);
}

#[test]
fn subsolar_longitude_wraps() {
    ensure_earth_binary();
    assert_eq!(subsolar_longitude_deg(0.5), 0.0);
}

#[test]
fn local_noon_is_brighter_than_midnight() {
    ensure_earth_binary();
    assert!(solar_elevation_deg(0.0, 12.0) > solar_elevation_deg(0.0, 0.0));
}

#[test]
fn earthshine_scales_with_phase() {
    ensure_earth_binary();
    assert!(earthshine_irradiance_lux(1.0) > earthshine_irradiance_lux(0.1));
    assert!(dark_side_visibility_index(1.0, 0.12) > 0.0);
}

#[test]
fn eclipse_duration_is_finite() {
    ensure_earth_binary();
    assert!(typical_lunar_eclipse().totality_duration_minutes() > 100.0);
    assert!(illumination(80.0, 6.0, 30.0).incidence_deg >= 0.0);
}