|
| 1 | +//! Angular Acceleration (base unit radian per second squared, s⁻²). |
| 2 | +
|
| 3 | +quantity! { |
| 4 | + /// Angular Acceleration (base unit radian per second squared, s⁻²). |
| 5 | + quantity: AngularAcceleration; "angular acceleration"; |
| 6 | + /// Dimension of angular acceleration, T⁻² (base unit radian per second squared, s⁻²). |
| 7 | + dimension: ISQ< |
| 8 | + Z0, // length |
| 9 | + Z0, // mass |
| 10 | + N2, // 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 acceleration. |
| 18 | + @radian_per_second_squared: 1.0; "rad/s²", "radian per second squared", |
| 19 | + "radians per second squared"; |
| 20 | + @degree_per_second_squared: 1.745_329_251_994_329_5_E-2; "°/s²", |
| 21 | + "degree per second squared", "degrees per second squared"; |
| 22 | + } |
| 23 | +} |
| 24 | + |
| 25 | +#[cfg(test)] |
| 26 | +mod tests { |
| 27 | + storage_types! { |
| 28 | + use ::lib::f64::consts::PI; |
| 29 | + use num::{FromPrimitive, One}; |
| 30 | + use si::angle as a; |
| 31 | + use si::angular_acceleration as aa; |
| 32 | + use si::quantities::*; |
| 33 | + use si::time as t; |
| 34 | + use tests::Test; |
| 35 | + |
| 36 | + #[test] |
| 37 | + fn check_units() { |
| 38 | + Test::assert_eq( |
| 39 | + &AngularAcceleration::new::<aa::radian_per_second_squared>( |
| 40 | + V::from_f64(2.0 * PI).unwrap() |
| 41 | + ), |
| 42 | + &AngularAcceleration::new::<aa::degree_per_second_squared>( |
| 43 | + V::from_f64(360.0).unwrap() |
| 44 | + ) |
| 45 | + ); |
| 46 | + |
| 47 | + test::<a::radian, t::second, aa::radian_per_second_squared>(); |
| 48 | + test::<a::degree, t::second, aa::degree_per_second_squared>(); |
| 49 | + |
| 50 | + fn test<A: a::Conversion<V>, T: t::Conversion<V>, R: aa::Conversion<V>>() { |
| 51 | + let square_second = Time::new::<T>(V::one()) * Time::new::<T>(V::one()); |
| 52 | + Test::assert_approx_eq(&AngularAcceleration::new::<R>(V::one()), |
| 53 | + &(Angle::new::<A>(V::one()) / square_second).into()); |
| 54 | + } |
| 55 | + } |
| 56 | + } |
| 57 | +} |
0 commit comments