pub mod distance {
pub const FEET_TO_METERS: f64 = 0.3048;
pub const FEET_TO_NMI: f64 = 0.3048 / 1852.0;
pub const METERS_TO_FEET: f64 = 1.0 / 0.3048;
pub const METERS_TO_NMI: f64 = 1.0 / 1852.0;
pub const NMI_TO_FEET: f64 = 1852.0 / 0.3048;
pub const NMI_TO_METERS: f64 = 1852.0;
}
pub mod time {
pub const DAYS_TO_HOURS: f64 = 24.0;
pub const DAYS_TO_MINUTES: f64 = 1440.0;
pub const DAYS_TO_SECONDS: f64 = 86400.0;
pub const HOURS_TO_DAYS: f64 = 1.0 / 24.0;
pub const HOURS_TO_SECONDS: f64 = 3600.0;
pub const HOURS_TO_MINUTES: f64 = 60.0;
pub const MINUTES_TO_DAYS: f64 = 1.0 / 1440.0;
pub const MINUTES_TO_HOURS: f64 = 1.0 / 60.0;
pub const MINUTES_TO_SECONDS: f64 = 60.0;
pub const SECONDS_TO_DAYS: f64 = 1.0 / 86400.0;
pub const SECONDS_TO_HOURS: f64 = 1.0 / 3600.0;
pub const SECONDS_TO_MINUTES: f64 = 1.0 / 60.0;
}
#[cfg(test)]
mod tests {
use crate::conversions::{distance, time};
#[test]
fn distance_tests() {
assert_eq!(distance::FEET_TO_METERS, 0.3048);
assert_eq!(distance::FEET_TO_NMI, 0.3048 / 1852.0);
assert_eq!(distance::METERS_TO_FEET, 1.0 / 0.3048);
assert_eq!(distance::METERS_TO_NMI, 1.0 / 1852.0);
assert_eq!(distance::NMI_TO_FEET, 1852.0 / 0.3048);
assert_eq!(distance::NMI_TO_METERS, 1852.0);
}
#[test]
fn time_tests() {
assert_eq!(time::DAYS_TO_HOURS, 24.0);
assert_eq!(time::DAYS_TO_MINUTES, 1440.0);
assert_eq!(time::DAYS_TO_SECONDS, 86400.0);
assert_eq!(time::HOURS_TO_DAYS, 1.0 / 24.0);
assert_eq!(time::HOURS_TO_SECONDS, 3600.0);
assert_eq!(time::HOURS_TO_MINUTES, 60.0);
assert_eq!(time::MINUTES_TO_DAYS, 1.0 / 1440.0);
assert_eq!(time::MINUTES_TO_HOURS, 1.0 / 60.0);
assert_eq!(time::MINUTES_TO_SECONDS, 60.0);
assert_eq!(time::SECONDS_TO_DAYS, 1.0 / 86400.0);
assert_eq!(time::SECONDS_TO_HOURS, 1.0 / 3600.0);
assert_eq!(time::SECONDS_TO_MINUTES, 1.0 / 60.0);
}
}