Skip to content

Commit 1ee1515

Browse files
committed
Fixed unit tests and implementation.
VolumeTests.cs had bad constants, implementation OK. Unit.cs had bad constants for angle radians and gradians, so effectively a bad implementation. Tests were OK.
1 parent 6d40e50 commit 1ee1515

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Src/UnitsNet/Generated/Angle.generated.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ public Angle(double degrees) : this()
4343

4444
public double Gradians
4545
{
46-
get { return Degrees/1.11111111111111; }
46+
get { return Degrees/0.9; }
4747
}
4848

4949
public double Radians
5050
{
51-
get { return Degrees/0.0174532925199433; }
51+
get { return Degrees/57.2957795130823; }
5252
}
5353

5454
#endregion
@@ -67,12 +67,12 @@ public static Angle FromDegrees(double degrees)
6767

6868
public static Angle FromGradians(double gradians)
6969
{
70-
return new Angle(gradians*1.11111111111111);
70+
return new Angle(gradians*0.9);
7171
}
7272

7373
public static Angle FromRadians(double radians)
7474
{
75-
return new Angle(radians*0.0174532925199433);
75+
return new Angle(radians*57.2957795130823);
7676
}
7777

7878
#endregion

Src/UnitsNet/Unit.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ public enum Unit
110110
[Area(0.00064516, "SquareInches")] SquareInch,
111111

112112
// Metric
113-
[Angle(Math.PI / 180.0)] Radian,
113+
[Angle(180 / Math.PI)] Radian,
114114
[Angle(1)] Degree, // Base unit
115-
[Angle(1 / 0.9)] Gradian,
115+
[Angle(0.9)] Gradian,
116116

117117
// Metric
118118
[Volume(1e9)] CubicKilometer,

Tests/VolumeTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ protected override double CubicYardsInOneCubicMeter
6060

6161
protected override double DecilitersInOneCubicMeter
6262
{
63-
get { return 1E5; }
63+
get { return 1E4; }
6464
}
6565

6666
protected override double HectolitersInOneCubicMeter
6767
{
68-
get { return 1E4; }
68+
get { return 1E1; }
6969
}
7070

7171
protected override double ImperialGallonsInOneCubicMeter

0 commit comments

Comments
 (0)