-
Notifications
You must be signed in to change notification settings - Fork 406
Changing the Dimensions and BaseUnit for the FuelEfficiency #1489
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
Changes from 3 commits
676a359
24c56b0
cd05244
13deb69
d7169c1
1490f83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,55 +1,84 @@ | ||
| { | ||
| "Name": "FuelEfficiency", | ||
| "BaseUnit": "LiterPer100Kilometers", | ||
| "XmlDocSummary": "Fuel efficiency is a form of thermal efficiency, meaning the ratio from effort to result of a process that converts chemical potential energy contained in a carrier (fuel) into kinetic energy or work. Fuel economy is stated as \"fuel consumption\" in liters per 100 kilometers (L/100 km). In countries using non-metric system, fuel economy is expressed in miles per gallon (mpg) (imperial galon or US galon).", | ||
| "XmlDocRemarks": "https://en.wikipedia.org/wiki/Fuel_efficiency", | ||
| "Units": [{ | ||
| "SingularName": "LiterPer100Kilometers", | ||
| "PluralName": "LitersPer100Kilometers", | ||
| "FromUnitToBaseFunc": "{x}", | ||
| "FromBaseToUnitFunc": "{x}", | ||
| "Localization": [{ | ||
| "Name": "FuelEfficiency", | ||
| "BaseUnit": "KilometerPerLiter", | ||
| "XmlDocSummary": "In the context of transport, fuel economy is the energy efficiency of a particular vehicle, given as a ratio of distance traveled per unit of fuel consumed. In most countries, using the metric system, fuel economy is stated as \"fuel consumption\" in liters per 100 kilometers (L/100 km) or kilometers per liter (km/L or kmpl). In countries using non-metric system, fuel economy is expressed in miles per gallon (mpg) (imperial galon or US galon).", | ||
| "XmlDocRemarks": "https://en.wikipedia.org/wiki/Fuel_efficiency", | ||
| "BaseDimensions": { | ||
| "L": -2 | ||
| }, | ||
| "Units": [ | ||
| { | ||
| "SingularName": "LiterPer100Kilometers", | ||
| "PluralName": "LitersPer100Kilometers", | ||
| "FromUnitToBaseFunc": "100 / {x}", | ||
| "FromBaseToUnitFunc": "100 / {x}", | ||
| "Localization": [ | ||
| { | ||
| "Culture": "en-US", | ||
| "Abbreviations": [ | ||
| "l/100km" | ||
| ] | ||
| }] | ||
| }, | ||
| { | ||
| "SingularName": "MilePerUsGallon", | ||
| "PluralName": "MilesPerUsGallon", | ||
| "FromUnitToBaseFunc": "(100 * 3.785411784) / (1.609344 * {x})", | ||
| "FromBaseToUnitFunc": "(100 * 3.785411784) / (1.609344 * {x})", | ||
| "Localization": [{ | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "SingularName": "MilePerUsGallon", | ||
| "PluralName": "MilesPerUsGallon", | ||
| "FromUnitToBaseFunc": "{x} * 1.609344 / 3.785411784", | ||
| "FromBaseToUnitFunc": "{x} * 3.785411784 / 1.609344", | ||
| "Localization": [ | ||
| { | ||
| "Culture": "en-US", | ||
| "Abbreviations": [ | ||
| "mpg (U.S.)" | ||
| ] | ||
| }] | ||
| }, | ||
| { | ||
| "SingularName": "MilePerUkGallon", | ||
| "PluralName": "MilesPerUkGallon", | ||
| "FromUnitToBaseFunc": "(100 * 4.54609188) / (1.609344 * {x})", | ||
| "FromBaseToUnitFunc": "(100 * 4.54609188) / (1.609344 * {x})", | ||
| "Localization": [{ | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "SingularName": "MilePerUkGallon", | ||
| "PluralName": "MilesPerUkGallon", | ||
| "FromUnitToBaseFunc": "{x} * 1.609344 / 4.54609", | ||
| "FromBaseToUnitFunc": "{x} * 4.54609 / 1.609344", | ||
| "Localization": [ | ||
| { | ||
| "Culture": "en-US", | ||
| "Abbreviations": [ | ||
| "mpg (imp.)" | ||
| ] | ||
| }] | ||
| }, | ||
| { | ||
| "SingularName": "KilometerPerLiter", | ||
| "PluralName": "KilometersPerLiter", | ||
| "FromUnitToBaseFunc": "100 / {x}", | ||
| "FromBaseToUnitFunc": "100 / {x}", | ||
| "Localization": [{ | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "SingularName": "KilometerPerLiter", | ||
| "PluralName": "KilometersPerLiter", | ||
| "FromUnitToBaseFunc": "{x}", | ||
| "FromBaseToUnitFunc": "{x}", | ||
| "Localization": [ | ||
| { | ||
| "Culture": "en-US", | ||
| "Abbreviations": [ | ||
| "km/l" | ||
| ] | ||
| }] | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "SingularName": "MeterPerCubicMeter", | ||
| "PluralName": "MetersPerCubicMeter", | ||
| "BaseUnits": { | ||
| "L": "Meter" | ||
| }, | ||
| "FromUnitToBaseFunc": "{x} / 1e6", | ||
| "FromBaseToUnitFunc": "{x} * 1e6", | ||
| "Localization": [ | ||
| { | ||
| "Culture": "en-US", | ||
| "Abbreviations": [ | ||
| "m/m³" | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,25 +17,22 @@ | |
| // Licensed under MIT No Attribution, see LICENSE file at the root. | ||
| // Copyright 2013 Andreas Gullberg Larsen ([email protected]). Maintained at https://github.com/angularsen/UnitsNet. | ||
|
|
||
| using System; | ||
| using UnitsNet.Units; | ||
| using Xunit; | ||
|
|
||
| namespace UnitsNet.Tests.CustomCode | ||
| { | ||
| public class FuelEfficiencyTests : FuelEfficiencyTestsBase | ||
| { | ||
| protected override bool SupportsSIUnitSystem => false; | ||
| protected override double KilometersPerLiterInOneLiterPer100Kilometers => 100; | ||
| protected override double LitersPer100KilometersInOneLiterPer100Kilometers => 1; | ||
| protected override double MilesPerUkGallonInOneLiterPer100Kilometers => 282.4809363; | ||
| protected override double MilesPerUsGallonInOneLiterPer100Kilometers => 235.2145833; | ||
|
|
||
| [Theory(Skip = "Conversion from 0 km/L results in infinity")] | ||
| [MemberData(nameof(UnitTypes))] | ||
| public override void ToUnit_FromDefaultQuantity_ReturnsQuantityWithGivenUnit(FuelEfficiencyUnit unit) | ||
| protected override double MetersPerCubicMeterInOneKilometerPerLiter => 1e6; | ||
| protected override double KilometersPerLiterInOneKilometerPerLiter => 1; | ||
| protected override double LitersPer100KilometersInOneKilometerPerLiter => 100; | ||
| protected override double MilesPerUkGallonInOneKilometerPerLiter => 2.824809363318222; | ||
| protected override double MilesPerUsGallonInOneKilometerPerLiter => 2.352145833333333; | ||
|
|
||
| [Fact(Skip = "See about changing this to MetersPerCubicMeter")] | ||
| public override void BaseUnit_HasSIBase() | ||
lipchev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| base.ToUnit_FromDefaultQuantity_ReturnsQuantityWithGivenUnit(unit); | ||
| base.BaseUnit_HasSIBase(); | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.