Skip to content

Commit

Permalink
Fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
iliekturtles committed Sep 11, 2024
1 parent 0e662ef commit 68ca9c4
Showing 1 changed file with 101 additions and 51 deletions.
152 changes: 101 additions & 51 deletions src/si/angular_momentum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,92 @@ quantity! {
kind: dyn (crate::si::marker::AngleKind);
units {
/// Derived unit of angular velocity.
@kilogram_square_meter_per_second: prefix!(kilo) / prefix!(kilo); "kg · m²/s", "kilogram square meter per second", "kilogram square meters per second";
@kilogram_square_meter_per_second: prefix!(kilo) / prefix!(kilo); "kg · m²/s",
"kilogram square meter per second", "kilogram square meters per second";

@yottanewton_meter_second: prefix!(yotta); "YN · m · s", "yottanewton meter second", "yottanewton meter seconds";
@zettanewton_meter_second: prefix!(zetta); "ZN · m · s", "zettanewton meter second", "zettanewton meter seconds";
@exanewton_meter_second: prefix!(exa); "EN · m · s", "exanewton meter second", "exanewton meter seconds";
@petanewton_meter_second: prefix!(peta); "PN · m · s", "petanewton meter second", "petanewton meter seconds";
@teranewton_meter_second: prefix!(tera); "TN · m · s", "teranewton meter second", "teranewton meter seconds";
@giganewton_meter_second: prefix!(giga); "GN · m · s", "giganewton meter second", "giganewton meter seconds";
@meganewton_meter_second: prefix!(mega); "MN · m · s", "meganewton meter second", "meganewton meter seconds";
@kilonewton_meter_second: prefix!(kilo); "kN · m · s", "kilonewton meter second", "kilonewton meter seconds";
@hectonewton_meter_second: prefix!(hecto); "hN · m · s", "hectonewton meter second", "hectonewton meter seconds";
@decanewton_meter_second: prefix!(deca); "daN · m · s", "decanewton meter second", "decanewton meter seconds";
@newton_meter_second: prefix!(none); "N · m · s", "newton meter second", "newton meter seconds";
@decinewton_meter_second: prefix!(deci); "dN · m · s", "decinewton meter second", "decinewton meter seconds";
@centinewton_meter_second: prefix!(centi); "cN · m · s", "centinewton meter second", "centinewton meter seconds";
@millinewton_meter_second: prefix!(milli); "mN · m · s", "millinewton meter second", "millinewton meter seconds";
@micronewton_meter_second: prefix!(micro); "µN · m · s", "micronewton meter second", "micronewton meter seconds";
@nanonewton_meter_second: prefix!(nano); "nN · m · s", "nanonewton meter second", "nanonewton meter seconds";
@piconewton_meter_second: prefix!(pico); "pN · m · s", "piconewton meter second", "piconewton meter seconds";
@femtonewton_meter_second: prefix!(femto); "fN · m · s", "femtonewton meter second", "femtonewton meter seconds";
@attonewton_meter_second: prefix!(atto); "aN · m · s", "attonewton meter second", "attonewton meter seconds";
@zeptonewton_meter_second: prefix!(zepto); "zN · m · s", "zeptonewton meter second", "zeptonewton meter seconds";
@yoctonewton_meter_second: prefix!(yocto); "yN · m · s", "yoctonewton meter second", "yoctonewton meter seconds";
@yottanewton_meter_second: prefix!(yotta); "YN · m · s", "yottanewton meter second",
"yottanewton meter seconds";
@zettanewton_meter_second: prefix!(zetta); "ZN · m · s", "zettanewton meter second",
"zettanewton meter seconds";
@exanewton_meter_second: prefix!(exa); "EN · m · s", "exanewton meter second",
"exanewton meter seconds";
@petanewton_meter_second: prefix!(peta); "PN · m · s", "petanewton meter second",
"petanewton meter seconds";
@teranewton_meter_second: prefix!(tera); "TN · m · s", "teranewton meter second",
"teranewton meter seconds";
@giganewton_meter_second: prefix!(giga); "GN · m · s", "giganewton meter second",
"giganewton meter seconds";
@meganewton_meter_second: prefix!(mega); "MN · m · s", "meganewton meter second",
"meganewton meter seconds";
@kilonewton_meter_second: prefix!(kilo); "kN · m · s", "kilonewton meter second",
"kilonewton meter seconds";
@hectonewton_meter_second: prefix!(hecto); "hN · m · s", "hectonewton meter second",
"hectonewton meter seconds";
@decanewton_meter_second: prefix!(deca); "daN · m · s", "decanewton meter second",
"decanewton meter seconds";
@newton_meter_second: prefix!(none); "N · m · s", "newton meter second",
"newton meter seconds";
@decinewton_meter_second: prefix!(deci); "dN · m · s", "decinewton meter second",
"decinewton meter seconds";
@centinewton_meter_second: prefix!(centi); "cN · m · s", "centinewton meter second",
"centinewton meter seconds";
@millinewton_meter_second: prefix!(milli); "mN · m · s", "millinewton meter second",
"millinewton meter seconds";
@micronewton_meter_second: prefix!(micro); "µN · m · s", "micronewton meter second",
"micronewton meter seconds";
@nanonewton_meter_second: prefix!(nano); "nN · m · s", "nanonewton meter second",
"nanonewton meter seconds";
@piconewton_meter_second: prefix!(pico); "pN · m · s", "piconewton meter second",
"piconewton meter seconds";
@femtonewton_meter_second: prefix!(femto); "fN · m · s", "femtonewton meter second",
"femtonewton meter seconds";
@attonewton_meter_second: prefix!(atto); "aN · m · s", "attonewton meter second",
"attonewton meter seconds";
@zeptonewton_meter_second: prefix!(zepto); "zN · m · s", "zeptonewton meter second",
"zeptonewton meter seconds";
@yoctonewton_meter_second: prefix!(yocto); "yN · m · s", "yoctonewton meter second",
"yoctonewton meter seconds";

@newton_yottameter_second: prefix!(yotta); "N · Ym · s", "newton yottameter second second", "newton yottameter second seconds";
@newton_zettameter_second: prefix!(zetta); "N · Zm · s", "newton zettameter second", "newton zettameter seconds";
@newton_exameter_second: prefix!(exa); "N · Em · s", "newton exameter second", "newton exameter seconds";
@newton_petameter_second: prefix!(peta); "N · Pm · s", "newton petameter second", "newton petameter seconds";
@newton_terameter_second: prefix!(tera); "N · Tm · s", "newton terameter second", "newton terameter seconds";
@newton_gigameter_second: prefix!(giga); "N · Gm · s", "newton gigameter second", "newton gigameter seconds";
@newton_megameter_second: prefix!(mega); "N · Mm · s", "newton megameter second", "newton megameter seconds";
@newton_kilometer_second: prefix!(kilo); "N · km · s", "newton kilometer second", "newton kilometer seconds";
@newton_hectometer_second: prefix!(hecto); "N · hm · s", "newton hectometer second", "newton hectometer seconds";
@newton_decameter_second: prefix!(deca); "N · dam · s", "newton decameter second", "newton decameter seconds";
@newton_decimeter_second: prefix!(deci); "N · dm · s", "newton decimeter second", "newton decimeter seconds";
@newton_centimeter_second: prefix!(centi); "N · cm · s", "newton centimeter second", "newton centimeter seconds";
@newton_millimeter_second: prefix!(milli); "N · mm · s", "newton millimeter second", "newton millimeter seconds";
@newton_micrometer_second: prefix!(micro); "N · µm · s", "newton micrometer second", "newton micrometer seconds";
@newton_nanometer_second: prefix!(nano); "N · nm · s", "newton nanometer second", "newton nanometer seconds";
@newton_picometer_second: prefix!(pico); "N · pm · s", "newton picometer second", "newton picometer seconds";
@newton_femtometer_second: prefix!(femto); "N · fm · s", "newton femtometer second", "newton femtometer seconds";
@newton_attometer_second: prefix!(atto); "N · am · s", "newton attometer second", "newton attometer seconds";
@newton_zeptometer_second: prefix!(zepto); "N · zm · s", "newton zeptometer second", "newton zeptometer seconds";
@newton_yoctometer_second: prefix!(yocto); "N · ym · s", "newton yoctometer second", "newton yoctometer seconds";
@newton_yottameter_second: prefix!(yotta); "N · Ym · s", "newton yottameter second",
"newton yottameter seconds";
@newton_zettameter_second: prefix!(zetta); "N · Zm · s", "newton zettameter second",
"newton zettameter seconds";
@newton_exameter_second: prefix!(exa); "N · Em · s", "newton exameter second",
"newton exameter seconds";
@newton_petameter_second: prefix!(peta); "N · Pm · s", "newton petameter second",
"newton petameter seconds";
@newton_terameter_second: prefix!(tera); "N · Tm · s", "newton terameter second",
"newton terameter seconds";
@newton_gigameter_second: prefix!(giga); "N · Gm · s", "newton gigameter second",
"newton gigameter seconds";
@newton_megameter_second: prefix!(mega); "N · Mm · s", "newton megameter second",
"newton megameter seconds";
@newton_kilometer_second: prefix!(kilo); "N · km · s", "newton kilometer second",
"newton kilometer seconds";
@newton_hectometer_second: prefix!(hecto); "N · hm · s", "newton hectometer second",
"newton hectometer seconds";
@newton_decameter_second: prefix!(deca); "N · dam · s", "newton decameter second",
"newton decameter seconds";
@newton_decimeter_second: prefix!(deci); "N · dm · s", "newton decimeter second",
"newton decimeter seconds";
@newton_centimeter_second: prefix!(centi); "N · cm · s", "newton centimeter second",
"newton centimeter seconds";
@newton_millimeter_second: prefix!(milli); "N · mm · s", "newton millimeter second",
"newton millimeter seconds";
@newton_micrometer_second: prefix!(micro); "N · µm · s", "newton micrometer second",
"newton micrometer seconds";
@newton_nanometer_second: prefix!(nano); "N · nm · s", "newton nanometer second",
"newton nanometer seconds";
@newton_picometer_second: prefix!(pico); "N · pm · s", "newton picometer second",
"newton picometer seconds";
@newton_femtometer_second: prefix!(femto); "N · fm · s", "newton femtometer second",
"newton femtometer seconds";
@newton_attometer_second: prefix!(atto); "N · am · s", "newton attometer second",
"newton attometer seconds";
@newton_zeptometer_second: prefix!(zepto); "N · zm · s", "newton zeptometer second",
"newton zeptometer seconds";
@newton_yoctometer_second: prefix!(yocto); "N · ym · s", "newton yoctometer second",
"newton yoctometer seconds";
}
}

Expand Down Expand Up @@ -88,14 +130,22 @@ mod tests {
}

#[test]
fn check_units() {
Test::assert_approx_eq(
&AngularMomentum::new::<am::kilogram_square_meter_per_second>(V::one()),
&(Mass::new::<m::kilogram>(V::one()) * Area::new::<a::square_meter>(V::one())
/ Time::new::<t::second>(V::one()))
.into(),
);
fn check_units_mass_area() {
test::<m::kilogram, a::square_meter, am::kilogram_square_meter_per_second>();

fn test<M: m::Conversion<V>, A: a::Conversion<V>, AM: am::Conversion<V>>() {
Test::assert_approx_eq(
&AngularMomentum::new::<AM>(V::one()),
&(Mass::new::<M>(V::one())
* Area::new::<A>(V::one())
/ Time::new::<t::second>(V::one()))
.into(),
);
}
}

#[test]
fn check_units_force_length() {
test::<f::yottanewton, l::meter, am::yottanewton_meter_second>();
test::<f::zettanewton, l::meter, am::zettanewton_meter_second>();
test::<f::exanewton, l::meter, am::exanewton_meter_second>();
Expand Down Expand Up @@ -139,9 +189,9 @@ mod tests {
test::<f::newton, l::zeptometer, am::newton_zeptometer_second>();
test::<f::newton, l::yoctometer, am::newton_yoctometer_second>();

fn test<F: f::Conversion<V>, L: l::Conversion<V>, A: am::Conversion<V>>() {
fn test<F: f::Conversion<V>, L: l::Conversion<V>, AM: am::Conversion<V>>() {
Test::assert_approx_eq(
&AngularMomentum::new::<A>(V::one()),
&AngularMomentum::new::<AM>(V::one()),
&(Force::new::<F>(V::one())
* Length::new::<L>(V::one())
* Time::new::<t::second>(V::one()))
Expand Down

0 comments on commit 68ca9c4

Please sign in to comment.