Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Flow.CubicDecimeterPerMinute #170

Merged
merged 1 commit into from
Jun 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions UnitsNet.Tests/CustomCode/FlowTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class FlowTests : FlowTestsBase
{
protected override double CubicMetersPerHourInOneCubicMeterPerSecond => 3600.0;

protected override double CubicDecimetersPerMinuteInOneCubicMeterPerSecond => 60000.00000;

protected override double CubicFeetPerSecondInOneCubicMeterPerSecond => 35.314666213;

protected override double MillionUsGallonsPerDayInOneCubicMeterPerSecond => 22.824465227;
Expand Down
6 changes: 6 additions & 0 deletions UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace UnitsNet.Tests
public abstract partial class FlowTestsBase
{
protected abstract double CentilitersPerMinuteInOneCubicMeterPerSecond { get; }
protected abstract double CubicDecimetersPerMinuteInOneCubicMeterPerSecond { get; }
protected abstract double CubicFeetPerSecondInOneCubicMeterPerSecond { get; }
protected abstract double CubicMetersPerHourInOneCubicMeterPerSecond { get; }
protected abstract double CubicMetersPerSecondInOneCubicMeterPerSecond { get; }
Expand All @@ -51,6 +52,7 @@ public abstract partial class FlowTestsBase

// ReSharper disable VirtualMemberNeverOverriden.Global
protected virtual double CentilitersPerMinuteTolerance { get { return 1e-5; } }
protected virtual double CubicDecimetersPerMinuteTolerance { get { return 1e-5; } }
protected virtual double CubicFeetPerSecondTolerance { get { return 1e-5; } }
protected virtual double CubicMetersPerHourTolerance { get { return 1e-5; } }
protected virtual double CubicMetersPerSecondTolerance { get { return 1e-5; } }
Expand All @@ -69,6 +71,7 @@ public void CubicMeterPerSecondToFlowUnits()
{
Flow cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1);
Assert.AreEqual(CentilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CentilitersPerMinute, CentilitersPerMinuteTolerance);
Assert.AreEqual(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance);
Assert.AreEqual(CubicFeetPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicFeetPerSecond, CubicFeetPerSecondTolerance);
Assert.AreEqual(CubicMetersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerHour, CubicMetersPerHourTolerance);
Assert.AreEqual(CubicMetersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerSecond, CubicMetersPerSecondTolerance);
Expand All @@ -86,6 +89,7 @@ public void CubicMeterPerSecondToFlowUnits()
public void FromValueAndUnit()
{
Assert.AreEqual(1, Flow.From(1, FlowUnit.CentilitersPerMinute).CentilitersPerMinute, CentilitersPerMinuteTolerance);
Assert.AreEqual(1, Flow.From(1, FlowUnit.CubicDecimeterPerMinute).CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance);
Assert.AreEqual(1, Flow.From(1, FlowUnit.CubicFootPerSecond).CubicFeetPerSecond, CubicFeetPerSecondTolerance);
Assert.AreEqual(1, Flow.From(1, FlowUnit.CubicMeterPerHour).CubicMetersPerHour, CubicMetersPerHourTolerance);
Assert.AreEqual(1, Flow.From(1, FlowUnit.CubicMeterPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance);
Expand All @@ -104,6 +108,7 @@ public void As()
{
var cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1);
Assert.AreEqual(CentilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CentilitersPerMinute), CentilitersPerMinuteTolerance);
Assert.AreEqual(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicDecimeterPerMinute), CubicDecimetersPerMinuteTolerance);
Assert.AreEqual(CubicFeetPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicFootPerSecond), CubicFeetPerSecondTolerance);
Assert.AreEqual(CubicMetersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicMeterPerHour), CubicMetersPerHourTolerance);
Assert.AreEqual(CubicMetersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicMeterPerSecond), CubicMetersPerSecondTolerance);
Expand All @@ -122,6 +127,7 @@ public void ConversionRoundTrip()
{
Flow cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1);
Assert.AreEqual(1, Flow.FromCentilitersPerMinute(cubicmeterpersecond.CentilitersPerMinute).CubicMetersPerSecond, CentilitersPerMinuteTolerance);
Assert.AreEqual(1, Flow.FromCubicDecimetersPerMinute(cubicmeterpersecond.CubicDecimetersPerMinute).CubicMetersPerSecond, CubicDecimetersPerMinuteTolerance);
Assert.AreEqual(1, Flow.FromCubicFeetPerSecond(cubicmeterpersecond.CubicFeetPerSecond).CubicMetersPerSecond, CubicFeetPerSecondTolerance);
Assert.AreEqual(1, Flow.FromCubicMetersPerHour(cubicmeterpersecond.CubicMetersPerHour).CubicMetersPerSecond, CubicMetersPerHourTolerance);
Assert.AreEqual(1, Flow.FromCubicMetersPerSecond(cubicmeterpersecond.CubicMetersPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance);
Expand Down
1 change: 1 addition & 0 deletions UnitsNet/GeneratedCode/Enums/FlowUnit.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public enum FlowUnit
{
Undefined = 0,
CentilitersPerMinute,
CubicDecimeterPerMinute,
CubicFootPerSecond,
CubicMeterPerHour,
CubicMeterPerSecond,
Expand Down
37 changes: 37 additions & 0 deletions UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ public double CentilitersPerMinute
get { return (_cubicMetersPerSecond*60000.00000) / 1e-2d; }
}

/// <summary>
/// Get Flow in CubicDecimetersPerMinute.
/// </summary>
public double CubicDecimetersPerMinute
{
get { return _cubicMetersPerSecond*60000.00000; }
}

/// <summary>
/// Get Flow in CubicFeetPerSecond.
/// </summary>
Expand Down Expand Up @@ -206,6 +214,14 @@ public static Flow FromCentilitersPerMinute(double centilitersperminute)
return new Flow((centilitersperminute/60000.00000) * 1e-2d);
}

/// <summary>
/// Get Flow from CubicDecimetersPerMinute.
/// </summary>
public static Flow FromCubicDecimetersPerMinute(double cubicdecimetersperminute)
{
return new Flow(cubicdecimetersperminute/60000.00000);
}

/// <summary>
/// Get Flow from CubicFeetPerSecond.
/// </summary>
Expand Down Expand Up @@ -310,6 +326,21 @@ public static Flow FromUsGallonsPerMinute(double usgallonsperminute)
}
}

/// <summary>
/// Get nullable Flow from nullable CubicDecimetersPerMinute.
/// </summary>
public static Flow? FromCubicDecimetersPerMinute(double? cubicdecimetersperminute)
{
if (cubicdecimetersperminute.HasValue)
{
return FromCubicDecimetersPerMinute(cubicdecimetersperminute.Value);
}
else
{
return null;
}
}

/// <summary>
/// Get nullable Flow from nullable CubicFeetPerSecond.
/// </summary>
Expand Down Expand Up @@ -489,6 +520,8 @@ public static Flow From(double val, FlowUnit fromUnit)
{
case FlowUnit.CentilitersPerMinute:
return FromCentilitersPerMinute(val);
case FlowUnit.CubicDecimeterPerMinute:
return FromCubicDecimetersPerMinute(val);
case FlowUnit.CubicFootPerSecond:
return FromCubicFeetPerSecond(val);
case FlowUnit.CubicMeterPerHour:
Expand Down Expand Up @@ -534,6 +567,8 @@ public static Flow From(double val, FlowUnit fromUnit)
{
case FlowUnit.CentilitersPerMinute:
return FromCentilitersPerMinute(value.Value);
case FlowUnit.CubicDecimeterPerMinute:
return FromCubicDecimetersPerMinute(value.Value);
case FlowUnit.CubicFootPerSecond:
return FromCubicFeetPerSecond(value.Value);
case FlowUnit.CubicMeterPerHour:
Expand Down Expand Up @@ -712,6 +747,8 @@ public double As(FlowUnit unit)
{
case FlowUnit.CentilitersPerMinute:
return CentilitersPerMinute;
case FlowUnit.CubicDecimeterPerMinute:
return CubicDecimetersPerMinute;
case FlowUnit.CubicFootPerSecond:
return CubicFeetPerSecond;
case FlowUnit.CubicMeterPerHour:
Expand Down
6 changes: 6 additions & 0 deletions UnitsNet/GeneratedCode/UnitSystem.Default.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,12 @@ private static readonly ReadOnlyCollection<UnitLocalization> DefaultLocalization
{
new AbbreviationsForCulture("en-US", "cLPM"),
}),
new CulturesForEnumValue((int) FlowUnit.CubicDecimeterPerMinute,
new[]
{
new AbbreviationsForCulture("en-US", "dm³/min"),
new AbbreviationsForCulture("ru-RU", "дм³/мин"),
}),
new CulturesForEnumValue((int) FlowUnit.CubicFootPerSecond,
new[]
{
Expand Down
20 changes: 18 additions & 2 deletions UnitsNet/Scripts/UnitDefinitions/Flow.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@
"PluralName": "LitersPerMinute",
"FromUnitToBaseFunc": "x/60000.00000",
"FromBaseToUnitFunc": "x*60000.00000",
"Prefixes": [ "Nano", "Micro", "Milli", "Centi", "Deci", "Kilo"],
"Prefixes": [ "Nano", "Micro", "Milli", "Centi", "Deci", "Kilo" ],
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "LPM" ],
"AbbreviationsWithPrefixes": ["nLPM", "μLPM", "mLPM", "cLPM", "dLPM", "kLPM"]
"AbbreviationsWithPrefixes": [ "nLPM", "μLPM", "mLPM", "cLPM", "dLPM", "kLPM" ]
}
]
},
Expand All @@ -84,6 +84,22 @@
"Abbreviations": [ "GPM" ]
}
]
},
{
"SingularName": "CubicDecimeterPerMinute",
"PluralName": "CubicDecimetersPerMinute",
"FromUnitToBaseFunc": "x/60000.00000",
"FromBaseToUnitFunc": "x*60000.00000",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "dm³/min" ]
},
{
"Culture": "ru-RU",
"Abbreviations": [ "дм³/мин" ]
}
]
}
]
}