use crate::{duration::Duration, prelude::*};
#[quantity(AmountT / Duration)]
#[ref_unit(Hertz, "Hz", NONE, "Reference unit of quantity `Frequency`")]
#[unit(Kilohertz, "kHz", KILO, 1000, "1000·Hz")]
#[unit(Megahertz, "MHz", MEGA, 1000000, "1000000·Hz")]
#[unit(Gigahertz, "GHz", GIGA, 1000000000, "1000000000·Hz")]
pub struct Frequency {}
#[cfg(test)]
mod tests {
use super::*;
use crate::{assert_almost_eq, duration::MILLISECOND};
#[test]
fn test_amount_div_duration() {
let a: AmountT = Amnt!(9030.);
let at: AmountT = Amnt!(2.5);
let t = at * MILLISECOND;
let f = (a / t).convert(KILOHERTZ);
assert_almost_eq!(f.amount(), a / at);
assert_eq!(f.unit(), KILOHERTZ);
}
}