Skip to content

Add More Flow Units #361

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

Merged
merged 2 commits into from
Jan 14, 2018
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
14 changes: 14 additions & 0 deletions UnitsNet.Tests/CustomCode/FlowTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,19 @@ public class FlowTests : FlowTestsBase
protected override double KilolitersPerMinuteInOneCubicMeterPerSecond => 60.00000;

protected override double OilBarrelsPerDayInOneCubicMeterPerSecond => 543439.65056533388306722269588172;

protected override double CubicFeetPerMinuteInOneCubicMeterPerSecond => 2.11888E3;

protected override double CubicMetersPerMinuteInOneCubicMeterPerSecond => 6.0E1;

protected override double CubicYardsPerHourInOneCubicMeterPerSecond => 4.708622232E3;

protected override double CubicYardsPerMinuteInOneCubicMeterPerSecond => 7.84770372E1;

protected override double CubicYardsPerSecondInOneCubicMeterPerSecond => 1.30795062;

protected override double UsGallonsPerHourInOneCubicMeterPerSecond => 9.510193884893328E5;

protected override double UsGallonsPerSecondInOneCubicMeterPerSecond => 2.64172052358148E2;
}
}
42 changes: 42 additions & 0 deletions UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ public abstract partial class FlowTestsBase
protected abstract double CentilitersPerMinuteInOneCubicMeterPerSecond { get; }
protected abstract double CubicDecimetersPerMinuteInOneCubicMeterPerSecond { get; }
protected abstract double CubicFeetPerHourInOneCubicMeterPerSecond { get; }
protected abstract double CubicFeetPerMinuteInOneCubicMeterPerSecond { get; }
protected abstract double CubicFeetPerSecondInOneCubicMeterPerSecond { get; }
protected abstract double CubicMetersPerHourInOneCubicMeterPerSecond { get; }
protected abstract double CubicMetersPerMinuteInOneCubicMeterPerSecond { get; }
protected abstract double CubicMetersPerSecondInOneCubicMeterPerSecond { get; }
protected abstract double CubicYardsPerHourInOneCubicMeterPerSecond { get; }
protected abstract double CubicYardsPerMinuteInOneCubicMeterPerSecond { get; }
protected abstract double CubicYardsPerSecondInOneCubicMeterPerSecond { get; }
protected abstract double DecilitersPerMinuteInOneCubicMeterPerSecond { get; }
protected abstract double KilolitersPerMinuteInOneCubicMeterPerSecond { get; }
protected abstract double LitersPerHourInOneCubicMeterPerSecond { get; }
Expand All @@ -68,15 +73,22 @@ public abstract partial class FlowTestsBase
protected abstract double MillionUsGallonsPerDayInOneCubicMeterPerSecond { get; }
protected abstract double NanolitersPerMinuteInOneCubicMeterPerSecond { get; }
protected abstract double OilBarrelsPerDayInOneCubicMeterPerSecond { get; }
protected abstract double UsGallonsPerHourInOneCubicMeterPerSecond { get; }
protected abstract double UsGallonsPerMinuteInOneCubicMeterPerSecond { get; }
protected abstract double UsGallonsPerSecondInOneCubicMeterPerSecond { get; }

// ReSharper disable VirtualMemberNeverOverriden.Global
protected virtual double CentilitersPerMinuteTolerance { get { return 1e-5; } }
protected virtual double CubicDecimetersPerMinuteTolerance { get { return 1e-5; } }
protected virtual double CubicFeetPerHourTolerance { get { return 1e-5; } }
protected virtual double CubicFeetPerMinuteTolerance { get { return 1e-5; } }
protected virtual double CubicFeetPerSecondTolerance { get { return 1e-5; } }
protected virtual double CubicMetersPerHourTolerance { get { return 1e-5; } }
protected virtual double CubicMetersPerMinuteTolerance { get { return 1e-5; } }
protected virtual double CubicMetersPerSecondTolerance { get { return 1e-5; } }
protected virtual double CubicYardsPerHourTolerance { get { return 1e-5; } }
protected virtual double CubicYardsPerMinuteTolerance { get { return 1e-5; } }
protected virtual double CubicYardsPerSecondTolerance { get { return 1e-5; } }
protected virtual double DecilitersPerMinuteTolerance { get { return 1e-5; } }
protected virtual double KilolitersPerMinuteTolerance { get { return 1e-5; } }
protected virtual double LitersPerHourTolerance { get { return 1e-5; } }
Expand All @@ -87,7 +99,9 @@ public abstract partial class FlowTestsBase
protected virtual double MillionUsGallonsPerDayTolerance { get { return 1e-5; } }
protected virtual double NanolitersPerMinuteTolerance { get { return 1e-5; } }
protected virtual double OilBarrelsPerDayTolerance { get { return 1e-5; } }
protected virtual double UsGallonsPerHourTolerance { get { return 1e-5; } }
protected virtual double UsGallonsPerMinuteTolerance { get { return 1e-5; } }
protected virtual double UsGallonsPerSecondTolerance { get { return 1e-5; } }
// ReSharper restore VirtualMemberNeverOverriden.Global

[Fact]
Expand All @@ -97,9 +111,14 @@ public void CubicMeterPerSecondToFlowUnits()
AssertEx.EqualTolerance(CentilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CentilitersPerMinute, CentilitersPerMinuteTolerance);
AssertEx.EqualTolerance(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance);
AssertEx.EqualTolerance(CubicFeetPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.CubicFeetPerHour, CubicFeetPerHourTolerance);
AssertEx.EqualTolerance(CubicFeetPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CubicFeetPerMinute, CubicFeetPerMinuteTolerance);
AssertEx.EqualTolerance(CubicFeetPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicFeetPerSecond, CubicFeetPerSecondTolerance);
AssertEx.EqualTolerance(CubicMetersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerHour, CubicMetersPerHourTolerance);
AssertEx.EqualTolerance(CubicMetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerMinute, CubicMetersPerMinuteTolerance);
AssertEx.EqualTolerance(CubicMetersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerSecond, CubicMetersPerSecondTolerance);
AssertEx.EqualTolerance(CubicYardsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.CubicYardsPerHour, CubicYardsPerHourTolerance);
AssertEx.EqualTolerance(CubicYardsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CubicYardsPerMinute, CubicYardsPerMinuteTolerance);
AssertEx.EqualTolerance(CubicYardsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicYardsPerSecond, CubicYardsPerSecondTolerance);
AssertEx.EqualTolerance(DecilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.DecilitersPerMinute, DecilitersPerMinuteTolerance);
AssertEx.EqualTolerance(KilolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.KilolitersPerMinute, KilolitersPerMinuteTolerance);
AssertEx.EqualTolerance(LitersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.LitersPerHour, LitersPerHourTolerance);
Expand All @@ -110,7 +129,9 @@ public void CubicMeterPerSecondToFlowUnits()
AssertEx.EqualTolerance(MillionUsGallonsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.MillionUsGallonsPerDay, MillionUsGallonsPerDayTolerance);
AssertEx.EqualTolerance(NanolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.NanolitersPerMinute, NanolitersPerMinuteTolerance);
AssertEx.EqualTolerance(OilBarrelsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.OilBarrelsPerDay, OilBarrelsPerDayTolerance);
AssertEx.EqualTolerance(UsGallonsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.UsGallonsPerHour, UsGallonsPerHourTolerance);
AssertEx.EqualTolerance(UsGallonsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.UsGallonsPerMinute, UsGallonsPerMinuteTolerance);
AssertEx.EqualTolerance(UsGallonsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.UsGallonsPerSecond, UsGallonsPerSecondTolerance);
}

[Fact]
Expand All @@ -119,9 +140,14 @@ public void FromValueAndUnit()
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CentilitersPerMinute).CentilitersPerMinute, CentilitersPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicDecimeterPerMinute).CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicFootPerHour).CubicFeetPerHour, CubicFeetPerHourTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicFootPerMinute).CubicFeetPerMinute, CubicFeetPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicFootPerSecond).CubicFeetPerSecond, CubicFeetPerSecondTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicMeterPerHour).CubicMetersPerHour, CubicMetersPerHourTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicMeterPerMinute).CubicMetersPerMinute, CubicMetersPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicMeterPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicYardPerHour).CubicYardsPerHour, CubicYardsPerHourTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicYardPerMinute).CubicYardsPerMinute, CubicYardsPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicYardPerSecond).CubicYardsPerSecond, CubicYardsPerSecondTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.DecilitersPerMinute).DecilitersPerMinute, DecilitersPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.KilolitersPerMinute).KilolitersPerMinute, KilolitersPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.LitersPerHour).LitersPerHour, LitersPerHourTolerance);
Expand All @@ -132,7 +158,9 @@ public void FromValueAndUnit()
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.MillionUsGallonsPerDay).MillionUsGallonsPerDay, MillionUsGallonsPerDayTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.NanolitersPerMinute).NanolitersPerMinute, NanolitersPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.OilBarrelsPerDay).OilBarrelsPerDay, OilBarrelsPerDayTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.UsGallonsPerHour).UsGallonsPerHour, UsGallonsPerHourTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.UsGallonsPerMinute).UsGallonsPerMinute, UsGallonsPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.UsGallonsPerSecond).UsGallonsPerSecond, UsGallonsPerSecondTolerance);
}

[Fact]
Expand All @@ -142,9 +170,14 @@ public void As()
AssertEx.EqualTolerance(CentilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CentilitersPerMinute), CentilitersPerMinuteTolerance);
AssertEx.EqualTolerance(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicDecimeterPerMinute), CubicDecimetersPerMinuteTolerance);
AssertEx.EqualTolerance(CubicFeetPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicFootPerHour), CubicFeetPerHourTolerance);
AssertEx.EqualTolerance(CubicFeetPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicFootPerMinute), CubicFeetPerMinuteTolerance);
AssertEx.EqualTolerance(CubicFeetPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicFootPerSecond), CubicFeetPerSecondTolerance);
AssertEx.EqualTolerance(CubicMetersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicMeterPerHour), CubicMetersPerHourTolerance);
AssertEx.EqualTolerance(CubicMetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicMeterPerMinute), CubicMetersPerMinuteTolerance);
AssertEx.EqualTolerance(CubicMetersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicMeterPerSecond), CubicMetersPerSecondTolerance);
AssertEx.EqualTolerance(CubicYardsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicYardPerHour), CubicYardsPerHourTolerance);
AssertEx.EqualTolerance(CubicYardsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicYardPerMinute), CubicYardsPerMinuteTolerance);
AssertEx.EqualTolerance(CubicYardsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicYardPerSecond), CubicYardsPerSecondTolerance);
AssertEx.EqualTolerance(DecilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.DecilitersPerMinute), DecilitersPerMinuteTolerance);
AssertEx.EqualTolerance(KilolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.KilolitersPerMinute), KilolitersPerMinuteTolerance);
AssertEx.EqualTolerance(LitersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.LitersPerHour), LitersPerHourTolerance);
Expand All @@ -155,7 +188,9 @@ public void As()
AssertEx.EqualTolerance(MillionUsGallonsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.MillionUsGallonsPerDay), MillionUsGallonsPerDayTolerance);
AssertEx.EqualTolerance(NanolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.NanolitersPerMinute), NanolitersPerMinuteTolerance);
AssertEx.EqualTolerance(OilBarrelsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.OilBarrelsPerDay), OilBarrelsPerDayTolerance);
AssertEx.EqualTolerance(UsGallonsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.UsGallonsPerHour), UsGallonsPerHourTolerance);
AssertEx.EqualTolerance(UsGallonsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.UsGallonsPerMinute), UsGallonsPerMinuteTolerance);
AssertEx.EqualTolerance(UsGallonsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.UsGallonsPerSecond), UsGallonsPerSecondTolerance);
}

[Fact]
Expand All @@ -165,9 +200,14 @@ public void ConversionRoundTrip()
AssertEx.EqualTolerance(1, Flow.FromCentilitersPerMinute(cubicmeterpersecond.CentilitersPerMinute).CubicMetersPerSecond, CentilitersPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.FromCubicDecimetersPerMinute(cubicmeterpersecond.CubicDecimetersPerMinute).CubicMetersPerSecond, CubicDecimetersPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.FromCubicFeetPerHour(cubicmeterpersecond.CubicFeetPerHour).CubicMetersPerSecond, CubicFeetPerHourTolerance);
AssertEx.EqualTolerance(1, Flow.FromCubicFeetPerMinute(cubicmeterpersecond.CubicFeetPerMinute).CubicMetersPerSecond, CubicFeetPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.FromCubicFeetPerSecond(cubicmeterpersecond.CubicFeetPerSecond).CubicMetersPerSecond, CubicFeetPerSecondTolerance);
AssertEx.EqualTolerance(1, Flow.FromCubicMetersPerHour(cubicmeterpersecond.CubicMetersPerHour).CubicMetersPerSecond, CubicMetersPerHourTolerance);
AssertEx.EqualTolerance(1, Flow.FromCubicMetersPerMinute(cubicmeterpersecond.CubicMetersPerMinute).CubicMetersPerSecond, CubicMetersPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.FromCubicMetersPerSecond(cubicmeterpersecond.CubicMetersPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance);
AssertEx.EqualTolerance(1, Flow.FromCubicYardsPerHour(cubicmeterpersecond.CubicYardsPerHour).CubicMetersPerSecond, CubicYardsPerHourTolerance);
AssertEx.EqualTolerance(1, Flow.FromCubicYardsPerMinute(cubicmeterpersecond.CubicYardsPerMinute).CubicMetersPerSecond, CubicYardsPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.FromCubicYardsPerSecond(cubicmeterpersecond.CubicYardsPerSecond).CubicMetersPerSecond, CubicYardsPerSecondTolerance);
AssertEx.EqualTolerance(1, Flow.FromDecilitersPerMinute(cubicmeterpersecond.DecilitersPerMinute).CubicMetersPerSecond, DecilitersPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.FromKilolitersPerMinute(cubicmeterpersecond.KilolitersPerMinute).CubicMetersPerSecond, KilolitersPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.FromLitersPerHour(cubicmeterpersecond.LitersPerHour).CubicMetersPerSecond, LitersPerHourTolerance);
Expand All @@ -178,7 +218,9 @@ public void ConversionRoundTrip()
AssertEx.EqualTolerance(1, Flow.FromMillionUsGallonsPerDay(cubicmeterpersecond.MillionUsGallonsPerDay).CubicMetersPerSecond, MillionUsGallonsPerDayTolerance);
AssertEx.EqualTolerance(1, Flow.FromNanolitersPerMinute(cubicmeterpersecond.NanolitersPerMinute).CubicMetersPerSecond, NanolitersPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.FromOilBarrelsPerDay(cubicmeterpersecond.OilBarrelsPerDay).CubicMetersPerSecond, OilBarrelsPerDayTolerance);
AssertEx.EqualTolerance(1, Flow.FromUsGallonsPerHour(cubicmeterpersecond.UsGallonsPerHour).CubicMetersPerSecond, UsGallonsPerHourTolerance);
AssertEx.EqualTolerance(1, Flow.FromUsGallonsPerMinute(cubicmeterpersecond.UsGallonsPerMinute).CubicMetersPerSecond, UsGallonsPerMinuteTolerance);
AssertEx.EqualTolerance(1, Flow.FromUsGallonsPerSecond(cubicmeterpersecond.UsGallonsPerSecond).CubicMetersPerSecond, UsGallonsPerSecondTolerance);
}

[Fact]
Expand Down
Loading