-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move semver into repo and remove nuget reference
- Loading branch information
andrew-cat
committed
Apr 16, 2020
1 parent
1a19621
commit 14c2563
Showing
8 changed files
with
666 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version: 5.0.{build} | ||
version: 5.1.{build} | ||
image: Visual Studio 2019 | ||
configuration: Release | ||
platform: Any CPU | ||
|
@@ -22,7 +22,7 @@ before_test: | |
- ps: choco install codecov --no-progress | ||
test_script: | ||
- ps: . .\set-debug-type.ps1 src\ConfigCatClient\ConfigCatClient.csproj | ||
- OpenCover.Console.exe -register:user -target:dotnet.exe -targetargs:"test src\ConfigCat.Client.Tests\ConfigCat.Client.Tests.csproj -c Release" -output:.\coverage.xml -filter:"+[*]ConfigCat.Client.* -[ConfigCatClientTests]*" -oldstyle -returntargetcode | ||
- cmd: coverage.cmd | ||
after_test: | ||
- codecov -f "coverage.xml" | ||
artifacts: | ||
|
@@ -33,4 +33,4 @@ notifications: | |
to: | ||
- [email protected] | ||
on_build_success: false | ||
on_build_failure: true | ||
on_build_failure: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
OpenCover.Console.exe -register:user -target:dotnet.exe -targetargs:"test src\ConfigCat.Client.Tests\ConfigCat.Client.Tests.csproj -c Release" -output:.\coverage.xml -filter:"+[*]ConfigCat.Client.* -[ConfigCatClientTests]*" -oldstyle -returntargetcode | ||
|
||
pause | ||
OpenCover.Console.exe -register:user -target:dotnet.exe -targetargs:"test src\ConfigCat.Client.Tests\ConfigCat.Client.Tests.csproj -c Release" -output:.\coverage.xml -filter:"+[*]ConfigCat.Client.* -[ConfigCatClientTests]* -[*]ConfigCat.Client.Versioning.*" -oldstyle -returntargetcode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
//Copyright(c) 2013 Max Hauser | ||
|
||
//Permission is hereby granted, free of charge, to any person obtaining a copy | ||
//of this software and associated documentation files (the "Software"), to deal | ||
//in the Software without restriction, including without limitation the rights | ||
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
//copies of the Software, and to permit persons to whom the Software is | ||
//furnished to do so, subject to the following conditions: | ||
|
||
//The above copyright notice and this permission notice shall be included in | ||
//all copies or substantial portions of the Software. | ||
|
||
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
//THE SOFTWARE. | ||
|
||
using System.Text; | ||
#if !NETSTANDARD | ||
#endif | ||
|
||
namespace ConfigCat.Client.Versioning | ||
{ | ||
internal static class IntExtensions | ||
{ | ||
/// <summary> | ||
/// The number of digits in a non-negative number. Returns 1 for all | ||
/// negative numbers. That is ok because we are using it to calculate | ||
/// string length for a <see cref="StringBuilder"/> for numbers that | ||
/// aren't supposed to be negative, but when they are it is just a little | ||
/// slower. | ||
/// </summary> | ||
/// <remarks> | ||
/// This approach is based on https://stackoverflow.com/a/51099524/268898 | ||
/// where the poster offers performance benchmarks showing this is the | ||
/// fastest way to get a number of digits. | ||
/// </remarks> | ||
public static int Digits(this int n) | ||
{ | ||
if (n < 10) return 1; | ||
if (n < 100) return 2; | ||
if (n < 1_000) return 3; | ||
if (n < 10_000) return 4; | ||
if (n < 100_000) return 5; | ||
if (n < 1_000_000) return 6; | ||
if (n < 10_000_000) return 7; | ||
if (n < 100_000_000) return 8; | ||
if (n < 1_000_000_000) return 9; | ||
return 10; | ||
} | ||
} | ||
} |
Oops, something went wrong.