diff --git a/CaliperSharp/Prefix.cs b/CaliperSharp/Prefix.cs index 2ee2d51..dd438ca 100644 --- a/CaliperSharp/Prefix.cs +++ b/CaliperSharp/Prefix.cs @@ -41,7 +41,7 @@ public class Prefix /// SI prefix 10^18 public static readonly Prefix EXA = new Prefix("exa", "E", 1.0E+18); /// SI prefix 10^15 - public static readonly Prefix PETA = new Prefix("petta", "P", 1.0E+15); + public static readonly Prefix PETA = new Prefix("peta", "P", 1.0E+15); /// SI prefix 10^12 public static readonly Prefix TERA = new Prefix("tera", "T", 1.0E+12); /// SI prefix 10^9 diff --git a/CaliperSharpTests/TestBridges.cs b/CaliperSharpTests/TestBridges.cs index 74f82f2..dd1d322 100644 --- a/CaliperSharpTests/TestBridges.cs +++ b/CaliperSharpTests/TestBridges.cs @@ -221,5 +221,21 @@ public void TestBridgeUnits2() } } + + [TestMethod] + public void TestBridgeUnits3() + { + UnitOfMeasure uomGrams = sys.GetUOM(Unit.GRAM); + UnitOfMeasure uomTonnes = sys.GetUOM(Unit.TONNE); + UnitOfMeasure uomShortTons = sys.GetUOM(Unit.US_TON); + UnitOfMeasure uomTroyOz = sys.GetUOM(Unit.TROY_OUNCE); + UnitOfMeasure uomPennyweight = sys.CreateScalarUOM(UnitType.MASS, "pennyweight", "dwt", "Pennyweight"); + uomPennyweight.SetConversion(0.05, uomTroyOz); + UnitOfMeasure uomGramsPerTonne = sys.CreateQuotientUOM(uomGrams, uomTonnes); + UnitOfMeasure uomPennyweightPerShortTon = sys.CreateQuotientUOM(uomPennyweight, uomShortTons); + Quantity grade = new Quantity(0.95, uomGramsPerTonne); + Quantity converted = grade.Convert(uomPennyweightPerShortTon); + Assert.IsTrue(IsCloseTo(converted.Amount, 0.554167, DELTA6)); + } } }