Skip to content

Commit

Permalink
Add joules/hour, GigaJoule and MegaCalorie (angularsen#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
BickelLukas authored and angularsen committed Dec 8, 2019
1 parent 8ea1dbb commit d9d352c
Show file tree
Hide file tree
Showing 17 changed files with 380 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Common/UnitDefinitions/Energy.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"FromUnitToBaseFunc": "x",
"FromBaseToUnitFunc": "x",
"Prefixes": [ "Milli", "Kilo", "Mega" ],
"Prefixes": [ "Milli", "Kilo", "Mega", "Giga" ],
"Localization": [
{
"Culture": "en-US",
Expand All @@ -31,7 +31,7 @@
"PluralName": "Calories",
"FromUnitToBaseFunc": "x*4.184",
"FromBaseToUnitFunc": "x/4.184",
"Prefixes": [ "Kilo" ],
"Prefixes": [ "Kilo", "Mega" ],
"Localization": [
{
"Culture": "en-US",
Expand Down
15 changes: 14 additions & 1 deletion Common/UnitDefinitions/Power.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@
"Abbreviations": [ "Btu/h", "Btu/hr" ]
}
]
}
},
{
"SingularName": "JoulePerHour",
"PluralName": "JoulesPerHour",
"FromUnitToBaseFunc": "x/3600m",
"FromBaseToUnitFunc": "x*3600m",
"Prefixes": [ "Milli", "Kilo", "Mega", "Giga" ],
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "J/h" ]
}
]
},
]
}
4 changes: 4 additions & 0 deletions UnitsNet.Tests/CustomCode/EnergyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class EnergyTests : EnergyTestsBase

protected override double MegabritishThermalUnitsInOneJoule => 9.4781712e-10;

protected override double MegacaloriesInOneJoule => 0.239005736e-6;

protected override double MegajoulesInOneJoule => 1E-6;

protected override double BritishThermalUnitsInOneJoule => 0.00094781712;
Expand All @@ -44,6 +46,8 @@ public class EnergyTests : EnergyTestsBase

protected override double GigabritishThermalUnitsInOneJoule => 9.4781712e-13;

protected override double GigajoulesInOneJoule => 1e-9;

protected override double GigawattHoursInOneJoule => 2.77777778e-13;

protected override double KilocaloriesInOneJoule => 0.00023900573614;
Expand Down
10 changes: 10 additions & 0 deletions UnitsNet.Tests/CustomCode/PowerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ public class PowerTests : PowerTestsBase
{
protected override double FemtowattsInOneWatt => 1e15;

protected override double GigajoulesPerHourInOneWatt => 3600e-9;

protected override double PicowattsInOneWatt => 1e12;

protected override double NanowattsInOneWatt => 1e9;

protected override double MicrowattsInOneWatt => 1e6;

protected override double MillijoulesPerHourInOneWatt => 3600e3;

protected override double MilliwattsInOneWatt => 1e3;

protected override double DeciwattsInOneWatt => 1e1;
Expand All @@ -24,8 +28,12 @@ public class PowerTests : PowerTestsBase

protected override double DecawattsInOneWatt => 1e-1;

protected override double KilojoulesPerHourInOneWatt => 3600e-3;

protected override double KilowattsInOneWatt => 1e-3;

protected override double MegajoulesPerHourInOneWatt => 3600e-6;

protected override double MegawattsInOneWatt => 1e-6;

protected override double GigawattsInOneWatt => 1e-9;
Expand All @@ -34,6 +42,8 @@ public class PowerTests : PowerTestsBase

protected override double PetawattsInOneWatt => 1e-15;

protected override double JoulesPerHourInOneWatt => 3600;

protected override double KilobritishThermalUnitsPerHourInOneWatt => 3.412141633e-3;

protected override double BoilerHorsepowerInOneWatt => 1.0191082802547770700636942675159e-4;
Expand Down
20 changes: 20 additions & 0 deletions UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d9d352c

Please sign in to comment.