Skip to content

Commit 799bfcc

Browse files
committed
Merge remote-tracking branch 'angularsen/master' into v4
2 parents b27ab41 + 29cbadf commit 799bfcc

17 files changed

+123
-13
lines changed

Common/UnitDefinitions/Force.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"PluralName": "Newtons",
6262
"FromUnitToBaseFunc": "x",
6363
"FromBaseToUnitFunc": "x",
64-
"Prefixes": [ "Deca", "Kilo", "Mega" ],
64+
"Prefixes": [ "Micro", "Milli", "Deca", "Kilo", "Mega" ],
6565
"Localization": [
6666
{
6767
"Culture": "en-US",
@@ -70,7 +70,7 @@
7070
{
7171
"Culture": "ru-RU",
7272
"Abbreviations": [ "Н" ],
73-
"AbbreviationsWithPrefixes": [ "даН", "кН" ]
73+
"AbbreviationsWithPrefixes": [ "мкН", "мН", "даН", "кН", "МН" ]
7474
}
7575
]
7676
},
@@ -121,6 +121,18 @@
121121
"Abbreviations": [ "фунт-сила" ]
122122
}
123123
]
124+
},
125+
{
126+
"SingularName": "OunceForce",
127+
"PluralName": "OunceForce",
128+
"FromUnitToBaseFunc": "x*2.780138509537812e-1",
129+
"FromBaseToUnitFunc": "x/2.780138509537812e-1",
130+
"Localization": [
131+
{
132+
"Culture": "en-US",
133+
"Abbreviations": [ "ozf" ]
134+
}
135+
]
124136
}
125137
]
126138
}

Common/UnitDefinitions/Pressure.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"PluralName": "Bars",
4848
"FromUnitToBaseFunc": "x*1e5",
4949
"FromBaseToUnitFunc": "x/1e5",
50-
"Prefixes": [ "Milli", "Centi", "Deci", "Kilo", "Mega" ],
50+
"Prefixes": [ "Micro", "Milli", "Centi", "Deci", "Kilo", "Mega" ],
5151
"Localization": [
5252
{
5353
"Culture": "en-US",
@@ -304,6 +304,30 @@
304304
"Abbreviations": [ "inHg" ]
305305
}
306306
]
307+
},
308+
{
309+
"SingularName": "DynePerSquareCentimeter",
310+
"PluralName": "DynesPerSquareCentimeter",
311+
"FromUnitToBaseFunc": "x*1.0e-1",
312+
"FromBaseToUnitFunc": "x/1.0e-1",
313+
"Localization": [
314+
{
315+
"Culture": "en-US",
316+
"Abbreviations": [ "dyn/cm²" ]
317+
}
318+
]
319+
},
320+
{
321+
"SingularName": "PoundPerInchSecondSquared",
322+
"PluralName": "PoundsPerInchSecondSquared",
323+
"FromUnitToBaseFunc": "x*1.785796732283465e1",
324+
"FromBaseToUnitFunc": "x/1.785796732283465e1",
325+
"Localization": [
326+
{
327+
"Culture": "en-US",
328+
"Abbreviations": [ "lbm/(in·s²)", "lb/(in·s²)" ]
329+
}
330+
]
307331
}
308332
]
309333
}

Common/UnitDefinitions/Torque.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
{
4949
"Culture": "ru-RU",
5050
"Abbreviations": [ "Н·м" ],
51-
"AbbreviationsWithPrefixes": [ "кН·м" ]
51+
"AbbreviationsWithPrefixes": [ "кН·м", "МН·м" ]
5252
}
5353
]
5454
},

UnitsNet.Tests/CustomCode/ForceTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ public class ForceTests : ForceTestsBase
4343

4444
protected override double TonnesForceInOneNewton => 1.019716212977928e-4;
4545

46+
protected override double MillinewtonsInOneNewton => 1.0e3;
47+
48+
protected override double MicronewtonsInOneNewton => 1.0e6;
49+
50+
protected override double OunceForceInOneNewton => 3.596943089595368;
51+
4652
[Fact]
4753
public void ForceDividedByAreaEqualsPressure()
4854
{

UnitsNet.Tests/CustomCode/PressureTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,16 @@ public class PressureTests : PressureTestsBase
9494

9595
protected override double MillibarsInOnePascal => 1e-2;
9696

97+
protected override double MicrobarsInOnePascal => 1.0e1;
98+
9799
protected override double MillimetersOfMercuryInOnePascal => 7.50061561302643e-3;
98100

99101
protected override double InchesOfMercuryInOnePascal => 2.95299830714159e-4;
100102

103+
protected override double DynesPerSquareCentimeterInOnePascal => 1.0e1;
104+
105+
protected override double PoundsPerInchSecondSquaredInOnePascal => 5.599741459495891e-2;
106+
101107
[Fact]
102108
public void AreaTimesPressureEqualsForce()
103109
{

UnitsNet.Tests/QuantityTests.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (c) 2013 Andreas Gullberg Larsen ([email protected]).
2+
// https://github.com/angularsen/UnitsNet
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy
5+
// of this software and associated documentation files (the "Software"), to deal
6+
// in the Software without restriction, including without limitation the rights
7+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
// copies of the Software, and to permit persons to whom the Software is
9+
// furnished to do so, subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in
12+
// all copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
// THE SOFTWARE.
21+
22+
using UnitsNet.Units;
23+
using Xunit;
24+
25+
namespace UnitsNet.Tests
26+
{
27+
public partial class QuantityTests
28+
{
29+
[Fact]
30+
public void GetHashCodeForDifferentQuantitiesWithSameValuesAreNotEqual()
31+
{
32+
var length = new Length( 1.0, (LengthUnit)2 );
33+
var area = new Area( 1.0, (AreaUnit)2 );
34+
35+
Assert.NotEqual( length.GetHashCode(), area.GetHashCode() );
36+
}
37+
}
38+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ public bool Equals(Information other, double tolerance, ComparisonType compariso
817817
/// <returns>A hash code for the current Information.</returns>
818818
public override int GetHashCode()
819819
{
820-
return new { Value, Unit }.GetHashCode();
820+
return new { QuantityType, Value, Unit }.GetHashCode();
821821
}
822822

823823
#endregion

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ public bool Equals(Length other, double tolerance, ComparisonType comparisonType
757757
/// <returns>A hash code for the current Length.</returns>
758758
public override int GetHashCode()
759759
{
760-
return new { Value, Unit }.GetHashCode();
760+
return new { QuantityType, Value, Unit }.GetHashCode();
761761
}
762762

763763
#endregion

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ public bool Equals(Level other, double tolerance, ComparisonType comparisonType)
457457
/// <returns>A hash code for the current Level.</returns>
458458
public override int GetHashCode()
459459
{
460-
return new { Value, Unit }.GetHashCode();
460+
return new { QuantityType, Value, Unit }.GetHashCode();
461461
}
462462

463463
#endregion

UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ public bool Equals(Information other, double tolerance, ComparisonType compariso
829829
/// <returns>A hash code for the current Information.</returns>
830830
public override int GetHashCode()
831831
{
832-
return new { Value, Unit }.GetHashCode();
832+
return new { QuantityType, Value, Unit }.GetHashCode();
833833
}
834834

835835
#endregion

0 commit comments

Comments
 (0)