use callistos::rendering::dust::DustScattering;
use callistos::rendering::exosphere::ExosphereEndpoint;
use callistos::rendering::materials::PbrMaterial;
use callistos::rendering::shaders::{ShaderEndpoint, UniformValue};
#[test]
fn dust_plume_opacity_at_surface() {
let d = DustScattering::impact_plume();
assert!(d.opacity_at_height(0.0) > 0.0);
}
#[test]
fn opacity_decreases_with_height() {
let d = DustScattering::impact_plume();
assert!(d.opacity_at_height(10_000.0) < d.opacity_at_height(0.0));
}
#[test]
fn dark_terrain_material_albedo() {
let m = PbrMaterial::dark_terrain();
assert!(m.albedo[0] < 0.3);
assert!(m.roughness > 0.8);
}
#[test]
fn icy_bright_patch_material() {
let m = PbrMaterial::icy_bright_patch();
assert!(m.albedo[0] > 0.4);
}
#[test]
fn crater_floor_roughness() {
let m = PbrMaterial::crater_floor();
assert!(m.roughness > 0.8);
}
#[test]
fn exosphere_species_count() {
let exo = ExosphereEndpoint::callisto();
assert_eq!(exo.species.len(), 3);
}
#[test]
fn exosphere_body_radius() {
let exo = ExosphereEndpoint::callisto();
assert!((exo.body_radius_m - callistos::CALLISTO_RADIUS_M).abs() < 1.0);
}
#[test]
fn exosphere_co2_dominant() {
let exo = ExosphereEndpoint::callisto();
let co2 = exo.species.iter().find(|s| s.symbol == "CO2").unwrap();
let o2 = exo.species.iter().find(|s| s.symbol == "O2").unwrap();
assert!(co2.column_density_m2 > o2.column_density_m2);
}
#[test]
fn exosphere_density_decreases() {
let exo = ExosphereEndpoint::callisto();
let d0 = exo.density_at_altitude("CO2", 0.0);
let d60 = exo.density_at_altitude("CO2", 60_000.0);
assert!(d0 > d60);
}
#[test]
fn exosphere_total_column() {
let exo = ExosphereEndpoint::callisto();
assert!(exo.total_column_density() > 1e18);
}
#[test]
fn exosphere_molar_mass_positive() {
let exo = ExosphereEndpoint::callisto();
for sp in &exo.species {
assert!(sp.molar_mass_kg_mol > 0.0);
}
}
#[test]
fn terrain_shader_name() {
let s = ShaderEndpoint::terrain();
assert_eq!(s.name, "callisto_terrain_pbr");
assert!(s.uniforms.len() >= 6);
}
#[test]
fn terrain_shader_surface_temp() {
let s = ShaderEndpoint::terrain();
let temp = s
.uniforms
.iter()
.find(|u| u.name == "u_surface_temp_k")
.unwrap();
match temp.value {
UniformValue::Float(v) => assert!((v - 120.0).abs() < 5.0),
_ => panic!("expected Float"),
}
}
#[test]
fn exosphere_shader_name() {
let s = ShaderEndpoint::exosphere();
assert_eq!(s.name, "callisto_co2_exosphere");
assert!(s.uniforms.len() >= 2);
}
#[test]
fn exosphere_shader_co2_column() {
let s = ShaderEndpoint::exosphere();
let co2 = s
.uniforms
.iter()
.find(|u| u.name == "u_co2_column_density")
.unwrap();
match co2.value {
UniformValue::Float(v) => assert!(v > 1e18),
_ => panic!("expected Float"),
}
}
#[test]
fn eclipse_shader_name() {
let s = ShaderEndpoint::eclipse();
assert_eq!(s.name, "callisto_eclipse");
assert!(s.uniforms.len() >= 3);
}