Skip to content

Commit 68ca9c4

Browse files
committed
Fixes.
1 parent 0e662ef commit 68ca9c4

File tree

1 file changed

+101
-51
lines changed

1 file changed

+101
-51
lines changed

src/si/angular_momentum.rs

+101-51
Original file line numberDiff line numberDiff line change
@@ -15,50 +15,92 @@ quantity! {
1515
kind: dyn (crate::si::marker::AngleKind);
1616
units {
1717
/// Derived unit of angular velocity.
18-
@kilogram_square_meter_per_second: prefix!(kilo) / prefix!(kilo); "kg · m²/s", "kilogram square meter per second", "kilogram square meters per second";
18+
@kilogram_square_meter_per_second: prefix!(kilo) / prefix!(kilo); "kg · m²/s",
19+
"kilogram square meter per second", "kilogram square meters per second";
1920

20-
@yottanewton_meter_second: prefix!(yotta); "YN · m · s", "yottanewton meter second", "yottanewton meter seconds";
21-
@zettanewton_meter_second: prefix!(zetta); "ZN · m · s", "zettanewton meter second", "zettanewton meter seconds";
22-
@exanewton_meter_second: prefix!(exa); "EN · m · s", "exanewton meter second", "exanewton meter seconds";
23-
@petanewton_meter_second: prefix!(peta); "PN · m · s", "petanewton meter second", "petanewton meter seconds";
24-
@teranewton_meter_second: prefix!(tera); "TN · m · s", "teranewton meter second", "teranewton meter seconds";
25-
@giganewton_meter_second: prefix!(giga); "GN · m · s", "giganewton meter second", "giganewton meter seconds";
26-
@meganewton_meter_second: prefix!(mega); "MN · m · s", "meganewton meter second", "meganewton meter seconds";
27-
@kilonewton_meter_second: prefix!(kilo); "kN · m · s", "kilonewton meter second", "kilonewton meter seconds";
28-
@hectonewton_meter_second: prefix!(hecto); "hN · m · s", "hectonewton meter second", "hectonewton meter seconds";
29-
@decanewton_meter_second: prefix!(deca); "daN · m · s", "decanewton meter second", "decanewton meter seconds";
30-
@newton_meter_second: prefix!(none); "N · m · s", "newton meter second", "newton meter seconds";
31-
@decinewton_meter_second: prefix!(deci); "dN · m · s", "decinewton meter second", "decinewton meter seconds";
32-
@centinewton_meter_second: prefix!(centi); "cN · m · s", "centinewton meter second", "centinewton meter seconds";
33-
@millinewton_meter_second: prefix!(milli); "mN · m · s", "millinewton meter second", "millinewton meter seconds";
34-
@micronewton_meter_second: prefix!(micro); "µN · m · s", "micronewton meter second", "micronewton meter seconds";
35-
@nanonewton_meter_second: prefix!(nano); "nN · m · s", "nanonewton meter second", "nanonewton meter seconds";
36-
@piconewton_meter_second: prefix!(pico); "pN · m · s", "piconewton meter second", "piconewton meter seconds";
37-
@femtonewton_meter_second: prefix!(femto); "fN · m · s", "femtonewton meter second", "femtonewton meter seconds";
38-
@attonewton_meter_second: prefix!(atto); "aN · m · s", "attonewton meter second", "attonewton meter seconds";
39-
@zeptonewton_meter_second: prefix!(zepto); "zN · m · s", "zeptonewton meter second", "zeptonewton meter seconds";
40-
@yoctonewton_meter_second: prefix!(yocto); "yN · m · s", "yoctonewton meter second", "yoctonewton meter seconds";
21+
@yottanewton_meter_second: prefix!(yotta); "YN · m · s", "yottanewton meter second",
22+
"yottanewton meter seconds";
23+
@zettanewton_meter_second: prefix!(zetta); "ZN · m · s", "zettanewton meter second",
24+
"zettanewton meter seconds";
25+
@exanewton_meter_second: prefix!(exa); "EN · m · s", "exanewton meter second",
26+
"exanewton meter seconds";
27+
@petanewton_meter_second: prefix!(peta); "PN · m · s", "petanewton meter second",
28+
"petanewton meter seconds";
29+
@teranewton_meter_second: prefix!(tera); "TN · m · s", "teranewton meter second",
30+
"teranewton meter seconds";
31+
@giganewton_meter_second: prefix!(giga); "GN · m · s", "giganewton meter second",
32+
"giganewton meter seconds";
33+
@meganewton_meter_second: prefix!(mega); "MN · m · s", "meganewton meter second",
34+
"meganewton meter seconds";
35+
@kilonewton_meter_second: prefix!(kilo); "kN · m · s", "kilonewton meter second",
36+
"kilonewton meter seconds";
37+
@hectonewton_meter_second: prefix!(hecto); "hN · m · s", "hectonewton meter second",
38+
"hectonewton meter seconds";
39+
@decanewton_meter_second: prefix!(deca); "daN · m · s", "decanewton meter second",
40+
"decanewton meter seconds";
41+
@newton_meter_second: prefix!(none); "N · m · s", "newton meter second",
42+
"newton meter seconds";
43+
@decinewton_meter_second: prefix!(deci); "dN · m · s", "decinewton meter second",
44+
"decinewton meter seconds";
45+
@centinewton_meter_second: prefix!(centi); "cN · m · s", "centinewton meter second",
46+
"centinewton meter seconds";
47+
@millinewton_meter_second: prefix!(milli); "mN · m · s", "millinewton meter second",
48+
"millinewton meter seconds";
49+
@micronewton_meter_second: prefix!(micro); "µN · m · s", "micronewton meter second",
50+
"micronewton meter seconds";
51+
@nanonewton_meter_second: prefix!(nano); "nN · m · s", "nanonewton meter second",
52+
"nanonewton meter seconds";
53+
@piconewton_meter_second: prefix!(pico); "pN · m · s", "piconewton meter second",
54+
"piconewton meter seconds";
55+
@femtonewton_meter_second: prefix!(femto); "fN · m · s", "femtonewton meter second",
56+
"femtonewton meter seconds";
57+
@attonewton_meter_second: prefix!(atto); "aN · m · s", "attonewton meter second",
58+
"attonewton meter seconds";
59+
@zeptonewton_meter_second: prefix!(zepto); "zN · m · s", "zeptonewton meter second",
60+
"zeptonewton meter seconds";
61+
@yoctonewton_meter_second: prefix!(yocto); "yN · m · s", "yoctonewton meter second",
62+
"yoctonewton meter seconds";
4163

42-
@newton_yottameter_second: prefix!(yotta); "N · Ym · s", "newton yottameter second second", "newton yottameter second seconds";
43-
@newton_zettameter_second: prefix!(zetta); "N · Zm · s", "newton zettameter second", "newton zettameter seconds";
44-
@newton_exameter_second: prefix!(exa); "N · Em · s", "newton exameter second", "newton exameter seconds";
45-
@newton_petameter_second: prefix!(peta); "N · Pm · s", "newton petameter second", "newton petameter seconds";
46-
@newton_terameter_second: prefix!(tera); "N · Tm · s", "newton terameter second", "newton terameter seconds";
47-
@newton_gigameter_second: prefix!(giga); "N · Gm · s", "newton gigameter second", "newton gigameter seconds";
48-
@newton_megameter_second: prefix!(mega); "N · Mm · s", "newton megameter second", "newton megameter seconds";
49-
@newton_kilometer_second: prefix!(kilo); "N · km · s", "newton kilometer second", "newton kilometer seconds";
50-
@newton_hectometer_second: prefix!(hecto); "N · hm · s", "newton hectometer second", "newton hectometer seconds";
51-
@newton_decameter_second: prefix!(deca); "N · dam · s", "newton decameter second", "newton decameter seconds";
52-
@newton_decimeter_second: prefix!(deci); "N · dm · s", "newton decimeter second", "newton decimeter seconds";
53-
@newton_centimeter_second: prefix!(centi); "N · cm · s", "newton centimeter second", "newton centimeter seconds";
54-
@newton_millimeter_second: prefix!(milli); "N · mm · s", "newton millimeter second", "newton millimeter seconds";
55-
@newton_micrometer_second: prefix!(micro); "N · µm · s", "newton micrometer second", "newton micrometer seconds";
56-
@newton_nanometer_second: prefix!(nano); "N · nm · s", "newton nanometer second", "newton nanometer seconds";
57-
@newton_picometer_second: prefix!(pico); "N · pm · s", "newton picometer second", "newton picometer seconds";
58-
@newton_femtometer_second: prefix!(femto); "N · fm · s", "newton femtometer second", "newton femtometer seconds";
59-
@newton_attometer_second: prefix!(atto); "N · am · s", "newton attometer second", "newton attometer seconds";
60-
@newton_zeptometer_second: prefix!(zepto); "N · zm · s", "newton zeptometer second", "newton zeptometer seconds";
61-
@newton_yoctometer_second: prefix!(yocto); "N · ym · s", "newton yoctometer second", "newton yoctometer seconds";
64+
@newton_yottameter_second: prefix!(yotta); "N · Ym · s", "newton yottameter second",
65+
"newton yottameter seconds";
66+
@newton_zettameter_second: prefix!(zetta); "N · Zm · s", "newton zettameter second",
67+
"newton zettameter seconds";
68+
@newton_exameter_second: prefix!(exa); "N · Em · s", "newton exameter second",
69+
"newton exameter seconds";
70+
@newton_petameter_second: prefix!(peta); "N · Pm · s", "newton petameter second",
71+
"newton petameter seconds";
72+
@newton_terameter_second: prefix!(tera); "N · Tm · s", "newton terameter second",
73+
"newton terameter seconds";
74+
@newton_gigameter_second: prefix!(giga); "N · Gm · s", "newton gigameter second",
75+
"newton gigameter seconds";
76+
@newton_megameter_second: prefix!(mega); "N · Mm · s", "newton megameter second",
77+
"newton megameter seconds";
78+
@newton_kilometer_second: prefix!(kilo); "N · km · s", "newton kilometer second",
79+
"newton kilometer seconds";
80+
@newton_hectometer_second: prefix!(hecto); "N · hm · s", "newton hectometer second",
81+
"newton hectometer seconds";
82+
@newton_decameter_second: prefix!(deca); "N · dam · s", "newton decameter second",
83+
"newton decameter seconds";
84+
@newton_decimeter_second: prefix!(deci); "N · dm · s", "newton decimeter second",
85+
"newton decimeter seconds";
86+
@newton_centimeter_second: prefix!(centi); "N · cm · s", "newton centimeter second",
87+
"newton centimeter seconds";
88+
@newton_millimeter_second: prefix!(milli); "N · mm · s", "newton millimeter second",
89+
"newton millimeter seconds";
90+
@newton_micrometer_second: prefix!(micro); "N · µm · s", "newton micrometer second",
91+
"newton micrometer seconds";
92+
@newton_nanometer_second: prefix!(nano); "N · nm · s", "newton nanometer second",
93+
"newton nanometer seconds";
94+
@newton_picometer_second: prefix!(pico); "N · pm · s", "newton picometer second",
95+
"newton picometer seconds";
96+
@newton_femtometer_second: prefix!(femto); "N · fm · s", "newton femtometer second",
97+
"newton femtometer seconds";
98+
@newton_attometer_second: prefix!(atto); "N · am · s", "newton attometer second",
99+
"newton attometer seconds";
100+
@newton_zeptometer_second: prefix!(zepto); "N · zm · s", "newton zeptometer second",
101+
"newton zeptometer seconds";
102+
@newton_yoctometer_second: prefix!(yocto); "N · ym · s", "newton yoctometer second",
103+
"newton yoctometer seconds";
62104
}
63105
}
64106

@@ -88,14 +130,22 @@ mod tests {
88130
}
89131

90132
#[test]
91-
fn check_units() {
92-
Test::assert_approx_eq(
93-
&AngularMomentum::new::<am::kilogram_square_meter_per_second>(V::one()),
94-
&(Mass::new::<m::kilogram>(V::one()) * Area::new::<a::square_meter>(V::one())
95-
/ Time::new::<t::second>(V::one()))
96-
.into(),
97-
);
133+
fn check_units_mass_area() {
134+
test::<m::kilogram, a::square_meter, am::kilogram_square_meter_per_second>();
98135

136+
fn test<M: m::Conversion<V>, A: a::Conversion<V>, AM: am::Conversion<V>>() {
137+
Test::assert_approx_eq(
138+
&AngularMomentum::new::<AM>(V::one()),
139+
&(Mass::new::<M>(V::one())
140+
* Area::new::<A>(V::one())
141+
/ Time::new::<t::second>(V::one()))
142+
.into(),
143+
);
144+
}
145+
}
146+
147+
#[test]
148+
fn check_units_force_length() {
99149
test::<f::yottanewton, l::meter, am::yottanewton_meter_second>();
100150
test::<f::zettanewton, l::meter, am::zettanewton_meter_second>();
101151
test::<f::exanewton, l::meter, am::exanewton_meter_second>();
@@ -139,9 +189,9 @@ mod tests {
139189
test::<f::newton, l::zeptometer, am::newton_zeptometer_second>();
140190
test::<f::newton, l::yoctometer, am::newton_yoctometer_second>();
141191

142-
fn test<F: f::Conversion<V>, L: l::Conversion<V>, A: am::Conversion<V>>() {
192+
fn test<F: f::Conversion<V>, L: l::Conversion<V>, AM: am::Conversion<V>>() {
143193
Test::assert_approx_eq(
144-
&AngularMomentum::new::<A>(V::one()),
194+
&AngularMomentum::new::<AM>(V::one()),
145195
&(Force::new::<F>(V::one())
146196
* Length::new::<L>(V::one())
147197
* Time::new::<t::second>(V::one()))

0 commit comments

Comments
 (0)