Change terminology weight → mass
This commit is contained in:
parent
db674d1419
commit
4eb55ac7b8
4 changed files with 7 additions and 7 deletions
|
@ -48,7 +48,7 @@ fn get_conversion(unit: NonMetric) -> Conversion {
|
|||
from: inch_from,
|
||||
to: MetricQuantity { amount: 1760.0 * 3.0 * 12.0 * inch_to, unit: Metric::Metre },
|
||||
},
|
||||
// Weight
|
||||
// Mass
|
||||
NonMetric::Ounce => Conversion {
|
||||
offset: 0.0,
|
||||
from: 16.0 * pound_from,
|
||||
|
@ -189,7 +189,7 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn weight() {
|
||||
fn mass() {
|
||||
let tests = [
|
||||
Test(NonMetric::Ounce, 28.349523125),
|
||||
Test(NonMetric::Pound, 453.59237),
|
||||
|
|
|
@ -73,7 +73,7 @@ fn unit_to_name(unit: NonMetric) -> &'static str {
|
|||
NonMetric::Foot => "feet",
|
||||
NonMetric::Yard => "yards",
|
||||
NonMetric::Mile => "miles",
|
||||
// Weight
|
||||
// Mass
|
||||
NonMetric::Ounce => "ounces",
|
||||
NonMetric::Pound => "pounds",
|
||||
NonMetric::Stone => "stones",
|
||||
|
@ -127,7 +127,7 @@ mod test {
|
|||
assert_eq!(run("1 ft"), Ok("30.48 cm".to_string()));
|
||||
assert_eq!(run("1 yard"), Ok("91.44 cm".to_string()));
|
||||
assert_eq!(run("1 mile"), Ok("1.609 km".to_string()));
|
||||
// Weight
|
||||
// Mass
|
||||
assert_eq!(run("1 oz"), Ok("28.35 g".to_string()));
|
||||
assert_eq!(run("1 lb"), Ok("453.6 g".to_string()));
|
||||
assert_eq!(run("1 st"), Ok("6.35 kg".to_string()));
|
||||
|
|
|
@ -83,7 +83,7 @@ fn parse_unit(input: String) -> Result<NonMetric, ParseError> {
|
|||
"mi" => Ok(NonMetric::Mile),
|
||||
"m" => Ok(NonMetric::Mile),
|
||||
|
||||
// Weight
|
||||
// Mass
|
||||
"ounce" => Ok(NonMetric::Ounce),
|
||||
"ounces" => Ok(NonMetric::Ounce),
|
||||
"oz" => Ok(NonMetric::Ounce),
|
||||
|
@ -459,7 +459,7 @@ mod test {
|
|||
"m",
|
||||
]);
|
||||
|
||||
// Weight
|
||||
// Mass
|
||||
test_units(NonMetric::Ounce, &[
|
||||
"ounce",
|
||||
"ounces",
|
||||
|
|
|
@ -15,7 +15,7 @@ pub enum NonMetric {
|
|||
Foot,
|
||||
Yard,
|
||||
Mile,
|
||||
// Weight
|
||||
// Mass
|
||||
Ounce,
|
||||
Pound,
|
||||
Stone,
|
||||
|
|
Loading…
Reference in a new issue