|
| 1 | +//! Electric Flux (base unit volt meter, m³ ⋅ kg ⋅ s⁻³ ⋅ A⁻¹). |
| 2 | +
|
| 3 | +quantity! { |
| 4 | + /// Electric Flux (base unit volt meter, m³ ⋅ kg ⋅ s⁻³ ⋅ A⁻¹). |
| 5 | + quantity: ElectricFlux; "electric flux"; |
| 6 | + /// Dimension of electric flux, L³MT⁻³I⁻¹ (base unit volt meter, m³ ⋅ kg ⋅ s⁻³ ⋅ A⁻¹). |
| 7 | + dimension: ISQ< |
| 8 | + P3, // length |
| 9 | + P1, // mass |
| 10 | + N3, // time |
| 11 | + N1, // electric current |
| 12 | + Z0, // thermodynamic temperature |
| 13 | + Z0, // amount of substance |
| 14 | + Z0>; // luminous intensity |
| 15 | + units { |
| 16 | + @volt_meter: prefix!(none); "V ⋅ m", "volt meter", "volt meters"; |
| 17 | + @volt_centimeter: prefix!(none) * prefix!(centi); "V ⋅ cm", "volt centimeter", |
| 18 | + "volt centimeters"; |
| 19 | + } |
| 20 | +} |
| 21 | + |
| 22 | +#[cfg(test)] |
| 23 | +mod test { |
| 24 | + storage_types! { |
| 25 | + use crate::num::One; |
| 26 | + use crate::si::electric_flux as ef; |
| 27 | + use crate::si::quantities::*; |
| 28 | + use crate::si::electric_potential as ep; |
| 29 | + use crate::si::length as l; |
| 30 | + use crate::tests::Test; |
| 31 | + |
| 32 | + #[test] |
| 33 | + fn check_dimension() { |
| 34 | + let _: ElectricFlux<V> = ElectricPotential::new::<ep::volt>(V::one()) |
| 35 | + * Length::new::<l::meter>(V::one()); |
| 36 | + } |
| 37 | + |
| 38 | + #[test] |
| 39 | + fn check_units() { |
| 40 | + test::<ef::volt_meter, l::meter, ep::volt>(); |
| 41 | + test::<ef::volt_centimeter, l::centimeter, ep::volt>(); |
| 42 | + |
| 43 | + fn test<EF: ef::Conversion<V>, L: l::Conversion<V>, EP: ep::Conversion<V>>() { |
| 44 | + Test::assert_approx_eq(&ElectricFlux::new::<EF>(V::one()), |
| 45 | + &(ElectricPotential::new::<EP>(V::one()) |
| 46 | + * Length::new::<L>(V::one()))); |
| 47 | + } |
| 48 | + } |
| 49 | + } |
| 50 | +} |
0 commit comments