Fix spelling Celcius → Celsius

This commit is contained in:
Juhani Krekelä 2023-05-29 21:37:56 +03:00
parent 055ab32a99
commit 1a493a1716
3 changed files with 10 additions and 10 deletions

View File

@ -62,7 +62,7 @@ fn get_conversion(unit: NonMetric) -> Conversion {
NonMetric::Fahrenheit => Conversion { NonMetric::Fahrenheit => Conversion {
offset: 32.0, offset: 32.0,
from: 9.0, from: 9.0,
to: MetricQuantity { amount: 5.0, unit: Metric::Celcius }, to: MetricQuantity { amount: 5.0, unit: Metric::Celsius },
}, },
// Area // Area
NonMetric::SquareInch => Conversion { NonMetric::SquareInch => Conversion {
@ -122,14 +122,14 @@ mod test {
unit: NonMetric::Fahrenheit, unit: NonMetric::Fahrenheit,
}), MetricQuantity { }), MetricQuantity {
amount: -40.0, amount: -40.0,
unit: Metric::Celcius, unit: Metric::Celsius,
}); });
assert_eq!(convert(NonMetricQuantity { assert_eq!(convert(NonMetricQuantity {
amount: 32.0, amount: 32.0,
unit: NonMetric::Fahrenheit, unit: NonMetric::Fahrenheit,
}), MetricQuantity { }), MetricQuantity {
amount: 0.0, amount: 0.0,
unit: Metric::Celcius, unit: Metric::Celsius,
}); });
} }

View File

@ -83,7 +83,7 @@ fn prefixed_unit(quantity: MetricQuantity) -> PrefixedUnit {
return PrefixedUnit(1.0, "g"); return PrefixedUnit(1.0, "g");
} }
} }
Metric::Celcius => PrefixedUnit(1.0, "°C"), Metric::Celsius => PrefixedUnit(1.0, "°C"),
Metric::SquareMetre => { Metric::SquareMetre => {
if absolute >= 1000.0 * 1000.0 { if absolute >= 1000.0 * 1000.0 {
return PrefixedUnit(1000.0 * 1000.0, "km²"); return PrefixedUnit(1000.0 * 1000.0, "km²");
@ -132,7 +132,7 @@ mod test {
assert_eq!("1 000 °C", &format(MetricQuantity { assert_eq!("1 000 °C", &format(MetricQuantity {
amount: 1_000.0, amount: 1_000.0,
unit: Metric::Celcius, unit: Metric::Celsius,
})); }));
} }
@ -259,18 +259,18 @@ mod test {
} }
#[test] #[test]
fn celcius() { fn celsius() {
assert_eq!(PrefixedUnit(1.0, "°C"), prefixed_unit(MetricQuantity { assert_eq!(PrefixedUnit(1.0, "°C"), prefixed_unit(MetricQuantity {
amount: 0.0001, amount: 0.0001,
unit: Metric::Celcius, unit: Metric::Celsius,
})); }));
assert_eq!(PrefixedUnit(1.0, "°C"), prefixed_unit(MetricQuantity { assert_eq!(PrefixedUnit(1.0, "°C"), prefixed_unit(MetricQuantity {
amount: -1.0, amount: -1.0,
unit: Metric::Celcius, unit: Metric::Celsius,
})); }));
assert_eq!(PrefixedUnit(1.0, "°C"), prefixed_unit(MetricQuantity { assert_eq!(PrefixedUnit(1.0, "°C"), prefixed_unit(MetricQuantity {
amount: 1_000.0, amount: 1_000.0,
unit: Metric::Celcius, unit: Metric::Celsius,
})); }));
} }

View File

@ -2,7 +2,7 @@
pub enum Metric { pub enum Metric {
Metre, Metre,
Gram, Gram,
Celcius, Celsius,
SquareMetre, SquareMetre,
} }