From 395c5223f3fcffe6e3ab8655d4dc13737d3ea316 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Papp=20Tam=C3=A1s?=
<22793739+t03apt@users.noreply.github.com>
Date: Mon, 13 Mar 2023 16:07:32 +0100
Subject: [PATCH 1/8] add: UsGallonsPerMile
---
Common/UnitDefinitions/VolumePerLength.json | 12 ++++++
Common/UnitEnumValues.g.json | 3 +-
.../Quantities/VolumePerLength.g.cs | 13 +++++++
.../Units/VolumePerLengthUnit.g.cs | 1 +
...NumberToVolumePerLengthExtensionsTest.g.cs | 4 ++
.../NumberToVolumePerLengthExtensions.g.cs | 4 ++
.../CustomCode/VolumePerLengthTests.cs | 2 +
.../GeneratedCode/IQuantityTests.g.cs | 2 +-
.../TestsBase/VolumePerLengthTestsBase.g.cs | 37 +++++++++++++++++++
.../Quantities/VolumePerLength.g.cs | 21 +++++++++++
.../Units/VolumePerLengthUnit.g.cs | 1 +
11 files changed, 98 insertions(+), 2 deletions(-)
diff --git a/Common/UnitDefinitions/VolumePerLength.json b/Common/UnitDefinitions/VolumePerLength.json
index 2d4690e730..9e9f6a02a7 100644
--- a/Common/UnitDefinitions/VolumePerLength.json
+++ b/Common/UnitDefinitions/VolumePerLength.json
@@ -100,6 +100,18 @@
"Abbreviations": [ "yd³/ftUS" ]
}
]
+ },
+ {
+ "SingularName": "UsGallonPerMile",
+ "PluralName": "UsGallonsPerMile",
+ "FromUnitToBaseFunc": "{x} / 4.251439077933434e5",
+ "FromBaseToUnitFunc": "{x} * 4.251439077933434e5",
+ "Localization": [
+ {
+ "Culture": "en-US",
+ "Abbreviations": [ "gal (U.S.)/mi" ]
+ }
+ ]
}
]
}
diff --git a/Common/UnitEnumValues.g.json b/Common/UnitEnumValues.g.json
index 6aabb654ac..b520cfd09c 100644
--- a/Common/UnitEnumValues.g.json
+++ b/Common/UnitEnumValues.g.json
@@ -1657,7 +1657,8 @@
"LiterPerKilometer": 4,
"LiterPerMeter": 5,
"LiterPerMillimeter": 6,
- "OilBarrelPerFoot": 7
+ "OilBarrelPerFoot": 7,
+ "UsGallonPerMile": 8
},
"VolumetricHeatCapacity": {
"BtuPerCubicFootDegreeFahrenheit": 1,
diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumePerLength.g.cs
index 4d202492b0..32834376ef 100644
--- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumePerLength.g.cs
+++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumePerLength.g.cs
@@ -114,6 +114,11 @@ public VolumePerLength(double value, VolumePerLengthUnit unit)
///
public double OilBarrelsPerFoot => As(VolumePerLengthUnit.OilBarrelPerFoot);
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double UsGallonsPerMile => As(VolumePerLengthUnit.UsGallonPerMile);
+
#endregion
#region Static Factory Methods
@@ -160,6 +165,12 @@ public VolumePerLength(double value, VolumePerLengthUnit unit)
/// If value is NaN or Infinity.
public static VolumePerLength FromOilBarrelsPerFoot(double oilbarrelsperfoot) => new VolumePerLength(oilbarrelsperfoot, VolumePerLengthUnit.OilBarrelPerFoot);
+ ///
+ /// Creates a from .
+ ///
+ /// If value is NaN or Infinity.
+ public static VolumePerLength FromUsGallonsPerMile(double usgallonspermile) => new VolumePerLength(usgallonspermile, VolumePerLengthUnit.UsGallonPerMile);
+
///
/// Dynamically convert from value and unit enum to .
///
@@ -207,6 +218,7 @@ private double GetValueInBaseUnit()
VolumePerLengthUnit.LiterPerMeter => _value / 1000,
VolumePerLengthUnit.LiterPerMillimeter => _value,
VolumePerLengthUnit.OilBarrelPerFoot => _value / 1.91713408,
+ VolumePerLengthUnit.UsGallonPerMile => _value / 4.251439077933434e5,
_ => throw new NotImplementedException($"Can not convert {Unit} to base units.")
};
}
@@ -227,6 +239,7 @@ private double GetValueAs(VolumePerLengthUnit unit)
VolumePerLengthUnit.LiterPerMeter => baseUnitValue * 1000,
VolumePerLengthUnit.LiterPerMillimeter => baseUnitValue,
VolumePerLengthUnit.OilBarrelPerFoot => baseUnitValue * 1.91713408,
+ VolumePerLengthUnit.UsGallonPerMile => baseUnitValue * 4.251439077933434e5,
_ => throw new NotImplementedException($"Can not convert {Unit} to {unit}.")
};
}
diff --git a/UnitsNet.NanoFramework/GeneratedCode/Units/VolumePerLengthUnit.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Units/VolumePerLengthUnit.g.cs
index 73b3ab5b35..6a5aa99334 100644
--- a/UnitsNet.NanoFramework/GeneratedCode/Units/VolumePerLengthUnit.g.cs
+++ b/UnitsNet.NanoFramework/GeneratedCode/Units/VolumePerLengthUnit.g.cs
@@ -32,6 +32,7 @@ public enum VolumePerLengthUnit
LiterPerMeter = 5,
LiterPerMillimeter = 6,
OilBarrelPerFoot = 7,
+ UsGallonPerMile = 8,
}
#pragma warning restore 1591
diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumePerLengthExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumePerLengthExtensionsTest.g.cs
index 1e10aa3c44..ba2f3285f0 100644
--- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumePerLengthExtensionsTest.g.cs
+++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumePerLengthExtensionsTest.g.cs
@@ -52,5 +52,9 @@ public void NumberToLitersPerMillimeterTest() =>
public void NumberToOilBarrelsPerFootTest() =>
Assert.Equal(VolumePerLength.FromOilBarrelsPerFoot(2), 2.OilBarrelsPerFoot());
+ [Fact]
+ public void NumberToUsGallonsPerMileTest() =>
+ Assert.Equal(VolumePerLength.FromUsGallonsPerMile(2), 2.UsGallonsPerMile());
+
}
}
diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumePerLengthExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumePerLengthExtensions.g.cs
index eff61d751d..9628b885c7 100644
--- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumePerLengthExtensions.g.cs
+++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumePerLengthExtensions.g.cs
@@ -56,5 +56,9 @@ public static VolumePerLength LitersPerMillimeter(this T value) =>
public static VolumePerLength OilBarrelsPerFoot(this T value) =>
VolumePerLength.FromOilBarrelsPerFoot(Convert.ToDouble(value));
+ ///
+ public static VolumePerLength UsGallonsPerMile(this T value) =>
+ VolumePerLength.FromUsGallonsPerMile(Convert.ToDouble(value));
+
}
}
diff --git a/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs b/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs
index 6379c4ac9c..661d3bf376 100644
--- a/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs
+++ b/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs
@@ -40,5 +40,7 @@ public class VolumePerLengthTests : VolumePerLengthTestsBase
protected override double LitersPerKilometerInOneCubicMeterPerMeter => 1E6;
protected override double LitersPerMillimeterInOneCubicMeterPerMeter => 1;
+
+ protected override double UsGallonsPerMileInOneCubicMeterPerMeter => 4.251439077933434e5;
}
}
diff --git a/UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs b/UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs
index 7615954ee6..85a7ca739d 100644
--- a/UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs
@@ -150,7 +150,7 @@ void Assertion(int expectedValue, Enum expectedUnit, IQuantity quantity)
Assertion(3, VolumeConcentrationUnit.PicolitersPerMililiter, Quantity.From(3, VolumeConcentrationUnit.PicolitersPerMililiter));
Assertion(3, VolumeFlowUnit.UsGallonPerSecond, Quantity.From(3, VolumeFlowUnit.UsGallonPerSecond));
Assertion(3, VolumeFlowPerAreaUnit.CubicMeterPerSecondPerSquareMeter, Quantity.From(3, VolumeFlowPerAreaUnit.CubicMeterPerSecondPerSquareMeter));
- Assertion(3, VolumePerLengthUnit.OilBarrelPerFoot, Quantity.From(3, VolumePerLengthUnit.OilBarrelPerFoot));
+ Assertion(3, VolumePerLengthUnit.UsGallonPerMile, Quantity.From(3, VolumePerLengthUnit.UsGallonPerMile));
Assertion(3, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin, Quantity.From(3, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin));
Assertion(3, WarpingMomentOfInertiaUnit.MillimeterToTheSixth, Quantity.From(3, WarpingMomentOfInertiaUnit.MillimeterToTheSixth));
}
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs
index 0754d4eb89..6b98d1ebfe 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs
@@ -45,6 +45,7 @@ public abstract partial class VolumePerLengthTestsBase : QuantityTestsBase
protected abstract double LitersPerMeterInOneCubicMeterPerMeter { get; }
protected abstract double LitersPerMillimeterInOneCubicMeterPerMeter { get; }
protected abstract double OilBarrelsPerFootInOneCubicMeterPerMeter { get; }
+ protected abstract double UsGallonsPerMileInOneCubicMeterPerMeter { get; }
// ReSharper disable VirtualMemberNeverOverriden.Global
protected virtual double CubicMetersPerMeterTolerance { get { return 1e-5; } }
@@ -54,6 +55,7 @@ public abstract partial class VolumePerLengthTestsBase : QuantityTestsBase
protected virtual double LitersPerMeterTolerance { get { return 1e-5; } }
protected virtual double LitersPerMillimeterTolerance { get { return 1e-5; } }
protected virtual double OilBarrelsPerFootTolerance { get { return 1e-5; } }
+ protected virtual double UsGallonsPerMileTolerance { get { return 1e-5; } }
// ReSharper restore VirtualMemberNeverOverriden.Global
protected (double UnitsInBaseUnit, double Tolerence) GetConversionFactor(VolumePerLengthUnit unit)
@@ -67,6 +69,7 @@ public abstract partial class VolumePerLengthTestsBase : QuantityTestsBase
VolumePerLengthUnit.LiterPerMeter => (LitersPerMeterInOneCubicMeterPerMeter, LitersPerMeterTolerance),
VolumePerLengthUnit.LiterPerMillimeter => (LitersPerMillimeterInOneCubicMeterPerMeter, LitersPerMillimeterTolerance),
VolumePerLengthUnit.OilBarrelPerFoot => (OilBarrelsPerFootInOneCubicMeterPerMeter, OilBarrelsPerFootTolerance),
+ VolumePerLengthUnit.UsGallonPerMile => (UsGallonsPerMileInOneCubicMeterPerMeter, UsGallonsPerMileTolerance),
_ => throw new NotSupportedException()
};
}
@@ -80,6 +83,7 @@ public abstract partial class VolumePerLengthTestsBase : QuantityTestsBase
new object[] { VolumePerLengthUnit.LiterPerMeter },
new object[] { VolumePerLengthUnit.LiterPerMillimeter },
new object[] { VolumePerLengthUnit.OilBarrelPerFoot },
+ new object[] { VolumePerLengthUnit.UsGallonPerMile },
};
[Fact]
@@ -149,6 +153,7 @@ public void CubicMeterPerMeterToVolumePerLengthUnits()
AssertEx.EqualTolerance(LitersPerMeterInOneCubicMeterPerMeter, cubicmeterpermeter.LitersPerMeter, LitersPerMeterTolerance);
AssertEx.EqualTolerance(LitersPerMillimeterInOneCubicMeterPerMeter, cubicmeterpermeter.LitersPerMillimeter, LitersPerMillimeterTolerance);
AssertEx.EqualTolerance(OilBarrelsPerFootInOneCubicMeterPerMeter, cubicmeterpermeter.OilBarrelsPerFoot, OilBarrelsPerFootTolerance);
+ AssertEx.EqualTolerance(UsGallonsPerMileInOneCubicMeterPerMeter, cubicmeterpermeter.UsGallonsPerMile, UsGallonsPerMileTolerance);
}
[Fact]
@@ -182,6 +187,10 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit()
AssertEx.EqualTolerance(1, quantity06.OilBarrelsPerFoot, OilBarrelsPerFootTolerance);
Assert.Equal(VolumePerLengthUnit.OilBarrelPerFoot, quantity06.Unit);
+ var quantity07 = VolumePerLength.From(1, VolumePerLengthUnit.UsGallonPerMile);
+ AssertEx.EqualTolerance(1, quantity07.UsGallonsPerMile, UsGallonsPerMileTolerance);
+ Assert.Equal(VolumePerLengthUnit.UsGallonPerMile, quantity07.Unit);
+
}
[Fact]
@@ -208,6 +217,7 @@ public void As()
AssertEx.EqualTolerance(LitersPerMeterInOneCubicMeterPerMeter, cubicmeterpermeter.As(VolumePerLengthUnit.LiterPerMeter), LitersPerMeterTolerance);
AssertEx.EqualTolerance(LitersPerMillimeterInOneCubicMeterPerMeter, cubicmeterpermeter.As(VolumePerLengthUnit.LiterPerMillimeter), LitersPerMillimeterTolerance);
AssertEx.EqualTolerance(OilBarrelsPerFootInOneCubicMeterPerMeter, cubicmeterpermeter.As(VolumePerLengthUnit.OilBarrelPerFoot), OilBarrelsPerFootTolerance);
+ AssertEx.EqualTolerance(UsGallonsPerMileInOneCubicMeterPerMeter, cubicmeterpermeter.As(VolumePerLengthUnit.UsGallonPerMile), UsGallonsPerMileTolerance);
}
[Fact]
@@ -279,6 +289,13 @@ public void Parse()
Assert.Equal(VolumePerLengthUnit.OilBarrelPerFoot, parsed.Unit);
} catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+ try
+ {
+ var parsed = VolumePerLength.Parse("1 gal (U.S.)/mi", CultureInfo.GetCultureInfo("en-US"));
+ AssertEx.EqualTolerance(1, parsed.UsGallonsPerMile, UsGallonsPerMileTolerance);
+ Assert.Equal(VolumePerLengthUnit.UsGallonPerMile, parsed.Unit);
+ } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+
}
[Fact]
@@ -326,6 +343,12 @@ public void TryParse()
Assert.Equal(VolumePerLengthUnit.OilBarrelPerFoot, parsed.Unit);
}
+ {
+ Assert.True(VolumePerLength.TryParse("1 gal (U.S.)/mi", CultureInfo.GetCultureInfo("en-US"), out var parsed));
+ AssertEx.EqualTolerance(1, parsed.UsGallonsPerMile, UsGallonsPerMileTolerance);
+ Assert.Equal(VolumePerLengthUnit.UsGallonPerMile, parsed.Unit);
+ }
+
}
[Fact]
@@ -373,6 +396,12 @@ public void ParseUnit()
Assert.Equal(VolumePerLengthUnit.OilBarrelPerFoot, parsedUnit);
} catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+ try
+ {
+ var parsedUnit = VolumePerLength.ParseUnit("gal (U.S.)/mi", CultureInfo.GetCultureInfo("en-US"));
+ Assert.Equal(VolumePerLengthUnit.UsGallonPerMile, parsedUnit);
+ } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+
}
[Fact]
@@ -413,6 +442,11 @@ public void TryParseUnit()
Assert.Equal(VolumePerLengthUnit.OilBarrelPerFoot, parsedUnit);
}
+ {
+ Assert.True(VolumePerLength.TryParseUnit("gal (U.S.)/mi", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit));
+ Assert.Equal(VolumePerLengthUnit.UsGallonPerMile, parsedUnit);
+ }
+
}
[Theory]
@@ -468,6 +502,7 @@ public void ConversionRoundTrip()
AssertEx.EqualTolerance(1, VolumePerLength.FromLitersPerMeter(cubicmeterpermeter.LitersPerMeter).CubicMetersPerMeter, LitersPerMeterTolerance);
AssertEx.EqualTolerance(1, VolumePerLength.FromLitersPerMillimeter(cubicmeterpermeter.LitersPerMillimeter).CubicMetersPerMeter, LitersPerMillimeterTolerance);
AssertEx.EqualTolerance(1, VolumePerLength.FromOilBarrelsPerFoot(cubicmeterpermeter.OilBarrelsPerFoot).CubicMetersPerMeter, OilBarrelsPerFootTolerance);
+ AssertEx.EqualTolerance(1, VolumePerLength.FromUsGallonsPerMile(cubicmeterpermeter.UsGallonsPerMile).CubicMetersPerMeter, UsGallonsPerMileTolerance);
}
[Fact]
@@ -622,6 +657,7 @@ public void ToString_ReturnsValueAndUnitAbbreviationInCurrentCulture()
Assert.Equal("1 l/m", new VolumePerLength(1, VolumePerLengthUnit.LiterPerMeter).ToString());
Assert.Equal("1 l/mm", new VolumePerLength(1, VolumePerLengthUnit.LiterPerMillimeter).ToString());
Assert.Equal("1 bbl/ft", new VolumePerLength(1, VolumePerLengthUnit.OilBarrelPerFoot).ToString());
+ Assert.Equal("1 gal (U.S.)/mi", new VolumePerLength(1, VolumePerLengthUnit.UsGallonPerMile).ToString());
}
finally
{
@@ -642,6 +678,7 @@ public void ToString_WithSwedishCulture_ReturnsUnitAbbreviationForEnglishCulture
Assert.Equal("1 l/m", new VolumePerLength(1, VolumePerLengthUnit.LiterPerMeter).ToString(swedishCulture));
Assert.Equal("1 l/mm", new VolumePerLength(1, VolumePerLengthUnit.LiterPerMillimeter).ToString(swedishCulture));
Assert.Equal("1 bbl/ft", new VolumePerLength(1, VolumePerLengthUnit.OilBarrelPerFoot).ToString(swedishCulture));
+ Assert.Equal("1 gal (U.S.)/mi", new VolumePerLength(1, VolumePerLengthUnit.UsGallonPerMile).ToString(swedishCulture));
}
[Fact]
diff --git a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs
index 5f65560339..8d3b01d729 100644
--- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs
@@ -72,6 +72,7 @@ static VolumePerLength()
new UnitInfo(VolumePerLengthUnit.LiterPerMeter, "LitersPerMeter", new BaseUnits(length: LengthUnit.Decimeter)),
new UnitInfo(VolumePerLengthUnit.LiterPerMillimeter, "LitersPerMillimeter", BaseUnits.Undefined),
new UnitInfo(VolumePerLengthUnit.OilBarrelPerFoot, "OilBarrelsPerFoot", BaseUnits.Undefined),
+ new UnitInfo(VolumePerLengthUnit.UsGallonPerMile, "UsGallonsPerMile", BaseUnits.Undefined),
},
BaseUnit, Zero, BaseDimensions);
@@ -210,6 +211,11 @@ public VolumePerLength(double value, UnitSystem unitSystem)
///
public double OilBarrelsPerFoot => As(VolumePerLengthUnit.OilBarrelPerFoot);
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double UsGallonsPerMile => As(VolumePerLengthUnit.UsGallonPerMile);
+
#endregion
#region Static Methods
@@ -227,6 +233,7 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
unitConverter.SetConversionFunction(VolumePerLengthUnit.LiterPerMeter, VolumePerLengthUnit.CubicMeterPerMeter, quantity => quantity.ToUnit(VolumePerLengthUnit.CubicMeterPerMeter));
unitConverter.SetConversionFunction(VolumePerLengthUnit.LiterPerMillimeter, VolumePerLengthUnit.CubicMeterPerMeter, quantity => quantity.ToUnit(VolumePerLengthUnit.CubicMeterPerMeter));
unitConverter.SetConversionFunction(VolumePerLengthUnit.OilBarrelPerFoot, VolumePerLengthUnit.CubicMeterPerMeter, quantity => quantity.ToUnit(VolumePerLengthUnit.CubicMeterPerMeter));
+ unitConverter.SetConversionFunction(VolumePerLengthUnit.UsGallonPerMile, VolumePerLengthUnit.CubicMeterPerMeter, quantity => quantity.ToUnit(VolumePerLengthUnit.CubicMeterPerMeter));
// Register in unit converter: BaseUnit <-> BaseUnit
unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.CubicMeterPerMeter, quantity => quantity);
@@ -238,6 +245,7 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.LiterPerMeter, quantity => quantity.ToUnit(VolumePerLengthUnit.LiterPerMeter));
unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.LiterPerMillimeter, quantity => quantity.ToUnit(VolumePerLengthUnit.LiterPerMillimeter));
unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.OilBarrelPerFoot, quantity => quantity.ToUnit(VolumePerLengthUnit.OilBarrelPerFoot));
+ unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.UsGallonPerMile, quantity => quantity.ToUnit(VolumePerLengthUnit.UsGallonPerMile));
}
internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbreviationsCache)
@@ -249,6 +257,7 @@ internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbrev
unitAbbreviationsCache.PerformAbbreviationMapping(VolumePerLengthUnit.LiterPerMeter, new CultureInfo("en-US"), false, true, new string[]{"l/m"});
unitAbbreviationsCache.PerformAbbreviationMapping(VolumePerLengthUnit.LiterPerMillimeter, new CultureInfo("en-US"), false, true, new string[]{"l/mm"});
unitAbbreviationsCache.PerformAbbreviationMapping(VolumePerLengthUnit.OilBarrelPerFoot, new CultureInfo("en-US"), false, true, new string[]{"bbl/ft"});
+ unitAbbreviationsCache.PerformAbbreviationMapping(VolumePerLengthUnit.UsGallonPerMile, new CultureInfo("en-US"), false, true, new string[]{"gal (U.S.)/mi"});
}
///
@@ -346,6 +355,16 @@ public static VolumePerLength FromOilBarrelsPerFoot(QuantityValue oilbarrelsperf
return new VolumePerLength(value, VolumePerLengthUnit.OilBarrelPerFoot);
}
+ ///
+ /// Creates a from .
+ ///
+ /// If value is NaN or Infinity.
+ public static VolumePerLength FromUsGallonsPerMile(QuantityValue usgallonspermile)
+ {
+ double value = (double) usgallonspermile;
+ return new VolumePerLength(value, VolumePerLengthUnit.UsGallonPerMile);
+ }
+
///
/// Dynamically convert from value and unit enum to .
///
@@ -827,6 +846,7 @@ private bool TryToUnit(VolumePerLengthUnit unit, [NotNullWhen(true)] out VolumeP
(VolumePerLengthUnit.LiterPerMeter, VolumePerLengthUnit.CubicMeterPerMeter) => new VolumePerLength(_value / 1000, VolumePerLengthUnit.CubicMeterPerMeter),
(VolumePerLengthUnit.LiterPerMillimeter, VolumePerLengthUnit.CubicMeterPerMeter) => new VolumePerLength(_value, VolumePerLengthUnit.CubicMeterPerMeter),
(VolumePerLengthUnit.OilBarrelPerFoot, VolumePerLengthUnit.CubicMeterPerMeter) => new VolumePerLength(_value / 1.91713408, VolumePerLengthUnit.CubicMeterPerMeter),
+ (VolumePerLengthUnit.UsGallonPerMile, VolumePerLengthUnit.CubicMeterPerMeter) => new VolumePerLength(_value / 4.251439077933434e5, VolumePerLengthUnit.CubicMeterPerMeter),
// BaseUnit -> VolumePerLengthUnit
(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.CubicYardPerFoot) => new VolumePerLength(_value / 2.50838208, VolumePerLengthUnit.CubicYardPerFoot),
@@ -835,6 +855,7 @@ private bool TryToUnit(VolumePerLengthUnit unit, [NotNullWhen(true)] out VolumeP
(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.LiterPerMeter) => new VolumePerLength(_value * 1000, VolumePerLengthUnit.LiterPerMeter),
(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.LiterPerMillimeter) => new VolumePerLength(_value, VolumePerLengthUnit.LiterPerMillimeter),
(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.OilBarrelPerFoot) => new VolumePerLength(_value * 1.91713408, VolumePerLengthUnit.OilBarrelPerFoot),
+ (VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.UsGallonPerMile) => new VolumePerLength(_value * 4.251439077933434e5, VolumePerLengthUnit.UsGallonPerMile),
_ => null
};
diff --git a/UnitsNet/GeneratedCode/Units/VolumePerLengthUnit.g.cs b/UnitsNet/GeneratedCode/Units/VolumePerLengthUnit.g.cs
index 73b3ab5b35..6a5aa99334 100644
--- a/UnitsNet/GeneratedCode/Units/VolumePerLengthUnit.g.cs
+++ b/UnitsNet/GeneratedCode/Units/VolumePerLengthUnit.g.cs
@@ -32,6 +32,7 @@ public enum VolumePerLengthUnit
LiterPerMeter = 5,
LiterPerMillimeter = 6,
OilBarrelPerFoot = 7,
+ UsGallonPerMile = 8,
}
#pragma warning restore 1591
From bedda36e993bd6363d5c9f130a422d49dcb85854 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Papp=20Tam=C3=A1s?=
<22793739+t03apt@users.noreply.github.com>
Date: Mon, 13 Mar 2023 22:11:09 +0100
Subject: [PATCH 2/8] fix: UsGallonPerMile, add: ImperialGallonPerMile,
MegaukGallonPerDay, MegausGallonPerDay
---
Common/UnitDefinitions/VolumeFlow.json | 2 +
Common/UnitDefinitions/VolumePerLength.json | 16 +-
Common/UnitEnumValues.g.json | 7 +-
.../GeneratedCode/Quantities/VolumeFlow.g.cs | 26 ++
.../Quantities/VolumePerLength.g.cs | 17 +-
.../GeneratedCode/Units/VolumeFlowUnit.g.cs | 2 +
.../Units/VolumePerLengthUnit.g.cs | 1 +
.../NumberToVolumeFlowExtensionsTest.g.cs | 8 +
...NumberToVolumePerLengthExtensionsTest.g.cs | 4 +
.../NumberToVolumeFlowExtensions.g.cs | 8 +
.../NumberToVolumePerLengthExtensions.g.cs | 4 +
UnitsNet.Tests/CustomCode/VolumeFlowTests.cs | 5 +-
.../CustomCode/VolumePerLengthTests.cs | 2 +
.../TestsBase/VolumeFlowTestsBase.g.cs | 254 ++++++++++++------
.../TestsBase/VolumePerLengthTestsBase.g.cs | 67 +++--
.../GeneratedCode/Quantities/VolumeFlow.g.cs | 42 +++
.../Quantities/VolumePerLength.g.cs | 25 +-
.../GeneratedCode/Units/VolumeFlowUnit.g.cs | 2 +
.../Units/VolumePerLengthUnit.g.cs | 1 +
19 files changed, 391 insertions(+), 102 deletions(-)
diff --git a/Common/UnitDefinitions/VolumeFlow.json b/Common/UnitDefinitions/VolumeFlow.json
index d70508cc65..22e3229124 100644
--- a/Common/UnitDefinitions/VolumeFlow.json
+++ b/Common/UnitDefinitions/VolumeFlow.json
@@ -168,6 +168,7 @@
"PluralName": "UsGallonsPerDay",
"FromUnitToBaseFunc": "{x} / 22824465.227",
"FromBaseToUnitFunc": "{x} * 22824465.227",
+ "Prefixes": [ "Mega" ],
"Localization": [
{
"Culture": "en-US",
@@ -268,6 +269,7 @@
"PluralName": "UkGallonsPerDay",
"FromUnitToBaseFunc": "{x} / 19005304",
"FromBaseToUnitFunc": "{x} * 19005304",
+ "Prefixes": [ "Mega" ],
"Localization": [
{
"Culture": "en-US",
diff --git a/Common/UnitDefinitions/VolumePerLength.json b/Common/UnitDefinitions/VolumePerLength.json
index 9e9f6a02a7..c436ca013f 100644
--- a/Common/UnitDefinitions/VolumePerLength.json
+++ b/Common/UnitDefinitions/VolumePerLength.json
@@ -104,14 +104,26 @@
{
"SingularName": "UsGallonPerMile",
"PluralName": "UsGallonsPerMile",
- "FromUnitToBaseFunc": "{x} / 4.251439077933434e5",
- "FromBaseToUnitFunc": "{x} * 4.251439077933434e5",
+ "FromUnitToBaseFunc": "{x} / (1000 * 1609.344 / 3.785411784)",
+ "FromBaseToUnitFunc": "{x} * (1000 * 1609.344 / 3.785411784)",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "gal (U.S.)/mi" ]
}
]
+ },
+ {
+ "SingularName": "ImperialGallonPerMile",
+ "PluralName": "ImperialGallonsPerMile",
+ "FromUnitToBaseFunc": "{x} / (1000 * 1609.344 / 4.54609)",
+ "FromBaseToUnitFunc": "{x} * (1000 * 1609.344 / 4.54609)",
+ "Localization": [
+ {
+ "Culture": "en-US",
+ "Abbreviations": [ "gal (imp.)/mi" ]
+ }
+ ]
}
]
}
diff --git a/Common/UnitEnumValues.g.json b/Common/UnitEnumValues.g.json
index b520cfd09c..b7b9ff97f3 100644
--- a/Common/UnitEnumValues.g.json
+++ b/Common/UnitEnumValues.g.json
@@ -1644,7 +1644,9 @@
"MillionUsGallonPerDay": 66,
"MegaliterPerHour": 68,
"MegaliterPerMinute": 64,
- "MegaliterPerSecond": 65
+ "MegaliterPerSecond": 65,
+ "MegaukGallonPerDay": 73,
+ "MegausGallonPerDay": 77
},
"VolumeFlowPerArea": {
"CubicFootPerMinutePerSquareFoot": 1,
@@ -1658,7 +1660,8 @@
"LiterPerMeter": 5,
"LiterPerMillimeter": 6,
"OilBarrelPerFoot": 7,
- "UsGallonPerMile": 8
+ "UsGallonPerMile": 8,
+ "ImperialGallonPerMile": 11
},
"VolumetricHeatCapacity": {
"BtuPerCubicFootDegreeFahrenheit": 1,
diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeFlow.g.cs
index 591f3031e2..daffaf77a2 100644
--- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeFlow.g.cs
+++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeFlow.g.cs
@@ -274,11 +274,21 @@ public VolumeFlow(double value, VolumeFlowUnit unit)
///
public double MegalitersPerSecond => As(VolumeFlowUnit.MegaliterPerSecond);
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double MegaukGallonsPerDay => As(VolumeFlowUnit.MegaukGallonPerDay);
+
///
/// Gets a value of this quantity converted into
///
public double MegaukGallonsPerSecond => As(VolumeFlowUnit.MegaukGallonPerSecond);
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double MegausGallonsPerDay => As(VolumeFlowUnit.MegausGallonPerDay);
+
///
/// Gets a value of this quantity converted into
///
@@ -642,12 +652,24 @@ public VolumeFlow(double value, VolumeFlowUnit unit)
/// If value is NaN or Infinity.
public static VolumeFlow FromMegalitersPerSecond(double megaliterspersecond) => new VolumeFlow(megaliterspersecond, VolumeFlowUnit.MegaliterPerSecond);
+ ///
+ /// Creates a from .
+ ///
+ /// If value is NaN or Infinity.
+ public static VolumeFlow FromMegaukGallonsPerDay(double megaukgallonsperday) => new VolumeFlow(megaukgallonsperday, VolumeFlowUnit.MegaukGallonPerDay);
+
///
/// Creates a from .
///
/// If value is NaN or Infinity.
public static VolumeFlow FromMegaukGallonsPerSecond(double megaukgallonspersecond) => new VolumeFlow(megaukgallonspersecond, VolumeFlowUnit.MegaukGallonPerSecond);
+ ///
+ /// Creates a from .
+ ///
+ /// If value is NaN or Infinity.
+ public static VolumeFlow FromMegausGallonsPerDay(double megausgallonsperday) => new VolumeFlow(megausgallonsperday, VolumeFlowUnit.MegausGallonPerDay);
+
///
/// Creates a from .
///
@@ -877,7 +899,9 @@ private double GetValueInBaseUnit()
VolumeFlowUnit.MegaliterPerHour => (_value / 3600000.000) * 1e6d,
VolumeFlowUnit.MegaliterPerMinute => (_value / 60000.00000) * 1e6d,
VolumeFlowUnit.MegaliterPerSecond => (_value / 1000) * 1e6d,
+ VolumeFlowUnit.MegaukGallonPerDay => (_value / 19005304) * 1e6d,
VolumeFlowUnit.MegaukGallonPerSecond => (_value / 219.969) * 1e6d,
+ VolumeFlowUnit.MegausGallonPerDay => (_value / 22824465.227) * 1e6d,
VolumeFlowUnit.MicroliterPerDay => (_value / 86400000) * 1e-6d,
VolumeFlowUnit.MicroliterPerHour => (_value / 3600000.000) * 1e-6d,
VolumeFlowUnit.MicroliterPerMinute => (_value / 60000.00000) * 1e-6d,
@@ -955,7 +979,9 @@ private double GetValueAs(VolumeFlowUnit unit)
VolumeFlowUnit.MegaliterPerHour => (baseUnitValue * 3600000.000) / 1e6d,
VolumeFlowUnit.MegaliterPerMinute => (baseUnitValue * 60000.00000) / 1e6d,
VolumeFlowUnit.MegaliterPerSecond => (baseUnitValue * 1000) / 1e6d,
+ VolumeFlowUnit.MegaukGallonPerDay => (baseUnitValue * 19005304) / 1e6d,
VolumeFlowUnit.MegaukGallonPerSecond => (baseUnitValue * 219.969) / 1e6d,
+ VolumeFlowUnit.MegausGallonPerDay => (baseUnitValue * 22824465.227) / 1e6d,
VolumeFlowUnit.MicroliterPerDay => (baseUnitValue * 86400000) / 1e-6d,
VolumeFlowUnit.MicroliterPerHour => (baseUnitValue * 3600000.000) / 1e-6d,
VolumeFlowUnit.MicroliterPerMinute => (baseUnitValue * 60000.00000) / 1e-6d,
diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumePerLength.g.cs
index 32834376ef..85df7d39d2 100644
--- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumePerLength.g.cs
+++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumePerLength.g.cs
@@ -94,6 +94,11 @@ public VolumePerLength(double value, VolumePerLengthUnit unit)
///
public double CubicYardsPerUsSurveyFoot => As(VolumePerLengthUnit.CubicYardPerUsSurveyFoot);
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double ImperialGallonsPerMile => As(VolumePerLengthUnit.ImperialGallonPerMile);
+
///
/// Gets a value of this quantity converted into
///
@@ -141,6 +146,12 @@ public VolumePerLength(double value, VolumePerLengthUnit unit)
/// If value is NaN or Infinity.
public static VolumePerLength FromCubicYardsPerUsSurveyFoot(double cubicyardsperussurveyfoot) => new VolumePerLength(cubicyardsperussurveyfoot, VolumePerLengthUnit.CubicYardPerUsSurveyFoot);
+ ///
+ /// Creates a from .
+ ///
+ /// If value is NaN or Infinity.
+ public static VolumePerLength FromImperialGallonsPerMile(double imperialgallonspermile) => new VolumePerLength(imperialgallonspermile, VolumePerLengthUnit.ImperialGallonPerMile);
+
///
/// Creates a from .
///
@@ -214,11 +225,12 @@ private double GetValueInBaseUnit()
VolumePerLengthUnit.CubicMeterPerMeter => _value,
VolumePerLengthUnit.CubicYardPerFoot => _value * 2.50838208,
VolumePerLengthUnit.CubicYardPerUsSurveyFoot => _value * 2.50837706323584,
+ VolumePerLengthUnit.ImperialGallonPerMile => _value / (1000 * 1609.344 / 4.54609),
VolumePerLengthUnit.LiterPerKilometer => _value / 1e6,
VolumePerLengthUnit.LiterPerMeter => _value / 1000,
VolumePerLengthUnit.LiterPerMillimeter => _value,
VolumePerLengthUnit.OilBarrelPerFoot => _value / 1.91713408,
- VolumePerLengthUnit.UsGallonPerMile => _value / 4.251439077933434e5,
+ VolumePerLengthUnit.UsGallonPerMile => _value / (1000 * 1609.344 / 3.785411784),
_ => throw new NotImplementedException($"Can not convert {Unit} to base units.")
};
}
@@ -235,11 +247,12 @@ private double GetValueAs(VolumePerLengthUnit unit)
VolumePerLengthUnit.CubicMeterPerMeter => baseUnitValue,
VolumePerLengthUnit.CubicYardPerFoot => baseUnitValue / 2.50838208,
VolumePerLengthUnit.CubicYardPerUsSurveyFoot => baseUnitValue / 2.50837706323584,
+ VolumePerLengthUnit.ImperialGallonPerMile => baseUnitValue * (1000 * 1609.344 / 4.54609),
VolumePerLengthUnit.LiterPerKilometer => baseUnitValue * 1e6,
VolumePerLengthUnit.LiterPerMeter => baseUnitValue * 1000,
VolumePerLengthUnit.LiterPerMillimeter => baseUnitValue,
VolumePerLengthUnit.OilBarrelPerFoot => baseUnitValue * 1.91713408,
- VolumePerLengthUnit.UsGallonPerMile => baseUnitValue * 4.251439077933434e5,
+ VolumePerLengthUnit.UsGallonPerMile => baseUnitValue * (1000 * 1609.344 / 3.785411784),
_ => throw new NotImplementedException($"Can not convert {Unit} to {unit}.")
};
}
diff --git a/UnitsNet.NanoFramework/GeneratedCode/Units/VolumeFlowUnit.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Units/VolumeFlowUnit.g.cs
index d8f0e8bc23..ab8b2bca49 100644
--- a/UnitsNet.NanoFramework/GeneratedCode/Units/VolumeFlowUnit.g.cs
+++ b/UnitsNet.NanoFramework/GeneratedCode/Units/VolumeFlowUnit.g.cs
@@ -64,7 +64,9 @@ public enum VolumeFlowUnit
MegaliterPerHour = 68,
MegaliterPerMinute = 64,
MegaliterPerSecond = 65,
+ MegaukGallonPerDay = 73,
MegaukGallonPerSecond = 37,
+ MegausGallonPerDay = 77,
MicroliterPerDay = 38,
MicroliterPerHour = 39,
MicroliterPerMinute = 40,
diff --git a/UnitsNet.NanoFramework/GeneratedCode/Units/VolumePerLengthUnit.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Units/VolumePerLengthUnit.g.cs
index 6a5aa99334..526d9c8509 100644
--- a/UnitsNet.NanoFramework/GeneratedCode/Units/VolumePerLengthUnit.g.cs
+++ b/UnitsNet.NanoFramework/GeneratedCode/Units/VolumePerLengthUnit.g.cs
@@ -28,6 +28,7 @@ public enum VolumePerLengthUnit
CubicMeterPerMeter = 1,
CubicYardPerFoot = 2,
CubicYardPerUsSurveyFoot = 3,
+ ImperialGallonPerMile = 11,
LiterPerKilometer = 4,
LiterPerMeter = 5,
LiterPerMillimeter = 6,
diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeFlowExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeFlowExtensionsTest.g.cs
index 215a2362d8..13d1660359 100644
--- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeFlowExtensionsTest.g.cs
+++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeFlowExtensionsTest.g.cs
@@ -180,10 +180,18 @@ public void NumberToMegalitersPerMinuteTest() =>
public void NumberToMegalitersPerSecondTest() =>
Assert.Equal(VolumeFlow.FromMegalitersPerSecond(2), 2.MegalitersPerSecond());
+ [Fact]
+ public void NumberToMegaukGallonsPerDayTest() =>
+ Assert.Equal(VolumeFlow.FromMegaukGallonsPerDay(2), 2.MegaukGallonsPerDay());
+
[Fact]
public void NumberToMegaukGallonsPerSecondTest() =>
Assert.Equal(VolumeFlow.FromMegaukGallonsPerSecond(2), 2.MegaukGallonsPerSecond());
+ [Fact]
+ public void NumberToMegausGallonsPerDayTest() =>
+ Assert.Equal(VolumeFlow.FromMegausGallonsPerDay(2), 2.MegausGallonsPerDay());
+
[Fact]
public void NumberToMicrolitersPerDayTest() =>
Assert.Equal(VolumeFlow.FromMicrolitersPerDay(2), 2.MicrolitersPerDay());
diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumePerLengthExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumePerLengthExtensionsTest.g.cs
index ba2f3285f0..97f4e96f25 100644
--- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumePerLengthExtensionsTest.g.cs
+++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumePerLengthExtensionsTest.g.cs
@@ -36,6 +36,10 @@ public void NumberToCubicYardsPerFootTest() =>
public void NumberToCubicYardsPerUsSurveyFootTest() =>
Assert.Equal(VolumePerLength.FromCubicYardsPerUsSurveyFoot(2), 2.CubicYardsPerUsSurveyFoot());
+ [Fact]
+ public void NumberToImperialGallonsPerMileTest() =>
+ Assert.Equal(VolumePerLength.FromImperialGallonsPerMile(2), 2.ImperialGallonsPerMile());
+
[Fact]
public void NumberToLitersPerKilometerTest() =>
Assert.Equal(VolumePerLength.FromLitersPerKilometer(2), 2.LitersPerKilometer());
diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeFlowExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeFlowExtensions.g.cs
index 31abb82cce..b4ca8e4dd5 100644
--- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeFlowExtensions.g.cs
+++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeFlowExtensions.g.cs
@@ -184,10 +184,18 @@ public static VolumeFlow MegalitersPerMinute(this T value) =>
public static VolumeFlow MegalitersPerSecond(this T value) =>
VolumeFlow.FromMegalitersPerSecond(Convert.ToDouble(value));
+ ///
+ public static VolumeFlow MegaukGallonsPerDay(this T value) =>
+ VolumeFlow.FromMegaukGallonsPerDay(Convert.ToDouble(value));
+
///
public static VolumeFlow MegaukGallonsPerSecond(this T value) =>
VolumeFlow.FromMegaukGallonsPerSecond(Convert.ToDouble(value));
+ ///
+ public static VolumeFlow MegausGallonsPerDay(this T value) =>
+ VolumeFlow.FromMegausGallonsPerDay(Convert.ToDouble(value));
+
///
public static VolumeFlow MicrolitersPerDay(this T value) =>
VolumeFlow.FromMicrolitersPerDay(Convert.ToDouble(value));
diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumePerLengthExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumePerLengthExtensions.g.cs
index 9628b885c7..b2ea8cda47 100644
--- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumePerLengthExtensions.g.cs
+++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumePerLengthExtensions.g.cs
@@ -40,6 +40,10 @@ public static VolumePerLength CubicYardsPerFoot(this T value) =>
public static VolumePerLength CubicYardsPerUsSurveyFoot(this T value) =>
VolumePerLength.FromCubicYardsPerUsSurveyFoot(Convert.ToDouble(value));
+ ///
+ public static VolumePerLength ImperialGallonsPerMile(this T value) =>
+ VolumePerLength.FromImperialGallonsPerMile(Convert.ToDouble(value));
+
///
public static VolumePerLength LitersPerKilometer(this T value) =>
VolumePerLength.FromLitersPerKilometer(Convert.ToDouble(value));
diff --git a/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs b/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs
index 484347d74d..df4fc808cb 100644
--- a/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs
+++ b/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs
@@ -109,6 +109,10 @@ public class VolumeFlowTests : VolumeFlowTestsBase
protected override double MegaukGallonsPerSecondInOneCubicMeterPerSecond => 2.19969e-4;
+ protected override double MegaukGallonsPerDayInOneCubicMeterPerSecond => 19.005304;
+
+ protected override double MegausGallonsPerDayInOneCubicMeterPerSecond => 22.824465227;
+
protected override double MicrolitersPerDayInOneCubicMeterPerSecond => 8.64e+13;
protected override double MicrolitersPerHourInOneCubicMeterPerSecond => 3.6e12;
@@ -159,7 +163,6 @@ public class VolumeFlowTests : VolumeFlowTestsBase
protected override double UsGallonsPerSecondInOneCubicMeterPerSecond => 2.64172052358148E2;
-
[Theory]
[InlineData(20, 2, 40)]
[InlineData(20, 62, 1240)]
diff --git a/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs b/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs
index 661d3bf376..b0bcfc5919 100644
--- a/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs
+++ b/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs
@@ -42,5 +42,7 @@ public class VolumePerLengthTests : VolumePerLengthTestsBase
protected override double LitersPerMillimeterInOneCubicMeterPerMeter => 1;
protected override double UsGallonsPerMileInOneCubicMeterPerMeter => 4.251439077933434e5;
+
+ protected override double ImperialGallonsPerMileInOneCubicMeterPerMeter => 3.54006189934647e5;
}
}
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs
index 5cef17f3d9..04592a2148 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs
@@ -77,7 +77,9 @@ public abstract partial class VolumeFlowTestsBase : QuantityTestsBase
protected abstract double MegalitersPerHourInOneCubicMeterPerSecond { get; }
protected abstract double MegalitersPerMinuteInOneCubicMeterPerSecond { get; }
protected abstract double MegalitersPerSecondInOneCubicMeterPerSecond { get; }
+ protected abstract double MegaukGallonsPerDayInOneCubicMeterPerSecond { get; }
protected abstract double MegaukGallonsPerSecondInOneCubicMeterPerSecond { get; }
+ protected abstract double MegausGallonsPerDayInOneCubicMeterPerSecond { get; }
protected abstract double MicrolitersPerDayInOneCubicMeterPerSecond { get; }
protected abstract double MicrolitersPerHourInOneCubicMeterPerSecond { get; }
protected abstract double MicrolitersPerMinuteInOneCubicMeterPerSecond { get; }
@@ -144,7 +146,9 @@ public abstract partial class VolumeFlowTestsBase : QuantityTestsBase
protected virtual double MegalitersPerHourTolerance { get { return 1e-5; } }
protected virtual double MegalitersPerMinuteTolerance { get { return 1e-5; } }
protected virtual double MegalitersPerSecondTolerance { get { return 1e-5; } }
+ protected virtual double MegaukGallonsPerDayTolerance { get { return 1e-5; } }
protected virtual double MegaukGallonsPerSecondTolerance { get { return 1e-5; } }
+ protected virtual double MegausGallonsPerDayTolerance { get { return 1e-5; } }
protected virtual double MicrolitersPerDayTolerance { get { return 1e-5; } }
protected virtual double MicrolitersPerHourTolerance { get { return 1e-5; } }
protected virtual double MicrolitersPerMinuteTolerance { get { return 1e-5; } }
@@ -215,7 +219,9 @@ public abstract partial class VolumeFlowTestsBase : QuantityTestsBase
VolumeFlowUnit.MegaliterPerHour => (MegalitersPerHourInOneCubicMeterPerSecond, MegalitersPerHourTolerance),
VolumeFlowUnit.MegaliterPerMinute => (MegalitersPerMinuteInOneCubicMeterPerSecond, MegalitersPerMinuteTolerance),
VolumeFlowUnit.MegaliterPerSecond => (MegalitersPerSecondInOneCubicMeterPerSecond, MegalitersPerSecondTolerance),
+ VolumeFlowUnit.MegaukGallonPerDay => (MegaukGallonsPerDayInOneCubicMeterPerSecond, MegaukGallonsPerDayTolerance),
VolumeFlowUnit.MegaukGallonPerSecond => (MegaukGallonsPerSecondInOneCubicMeterPerSecond, MegaukGallonsPerSecondTolerance),
+ VolumeFlowUnit.MegausGallonPerDay => (MegausGallonsPerDayInOneCubicMeterPerSecond, MegausGallonsPerDayTolerance),
VolumeFlowUnit.MicroliterPerDay => (MicrolitersPerDayInOneCubicMeterPerSecond, MicrolitersPerDayTolerance),
VolumeFlowUnit.MicroliterPerHour => (MicrolitersPerHourInOneCubicMeterPerSecond, MicrolitersPerHourTolerance),
VolumeFlowUnit.MicroliterPerMinute => (MicrolitersPerMinuteInOneCubicMeterPerSecond, MicrolitersPerMinuteTolerance),
@@ -286,7 +292,9 @@ public abstract partial class VolumeFlowTestsBase : QuantityTestsBase
new object[] { VolumeFlowUnit.MegaliterPerHour },
new object[] { VolumeFlowUnit.MegaliterPerMinute },
new object[] { VolumeFlowUnit.MegaliterPerSecond },
+ new object[] { VolumeFlowUnit.MegaukGallonPerDay },
new object[] { VolumeFlowUnit.MegaukGallonPerSecond },
+ new object[] { VolumeFlowUnit.MegausGallonPerDay },
new object[] { VolumeFlowUnit.MicroliterPerDay },
new object[] { VolumeFlowUnit.MicroliterPerHour },
new object[] { VolumeFlowUnit.MicroliterPerMinute },
@@ -413,7 +421,9 @@ public void CubicMeterPerSecondToVolumeFlowUnits()
AssertEx.EqualTolerance(MegalitersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.MegalitersPerHour, MegalitersPerHourTolerance);
AssertEx.EqualTolerance(MegalitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.MegalitersPerMinute, MegalitersPerMinuteTolerance);
AssertEx.EqualTolerance(MegalitersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.MegalitersPerSecond, MegalitersPerSecondTolerance);
+ AssertEx.EqualTolerance(MegaukGallonsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.MegaukGallonsPerDay, MegaukGallonsPerDayTolerance);
AssertEx.EqualTolerance(MegaukGallonsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.MegaukGallonsPerSecond, MegaukGallonsPerSecondTolerance);
+ AssertEx.EqualTolerance(MegausGallonsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.MegausGallonsPerDay, MegausGallonsPerDayTolerance);
AssertEx.EqualTolerance(MicrolitersPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.MicrolitersPerDay, MicrolitersPerDayTolerance);
AssertEx.EqualTolerance(MicrolitersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.MicrolitersPerHour, MicrolitersPerHourTolerance);
AssertEx.EqualTolerance(MicrolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.MicrolitersPerMinute, MicrolitersPerMinuteTolerance);
@@ -600,109 +610,117 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit()
AssertEx.EqualTolerance(1, quantity38.MegalitersPerSecond, MegalitersPerSecondTolerance);
Assert.Equal(VolumeFlowUnit.MegaliterPerSecond, quantity38.Unit);
- var quantity39 = VolumeFlow.From(1, VolumeFlowUnit.MegaukGallonPerSecond);
- AssertEx.EqualTolerance(1, quantity39.MegaukGallonsPerSecond, MegaukGallonsPerSecondTolerance);
- Assert.Equal(VolumeFlowUnit.MegaukGallonPerSecond, quantity39.Unit);
+ var quantity39 = VolumeFlow.From(1, VolumeFlowUnit.MegaukGallonPerDay);
+ AssertEx.EqualTolerance(1, quantity39.MegaukGallonsPerDay, MegaukGallonsPerDayTolerance);
+ Assert.Equal(VolumeFlowUnit.MegaukGallonPerDay, quantity39.Unit);
- var quantity40 = VolumeFlow.From(1, VolumeFlowUnit.MicroliterPerDay);
- AssertEx.EqualTolerance(1, quantity40.MicrolitersPerDay, MicrolitersPerDayTolerance);
- Assert.Equal(VolumeFlowUnit.MicroliterPerDay, quantity40.Unit);
+ var quantity40 = VolumeFlow.From(1, VolumeFlowUnit.MegaukGallonPerSecond);
+ AssertEx.EqualTolerance(1, quantity40.MegaukGallonsPerSecond, MegaukGallonsPerSecondTolerance);
+ Assert.Equal(VolumeFlowUnit.MegaukGallonPerSecond, quantity40.Unit);
- var quantity41 = VolumeFlow.From(1, VolumeFlowUnit.MicroliterPerHour);
- AssertEx.EqualTolerance(1, quantity41.MicrolitersPerHour, MicrolitersPerHourTolerance);
- Assert.Equal(VolumeFlowUnit.MicroliterPerHour, quantity41.Unit);
+ var quantity41 = VolumeFlow.From(1, VolumeFlowUnit.MegausGallonPerDay);
+ AssertEx.EqualTolerance(1, quantity41.MegausGallonsPerDay, MegausGallonsPerDayTolerance);
+ Assert.Equal(VolumeFlowUnit.MegausGallonPerDay, quantity41.Unit);
- var quantity42 = VolumeFlow.From(1, VolumeFlowUnit.MicroliterPerMinute);
- AssertEx.EqualTolerance(1, quantity42.MicrolitersPerMinute, MicrolitersPerMinuteTolerance);
- Assert.Equal(VolumeFlowUnit.MicroliterPerMinute, quantity42.Unit);
+ var quantity42 = VolumeFlow.From(1, VolumeFlowUnit.MicroliterPerDay);
+ AssertEx.EqualTolerance(1, quantity42.MicrolitersPerDay, MicrolitersPerDayTolerance);
+ Assert.Equal(VolumeFlowUnit.MicroliterPerDay, quantity42.Unit);
- var quantity43 = VolumeFlow.From(1, VolumeFlowUnit.MicroliterPerSecond);
- AssertEx.EqualTolerance(1, quantity43.MicrolitersPerSecond, MicrolitersPerSecondTolerance);
- Assert.Equal(VolumeFlowUnit.MicroliterPerSecond, quantity43.Unit);
+ var quantity43 = VolumeFlow.From(1, VolumeFlowUnit.MicroliterPerHour);
+ AssertEx.EqualTolerance(1, quantity43.MicrolitersPerHour, MicrolitersPerHourTolerance);
+ Assert.Equal(VolumeFlowUnit.MicroliterPerHour, quantity43.Unit);
- var quantity44 = VolumeFlow.From(1, VolumeFlowUnit.MilliliterPerDay);
- AssertEx.EqualTolerance(1, quantity44.MillilitersPerDay, MillilitersPerDayTolerance);
- Assert.Equal(VolumeFlowUnit.MilliliterPerDay, quantity44.Unit);
+ var quantity44 = VolumeFlow.From(1, VolumeFlowUnit.MicroliterPerMinute);
+ AssertEx.EqualTolerance(1, quantity44.MicrolitersPerMinute, MicrolitersPerMinuteTolerance);
+ Assert.Equal(VolumeFlowUnit.MicroliterPerMinute, quantity44.Unit);
- var quantity45 = VolumeFlow.From(1, VolumeFlowUnit.MilliliterPerHour);
- AssertEx.EqualTolerance(1, quantity45.MillilitersPerHour, MillilitersPerHourTolerance);
- Assert.Equal(VolumeFlowUnit.MilliliterPerHour, quantity45.Unit);
+ var quantity45 = VolumeFlow.From(1, VolumeFlowUnit.MicroliterPerSecond);
+ AssertEx.EqualTolerance(1, quantity45.MicrolitersPerSecond, MicrolitersPerSecondTolerance);
+ Assert.Equal(VolumeFlowUnit.MicroliterPerSecond, quantity45.Unit);
- var quantity46 = VolumeFlow.From(1, VolumeFlowUnit.MilliliterPerMinute);
- AssertEx.EqualTolerance(1, quantity46.MillilitersPerMinute, MillilitersPerMinuteTolerance);
- Assert.Equal(VolumeFlowUnit.MilliliterPerMinute, quantity46.Unit);
+ var quantity46 = VolumeFlow.From(1, VolumeFlowUnit.MilliliterPerDay);
+ AssertEx.EqualTolerance(1, quantity46.MillilitersPerDay, MillilitersPerDayTolerance);
+ Assert.Equal(VolumeFlowUnit.MilliliterPerDay, quantity46.Unit);
- var quantity47 = VolumeFlow.From(1, VolumeFlowUnit.MilliliterPerSecond);
- AssertEx.EqualTolerance(1, quantity47.MillilitersPerSecond, MillilitersPerSecondTolerance);
- Assert.Equal(VolumeFlowUnit.MilliliterPerSecond, quantity47.Unit);
+ var quantity47 = VolumeFlow.From(1, VolumeFlowUnit.MilliliterPerHour);
+ AssertEx.EqualTolerance(1, quantity47.MillilitersPerHour, MillilitersPerHourTolerance);
+ Assert.Equal(VolumeFlowUnit.MilliliterPerHour, quantity47.Unit);
- var quantity48 = VolumeFlow.From(1, VolumeFlowUnit.MillionUsGallonPerDay);
- AssertEx.EqualTolerance(1, quantity48.MillionUsGallonsPerDay, MillionUsGallonsPerDayTolerance);
- Assert.Equal(VolumeFlowUnit.MillionUsGallonPerDay, quantity48.Unit);
+ var quantity48 = VolumeFlow.From(1, VolumeFlowUnit.MilliliterPerMinute);
+ AssertEx.EqualTolerance(1, quantity48.MillilitersPerMinute, MillilitersPerMinuteTolerance);
+ Assert.Equal(VolumeFlowUnit.MilliliterPerMinute, quantity48.Unit);
- var quantity49 = VolumeFlow.From(1, VolumeFlowUnit.NanoliterPerDay);
- AssertEx.EqualTolerance(1, quantity49.NanolitersPerDay, NanolitersPerDayTolerance);
- Assert.Equal(VolumeFlowUnit.NanoliterPerDay, quantity49.Unit);
+ var quantity49 = VolumeFlow.From(1, VolumeFlowUnit.MilliliterPerSecond);
+ AssertEx.EqualTolerance(1, quantity49.MillilitersPerSecond, MillilitersPerSecondTolerance);
+ Assert.Equal(VolumeFlowUnit.MilliliterPerSecond, quantity49.Unit);
- var quantity50 = VolumeFlow.From(1, VolumeFlowUnit.NanoliterPerHour);
- AssertEx.EqualTolerance(1, quantity50.NanolitersPerHour, NanolitersPerHourTolerance);
- Assert.Equal(VolumeFlowUnit.NanoliterPerHour, quantity50.Unit);
+ var quantity50 = VolumeFlow.From(1, VolumeFlowUnit.MillionUsGallonPerDay);
+ AssertEx.EqualTolerance(1, quantity50.MillionUsGallonsPerDay, MillionUsGallonsPerDayTolerance);
+ Assert.Equal(VolumeFlowUnit.MillionUsGallonPerDay, quantity50.Unit);
- var quantity51 = VolumeFlow.From(1, VolumeFlowUnit.NanoliterPerMinute);
- AssertEx.EqualTolerance(1, quantity51.NanolitersPerMinute, NanolitersPerMinuteTolerance);
- Assert.Equal(VolumeFlowUnit.NanoliterPerMinute, quantity51.Unit);
+ var quantity51 = VolumeFlow.From(1, VolumeFlowUnit.NanoliterPerDay);
+ AssertEx.EqualTolerance(1, quantity51.NanolitersPerDay, NanolitersPerDayTolerance);
+ Assert.Equal(VolumeFlowUnit.NanoliterPerDay, quantity51.Unit);
- var quantity52 = VolumeFlow.From(1, VolumeFlowUnit.NanoliterPerSecond);
- AssertEx.EqualTolerance(1, quantity52.NanolitersPerSecond, NanolitersPerSecondTolerance);
- Assert.Equal(VolumeFlowUnit.NanoliterPerSecond, quantity52.Unit);
+ var quantity52 = VolumeFlow.From(1, VolumeFlowUnit.NanoliterPerHour);
+ AssertEx.EqualTolerance(1, quantity52.NanolitersPerHour, NanolitersPerHourTolerance);
+ Assert.Equal(VolumeFlowUnit.NanoliterPerHour, quantity52.Unit);
- var quantity53 = VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerDay);
- AssertEx.EqualTolerance(1, quantity53.OilBarrelsPerDay, OilBarrelsPerDayTolerance);
- Assert.Equal(VolumeFlowUnit.OilBarrelPerDay, quantity53.Unit);
+ var quantity53 = VolumeFlow.From(1, VolumeFlowUnit.NanoliterPerMinute);
+ AssertEx.EqualTolerance(1, quantity53.NanolitersPerMinute, NanolitersPerMinuteTolerance);
+ Assert.Equal(VolumeFlowUnit.NanoliterPerMinute, quantity53.Unit);
- var quantity54 = VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerHour);
- AssertEx.EqualTolerance(1, quantity54.OilBarrelsPerHour, OilBarrelsPerHourTolerance);
- Assert.Equal(VolumeFlowUnit.OilBarrelPerHour, quantity54.Unit);
+ var quantity54 = VolumeFlow.From(1, VolumeFlowUnit.NanoliterPerSecond);
+ AssertEx.EqualTolerance(1, quantity54.NanolitersPerSecond, NanolitersPerSecondTolerance);
+ Assert.Equal(VolumeFlowUnit.NanoliterPerSecond, quantity54.Unit);
- var quantity55 = VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerMinute);
- AssertEx.EqualTolerance(1, quantity55.OilBarrelsPerMinute, OilBarrelsPerMinuteTolerance);
- Assert.Equal(VolumeFlowUnit.OilBarrelPerMinute, quantity55.Unit);
+ var quantity55 = VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerDay);
+ AssertEx.EqualTolerance(1, quantity55.OilBarrelsPerDay, OilBarrelsPerDayTolerance);
+ Assert.Equal(VolumeFlowUnit.OilBarrelPerDay, quantity55.Unit);
- var quantity56 = VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerSecond);
- AssertEx.EqualTolerance(1, quantity56.OilBarrelsPerSecond, OilBarrelsPerSecondTolerance);
- Assert.Equal(VolumeFlowUnit.OilBarrelPerSecond, quantity56.Unit);
+ var quantity56 = VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerHour);
+ AssertEx.EqualTolerance(1, quantity56.OilBarrelsPerHour, OilBarrelsPerHourTolerance);
+ Assert.Equal(VolumeFlowUnit.OilBarrelPerHour, quantity56.Unit);
- var quantity57 = VolumeFlow.From(1, VolumeFlowUnit.UkGallonPerDay);
- AssertEx.EqualTolerance(1, quantity57.UkGallonsPerDay, UkGallonsPerDayTolerance);
- Assert.Equal(VolumeFlowUnit.UkGallonPerDay, quantity57.Unit);
+ var quantity57 = VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerMinute);
+ AssertEx.EqualTolerance(1, quantity57.OilBarrelsPerMinute, OilBarrelsPerMinuteTolerance);
+ Assert.Equal(VolumeFlowUnit.OilBarrelPerMinute, quantity57.Unit);
- var quantity58 = VolumeFlow.From(1, VolumeFlowUnit.UkGallonPerHour);
- AssertEx.EqualTolerance(1, quantity58.UkGallonsPerHour, UkGallonsPerHourTolerance);
- Assert.Equal(VolumeFlowUnit.UkGallonPerHour, quantity58.Unit);
+ var quantity58 = VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerSecond);
+ AssertEx.EqualTolerance(1, quantity58.OilBarrelsPerSecond, OilBarrelsPerSecondTolerance);
+ Assert.Equal(VolumeFlowUnit.OilBarrelPerSecond, quantity58.Unit);
- var quantity59 = VolumeFlow.From(1, VolumeFlowUnit.UkGallonPerMinute);
- AssertEx.EqualTolerance(1, quantity59.UkGallonsPerMinute, UkGallonsPerMinuteTolerance);
- Assert.Equal(VolumeFlowUnit.UkGallonPerMinute, quantity59.Unit);
+ var quantity59 = VolumeFlow.From(1, VolumeFlowUnit.UkGallonPerDay);
+ AssertEx.EqualTolerance(1, quantity59.UkGallonsPerDay, UkGallonsPerDayTolerance);
+ Assert.Equal(VolumeFlowUnit.UkGallonPerDay, quantity59.Unit);
- var quantity60 = VolumeFlow.From(1, VolumeFlowUnit.UkGallonPerSecond);
- AssertEx.EqualTolerance(1, quantity60.UkGallonsPerSecond, UkGallonsPerSecondTolerance);
- Assert.Equal(VolumeFlowUnit.UkGallonPerSecond, quantity60.Unit);
+ var quantity60 = VolumeFlow.From(1, VolumeFlowUnit.UkGallonPerHour);
+ AssertEx.EqualTolerance(1, quantity60.UkGallonsPerHour, UkGallonsPerHourTolerance);
+ Assert.Equal(VolumeFlowUnit.UkGallonPerHour, quantity60.Unit);
- var quantity61 = VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerDay);
- AssertEx.EqualTolerance(1, quantity61.UsGallonsPerDay, UsGallonsPerDayTolerance);
- Assert.Equal(VolumeFlowUnit.UsGallonPerDay, quantity61.Unit);
+ var quantity61 = VolumeFlow.From(1, VolumeFlowUnit.UkGallonPerMinute);
+ AssertEx.EqualTolerance(1, quantity61.UkGallonsPerMinute, UkGallonsPerMinuteTolerance);
+ Assert.Equal(VolumeFlowUnit.UkGallonPerMinute, quantity61.Unit);
- var quantity62 = VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerHour);
- AssertEx.EqualTolerance(1, quantity62.UsGallonsPerHour, UsGallonsPerHourTolerance);
- Assert.Equal(VolumeFlowUnit.UsGallonPerHour, quantity62.Unit);
+ var quantity62 = VolumeFlow.From(1, VolumeFlowUnit.UkGallonPerSecond);
+ AssertEx.EqualTolerance(1, quantity62.UkGallonsPerSecond, UkGallonsPerSecondTolerance);
+ Assert.Equal(VolumeFlowUnit.UkGallonPerSecond, quantity62.Unit);
- var quantity63 = VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerMinute);
- AssertEx.EqualTolerance(1, quantity63.UsGallonsPerMinute, UsGallonsPerMinuteTolerance);
- Assert.Equal(VolumeFlowUnit.UsGallonPerMinute, quantity63.Unit);
+ var quantity63 = VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerDay);
+ AssertEx.EqualTolerance(1, quantity63.UsGallonsPerDay, UsGallonsPerDayTolerance);
+ Assert.Equal(VolumeFlowUnit.UsGallonPerDay, quantity63.Unit);
- var quantity64 = VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerSecond);
- AssertEx.EqualTolerance(1, quantity64.UsGallonsPerSecond, UsGallonsPerSecondTolerance);
- Assert.Equal(VolumeFlowUnit.UsGallonPerSecond, quantity64.Unit);
+ var quantity64 = VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerHour);
+ AssertEx.EqualTolerance(1, quantity64.UsGallonsPerHour, UsGallonsPerHourTolerance);
+ Assert.Equal(VolumeFlowUnit.UsGallonPerHour, quantity64.Unit);
+
+ var quantity65 = VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerMinute);
+ AssertEx.EqualTolerance(1, quantity65.UsGallonsPerMinute, UsGallonsPerMinuteTolerance);
+ Assert.Equal(VolumeFlowUnit.UsGallonPerMinute, quantity65.Unit);
+
+ var quantity66 = VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerSecond);
+ AssertEx.EqualTolerance(1, quantity66.UsGallonsPerSecond, UsGallonsPerSecondTolerance);
+ Assert.Equal(VolumeFlowUnit.UsGallonPerSecond, quantity66.Unit);
}
@@ -762,7 +780,9 @@ public void As()
AssertEx.EqualTolerance(MegalitersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MegaliterPerHour), MegalitersPerHourTolerance);
AssertEx.EqualTolerance(MegalitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MegaliterPerMinute), MegalitersPerMinuteTolerance);
AssertEx.EqualTolerance(MegalitersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MegaliterPerSecond), MegalitersPerSecondTolerance);
+ AssertEx.EqualTolerance(MegaukGallonsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MegaukGallonPerDay), MegaukGallonsPerDayTolerance);
AssertEx.EqualTolerance(MegaukGallonsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MegaukGallonPerSecond), MegaukGallonsPerSecondTolerance);
+ AssertEx.EqualTolerance(MegausGallonsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MegausGallonPerDay), MegausGallonsPerDayTolerance);
AssertEx.EqualTolerance(MicrolitersPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MicroliterPerDay), MicrolitersPerDayTolerance);
AssertEx.EqualTolerance(MicrolitersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MicroliterPerHour), MicrolitersPerHourTolerance);
AssertEx.EqualTolerance(MicrolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MicroliterPerMinute), MicrolitersPerMinuteTolerance);
@@ -1426,6 +1446,13 @@ public void Parse()
Assert.Equal(VolumeFlowUnit.MegaliterPerSecond, parsed.Unit);
} catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+ try
+ {
+ var parsed = VolumeFlow.Parse("1 Mgal (U. K.)/d", CultureInfo.GetCultureInfo("en-US"));
+ AssertEx.EqualTolerance(1, parsed.MegaukGallonsPerDay, MegaukGallonsPerDayTolerance);
+ Assert.Equal(VolumeFlowUnit.MegaukGallonPerDay, parsed.Unit);
+ } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+
try
{
var parsed = VolumeFlow.Parse("1 Mgal (imp.)/s", CultureInfo.GetCultureInfo("en-US"));
@@ -1433,6 +1460,20 @@ public void Parse()
Assert.Equal(VolumeFlowUnit.MegaukGallonPerSecond, parsed.Unit);
} catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+ try
+ {
+ var parsed = VolumeFlow.Parse("1 Mgpd", CultureInfo.GetCultureInfo("en-US"));
+ AssertEx.EqualTolerance(1, parsed.MegausGallonsPerDay, MegausGallonsPerDayTolerance);
+ Assert.Equal(VolumeFlowUnit.MegausGallonPerDay, parsed.Unit);
+ } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+
+ try
+ {
+ var parsed = VolumeFlow.Parse("1 Mgal/d", CultureInfo.GetCultureInfo("en-US"));
+ AssertEx.EqualTolerance(1, parsed.MegausGallonsPerDay, MegausGallonsPerDayTolerance);
+ Assert.Equal(VolumeFlowUnit.MegausGallonPerDay, parsed.Unit);
+ } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+
try
{
var parsed = VolumeFlow.Parse("1 µl/day", CultureInfo.GetCultureInfo("en-US"));
@@ -2272,12 +2313,30 @@ public void TryParse()
Assert.Equal(VolumeFlowUnit.LiterPerSecond, parsed.Unit);
}
+ {
+ Assert.True(VolumeFlow.TryParse("1 Mgal (U. K.)/d", CultureInfo.GetCultureInfo("en-US"), out var parsed));
+ AssertEx.EqualTolerance(1, parsed.MegaukGallonsPerDay, MegaukGallonsPerDayTolerance);
+ Assert.Equal(VolumeFlowUnit.MegaukGallonPerDay, parsed.Unit);
+ }
+
{
Assert.True(VolumeFlow.TryParse("1 Mgal (imp.)/s", CultureInfo.GetCultureInfo("en-US"), out var parsed));
AssertEx.EqualTolerance(1, parsed.MegaukGallonsPerSecond, MegaukGallonsPerSecondTolerance);
Assert.Equal(VolumeFlowUnit.MegaukGallonPerSecond, parsed.Unit);
}
+ {
+ Assert.True(VolumeFlow.TryParse("1 Mgpd", CultureInfo.GetCultureInfo("en-US"), out var parsed));
+ AssertEx.EqualTolerance(1, parsed.MegausGallonsPerDay, MegausGallonsPerDayTolerance);
+ Assert.Equal(VolumeFlowUnit.MegausGallonPerDay, parsed.Unit);
+ }
+
+ {
+ Assert.True(VolumeFlow.TryParse("1 Mgal/d", CultureInfo.GetCultureInfo("en-US"), out var parsed));
+ AssertEx.EqualTolerance(1, parsed.MegausGallonsPerDay, MegausGallonsPerDayTolerance);
+ Assert.Equal(VolumeFlowUnit.MegausGallonPerDay, parsed.Unit);
+ }
+
{
Assert.True(VolumeFlow.TryParse("1 µl/day", CultureInfo.GetCultureInfo("en-US"), out var parsed));
AssertEx.EqualTolerance(1, parsed.MicrolitersPerDay, MicrolitersPerDayTolerance);
@@ -3063,12 +3122,30 @@ public void ParseUnit()
Assert.Equal(VolumeFlowUnit.MegaliterPerSecond, parsedUnit);
} catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+ try
+ {
+ var parsedUnit = VolumeFlow.ParseUnit("Mgal (U. K.)/d", CultureInfo.GetCultureInfo("en-US"));
+ Assert.Equal(VolumeFlowUnit.MegaukGallonPerDay, parsedUnit);
+ } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+
try
{
var parsedUnit = VolumeFlow.ParseUnit("Mgal (imp.)/s", CultureInfo.GetCultureInfo("en-US"));
Assert.Equal(VolumeFlowUnit.MegaukGallonPerSecond, parsedUnit);
} catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+ try
+ {
+ var parsedUnit = VolumeFlow.ParseUnit("Mgpd", CultureInfo.GetCultureInfo("en-US"));
+ Assert.Equal(VolumeFlowUnit.MegausGallonPerDay, parsedUnit);
+ } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+
+ try
+ {
+ var parsedUnit = VolumeFlow.ParseUnit("Mgal/d", CultureInfo.GetCultureInfo("en-US"));
+ Assert.Equal(VolumeFlowUnit.MegausGallonPerDay, parsedUnit);
+ } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+
try
{
var parsedUnit = VolumeFlow.ParseUnit("µl/day", CultureInfo.GetCultureInfo("en-US"));
@@ -3778,11 +3855,26 @@ public void TryParseUnit()
Assert.Equal(VolumeFlowUnit.LiterPerSecond, parsedUnit);
}
+ {
+ Assert.True(VolumeFlow.TryParseUnit("Mgal (U. K.)/d", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit));
+ Assert.Equal(VolumeFlowUnit.MegaukGallonPerDay, parsedUnit);
+ }
+
{
Assert.True(VolumeFlow.TryParseUnit("Mgal (imp.)/s", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit));
Assert.Equal(VolumeFlowUnit.MegaukGallonPerSecond, parsedUnit);
}
+ {
+ Assert.True(VolumeFlow.TryParseUnit("Mgpd", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit));
+ Assert.Equal(VolumeFlowUnit.MegausGallonPerDay, parsedUnit);
+ }
+
+ {
+ Assert.True(VolumeFlow.TryParseUnit("Mgal/d", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit));
+ Assert.Equal(VolumeFlowUnit.MegausGallonPerDay, parsedUnit);
+ }
+
{
Assert.True(VolumeFlow.TryParseUnit("µl/day", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit));
Assert.Equal(VolumeFlowUnit.MicroliterPerDay, parsedUnit);
@@ -4080,7 +4172,9 @@ public void ConversionRoundTrip()
AssertEx.EqualTolerance(1, VolumeFlow.FromMegalitersPerHour(cubicmeterpersecond.MegalitersPerHour).CubicMetersPerSecond, MegalitersPerHourTolerance);
AssertEx.EqualTolerance(1, VolumeFlow.FromMegalitersPerMinute(cubicmeterpersecond.MegalitersPerMinute).CubicMetersPerSecond, MegalitersPerMinuteTolerance);
AssertEx.EqualTolerance(1, VolumeFlow.FromMegalitersPerSecond(cubicmeterpersecond.MegalitersPerSecond).CubicMetersPerSecond, MegalitersPerSecondTolerance);
+ AssertEx.EqualTolerance(1, VolumeFlow.FromMegaukGallonsPerDay(cubicmeterpersecond.MegaukGallonsPerDay).CubicMetersPerSecond, MegaukGallonsPerDayTolerance);
AssertEx.EqualTolerance(1, VolumeFlow.FromMegaukGallonsPerSecond(cubicmeterpersecond.MegaukGallonsPerSecond).CubicMetersPerSecond, MegaukGallonsPerSecondTolerance);
+ AssertEx.EqualTolerance(1, VolumeFlow.FromMegausGallonsPerDay(cubicmeterpersecond.MegausGallonsPerDay).CubicMetersPerSecond, MegausGallonsPerDayTolerance);
AssertEx.EqualTolerance(1, VolumeFlow.FromMicrolitersPerDay(cubicmeterpersecond.MicrolitersPerDay).CubicMetersPerSecond, MicrolitersPerDayTolerance);
AssertEx.EqualTolerance(1, VolumeFlow.FromMicrolitersPerHour(cubicmeterpersecond.MicrolitersPerHour).CubicMetersPerSecond, MicrolitersPerHourTolerance);
AssertEx.EqualTolerance(1, VolumeFlow.FromMicrolitersPerMinute(cubicmeterpersecond.MicrolitersPerMinute).CubicMetersPerSecond, MicrolitersPerMinuteTolerance);
@@ -4292,7 +4386,9 @@ public void ToString_ReturnsValueAndUnitAbbreviationInCurrentCulture()
Assert.Equal("1 ML/h", new VolumeFlow(1, VolumeFlowUnit.MegaliterPerHour).ToString());
Assert.Equal("1 ML/min", new VolumeFlow(1, VolumeFlowUnit.MegaliterPerMinute).ToString());
Assert.Equal("1 ML/s", new VolumeFlow(1, VolumeFlowUnit.MegaliterPerSecond).ToString());
+ Assert.Equal("1 Mgal (U. K.)/d", new VolumeFlow(1, VolumeFlowUnit.MegaukGallonPerDay).ToString());
Assert.Equal("1 Mgal (imp.)/s", new VolumeFlow(1, VolumeFlowUnit.MegaukGallonPerSecond).ToString());
+ Assert.Equal("1 Mgpd", new VolumeFlow(1, VolumeFlowUnit.MegausGallonPerDay).ToString());
Assert.Equal("1 µl/day", new VolumeFlow(1, VolumeFlowUnit.MicroliterPerDay).ToString());
Assert.Equal("1 µL/h", new VolumeFlow(1, VolumeFlowUnit.MicroliterPerHour).ToString());
Assert.Equal("1 µL/min", new VolumeFlow(1, VolumeFlowUnit.MicroliterPerMinute).ToString());
@@ -4370,7 +4466,9 @@ public void ToString_WithSwedishCulture_ReturnsUnitAbbreviationForEnglishCulture
Assert.Equal("1 ML/h", new VolumeFlow(1, VolumeFlowUnit.MegaliterPerHour).ToString(swedishCulture));
Assert.Equal("1 ML/min", new VolumeFlow(1, VolumeFlowUnit.MegaliterPerMinute).ToString(swedishCulture));
Assert.Equal("1 ML/s", new VolumeFlow(1, VolumeFlowUnit.MegaliterPerSecond).ToString(swedishCulture));
+ Assert.Equal("1 Mgal (U. K.)/d", new VolumeFlow(1, VolumeFlowUnit.MegaukGallonPerDay).ToString(swedishCulture));
Assert.Equal("1 Mgal (imp.)/s", new VolumeFlow(1, VolumeFlowUnit.MegaukGallonPerSecond).ToString(swedishCulture));
+ Assert.Equal("1 Mgpd", new VolumeFlow(1, VolumeFlowUnit.MegausGallonPerDay).ToString(swedishCulture));
Assert.Equal("1 µl/day", new VolumeFlow(1, VolumeFlowUnit.MicroliterPerDay).ToString(swedishCulture));
Assert.Equal("1 µL/h", new VolumeFlow(1, VolumeFlowUnit.MicroliterPerHour).ToString(swedishCulture));
Assert.Equal("1 µL/min", new VolumeFlow(1, VolumeFlowUnit.MicroliterPerMinute).ToString(swedishCulture));
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs
index 6b98d1ebfe..006ee6ab74 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs
@@ -41,6 +41,7 @@ public abstract partial class VolumePerLengthTestsBase : QuantityTestsBase
protected abstract double CubicMetersPerMeterInOneCubicMeterPerMeter { get; }
protected abstract double CubicYardsPerFootInOneCubicMeterPerMeter { get; }
protected abstract double CubicYardsPerUsSurveyFootInOneCubicMeterPerMeter { get; }
+ protected abstract double ImperialGallonsPerMileInOneCubicMeterPerMeter { get; }
protected abstract double LitersPerKilometerInOneCubicMeterPerMeter { get; }
protected abstract double LitersPerMeterInOneCubicMeterPerMeter { get; }
protected abstract double LitersPerMillimeterInOneCubicMeterPerMeter { get; }
@@ -51,6 +52,7 @@ public abstract partial class VolumePerLengthTestsBase : QuantityTestsBase
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 ImperialGallonsPerMileTolerance { get { return 1e-5; } }
protected virtual double LitersPerKilometerTolerance { get { return 1e-5; } }
protected virtual double LitersPerMeterTolerance { get { return 1e-5; } }
protected virtual double LitersPerMillimeterTolerance { get { return 1e-5; } }
@@ -65,6 +67,7 @@ public abstract partial class VolumePerLengthTestsBase : QuantityTestsBase
VolumePerLengthUnit.CubicMeterPerMeter => (CubicMetersPerMeterInOneCubicMeterPerMeter, CubicMetersPerMeterTolerance),
VolumePerLengthUnit.CubicYardPerFoot => (CubicYardsPerFootInOneCubicMeterPerMeter, CubicYardsPerFootTolerance),
VolumePerLengthUnit.CubicYardPerUsSurveyFoot => (CubicYardsPerUsSurveyFootInOneCubicMeterPerMeter, CubicYardsPerUsSurveyFootTolerance),
+ VolumePerLengthUnit.ImperialGallonPerMile => (ImperialGallonsPerMileInOneCubicMeterPerMeter, ImperialGallonsPerMileTolerance),
VolumePerLengthUnit.LiterPerKilometer => (LitersPerKilometerInOneCubicMeterPerMeter, LitersPerKilometerTolerance),
VolumePerLengthUnit.LiterPerMeter => (LitersPerMeterInOneCubicMeterPerMeter, LitersPerMeterTolerance),
VolumePerLengthUnit.LiterPerMillimeter => (LitersPerMillimeterInOneCubicMeterPerMeter, LitersPerMillimeterTolerance),
@@ -79,6 +82,7 @@ public abstract partial class VolumePerLengthTestsBase : QuantityTestsBase
new object[] { VolumePerLengthUnit.CubicMeterPerMeter },
new object[] { VolumePerLengthUnit.CubicYardPerFoot },
new object[] { VolumePerLengthUnit.CubicYardPerUsSurveyFoot },
+ new object[] { VolumePerLengthUnit.ImperialGallonPerMile },
new object[] { VolumePerLengthUnit.LiterPerKilometer },
new object[] { VolumePerLengthUnit.LiterPerMeter },
new object[] { VolumePerLengthUnit.LiterPerMillimeter },
@@ -149,6 +153,7 @@ public void CubicMeterPerMeterToVolumePerLengthUnits()
AssertEx.EqualTolerance(CubicMetersPerMeterInOneCubicMeterPerMeter, cubicmeterpermeter.CubicMetersPerMeter, CubicMetersPerMeterTolerance);
AssertEx.EqualTolerance(CubicYardsPerFootInOneCubicMeterPerMeter, cubicmeterpermeter.CubicYardsPerFoot, CubicYardsPerFootTolerance);
AssertEx.EqualTolerance(CubicYardsPerUsSurveyFootInOneCubicMeterPerMeter, cubicmeterpermeter.CubicYardsPerUsSurveyFoot, CubicYardsPerUsSurveyFootTolerance);
+ AssertEx.EqualTolerance(ImperialGallonsPerMileInOneCubicMeterPerMeter, cubicmeterpermeter.ImperialGallonsPerMile, ImperialGallonsPerMileTolerance);
AssertEx.EqualTolerance(LitersPerKilometerInOneCubicMeterPerMeter, cubicmeterpermeter.LitersPerKilometer, LitersPerKilometerTolerance);
AssertEx.EqualTolerance(LitersPerMeterInOneCubicMeterPerMeter, cubicmeterpermeter.LitersPerMeter, LitersPerMeterTolerance);
AssertEx.EqualTolerance(LitersPerMillimeterInOneCubicMeterPerMeter, cubicmeterpermeter.LitersPerMillimeter, LitersPerMillimeterTolerance);
@@ -171,25 +176,29 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit()
AssertEx.EqualTolerance(1, quantity02.CubicYardsPerUsSurveyFoot, CubicYardsPerUsSurveyFootTolerance);
Assert.Equal(VolumePerLengthUnit.CubicYardPerUsSurveyFoot, quantity02.Unit);
- var quantity03 = VolumePerLength.From(1, VolumePerLengthUnit.LiterPerKilometer);
- AssertEx.EqualTolerance(1, quantity03.LitersPerKilometer, LitersPerKilometerTolerance);
- Assert.Equal(VolumePerLengthUnit.LiterPerKilometer, quantity03.Unit);
+ var quantity03 = VolumePerLength.From(1, VolumePerLengthUnit.ImperialGallonPerMile);
+ AssertEx.EqualTolerance(1, quantity03.ImperialGallonsPerMile, ImperialGallonsPerMileTolerance);
+ Assert.Equal(VolumePerLengthUnit.ImperialGallonPerMile, quantity03.Unit);
- var quantity04 = VolumePerLength.From(1, VolumePerLengthUnit.LiterPerMeter);
- AssertEx.EqualTolerance(1, quantity04.LitersPerMeter, LitersPerMeterTolerance);
- Assert.Equal(VolumePerLengthUnit.LiterPerMeter, quantity04.Unit);
+ var quantity04 = VolumePerLength.From(1, VolumePerLengthUnit.LiterPerKilometer);
+ AssertEx.EqualTolerance(1, quantity04.LitersPerKilometer, LitersPerKilometerTolerance);
+ Assert.Equal(VolumePerLengthUnit.LiterPerKilometer, quantity04.Unit);
- var quantity05 = VolumePerLength.From(1, VolumePerLengthUnit.LiterPerMillimeter);
- AssertEx.EqualTolerance(1, quantity05.LitersPerMillimeter, LitersPerMillimeterTolerance);
- Assert.Equal(VolumePerLengthUnit.LiterPerMillimeter, quantity05.Unit);
+ var quantity05 = VolumePerLength.From(1, VolumePerLengthUnit.LiterPerMeter);
+ AssertEx.EqualTolerance(1, quantity05.LitersPerMeter, LitersPerMeterTolerance);
+ Assert.Equal(VolumePerLengthUnit.LiterPerMeter, quantity05.Unit);
- var quantity06 = VolumePerLength.From(1, VolumePerLengthUnit.OilBarrelPerFoot);
- AssertEx.EqualTolerance(1, quantity06.OilBarrelsPerFoot, OilBarrelsPerFootTolerance);
- Assert.Equal(VolumePerLengthUnit.OilBarrelPerFoot, quantity06.Unit);
+ var quantity06 = VolumePerLength.From(1, VolumePerLengthUnit.LiterPerMillimeter);
+ AssertEx.EqualTolerance(1, quantity06.LitersPerMillimeter, LitersPerMillimeterTolerance);
+ Assert.Equal(VolumePerLengthUnit.LiterPerMillimeter, quantity06.Unit);
- var quantity07 = VolumePerLength.From(1, VolumePerLengthUnit.UsGallonPerMile);
- AssertEx.EqualTolerance(1, quantity07.UsGallonsPerMile, UsGallonsPerMileTolerance);
- Assert.Equal(VolumePerLengthUnit.UsGallonPerMile, quantity07.Unit);
+ var quantity07 = VolumePerLength.From(1, VolumePerLengthUnit.OilBarrelPerFoot);
+ AssertEx.EqualTolerance(1, quantity07.OilBarrelsPerFoot, OilBarrelsPerFootTolerance);
+ Assert.Equal(VolumePerLengthUnit.OilBarrelPerFoot, quantity07.Unit);
+
+ var quantity08 = VolumePerLength.From(1, VolumePerLengthUnit.UsGallonPerMile);
+ AssertEx.EqualTolerance(1, quantity08.UsGallonsPerMile, UsGallonsPerMileTolerance);
+ Assert.Equal(VolumePerLengthUnit.UsGallonPerMile, quantity08.Unit);
}
@@ -213,6 +222,7 @@ public void As()
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(ImperialGallonsPerMileInOneCubicMeterPerMeter, cubicmeterpermeter.As(VolumePerLengthUnit.ImperialGallonPerMile), ImperialGallonsPerMileTolerance);
AssertEx.EqualTolerance(LitersPerKilometerInOneCubicMeterPerMeter, cubicmeterpermeter.As(VolumePerLengthUnit.LiterPerKilometer), LitersPerKilometerTolerance);
AssertEx.EqualTolerance(LitersPerMeterInOneCubicMeterPerMeter, cubicmeterpermeter.As(VolumePerLengthUnit.LiterPerMeter), LitersPerMeterTolerance);
AssertEx.EqualTolerance(LitersPerMillimeterInOneCubicMeterPerMeter, cubicmeterpermeter.As(VolumePerLengthUnit.LiterPerMillimeter), LitersPerMillimeterTolerance);
@@ -261,6 +271,13 @@ public void Parse()
Assert.Equal(VolumePerLengthUnit.CubicYardPerUsSurveyFoot, parsed.Unit);
} catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+ try
+ {
+ var parsed = VolumePerLength.Parse("1 gal (imp.)/mi", CultureInfo.GetCultureInfo("en-US"));
+ AssertEx.EqualTolerance(1, parsed.ImperialGallonsPerMile, ImperialGallonsPerMileTolerance);
+ Assert.Equal(VolumePerLengthUnit.ImperialGallonPerMile, parsed.Unit);
+ } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+
try
{
var parsed = VolumePerLength.Parse("1 l/km", CultureInfo.GetCultureInfo("en-US"));
@@ -319,6 +336,12 @@ public void TryParse()
Assert.Equal(VolumePerLengthUnit.CubicYardPerUsSurveyFoot, parsed.Unit);
}
+ {
+ Assert.True(VolumePerLength.TryParse("1 gal (imp.)/mi", CultureInfo.GetCultureInfo("en-US"), out var parsed));
+ AssertEx.EqualTolerance(1, parsed.ImperialGallonsPerMile, ImperialGallonsPerMileTolerance);
+ Assert.Equal(VolumePerLengthUnit.ImperialGallonPerMile, parsed.Unit);
+ }
+
{
Assert.True(VolumePerLength.TryParse("1 l/km", CultureInfo.GetCultureInfo("en-US"), out var parsed));
AssertEx.EqualTolerance(1, parsed.LitersPerKilometer, LitersPerKilometerTolerance);
@@ -372,6 +395,12 @@ public void ParseUnit()
Assert.Equal(VolumePerLengthUnit.CubicYardPerUsSurveyFoot, parsedUnit);
} catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+ try
+ {
+ var parsedUnit = VolumePerLength.ParseUnit("gal (imp.)/mi", CultureInfo.GetCultureInfo("en-US"));
+ Assert.Equal(VolumePerLengthUnit.ImperialGallonPerMile, parsedUnit);
+ } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+
try
{
var parsedUnit = VolumePerLength.ParseUnit("l/km", CultureInfo.GetCultureInfo("en-US"));
@@ -422,6 +451,11 @@ public void TryParseUnit()
Assert.Equal(VolumePerLengthUnit.CubicYardPerUsSurveyFoot, parsedUnit);
}
+ {
+ Assert.True(VolumePerLength.TryParseUnit("gal (imp.)/mi", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit));
+ Assert.Equal(VolumePerLengthUnit.ImperialGallonPerMile, parsedUnit);
+ }
+
{
Assert.True(VolumePerLength.TryParseUnit("l/km", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit));
Assert.Equal(VolumePerLengthUnit.LiterPerKilometer, parsedUnit);
@@ -498,6 +532,7 @@ public void ConversionRoundTrip()
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.FromImperialGallonsPerMile(cubicmeterpermeter.ImperialGallonsPerMile).CubicMetersPerMeter, ImperialGallonsPerMileTolerance);
AssertEx.EqualTolerance(1, VolumePerLength.FromLitersPerKilometer(cubicmeterpermeter.LitersPerKilometer).CubicMetersPerMeter, LitersPerKilometerTolerance);
AssertEx.EqualTolerance(1, VolumePerLength.FromLitersPerMeter(cubicmeterpermeter.LitersPerMeter).CubicMetersPerMeter, LitersPerMeterTolerance);
AssertEx.EqualTolerance(1, VolumePerLength.FromLitersPerMillimeter(cubicmeterpermeter.LitersPerMillimeter).CubicMetersPerMeter, LitersPerMillimeterTolerance);
@@ -653,6 +688,7 @@ public void ToString_ReturnsValueAndUnitAbbreviationInCurrentCulture()
Assert.Equal("1 m³/m", new VolumePerLength(1, VolumePerLengthUnit.CubicMeterPerMeter).ToString());
Assert.Equal("1 yd³/ft", new VolumePerLength(1, VolumePerLengthUnit.CubicYardPerFoot).ToString());
Assert.Equal("1 yd³/ftUS", new VolumePerLength(1, VolumePerLengthUnit.CubicYardPerUsSurveyFoot).ToString());
+ Assert.Equal("1 gal (imp.)/mi", new VolumePerLength(1, VolumePerLengthUnit.ImperialGallonPerMile).ToString());
Assert.Equal("1 l/km", new VolumePerLength(1, VolumePerLengthUnit.LiterPerKilometer).ToString());
Assert.Equal("1 l/m", new VolumePerLength(1, VolumePerLengthUnit.LiterPerMeter).ToString());
Assert.Equal("1 l/mm", new VolumePerLength(1, VolumePerLengthUnit.LiterPerMillimeter).ToString());
@@ -674,6 +710,7 @@ public void ToString_WithSwedishCulture_ReturnsUnitAbbreviationForEnglishCulture
Assert.Equal("1 m³/m", new VolumePerLength(1, VolumePerLengthUnit.CubicMeterPerMeter).ToString(swedishCulture));
Assert.Equal("1 yd³/ft", new VolumePerLength(1, VolumePerLengthUnit.CubicYardPerFoot).ToString(swedishCulture));
Assert.Equal("1 yd³/ftUS", new VolumePerLength(1, VolumePerLengthUnit.CubicYardPerUsSurveyFoot).ToString(swedishCulture));
+ Assert.Equal("1 gal (imp.)/mi", new VolumePerLength(1, VolumePerLengthUnit.ImperialGallonPerMile).ToString(swedishCulture));
Assert.Equal("1 l/km", new VolumePerLength(1, VolumePerLengthUnit.LiterPerKilometer).ToString(swedishCulture));
Assert.Equal("1 l/m", new VolumePerLength(1, VolumePerLengthUnit.LiterPerMeter).ToString(swedishCulture));
Assert.Equal("1 l/mm", new VolumePerLength(1, VolumePerLengthUnit.LiterPerMillimeter).ToString(swedishCulture));
diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs
index fb7c8d9f09..9fef172f66 100644
--- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs
@@ -104,7 +104,9 @@ static VolumeFlow()
new UnitInfo(VolumeFlowUnit.MegaliterPerHour, "MegalitersPerHour", BaseUnits.Undefined),
new UnitInfo(VolumeFlowUnit.MegaliterPerMinute, "MegalitersPerMinute", BaseUnits.Undefined),
new UnitInfo(VolumeFlowUnit.MegaliterPerSecond, "MegalitersPerSecond", BaseUnits.Undefined),
+ new UnitInfo(VolumeFlowUnit.MegaukGallonPerDay, "MegaukGallonsPerDay", BaseUnits.Undefined),
new UnitInfo(VolumeFlowUnit.MegaukGallonPerSecond, "MegaukGallonsPerSecond", BaseUnits.Undefined),
+ new UnitInfo(VolumeFlowUnit.MegausGallonPerDay, "MegausGallonsPerDay", BaseUnits.Undefined),
new UnitInfo(VolumeFlowUnit.MicroliterPerDay, "MicrolitersPerDay", BaseUnits.Undefined),
new UnitInfo(VolumeFlowUnit.MicroliterPerHour, "MicrolitersPerHour", BaseUnits.Undefined),
new UnitInfo(VolumeFlowUnit.MicroliterPerMinute, "MicrolitersPerMinute", BaseUnits.Undefined),
@@ -428,11 +430,21 @@ public VolumeFlow(double value, UnitSystem unitSystem)
///
public double MegalitersPerSecond => As(VolumeFlowUnit.MegaliterPerSecond);
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double MegaukGallonsPerDay => As(VolumeFlowUnit.MegaukGallonPerDay);
+
///
/// Gets a value of this quantity converted into
///
public double MegaukGallonsPerSecond => As(VolumeFlowUnit.MegaukGallonPerSecond);
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double MegausGallonsPerDay => As(VolumeFlowUnit.MegausGallonPerDay);
+
///
/// Gets a value of this quantity converted into
///
@@ -607,7 +619,9 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
unitConverter.SetConversionFunction(VolumeFlowUnit.MegaliterPerHour, VolumeFlowUnit.CubicMeterPerSecond, quantity => quantity.ToUnit(VolumeFlowUnit.CubicMeterPerSecond));
unitConverter.SetConversionFunction(VolumeFlowUnit.MegaliterPerMinute, VolumeFlowUnit.CubicMeterPerSecond, quantity => quantity.ToUnit(VolumeFlowUnit.CubicMeterPerSecond));
unitConverter.SetConversionFunction(VolumeFlowUnit.MegaliterPerSecond, VolumeFlowUnit.CubicMeterPerSecond, quantity => quantity.ToUnit(VolumeFlowUnit.CubicMeterPerSecond));
+ unitConverter.SetConversionFunction(VolumeFlowUnit.MegaukGallonPerDay, VolumeFlowUnit.CubicMeterPerSecond, quantity => quantity.ToUnit(VolumeFlowUnit.CubicMeterPerSecond));
unitConverter.SetConversionFunction(VolumeFlowUnit.MegaukGallonPerSecond, VolumeFlowUnit.CubicMeterPerSecond, quantity => quantity.ToUnit(VolumeFlowUnit.CubicMeterPerSecond));
+ unitConverter.SetConversionFunction(VolumeFlowUnit.MegausGallonPerDay, VolumeFlowUnit.CubicMeterPerSecond, quantity => quantity.ToUnit(VolumeFlowUnit.CubicMeterPerSecond));
unitConverter.SetConversionFunction(VolumeFlowUnit.MicroliterPerDay, VolumeFlowUnit.CubicMeterPerSecond, quantity => quantity.ToUnit(VolumeFlowUnit.CubicMeterPerSecond));
unitConverter.SetConversionFunction(VolumeFlowUnit.MicroliterPerHour, VolumeFlowUnit.CubicMeterPerSecond, quantity => quantity.ToUnit(VolumeFlowUnit.CubicMeterPerSecond));
unitConverter.SetConversionFunction(VolumeFlowUnit.MicroliterPerMinute, VolumeFlowUnit.CubicMeterPerSecond, quantity => quantity.ToUnit(VolumeFlowUnit.CubicMeterPerSecond));
@@ -676,7 +690,9 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MegaliterPerHour, quantity => quantity.ToUnit(VolumeFlowUnit.MegaliterPerHour));
unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MegaliterPerMinute, quantity => quantity.ToUnit(VolumeFlowUnit.MegaliterPerMinute));
unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MegaliterPerSecond, quantity => quantity.ToUnit(VolumeFlowUnit.MegaliterPerSecond));
+ unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MegaukGallonPerDay, quantity => quantity.ToUnit(VolumeFlowUnit.MegaukGallonPerDay));
unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MegaukGallonPerSecond, quantity => quantity.ToUnit(VolumeFlowUnit.MegaukGallonPerSecond));
+ unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MegausGallonPerDay, quantity => quantity.ToUnit(VolumeFlowUnit.MegausGallonPerDay));
unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MicroliterPerDay, quantity => quantity.ToUnit(VolumeFlowUnit.MicroliterPerDay));
unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MicroliterPerHour, quantity => quantity.ToUnit(VolumeFlowUnit.MicroliterPerHour));
unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MicroliterPerMinute, quantity => quantity.ToUnit(VolumeFlowUnit.MicroliterPerMinute));
@@ -766,7 +782,9 @@ internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbrev
unitAbbreviationsCache.PerformAbbreviationMapping(VolumeFlowUnit.MegaliterPerMinute, new CultureInfo("ru-RU"), false, true, new string[]{"Мл/мин"});
unitAbbreviationsCache.PerformAbbreviationMapping(VolumeFlowUnit.MegaliterPerSecond, new CultureInfo("en-US"), false, true, new string[]{"ML/s", "MLPS"});
unitAbbreviationsCache.PerformAbbreviationMapping(VolumeFlowUnit.MegaliterPerSecond, new CultureInfo("ru-RU"), false, true, new string[]{"Мл/c"});
+ unitAbbreviationsCache.PerformAbbreviationMapping(VolumeFlowUnit.MegaukGallonPerDay, new CultureInfo("en-US"), false, true, new string[]{"Mgal (U. K.)/d"});
unitAbbreviationsCache.PerformAbbreviationMapping(VolumeFlowUnit.MegaukGallonPerSecond, new CultureInfo("en-US"), false, true, new string[]{"Mgal (imp.)/s"});
+ unitAbbreviationsCache.PerformAbbreviationMapping(VolumeFlowUnit.MegausGallonPerDay, new CultureInfo("en-US"), false, true, new string[]{"Mgpd", "Mgal/d"});
unitAbbreviationsCache.PerformAbbreviationMapping(VolumeFlowUnit.MicroliterPerDay, new CultureInfo("en-US"), false, true, new string[]{"µl/day", "µL/d", "µLPD"});
unitAbbreviationsCache.PerformAbbreviationMapping(VolumeFlowUnit.MicroliterPerHour, new CultureInfo("en-US"), false, true, new string[]{"µL/h", "µLPH"});
unitAbbreviationsCache.PerformAbbreviationMapping(VolumeFlowUnit.MicroliterPerHour, new CultureInfo("ru-RU"), false, true, new string[]{"мкл/ч"});
@@ -1218,6 +1236,16 @@ public static VolumeFlow FromMegalitersPerSecond(QuantityValue megalitersperseco
return new VolumeFlow(value, VolumeFlowUnit.MegaliterPerSecond);
}
+ ///
+ /// Creates a from .
+ ///
+ /// If value is NaN or Infinity.
+ public static VolumeFlow FromMegaukGallonsPerDay(QuantityValue megaukgallonsperday)
+ {
+ double value = (double) megaukgallonsperday;
+ return new VolumeFlow(value, VolumeFlowUnit.MegaukGallonPerDay);
+ }
+
///
/// Creates a from .
///
@@ -1228,6 +1256,16 @@ public static VolumeFlow FromMegaukGallonsPerSecond(QuantityValue megaukgallonsp
return new VolumeFlow(value, VolumeFlowUnit.MegaukGallonPerSecond);
}
+ ///
+ /// Creates a from .
+ ///
+ /// If value is NaN or Infinity.
+ public static VolumeFlow FromMegausGallonsPerDay(QuantityValue megausgallonsperday)
+ {
+ double value = (double) megausgallonsperday;
+ return new VolumeFlow(value, VolumeFlowUnit.MegausGallonPerDay);
+ }
+
///
/// Creates a from .
///
@@ -1991,7 +2029,9 @@ private bool TryToUnit(VolumeFlowUnit unit, [NotNullWhen(true)] out VolumeFlow?
(VolumeFlowUnit.MegaliterPerHour, VolumeFlowUnit.CubicMeterPerSecond) => new VolumeFlow((_value / 3600000.000) * 1e6d, VolumeFlowUnit.CubicMeterPerSecond),
(VolumeFlowUnit.MegaliterPerMinute, VolumeFlowUnit.CubicMeterPerSecond) => new VolumeFlow((_value / 60000.00000) * 1e6d, VolumeFlowUnit.CubicMeterPerSecond),
(VolumeFlowUnit.MegaliterPerSecond, VolumeFlowUnit.CubicMeterPerSecond) => new VolumeFlow((_value / 1000) * 1e6d, VolumeFlowUnit.CubicMeterPerSecond),
+ (VolumeFlowUnit.MegaukGallonPerDay, VolumeFlowUnit.CubicMeterPerSecond) => new VolumeFlow((_value / 19005304) * 1e6d, VolumeFlowUnit.CubicMeterPerSecond),
(VolumeFlowUnit.MegaukGallonPerSecond, VolumeFlowUnit.CubicMeterPerSecond) => new VolumeFlow((_value / 219.969) * 1e6d, VolumeFlowUnit.CubicMeterPerSecond),
+ (VolumeFlowUnit.MegausGallonPerDay, VolumeFlowUnit.CubicMeterPerSecond) => new VolumeFlow((_value / 22824465.227) * 1e6d, VolumeFlowUnit.CubicMeterPerSecond),
(VolumeFlowUnit.MicroliterPerDay, VolumeFlowUnit.CubicMeterPerSecond) => new VolumeFlow((_value / 86400000) * 1e-6d, VolumeFlowUnit.CubicMeterPerSecond),
(VolumeFlowUnit.MicroliterPerHour, VolumeFlowUnit.CubicMeterPerSecond) => new VolumeFlow((_value / 3600000.000) * 1e-6d, VolumeFlowUnit.CubicMeterPerSecond),
(VolumeFlowUnit.MicroliterPerMinute, VolumeFlowUnit.CubicMeterPerSecond) => new VolumeFlow((_value / 60000.00000) * 1e-6d, VolumeFlowUnit.CubicMeterPerSecond),
@@ -2057,7 +2097,9 @@ private bool TryToUnit(VolumeFlowUnit unit, [NotNullWhen(true)] out VolumeFlow?
(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MegaliterPerHour) => new VolumeFlow((_value * 3600000.000) / 1e6d, VolumeFlowUnit.MegaliterPerHour),
(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MegaliterPerMinute) => new VolumeFlow((_value * 60000.00000) / 1e6d, VolumeFlowUnit.MegaliterPerMinute),
(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MegaliterPerSecond) => new VolumeFlow((_value * 1000) / 1e6d, VolumeFlowUnit.MegaliterPerSecond),
+ (VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MegaukGallonPerDay) => new VolumeFlow((_value * 19005304) / 1e6d, VolumeFlowUnit.MegaukGallonPerDay),
(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MegaukGallonPerSecond) => new VolumeFlow((_value * 219.969) / 1e6d, VolumeFlowUnit.MegaukGallonPerSecond),
+ (VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MegausGallonPerDay) => new VolumeFlow((_value * 22824465.227) / 1e6d, VolumeFlowUnit.MegausGallonPerDay),
(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MicroliterPerDay) => new VolumeFlow((_value * 86400000) / 1e-6d, VolumeFlowUnit.MicroliterPerDay),
(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MicroliterPerHour) => new VolumeFlow((_value * 3600000.000) / 1e-6d, VolumeFlowUnit.MicroliterPerHour),
(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.MicroliterPerMinute) => new VolumeFlow((_value * 60000.00000) / 1e-6d, VolumeFlowUnit.MicroliterPerMinute),
diff --git a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs
index 8d3b01d729..9ac08db36a 100644
--- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs
@@ -68,6 +68,7 @@ static VolumePerLength()
new UnitInfo(VolumePerLengthUnit.CubicMeterPerMeter, "CubicMetersPerMeter", new BaseUnits(length: LengthUnit.Meter)),
new UnitInfo(VolumePerLengthUnit.CubicYardPerFoot, "CubicYardsPerFoot", BaseUnits.Undefined),
new UnitInfo(VolumePerLengthUnit.CubicYardPerUsSurveyFoot, "CubicYardsPerUsSurveyFoot", BaseUnits.Undefined),
+ new UnitInfo(VolumePerLengthUnit.ImperialGallonPerMile, "ImperialGallonsPerMile", BaseUnits.Undefined),
new UnitInfo(VolumePerLengthUnit.LiterPerKilometer, "LitersPerKilometer", BaseUnits.Undefined),
new UnitInfo(VolumePerLengthUnit.LiterPerMeter, "LitersPerMeter", new BaseUnits(length: LengthUnit.Decimeter)),
new UnitInfo(VolumePerLengthUnit.LiterPerMillimeter, "LitersPerMillimeter", BaseUnits.Undefined),
@@ -191,6 +192,11 @@ public VolumePerLength(double value, UnitSystem unitSystem)
///
public double CubicYardsPerUsSurveyFoot => As(VolumePerLengthUnit.CubicYardPerUsSurveyFoot);
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double ImperialGallonsPerMile => As(VolumePerLengthUnit.ImperialGallonPerMile);
+
///
/// Gets a value of this quantity converted into
///
@@ -229,6 +235,7 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
// Register in unit converter: VolumePerLengthUnit -> BaseUnit
unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicYardPerFoot, VolumePerLengthUnit.CubicMeterPerMeter, quantity => quantity.ToUnit(VolumePerLengthUnit.CubicMeterPerMeter));
unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicYardPerUsSurveyFoot, VolumePerLengthUnit.CubicMeterPerMeter, quantity => quantity.ToUnit(VolumePerLengthUnit.CubicMeterPerMeter));
+ unitConverter.SetConversionFunction(VolumePerLengthUnit.ImperialGallonPerMile, VolumePerLengthUnit.CubicMeterPerMeter, quantity => quantity.ToUnit(VolumePerLengthUnit.CubicMeterPerMeter));
unitConverter.SetConversionFunction(VolumePerLengthUnit.LiterPerKilometer, VolumePerLengthUnit.CubicMeterPerMeter, quantity => quantity.ToUnit(VolumePerLengthUnit.CubicMeterPerMeter));
unitConverter.SetConversionFunction(VolumePerLengthUnit.LiterPerMeter, VolumePerLengthUnit.CubicMeterPerMeter, quantity => quantity.ToUnit(VolumePerLengthUnit.CubicMeterPerMeter));
unitConverter.SetConversionFunction(VolumePerLengthUnit.LiterPerMillimeter, VolumePerLengthUnit.CubicMeterPerMeter, quantity => quantity.ToUnit(VolumePerLengthUnit.CubicMeterPerMeter));
@@ -241,6 +248,7 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
// Register in unit converter: BaseUnit -> VolumePerLengthUnit
unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.CubicYardPerFoot, quantity => quantity.ToUnit(VolumePerLengthUnit.CubicYardPerFoot));
unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.CubicYardPerUsSurveyFoot, quantity => quantity.ToUnit(VolumePerLengthUnit.CubicYardPerUsSurveyFoot));
+ unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.ImperialGallonPerMile, quantity => quantity.ToUnit(VolumePerLengthUnit.ImperialGallonPerMile));
unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.LiterPerKilometer, quantity => quantity.ToUnit(VolumePerLengthUnit.LiterPerKilometer));
unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.LiterPerMeter, quantity => quantity.ToUnit(VolumePerLengthUnit.LiterPerMeter));
unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.LiterPerMillimeter, quantity => quantity.ToUnit(VolumePerLengthUnit.LiterPerMillimeter));
@@ -253,6 +261,7 @@ internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbrev
unitAbbreviationsCache.PerformAbbreviationMapping(VolumePerLengthUnit.CubicMeterPerMeter, new CultureInfo("en-US"), false, true, new string[]{"m³/m"});
unitAbbreviationsCache.PerformAbbreviationMapping(VolumePerLengthUnit.CubicYardPerFoot, new CultureInfo("en-US"), false, true, new string[]{"yd³/ft"});
unitAbbreviationsCache.PerformAbbreviationMapping(VolumePerLengthUnit.CubicYardPerUsSurveyFoot, new CultureInfo("en-US"), false, true, new string[]{"yd³/ftUS"});
+ unitAbbreviationsCache.PerformAbbreviationMapping(VolumePerLengthUnit.ImperialGallonPerMile, new CultureInfo("en-US"), false, true, new string[]{"gal (imp.)/mi"});
unitAbbreviationsCache.PerformAbbreviationMapping(VolumePerLengthUnit.LiterPerKilometer, new CultureInfo("en-US"), false, true, new string[]{"l/km"});
unitAbbreviationsCache.PerformAbbreviationMapping(VolumePerLengthUnit.LiterPerMeter, new CultureInfo("en-US"), false, true, new string[]{"l/m"});
unitAbbreviationsCache.PerformAbbreviationMapping(VolumePerLengthUnit.LiterPerMillimeter, new CultureInfo("en-US"), false, true, new string[]{"l/mm"});
@@ -315,6 +324,16 @@ public static VolumePerLength FromCubicYardsPerUsSurveyFoot(QuantityValue cubicy
return new VolumePerLength(value, VolumePerLengthUnit.CubicYardPerUsSurveyFoot);
}
+ ///
+ /// Creates a from .
+ ///
+ /// If value is NaN or Infinity.
+ public static VolumePerLength FromImperialGallonsPerMile(QuantityValue imperialgallonspermile)
+ {
+ double value = (double) imperialgallonspermile;
+ return new VolumePerLength(value, VolumePerLengthUnit.ImperialGallonPerMile);
+ }
+
///
/// Creates a from .
///
@@ -842,20 +861,22 @@ private bool TryToUnit(VolumePerLengthUnit unit, [NotNullWhen(true)] out VolumeP
// VolumePerLengthUnit -> BaseUnit
(VolumePerLengthUnit.CubicYardPerFoot, VolumePerLengthUnit.CubicMeterPerMeter) => new VolumePerLength(_value * 2.50838208, VolumePerLengthUnit.CubicMeterPerMeter),
(VolumePerLengthUnit.CubicYardPerUsSurveyFoot, VolumePerLengthUnit.CubicMeterPerMeter) => new VolumePerLength(_value * 2.50837706323584, VolumePerLengthUnit.CubicMeterPerMeter),
+ (VolumePerLengthUnit.ImperialGallonPerMile, VolumePerLengthUnit.CubicMeterPerMeter) => new VolumePerLength(_value / (1000 * 1609.344 / 4.54609), VolumePerLengthUnit.CubicMeterPerMeter),
(VolumePerLengthUnit.LiterPerKilometer, VolumePerLengthUnit.CubicMeterPerMeter) => new VolumePerLength(_value / 1e6, VolumePerLengthUnit.CubicMeterPerMeter),
(VolumePerLengthUnit.LiterPerMeter, VolumePerLengthUnit.CubicMeterPerMeter) => new VolumePerLength(_value / 1000, VolumePerLengthUnit.CubicMeterPerMeter),
(VolumePerLengthUnit.LiterPerMillimeter, VolumePerLengthUnit.CubicMeterPerMeter) => new VolumePerLength(_value, VolumePerLengthUnit.CubicMeterPerMeter),
(VolumePerLengthUnit.OilBarrelPerFoot, VolumePerLengthUnit.CubicMeterPerMeter) => new VolumePerLength(_value / 1.91713408, VolumePerLengthUnit.CubicMeterPerMeter),
- (VolumePerLengthUnit.UsGallonPerMile, VolumePerLengthUnit.CubicMeterPerMeter) => new VolumePerLength(_value / 4.251439077933434e5, VolumePerLengthUnit.CubicMeterPerMeter),
+ (VolumePerLengthUnit.UsGallonPerMile, VolumePerLengthUnit.CubicMeterPerMeter) => new VolumePerLength(_value / (1000 * 1609.344 / 3.785411784), VolumePerLengthUnit.CubicMeterPerMeter),
// BaseUnit -> VolumePerLengthUnit
(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.CubicYardPerFoot) => new VolumePerLength(_value / 2.50838208, VolumePerLengthUnit.CubicYardPerFoot),
(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.CubicYardPerUsSurveyFoot) => new VolumePerLength(_value / 2.50837706323584, VolumePerLengthUnit.CubicYardPerUsSurveyFoot),
+ (VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.ImperialGallonPerMile) => new VolumePerLength(_value * (1000 * 1609.344 / 4.54609), VolumePerLengthUnit.ImperialGallonPerMile),
(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.LiterPerKilometer) => new VolumePerLength(_value * 1e6, VolumePerLengthUnit.LiterPerKilometer),
(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.LiterPerMeter) => new VolumePerLength(_value * 1000, VolumePerLengthUnit.LiterPerMeter),
(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.LiterPerMillimeter) => new VolumePerLength(_value, VolumePerLengthUnit.LiterPerMillimeter),
(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.OilBarrelPerFoot) => new VolumePerLength(_value * 1.91713408, VolumePerLengthUnit.OilBarrelPerFoot),
- (VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.UsGallonPerMile) => new VolumePerLength(_value * 4.251439077933434e5, VolumePerLengthUnit.UsGallonPerMile),
+ (VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.UsGallonPerMile) => new VolumePerLength(_value * (1000 * 1609.344 / 3.785411784), VolumePerLengthUnit.UsGallonPerMile),
_ => null
};
diff --git a/UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs b/UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs
index d8f0e8bc23..ab8b2bca49 100644
--- a/UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs
+++ b/UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs
@@ -64,7 +64,9 @@ public enum VolumeFlowUnit
MegaliterPerHour = 68,
MegaliterPerMinute = 64,
MegaliterPerSecond = 65,
+ MegaukGallonPerDay = 73,
MegaukGallonPerSecond = 37,
+ MegausGallonPerDay = 77,
MicroliterPerDay = 38,
MicroliterPerHour = 39,
MicroliterPerMinute = 40,
diff --git a/UnitsNet/GeneratedCode/Units/VolumePerLengthUnit.g.cs b/UnitsNet/GeneratedCode/Units/VolumePerLengthUnit.g.cs
index 6a5aa99334..526d9c8509 100644
--- a/UnitsNet/GeneratedCode/Units/VolumePerLengthUnit.g.cs
+++ b/UnitsNet/GeneratedCode/Units/VolumePerLengthUnit.g.cs
@@ -28,6 +28,7 @@ public enum VolumePerLengthUnit
CubicMeterPerMeter = 1,
CubicYardPerFoot = 2,
CubicYardPerUsSurveyFoot = 3,
+ ImperialGallonPerMile = 11,
LiterPerKilometer = 4,
LiterPerMeter = 5,
LiterPerMillimeter = 6,
From 1103add0b13e50d095a1841b48247c13ac932c68 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Papp=20Tam=C3=A1s?=
<22793739+t03apt@users.noreply.github.com>
Date: Mon, 13 Mar 2023 22:18:51 +0100
Subject: [PATCH 3/8] fix: VolumePerLengthTests
---
UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs b/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs
index b0bcfc5919..616fef0308 100644
--- a/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs
+++ b/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs
@@ -41,8 +41,8 @@ public class VolumePerLengthTests : VolumePerLengthTestsBase
protected override double LitersPerMillimeterInOneCubicMeterPerMeter => 1;
- protected override double UsGallonsPerMileInOneCubicMeterPerMeter => 4.251439077933434e5;
+ protected override double UsGallonsPerMileInOneCubicMeterPerMeter => 425144;
- protected override double ImperialGallonsPerMileInOneCubicMeterPerMeter => 3.54006189934647e5;
+ protected override double ImperialGallonsPerMileInOneCubicMeterPerMeter => 354006;
}
}
From 8b267a997fe2e6c03102bfcb0090a8cea74c7407 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Papp=20Tam=C3=A1s?=
<22793739+t03apt@users.noreply.github.com>
Date: Fri, 31 Mar 2023 12:52:15 +0200
Subject: [PATCH 4/8] fix: VolumePerLengthTests
---
UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs b/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs
index 616fef0308..7d8b69b95a 100644
--- a/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs
+++ b/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs
@@ -41,8 +41,8 @@ public class VolumePerLengthTests : VolumePerLengthTestsBase
protected override double LitersPerMillimeterInOneCubicMeterPerMeter => 1;
- protected override double UsGallonsPerMileInOneCubicMeterPerMeter => 425144;
+ protected override double UsGallonsPerMileInOneCubicMeterPerMeter => 4.25143707430272e5;
- protected override double ImperialGallonsPerMileInOneCubicMeterPerMeter => 354006;
+ protected override double ImperialGallonsPerMileInOneCubicMeterPerMeter => 3.540061899346471e5;
}
}
From ea47d5c6e7419438f692d2f5b0771d9768fdf53f Mon Sep 17 00:00:00 2001
From: Andreas Gullberg Larsen
Date: Sat, 1 Apr 2023 12:37:22 +0200
Subject: [PATCH 5/8] Update VolumeFlowTests.cs
Improve precision of test constants
---
UnitsNet.Tests/CustomCode/VolumeFlowTests.cs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs b/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs
index df4fc808cb..e5914c43d5 100644
--- a/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs
+++ b/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs
@@ -109,9 +109,11 @@ public class VolumeFlowTests : VolumeFlowTestsBase
protected override double MegaukGallonsPerSecondInOneCubicMeterPerSecond => 2.19969e-4;
- protected override double MegaukGallonsPerDayInOneCubicMeterPerSecond => 19.005304;
+ // https://www.wolframalpha.com/input?i=1.0000000000000000+Cubic+Meter+Per+Second+to+Megaukgallons+Per+Day
+ protected override double MegaukGallonsPerDayInOneCubicMeterPerSecond => 19.00534305304118;
- protected override double MegausGallonsPerDayInOneCubicMeterPerSecond => 22.824465227;
+ // https://www.wolframalpha.com/input?i=1.0000000000000000+Cubic+Meter+Per+Second+to+MegaGallons+Per+Day
+ protected override double MegausGallonsPerDayInOneCubicMeterPerSecond => 22.82446532374402;
protected override double MicrolitersPerDayInOneCubicMeterPerSecond => 8.64e+13;
From 62b9ea1bdbf7a7de63af806155bf364452558e2d Mon Sep 17 00:00:00 2001
From: Andreas Gullberg Larsen
Date: Sat, 1 Apr 2023 12:39:37 +0200
Subject: [PATCH 6/8] Document constants
---
UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs b/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs
index 7d8b69b95a..5be541c88a 100644
--- a/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs
+++ b/UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs
@@ -41,8 +41,10 @@ public class VolumePerLengthTests : VolumePerLengthTestsBase
protected override double LitersPerMillimeterInOneCubicMeterPerMeter => 1;
+ // https://www.wolframalpha.com/input?i=1.0000000000000000+cubic+meter+per+meter+to+us+gallon+per+mile
protected override double UsGallonsPerMileInOneCubicMeterPerMeter => 4.25143707430272e5;
+ // https://www.wolframalpha.com/input?i=1.0000000000000000+cubic+meter+per+meter+to+imperial+gallon+per+mile
protected override double ImperialGallonsPerMileInOneCubicMeterPerMeter => 3.540061899346471e5;
}
}
From 0d3b7c1123aaa481a9f0a3a85bc6a68c7219e24a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Papp=20Tam=C3=A1s?=
<22793739+t03apt@users.noreply.github.com>
Date: Sat, 1 Apr 2023 13:34:07 +0200
Subject: [PATCH 7/8] fix: MegaukGallonsPerDayInOneCubicMeterPerSecond,
MegausGallonsPerDayInOneCubicMeterPerSecond
---
UnitsNet.Tests/CustomCode/VolumeFlowTests.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs b/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs
index df4fc808cb..726030bf54 100644
--- a/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs
+++ b/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs
@@ -109,9 +109,9 @@ public class VolumeFlowTests : VolumeFlowTestsBase
protected override double MegaukGallonsPerSecondInOneCubicMeterPerSecond => 2.19969e-4;
- protected override double MegaukGallonsPerDayInOneCubicMeterPerSecond => 19.005304;
+ protected override double MegaukGallonsPerDayInOneCubicMeterPerSecond => 19.00534305304118;
- protected override double MegausGallonsPerDayInOneCubicMeterPerSecond => 22.824465227;
+ protected override double MegausGallonsPerDayInOneCubicMeterPerSecond => 22.82446532374402;
protected override double MicrolitersPerDayInOneCubicMeterPerSecond => 8.64e+13;
From c69748aea0f44f3a5891ac47274996ee2276f6bc Mon Sep 17 00:00:00 2001
From: Andreas Gullberg Larsen
Date: Sat, 1 Apr 2023 20:47:01 +0200
Subject: [PATCH 8/8] Add back documented sources
---
UnitsNet.Tests/CustomCode/VolumeFlowTests.cs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs b/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs
index 726030bf54..e5914c43d5 100644
--- a/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs
+++ b/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs
@@ -109,8 +109,10 @@ public class VolumeFlowTests : VolumeFlowTestsBase
protected override double MegaukGallonsPerSecondInOneCubicMeterPerSecond => 2.19969e-4;
+ // https://www.wolframalpha.com/input?i=1.0000000000000000+Cubic+Meter+Per+Second+to+Megaukgallons+Per+Day
protected override double MegaukGallonsPerDayInOneCubicMeterPerSecond => 19.00534305304118;
+ // https://www.wolframalpha.com/input?i=1.0000000000000000+Cubic+Meter+Per+Second+to+MegaGallons+Per+Day
protected override double MegausGallonsPerDayInOneCubicMeterPerSecond => 22.82446532374402;
protected override double MicrolitersPerDayInOneCubicMeterPerSecond => 8.64e+13;