#[test]
fn readme_test() {
use parsec_access::getters::*;
use uom::si::f64::{Mass, Time};
use uom::si::{length::kilometer, thermodynamic_temperature::kelvin};
use astro_units::{mass::solar_mass, time::gigayear};
if !is_data_ready() {
panic!("Loading the PARSEC data failed.");
}
let metallicity_mass_fraction = 0.004;
let initial_mass = Mass::new::<solar_mass>(1.8);
let current_age = Time::new::<gigayear>(0.6);
let parameters = get_closest_parameters(metallicity_mass_fraction, initial_mass, current_age);
println!(
"The star has a current mass of {} solar masses.",
parameters.mass.get::<solar_mass>()
);
println!(
"The star has a current temperature of {}.",
parameters.temperature.get::<kelvin>()
);
println!(
"The star has a current radius of {} km.",
parameters.radius.get::<kilometer>()
);
println!(
"The star has a current luminosity of {} sol.",
parameters.luminosity_in_solar
);
let metallicity_index =
get_closest_metallicity_index_from_mass_fraction(metallicity_mass_fraction);
let mass_index = get_closest_mass_index(metallicity_index, initial_mass);
let trajectory = get_trajectory(metallicity_index, mass_index);
println!(
"The star is expected to reach the proud age of {} Gyr.",
trajectory.lifetime.get::<gigayear>()
);
}