Skip to content

Commit 4243377

Browse files
thebhefangularsen
authored andcommitted
Added amp hour and millijoule (#704)
* Added Millijoule and Ampere hour * Updated A-h converson constants in ElectricCharge.json to match contribution guide and fixed test stubs * Added milli, kilo, and mega A-h prefixes * Updating based on comments from @angularsen on PR #704 * Updating charge units to match library conventions
1 parent e96adaa commit 4243377

File tree

18 files changed

+271
-2
lines changed

18 files changed

+271
-2
lines changed

Common/UnitDefinitions/ElectricCharge.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@
1919
"Abbreviations": [ "C" ]
2020
}
2121
]
22+
},
23+
{
24+
"SingularName": "AmpereHour",
25+
"PluralName": "AmpereHours",
26+
"FromUnitToBaseFunc": "x/2.77777777777e-4",
27+
"FromBaseToUnitFunc": "x*2.77777777777e-4",
28+
"Prefixes": [ "Milli", "Kilo", "Mega" ],
29+
"Localization": [
30+
{
31+
"Culture": "en-US",
32+
"Abbreviations": [ "A-h", "Ah" ]
33+
}
34+
]
2235
}
2336
]
2437
}

Common/UnitDefinitions/Energy.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"FromUnitToBaseFunc": "x",
2020
"FromBaseToUnitFunc": "x",
21-
"Prefixes": [ "Kilo", "Mega" ],
21+
"Prefixes": [ "Milli", "Kilo", "Mega" ],
2222
"Localization": [
2323
{
2424
"Culture": "en-US",

UnitsNet.Tests/CustomCode/ElectricChargeTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,9 @@ namespace UnitsNet.Tests.CustomCode
2828
public class ElectricChargeTests : ElectricChargeTestsBase
2929
{
3030
protected override double CoulombsInOneCoulomb => 1;
31+
protected override double MilliampereHoursInOneCoulomb => 2.77777777777e-1;
32+
protected override double AmpereHoursInOneCoulomb => 2.77777777777e-4;
33+
protected override double KiloampereHoursInOneCoulomb => 2.77777777777e-7;
34+
protected override double MegaampereHoursInOneCoulomb => 2.77777777777e-10;
3135
}
3236
}

UnitsNet.Tests/CustomCode/EnergyTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public class EnergyTests : EnergyTestsBase
3434

3535
protected override double ErgsInOneJoule => 10000000;
3636

37+
protected override double MillijoulesInOneJoule => 1000;
38+
3739
protected override double TerawattHoursInOneJoule => 2.77777778e-16;
3840

3941
protected override double ThermsEcInOneJoule => 9.4781712031331720001278504447561e-9;

UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.g.cs

Lines changed: 68 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)