|
| 1 | +//! Angular velocity (base unit radian per second, s⁻¹). |
| 2 | +
|
| 3 | +quantity! { |
| 4 | + /// Angular velocity (base unit radian per second, s⁻¹). |
| 5 | + quantity: AngularVelocity; "angular velocity"; |
| 6 | + /// Dimension of angular velocity, T⁻¹ (base unit radian per second, s⁻¹). |
| 7 | + dimension: ISQ< |
| 8 | + Z0, // length |
| 9 | + Z0, // mass |
| 10 | + N1, // time |
| 11 | + Z0, // electric current |
| 12 | + Z0, // thermodynamic temperature |
| 13 | + Z0, // amount of substance |
| 14 | + Z0>; // luminous intensity |
| 15 | + kind: ::si::marker::AngleKind; |
| 16 | + units { |
| 17 | + /// Derived unit of angular velocity. |
| 18 | + @radian_per_second: 1.0_E0; "rad/s", "radian per second", "radians per second"; |
| 19 | + @degree_per_second: 1.745_329_251_994_329_5_E-2; "°/s", "degree per second", |
| 20 | + "degrees per second"; |
| 21 | + @revolution_per_second: 6.283_185_307_179_586_E0; "rps", "revolution per second", |
| 22 | + "revolutions per second"; |
| 23 | + @revolution_per_minute: 1.047_197_551_196_597_7_E-1; "rpm", "revolution per minute", |
| 24 | + "revolutions per minute"; |
| 25 | + @revolution_per_hour: 1.745_329_251_994_329_6_E-3; "rph", "revolution per hour", |
| 26 | + "revolutions per hour"; |
| 27 | + } |
| 28 | +} |
| 29 | + |
| 30 | +#[cfg(test)] |
| 31 | +mod tests { |
| 32 | + storage_types! { |
| 33 | + use num::One; |
| 34 | + use si::angle as a; |
| 35 | + use si::angular_velocity as v; |
| 36 | + use si::quantities::*; |
| 37 | + use si::time as t; |
| 38 | + use tests::Test; |
| 39 | + |
| 40 | + #[test] |
| 41 | + fn check_units() { |
| 42 | + test::<a::radian, t::second, v::radian_per_second>(); |
| 43 | + test::<a::degree, t::second, v::degree_per_second>(); |
| 44 | + test::<a::revolution, t::second, v::revolution_per_second>(); |
| 45 | + test::<a::revolution, t::minute, v::revolution_per_minute>(); |
| 46 | + test::<a::revolution, t::hour, v::revolution_per_hour>(); |
| 47 | + |
| 48 | + fn test<A: a::Conversion<V>, T: t::Conversion<V>, R: v::Conversion<V>>() { |
| 49 | + Test::assert_approx_eq(&AngularVelocity::new::<R>(V::one()), |
| 50 | + &(Angle::new::<A>(V::one()) / Time::new::<T>(V::one())).into()); |
| 51 | + } |
| 52 | + } |
| 53 | + } |
| 54 | +} |
0 commit comments