diff --git a/src/si/curvature.rs b/src/si/curvature.rs new file mode 100644 index 00000000..689fc7a6 --- /dev/null +++ b/src/si/curvature.rs @@ -0,0 +1,57 @@ +//! [Curvature](https://en.wikipedia.org/wiki/Curvature) (base unit radian per meter, m⁻¹). + +quantity! { + /// Curvature (base unit radian per meter, m⁻¹). + quantity: Curvature; "curvature"; + /// Dimension of curvature, L⁻¹ (base unit radian per meter, m⁻¹). + dimension: ISQ< + N1, // length + Z0, // mass + Z0, // time + Z0, // electric current + Z0, // thermodynamic temperature + Z0, // amount of substance + Z0>; // luminous intensity + kind: dyn (::si::marker::AngleKind); + units { + @radian_per_meter: 1.0_E0; "rad/m", "radian per meter", "radians per meter"; + @degree_per_meter: 1.745_329_251_994_329_5_E-2; "°/m", "degree per meter", + "degrees per meter"; + + @radian_per_millimeter: 1000.0; "rad/mm", "radian per millimeter", "radians per millimeter"; + @degree_per_millimeter: 1.745_329_251_994_329_5_E1; "°/mm", "degree per millimeter", + "degrees per millimeter"; + } +} + +#[cfg(test)] +mod tests { + storage_types! { + use num::One; + use si::quantities::*; + use si::curvature as c; + use si::length as l; + use si::angle as a; + use tests::Test; + + #[test] + fn check_dimension() { + let _: Curvature = + (Angle::new::(V::one()) + / Length::new::(V::one())).into(); + } + + #[test] + fn check_units() { + test::(); + test::(); + test::(); + test::(); + + fn test, L: l::Conversion, C: c::Conversion>() { + Test::assert_approx_eq(&Curvature::new::(V::one()), + &(Angle::new::(V::one()) / Length::new::(V::one())).into()); + } + } + } +} diff --git a/src/si/mod.rs b/src/si/mod.rs index b6918e9e..cdc09b4d 100644 --- a/src/si/mod.rs +++ b/src/si/mod.rs @@ -56,6 +56,7 @@ system! { capacitance::Capacitance, catalytic_activity::CatalyticActivity, catalytic_activity_concentration::CatalyticActivityConcentration, + curvature::Curvature, electric_charge::ElectricCharge, electric_current::ElectricCurrent, electric_potential::ElectricPotential,