Skip to content

Commit f5fc686

Browse files
committed
tests, plus fixes
1 parent 2276607 commit f5fc686

3 files changed

Lines changed: 1326 additions & 2 deletions

File tree

src/PolylineAlgorithm/PolylineEncoding.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ public static int Normalize(double value, uint precision = 5) {
7575

7676
// Fast return if precision is zero, return current value converted to Int32.
7777
if (precision == default) {
78-
return Convert.ToInt32(value);
78+
return (int)Math.Truncate(value);
7979
}
8080

8181
uint factor = Pow10.GetFactor(precision);
8282

8383
checked {
84-
return (int)Math.Truncate(value * factor);
84+
return (int)(Math.Truncate(value * 10 * factor) / 10);
8585
}
8686
}
8787

tests/PolylineAlgorithm.Tests/PolylineAlgorithm.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<ItemGroup>
1919
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
2020
<PackageReference Include="Microsoft.Testing.Extensions.VSTestBridge" Version="2.1.0" />
21+
<PackageReference Include="Moq" Version="4.20.72" />
2122
<PackageReference Include="MSTest" Version="4.1.0" />
2223
<PackageReference Include="Microsoft.Testing.Platform.MSBuild" Version="2.1.0" />
2324
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.5.2" />

0 commit comments

Comments
 (0)