|
| 1 | +//! Molar flux (base unit mole per square meter second, m⁻² · s⁻¹ · mol). |
| 2 | +
|
| 3 | +quantity! { |
| 4 | + /// Molar flux (base unit mole per square meter second, m⁻² · s⁻¹ · mol). |
| 5 | + quantity: MolarFlux; "molar flux"; |
| 6 | + /// Dimension of molar flux, L⁻²T⁻¹N (base unit mole per square meter second, m⁻² · s⁻¹ · mol). |
| 7 | + dimension: ISQ< |
| 8 | + N2, // length |
| 9 | + Z0, // mass |
| 10 | + N1, // time |
| 11 | + Z0, // electric current |
| 12 | + Z0, // thermodynamic temperature |
| 13 | + P1, // amount of substance |
| 14 | + Z0>; // luminous intensity |
| 15 | + units { |
| 16 | + @mole_per_square_meter_second: prefix!(none); "mol/(m² · s)", |
| 17 | + "mole per square meter second", "moles per square meter second"; |
| 18 | + } |
| 19 | +} |
| 20 | + |
| 21 | +#[cfg(test)] |
| 22 | +mod test { |
| 23 | + storage_types! { |
| 24 | + use crate::num::One; |
| 25 | + use crate::si::amount_of_substance as aos; |
| 26 | + use crate::si::molar_flux as mf; |
| 27 | + use crate::si::quantities::*; |
| 28 | + use crate::si::time as t; |
| 29 | + use crate::si::area as area; |
| 30 | + use crate::tests::Test; |
| 31 | + |
| 32 | + #[test] |
| 33 | + fn check_dimension() { |
| 34 | + let _: MolarFlux<V> = AmountOfSubstance::new::<aos::mole>(V::one()) |
| 35 | + / Time::new::<t::second>(V::one()) |
| 36 | + / Area::new::<area::square_meter>(V::one()); |
| 37 | + } |
| 38 | + |
| 39 | + #[test] |
| 40 | + fn check_units() { |
| 41 | + test::<aos::mole, t::second, area::square_meter, mf::mole_per_square_meter_second>(); |
| 42 | + |
| 43 | + fn test<N: aos::Conversion<V>, T: t::Conversion<V>, A: area::Conversion<V>, R: mf::Conversion<V>>() { |
| 44 | + Test::assert_approx_eq(&MolarFlux::new::<R>(V::one()), |
| 45 | + &(AmountOfSubstance::new::<N>(V::one()) |
| 46 | + / Time::new::<T>(V::one()) |
| 47 | + / Area::new::<A>(V::one()))); |
| 48 | + } |
| 49 | + } |
| 50 | + } |
| 51 | +} |
0 commit comments