diff --git a/src/lexer.rs b/src/lexer.rs index 525bf42..301dfd4 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -277,6 +277,7 @@ pub fn lex(input: &str, allow_trailing_operators: bool, default_degree: Unit) -> } } }, + "stone" | "stones" => tokens.push(Token::Unit(Stone)), "st" | "ton" | "tons" | "short ton" | "short tons" | "short tonne" | "short tonnes" => tokens.push(Token::Unit(ShortTon)), "lt" | "long ton" | "long tons" | "long tonne" | "long tonnes" => tokens.push(Token::Unit(LongTon)), diff --git a/src/units.rs b/src/units.rs index 2cfec98..9c81561 100644 --- a/src/units.rs +++ b/src/units.rs @@ -148,6 +148,7 @@ create_units!( MetricTon: (Mass, d128!(1000000)), Ounce: (Mass, d128!(28.349523125)), Pound: (Mass, d128!(453.59237)), + Stone: (Mass, d128!(6350.29318)), ShortTon: (Mass, d128!(907184.74)), LongTon: (Mass, d128!(1016046.9088)), @@ -769,6 +770,7 @@ mod tests { assert_eq!(convert_test(1000.0, Kilogram, MetricTon), 1.0); assert_eq!(convert_test(0.45359237, Kilogram, Pound), 1.0); assert_eq!(convert_test(16.0, Ounce, Pound), 1.0); + assert_eq!(convert_test(14.0, Pound, Stone), 1.0); assert_eq!(convert_test(2000.0, Pound, ShortTon), 1.0); assert_eq!(convert_test(2240.0, Pound, LongTon), 1.0);