File tree Expand file tree Collapse file tree 8 files changed +44
-8
lines changed
HdrHistogram.Benchmarking Expand file tree Collapse file tree 8 files changed +44
-8
lines changed Original file line number Diff line number Diff line change @@ -110,4 +110,8 @@ _UpgradeReport_Files/
110110Backup * /
111111UpgradeLog * .XML
112112
113- Thumbs.db
113+ Thumbs.db
114+ .vs /HdrHistogram /v15 /Server /sqlite3 /storage.ide-wal
115+ .vs /HdrHistogram /v15 /Server /sqlite3 /storage.ide-shm
116+ .vs /HdrHistogram /v15 /Server /sqlite3 /storage.ide
117+ .vs /HdrHistogram /v15 /Server /sqlite3 /db.lock
Original file line number Diff line number Diff line change 22
33 <PropertyGroup >
44 <OutputType >Exe</OutputType >
5- <TargetFrameworks >net47 ;netcoreapp1.1</TargetFrameworks >
5+ <TargetFrameworks >net471 ;netcoreapp1.1</TargetFrameworks >
66 </PropertyGroup >
77
88 <ItemGroup >
99 <PackageReference Include =" BenchmarkDotNet" Version =" 0.10.8" />
1010 </ItemGroup >
1111
12- <ItemGroup Condition =" '$(TargetFramework)' == 'net47 '" >
12+ <ItemGroup Condition =" '$(TargetFramework)' == 'net471 '" >
1313 <PackageReference Include =" BenchmarkDotNet.Diagnostics.Windows" >
1414 <Version >0.10.8</Version >
1515 </PackageReference >
Original file line number Diff line number Diff line change 22
33 <PropertyGroup >
44 <OutputType >Exe</OutputType >
5- <TargetFramework >netcoreapp1.1 </TargetFramework >
5+ <TargetFramework >netcoreapp2.0 </TargetFramework >
66 </PropertyGroup >
77
88 <ItemGroup >
Original file line number Diff line number Diff line change 8484
8585 <ItemGroup >
8686 <PackageReference Include =" FluentAssertions" Version =" 4.19.2" />
87- <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 15.0 .0" />
88- <PackageReference Include =" xunit" Version =" 2.2.0 " />
87+ <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 15.7 .0" />
88+ <PackageReference Include =" xunit" Version =" 2.3.1 " />
8989 <PackageReference Include =" Xunit.Combinatorial" Version =" 1.2.1" />
90+ <PackageReference Include =" xunit.runner.console" Version =" 2.3.1" />
9091 <PackageReference Include =" xunit.runner.visualstudio" Version =" 2.2.0" />
9192 </ItemGroup >
9293
Original file line number Diff line number Diff line change 11using HdrHistogram . Encoding ;
22using HdrHistogram . Utilities ;
33using Xunit ;
4+ using FluentAssertions ;
5+ using System . Linq ;
46
57namespace HdrHistogram . UnitTests
68{
@@ -21,6 +23,22 @@ public void Given_a_populated_Histogram_When_encoded_and_decoded_Then_data_is_pr
2123 HistogramAssert . AreValueEqual ( source , result ) ;
2224 }
2325
26+ [ Fact ]
27+ public void Given_a_populated_Histogram_iterating_over_buckets_gives_all_buckets ( )
28+ {
29+ var source = Create ( DefaultHighestTrackableValue , DefaultSignificantFigures ) ;
30+ Load ( source ) ;
31+ Iteration . HistogramIterationValue lastSeen = null ;
32+ foreach ( var v in source . AllValues ( ) . ToList ( ) )
33+ {
34+ if ( lastSeen != null )
35+ {
36+ v . Should ( ) . NotBe ( lastSeen ) ;
37+ }
38+ lastSeen = v ;
39+ }
40+ }
41+
2442 [ Fact ]
2543 public void Given_a_populated_Histogram_When_encoded_and_decoded_with_compression_Then_data_is_preserved ( )
2644 {
Original file line number Diff line number Diff line change @@ -34,8 +34,13 @@ internal abstract class AbstractHistogramEnumerator : IEnumerator<HistogramItera
3434 protected int CurrentSubBucketIndex { get ; private set ; }
3535 protected long TotalCountToCurrentIndex { get ; private set ; }
3636 protected long CountAtThisValue { get ; private set ; }
37-
38- public HistogramIterationValue Current { get ; private set ; }
37+
38+ private HistogramIterationValue _current ;
39+ public HistogramIterationValue Current
40+ {
41+ get => _current . Clone ( ) ;
42+ private set => _current = value ;
43+ }
3944
4045 protected AbstractHistogramEnumerator ( HistogramBase histogram )
4146 {
Original file line number Diff line number Diff line change @@ -103,5 +103,7 @@ public override string ToString()
103103 ", Percentile:" + Percentile +
104104 ", PercentileLevelIteratedTo:" + PercentileLevelIteratedTo ;
105105 }
106+
107+ public HistogramIterationValue Clone ( ) => ( HistogramIterationValue ) this . MemberwiseClone ( ) ;
106108 }
107109}
Original file line number Diff line number Diff line change @@ -255,6 +255,12 @@ Next can you please ensure that your PR (Pull Request) has a comment in it descr
255255Ideally if it is fixing an issue or a bug, there would be a Unit Test proving the fix and a reference to the Issues in the PR comments.
256256
257257
258+ ### How to run tests?
259+ If you are having trouble running xunit tests out of the box, it is possible to run them using a version of the command line below.
260+ You'll just need to fill in the correct value of $(SolutionDir), which should be as defined in Visual Studio.
261+ PS> dotnet C:\Users\% USERNAME%\. nuget\packages\xunit.runner.console\2.3.1\tools\netcoreapp2.0\xunit.console.dll $(SolutionDir)\HdrHistogram.UnitTests\bin\Debug\netcoreapp1.1\HdrHistogram.UnitTests.dll
262+
263+
258264HdrHistogram Details
259265----------------------------------------------
260266
You can’t perform that action at this time.
0 commit comments