diff --git a/Common/UnitDefinitions/VolumePerLength.json b/Common/UnitDefinitions/VolumePerLength.json index 5090700bbc..5818df9069 100644 --- a/Common/UnitDefinitions/VolumePerLength.json +++ b/Common/UnitDefinitions/VolumePerLength.json @@ -50,6 +50,30 @@ "Abbreviations": [ "bbl/ft" ] } ] + }, + { + "SingularName": "CubicYardPerFoot", + "PluralName": "CubicYardsPerFoot", + "FromUnitToBaseFunc": "x*2.50838208", + "FromBaseToUnitFunc": "x/2.50838208", + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "yd³/ft" ] + } + ] + }, + { + "SingularName": "CubicYardPerUsSurveyFoot", + "PluralName": "CubicYardsPerUsSurveyFoot", + "FromUnitToBaseFunc": "x*2.50837706323584", + "FromBaseToUnitFunc": "x/2.50837706323584", + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "yd³/ftUS" ] + } + ] } ] } diff --git a/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs b/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs index 8be2e9cfed..323889d02f 100644 --- a/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs +++ b/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs @@ -32,5 +32,9 @@ public class VolumePerLengthTests : VolumePerLengthTestsBase protected override double LitersPerMeterInOneCubicMeterPerMeter => 1000; protected override double OilBarrelsPerFootInOneCubicMeterPerMeter => 1.917134088; + + protected override double CubicYardsPerFootInOneCubicMeterPerMeter => 0.3986633487670267521605; + + protected override double CubicYardsPerUsSurveyFootInOneCubicMeterPerMeter => 0.3986641460953189427984; } } diff --git a/UnitsNet.Tests/GeneratedCode/VolumePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumePerLengthTestsBase.g.cs index e28c1081d4..292f0d45ad 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumePerLengthTestsBase.g.cs @@ -35,11 +35,15 @@ namespace UnitsNet.Tests public abstract partial class VolumePerLengthTestsBase { protected abstract double CubicMetersPerMeterInOneCubicMeterPerMeter { get; } + protected abstract double CubicYardsPerFootInOneCubicMeterPerMeter { get; } + protected abstract double CubicYardsPerUsSurveyFootInOneCubicMeterPerMeter { get; } protected abstract double LitersPerMeterInOneCubicMeterPerMeter { get; } protected abstract double OilBarrelsPerFootInOneCubicMeterPerMeter { get; } // ReSharper disable VirtualMemberNeverOverriden.Global protected virtual double CubicMetersPerMeterTolerance { get { return 1e-5; } } + protected virtual double CubicYardsPerFootTolerance { get { return 1e-5; } } + protected virtual double CubicYardsPerUsSurveyFootTolerance { get { return 1e-5; } } protected virtual double LitersPerMeterTolerance { get { return 1e-5; } } protected virtual double OilBarrelsPerFootTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global @@ -68,6 +72,8 @@ public void CubicMeterPerMeterToVolumePerLengthUnits() { VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); AssertEx.EqualTolerance(CubicMetersPerMeterInOneCubicMeterPerMeter, cubicmeterpermeter.CubicMetersPerMeter, CubicMetersPerMeterTolerance); + AssertEx.EqualTolerance(CubicYardsPerFootInOneCubicMeterPerMeter, cubicmeterpermeter.CubicYardsPerFoot, CubicYardsPerFootTolerance); + AssertEx.EqualTolerance(CubicYardsPerUsSurveyFootInOneCubicMeterPerMeter, cubicmeterpermeter.CubicYardsPerUsSurveyFoot, CubicYardsPerUsSurveyFootTolerance); AssertEx.EqualTolerance(LitersPerMeterInOneCubicMeterPerMeter, cubicmeterpermeter.LitersPerMeter, LitersPerMeterTolerance); AssertEx.EqualTolerance(OilBarrelsPerFootInOneCubicMeterPerMeter, cubicmeterpermeter.OilBarrelsPerFoot, OilBarrelsPerFootTolerance); } @@ -76,6 +82,8 @@ public void CubicMeterPerMeterToVolumePerLengthUnits() public void FromValueAndUnit() { AssertEx.EqualTolerance(1, VolumePerLength.From(1, VolumePerLengthUnit.CubicMeterPerMeter).CubicMetersPerMeter, CubicMetersPerMeterTolerance); + AssertEx.EqualTolerance(1, VolumePerLength.From(1, VolumePerLengthUnit.CubicYardPerFoot).CubicYardsPerFoot, CubicYardsPerFootTolerance); + AssertEx.EqualTolerance(1, VolumePerLength.From(1, VolumePerLengthUnit.CubicYardPerUsSurveyFoot).CubicYardsPerUsSurveyFoot, CubicYardsPerUsSurveyFootTolerance); AssertEx.EqualTolerance(1, VolumePerLength.From(1, VolumePerLengthUnit.LiterPerMeter).LitersPerMeter, LitersPerMeterTolerance); AssertEx.EqualTolerance(1, VolumePerLength.From(1, VolumePerLengthUnit.OilBarrelPerFoot).OilBarrelsPerFoot, OilBarrelsPerFootTolerance); } @@ -98,6 +106,8 @@ public void As() { var cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); AssertEx.EqualTolerance(CubicMetersPerMeterInOneCubicMeterPerMeter, cubicmeterpermeter.As(VolumePerLengthUnit.CubicMeterPerMeter), CubicMetersPerMeterTolerance); + AssertEx.EqualTolerance(CubicYardsPerFootInOneCubicMeterPerMeter, cubicmeterpermeter.As(VolumePerLengthUnit.CubicYardPerFoot), CubicYardsPerFootTolerance); + AssertEx.EqualTolerance(CubicYardsPerUsSurveyFootInOneCubicMeterPerMeter, cubicmeterpermeter.As(VolumePerLengthUnit.CubicYardPerUsSurveyFoot), CubicYardsPerUsSurveyFootTolerance); AssertEx.EqualTolerance(LitersPerMeterInOneCubicMeterPerMeter, cubicmeterpermeter.As(VolumePerLengthUnit.LiterPerMeter), LitersPerMeterTolerance); AssertEx.EqualTolerance(OilBarrelsPerFootInOneCubicMeterPerMeter, cubicmeterpermeter.As(VolumePerLengthUnit.OilBarrelPerFoot), OilBarrelsPerFootTolerance); } @@ -111,6 +121,14 @@ public void ToUnit() AssertEx.EqualTolerance(CubicMetersPerMeterInOneCubicMeterPerMeter, (double)cubicmeterpermeterQuantity.Value, CubicMetersPerMeterTolerance); Assert.Equal(VolumePerLengthUnit.CubicMeterPerMeter, cubicmeterpermeterQuantity.Unit); + var cubicyardperfootQuantity = cubicmeterpermeter.ToUnit(VolumePerLengthUnit.CubicYardPerFoot); + AssertEx.EqualTolerance(CubicYardsPerFootInOneCubicMeterPerMeter, (double)cubicyardperfootQuantity.Value, CubicYardsPerFootTolerance); + Assert.Equal(VolumePerLengthUnit.CubicYardPerFoot, cubicyardperfootQuantity.Unit); + + var cubicyardperussurveyfootQuantity = cubicmeterpermeter.ToUnit(VolumePerLengthUnit.CubicYardPerUsSurveyFoot); + AssertEx.EqualTolerance(CubicYardsPerUsSurveyFootInOneCubicMeterPerMeter, (double)cubicyardperussurveyfootQuantity.Value, CubicYardsPerUsSurveyFootTolerance); + Assert.Equal(VolumePerLengthUnit.CubicYardPerUsSurveyFoot, cubicyardperussurveyfootQuantity.Unit); + var literpermeterQuantity = cubicmeterpermeter.ToUnit(VolumePerLengthUnit.LiterPerMeter); AssertEx.EqualTolerance(LitersPerMeterInOneCubicMeterPerMeter, (double)literpermeterQuantity.Value, LitersPerMeterTolerance); Assert.Equal(VolumePerLengthUnit.LiterPerMeter, literpermeterQuantity.Unit); @@ -125,6 +143,8 @@ public void ConversionRoundTrip() { VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); AssertEx.EqualTolerance(1, VolumePerLength.FromCubicMetersPerMeter(cubicmeterpermeter.CubicMetersPerMeter).CubicMetersPerMeter, CubicMetersPerMeterTolerance); + AssertEx.EqualTolerance(1, VolumePerLength.FromCubicYardsPerFoot(cubicmeterpermeter.CubicYardsPerFoot).CubicMetersPerMeter, CubicYardsPerFootTolerance); + AssertEx.EqualTolerance(1, VolumePerLength.FromCubicYardsPerUsSurveyFoot(cubicmeterpermeter.CubicYardsPerUsSurveyFoot).CubicMetersPerMeter, CubicYardsPerUsSurveyFootTolerance); AssertEx.EqualTolerance(1, VolumePerLength.FromLitersPerMeter(cubicmeterpermeter.LitersPerMeter).CubicMetersPerMeter, LitersPerMeterTolerance); AssertEx.EqualTolerance(1, VolumePerLength.FromOilBarrelsPerFoot(cubicmeterpermeter.OilBarrelsPerFoot).CubicMetersPerMeter, OilBarrelsPerFootTolerance); } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumePerLength.g.cs index c87f6d5cc5..fa5dd927ab 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -160,6 +160,16 @@ private VolumePerLength(double value, VolumePerLengthUnit unit) /// public double CubicMetersPerMeter => As(VolumePerLengthUnit.CubicMeterPerMeter); + /// + /// Get VolumePerLength in CubicYardsPerFoot. + /// + public double CubicYardsPerFoot => As(VolumePerLengthUnit.CubicYardPerFoot); + + /// + /// Get VolumePerLength in CubicYardsPerUsSurveyFoot. + /// + public double CubicYardsPerUsSurveyFoot => As(VolumePerLengthUnit.CubicYardPerUsSurveyFoot); + /// /// Get VolumePerLength in LitersPerMeter. /// @@ -211,6 +221,26 @@ public static VolumePerLength FromCubicMetersPerMeter(double cubicmeterspermeter return new VolumePerLength(value, VolumePerLengthUnit.CubicMeterPerMeter); } /// + /// Get VolumePerLength from CubicYardsPerFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumePerLength FromCubicYardsPerFoot(double cubicyardsperfoot) + { + double value = (double) cubicyardsperfoot; + return new VolumePerLength(value, VolumePerLengthUnit.CubicYardPerFoot); + } + /// + /// Get VolumePerLength from CubicYardsPerUsSurveyFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumePerLength FromCubicYardsPerUsSurveyFoot(double cubicyardsperussurveyfoot) + { + double value = (double) cubicyardsperussurveyfoot; + return new VolumePerLength(value, VolumePerLengthUnit.CubicYardPerUsSurveyFoot); + } + /// /// Get VolumePerLength from LitersPerMeter. /// /// If value is NaN or Infinity. @@ -522,6 +552,8 @@ private double AsBaseUnit() switch(Unit) { case VolumePerLengthUnit.CubicMeterPerMeter: return _value; + case VolumePerLengthUnit.CubicYardPerFoot: return _value*2.50838208; + case VolumePerLengthUnit.CubicYardPerUsSurveyFoot: return _value*2.50837706323584; case VolumePerLengthUnit.LiterPerMeter: return _value/1000; case VolumePerLengthUnit.OilBarrelPerFoot: return _value/1.91713408; default: @@ -539,6 +571,8 @@ private double AsBaseNumericType(VolumePerLengthUnit unit) switch(unit) { case VolumePerLengthUnit.CubicMeterPerMeter: return baseUnitValue; + case VolumePerLengthUnit.CubicYardPerFoot: return baseUnitValue/2.50838208; + case VolumePerLengthUnit.CubicYardPerUsSurveyFoot: return baseUnitValue/2.50837706323584; case VolumePerLengthUnit.LiterPerMeter: return baseUnitValue*1000; case VolumePerLengthUnit.OilBarrelPerFoot: return baseUnitValue*1.91713408; default: diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs index b50be2ff87..9057ee16e6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -1319,6 +1319,8 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.UsGallonPerMinute, new string[]{"gal (U.S.)/min", "GPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.UsGallonPerSecond, new string[]{"gal (U.S.)/s"}), ("en-US", typeof(VolumePerLengthUnit), (int)VolumePerLengthUnit.CubicMeterPerMeter, new string[]{"m³/m"}), + ("en-US", typeof(VolumePerLengthUnit), (int)VolumePerLengthUnit.CubicYardPerFoot, new string[]{"yd³/ft"}), + ("en-US", typeof(VolumePerLengthUnit), (int)VolumePerLengthUnit.CubicYardPerUsSurveyFoot, new string[]{"yd³/ftUS"}), ("en-US", typeof(VolumePerLengthUnit), (int)VolumePerLengthUnit.LiterPerMeter, new string[]{"l/m"}), ("en-US", typeof(VolumePerLengthUnit), (int)VolumePerLengthUnit.OilBarrelPerFoot, new string[]{"bbl/ft"}), }; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Units/VolumePerLengthUnit.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Units/VolumePerLengthUnit.g.cs index 0f1de7c933..07ad69d995 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Units/VolumePerLengthUnit.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Units/VolumePerLengthUnit.g.cs @@ -27,6 +27,8 @@ public enum VolumePerLengthUnit { Undefined = 0, CubicMeterPerMeter, + CubicYardPerFoot, + CubicYardPerUsSurveyFoot, LiterPerMeter, OilBarrelPerFoot, } diff --git a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs index f172de4651..d7f5fcb059 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -51,6 +51,8 @@ static VolumePerLength() Info = new QuantityInfo(QuantityType.VolumePerLength, new UnitInfo[] { new UnitInfo(VolumePerLengthUnit.CubicMeterPerMeter, new BaseUnits(length: LengthUnit.Meter)), + new UnitInfo(VolumePerLengthUnit.CubicYardPerFoot, BaseUnits.Undefined), + new UnitInfo(VolumePerLengthUnit.CubicYardPerUsSurveyFoot, BaseUnits.Undefined), new UnitInfo(VolumePerLengthUnit.LiterPerMeter, new BaseUnits(length: LengthUnit.Decimeter)), new UnitInfo(VolumePerLengthUnit.OilBarrelPerFoot, BaseUnits.Undefined), }, @@ -170,6 +172,16 @@ public VolumePerLength(double value, UnitSystem unitSystem) /// public double CubicMetersPerMeter => As(VolumePerLengthUnit.CubicMeterPerMeter); + /// + /// Get VolumePerLength in CubicYardsPerFoot. + /// + public double CubicYardsPerFoot => As(VolumePerLengthUnit.CubicYardPerFoot); + + /// + /// Get VolumePerLength in CubicYardsPerUsSurveyFoot. + /// + public double CubicYardsPerUsSurveyFoot => As(VolumePerLengthUnit.CubicYardPerUsSurveyFoot); + /// /// Get VolumePerLength in LitersPerMeter. /// @@ -219,6 +231,24 @@ public static VolumePerLength FromCubicMetersPerMeter(QuantityValue cubicmetersp return new VolumePerLength(value, VolumePerLengthUnit.CubicMeterPerMeter); } /// + /// Get VolumePerLength from CubicYardsPerFoot. + /// + /// If value is NaN or Infinity. + public static VolumePerLength FromCubicYardsPerFoot(QuantityValue cubicyardsperfoot) + { + double value = (double) cubicyardsperfoot; + return new VolumePerLength(value, VolumePerLengthUnit.CubicYardPerFoot); + } + /// + /// Get VolumePerLength from CubicYardsPerUsSurveyFoot. + /// + /// If value is NaN or Infinity. + public static VolumePerLength FromCubicYardsPerUsSurveyFoot(QuantityValue cubicyardsperussurveyfoot) + { + double value = (double) cubicyardsperussurveyfoot; + return new VolumePerLength(value, VolumePerLengthUnit.CubicYardPerUsSurveyFoot); + } + /// /// Get VolumePerLength from LitersPerMeter. /// /// If value is NaN or Infinity. @@ -666,6 +696,8 @@ private double GetValueInBaseUnit() switch(Unit) { case VolumePerLengthUnit.CubicMeterPerMeter: return _value; + case VolumePerLengthUnit.CubicYardPerFoot: return _value*2.50838208; + case VolumePerLengthUnit.CubicYardPerUsSurveyFoot: return _value*2.50837706323584; case VolumePerLengthUnit.LiterPerMeter: return _value/1000; case VolumePerLengthUnit.OilBarrelPerFoot: return _value/1.91713408; default: @@ -694,6 +726,8 @@ private double GetValueAs(VolumePerLengthUnit unit) switch(unit) { case VolumePerLengthUnit.CubicMeterPerMeter: return baseUnitValue; + case VolumePerLengthUnit.CubicYardPerFoot: return baseUnitValue/2.50838208; + case VolumePerLengthUnit.CubicYardPerUsSurveyFoot: return baseUnitValue/2.50837706323584; case VolumePerLengthUnit.LiterPerMeter: return baseUnitValue*1000; case VolumePerLengthUnit.OilBarrelPerFoot: return baseUnitValue*1.91713408; default: diff --git a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs index 738ce73bef..adde3764e4 100644 --- a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -1319,6 +1319,8 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.UsGallonPerMinute, new string[]{"gal (U.S.)/min", "GPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.UsGallonPerSecond, new string[]{"gal (U.S.)/s"}), ("en-US", typeof(VolumePerLengthUnit), (int)VolumePerLengthUnit.CubicMeterPerMeter, new string[]{"m³/m"}), + ("en-US", typeof(VolumePerLengthUnit), (int)VolumePerLengthUnit.CubicYardPerFoot, new string[]{"yd³/ft"}), + ("en-US", typeof(VolumePerLengthUnit), (int)VolumePerLengthUnit.CubicYardPerUsSurveyFoot, new string[]{"yd³/ftUS"}), ("en-US", typeof(VolumePerLengthUnit), (int)VolumePerLengthUnit.LiterPerMeter, new string[]{"l/m"}), ("en-US", typeof(VolumePerLengthUnit), (int)VolumePerLengthUnit.OilBarrelPerFoot, new string[]{"bbl/ft"}), }; diff --git a/UnitsNet/GeneratedCode/UnitConverter.g.cs b/UnitsNet/GeneratedCode/UnitConverter.g.cs index e9f11f9faa..7ad8267b87 100644 --- a/UnitsNet/GeneratedCode/UnitConverter.g.cs +++ b/UnitsNet/GeneratedCode/UnitConverter.g.cs @@ -2067,6 +2067,10 @@ public static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.UsGallonPerSecond, q => q.ToUnit(VolumeFlowUnit.UsGallonPerSecond)); unitConverter.SetConversionFunction(VolumeFlowUnit.UsGallonPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); unitConverter.SetConversionFunction(VolumePerLength.BaseUnit, VolumePerLength.BaseUnit, q => q); + unitConverter.SetConversionFunction(VolumePerLength.BaseUnit, VolumePerLengthUnit.CubicYardPerFoot, q => q.ToUnit(VolumePerLengthUnit.CubicYardPerFoot)); + unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicYardPerFoot, VolumePerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction(VolumePerLength.BaseUnit, VolumePerLengthUnit.CubicYardPerUsSurveyFoot, q => q.ToUnit(VolumePerLengthUnit.CubicYardPerUsSurveyFoot)); + unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicYardPerUsSurveyFoot, VolumePerLength.BaseUnit, q => q.ToBaseUnit()); unitConverter.SetConversionFunction(VolumePerLength.BaseUnit, VolumePerLengthUnit.LiterPerMeter, q => q.ToUnit(VolumePerLengthUnit.LiterPerMeter)); unitConverter.SetConversionFunction(VolumePerLengthUnit.LiterPerMeter, VolumePerLength.BaseUnit, q => q.ToBaseUnit()); unitConverter.SetConversionFunction(VolumePerLength.BaseUnit, VolumePerLengthUnit.OilBarrelPerFoot, q => q.ToUnit(VolumePerLengthUnit.OilBarrelPerFoot)); diff --git a/UnitsNet/GeneratedCode/Units/VolumePerLengthUnit.g.cs b/UnitsNet/GeneratedCode/Units/VolumePerLengthUnit.g.cs index 0f1de7c933..07ad69d995 100644 --- a/UnitsNet/GeneratedCode/Units/VolumePerLengthUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/VolumePerLengthUnit.g.cs @@ -27,6 +27,8 @@ public enum VolumePerLengthUnit { Undefined = 0, CubicMeterPerMeter, + CubicYardPerFoot, + CubicYardPerUsSurveyFoot, LiterPerMeter, OilBarrelPerFoot, }